Revision 4443b90a
Added by Katja Luther over 5 years ago
eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle.properties | ||
---|---|---|
50 | 50 |
command.name.setSecForSubtree = set secundum for subtree |
51 | 51 |
command.label.setPublishForSubtree = Set publish flag for subtree |
52 | 52 |
command.name.setPublishForSubtree = Set publish flag for subtree |
53 |
command.name.setUnplaced = Set Unplaced Flag |
|
54 |
command.label.setUnplaced = Set Unplaced Flag |
|
55 |
command.label.removeUnplaced = Remove Unplaced Flag |
|
56 |
command.name.removeUnplaced = Remove Unplaced Flag |
|
53 | 57 |
wizard.name = TCS |
54 | 58 |
wizard.name.2 = Excel Normal Explicit Taxa |
55 | 59 |
wizard.name.3 = ABCD |
eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle_de.properties | ||
---|---|---|
50 | 50 |
command.name.setSecForSubtree = Setze Secundum f?r Teilbaum |
51 | 51 |
command.label.setPublishForSubtree = Publish Flag |
52 | 52 |
command.name.setPublishForSubtree = Setze Publish Flag f?r Teilbaum |
53 |
command.name.setUnplaced = Setze Unplaced Flag |
|
54 |
command.label.setUnplaced = Setze Unplaced Flag |
|
55 |
command.label.removeUnplaced = Entferne Unplaced Flag |
|
56 |
command.name.removeUnplaced = Entferne Unplaced Flag |
|
57 |
|
|
53 | 58 |
wizard.name = TCS |
54 | 59 |
wizard.name.2 = Excel Normal Explicit Taxa |
55 | 60 |
wizard.name.3 = ABCD |
eu.etaxonomy.taxeditor.navigation/fragment.e4xmi | ||
---|---|---|
39 | 39 |
</handlers> |
40 | 40 |
<handlers xmi:id="_-GirMLVbEeeZf_R8QJbACw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.LinkWithTaxonHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.LinkWithTaxonHandlerE4" command="_6iiY8LVbEeeZf_R8QJbACw"/> |
41 | 41 |
<handlers xmi:id="_gWjsEJO5EeiqbJlqxN0v2w" elementId="eu.etaxonomy.taxeditor.navigation.handler.0" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.AggregateTaxonDescriptionsHandler" command="_jd_XEJO5EeiqbJlqxN0v2w"/> |
42 |
<handlers xmi:id="_Jr9BQM0xEeiHbMP3rrIRKQ" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.SetUnplacedHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.SetUnplacedHandler" command="_oghMkM0vEeiHbMP3rrIRKQ"/> |
|
43 |
<handlers xmi:id="_lct0oM1AEeiHbMP3rrIRKQ" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemoveUnplacedHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemoveUnplacedHandler" command="_gMQnoM1AEeiHbMP3rrIRKQ"/> |
|
42 | 44 |
<menus xsi:type="menu:PopupMenu" xmi:id="_XNXnkJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigator.popupmenu.taxonnavigator"> |
43 | 45 |
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_5ydggKkeEeejedk4mZQIGw" coreExpressionId="isCdmStoreConnected"/> |
44 | 46 |
<children xsi:type="menu:Menu" xmi:id="_yzFmYJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menu.new" label="%menu.label"> |
... | ... | |
93 | 95 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_SNIFsK5bEeeDTZvTg-vKRg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.setpublishforsubtree" label="%command.label.setPublishForSubtree" command="_Jb45kK5bEeeDTZvTg-vKRg"/> |
94 | 96 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_mLjosJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.setsecforsubtree" label="%command.label.setSecForSubtree" command="_uFj1YJIxEeeJAdt8ZUxyaw"/> |
95 | 97 |
</children> |
98 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_Yb8F8M1AEeiHbMP3rrIRKQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.removeUnplaced" label="%command.label.removeUnplaced" command="_gMQnoM1AEeiHbMP3rrIRKQ"> |
|
99 |
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_39MtQM1AEeiHbMP3rrIRKQ" coreExpressionId="isUnplaced"/> |
|
100 |
</children> |
|
101 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_YeWwgM0vEeiHbMP3rrIRKQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.setUnplaced" label="%command.label.setUnplaced" command="_oghMkM0vEeiHbMP3rrIRKQ"> |
|
102 |
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_fXWooM0vEeiHbMP3rrIRKQ" coreExpressionId="isNotUnplaced"/> |
|
103 |
</children> |
|
96 | 104 |
<children xsi:type="menu:MenuSeparator" xmi:id="_z0Q6EJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.4"/> |
97 | 105 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_0FX4MJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.refresh" label="%command.label.11" command="_ukhM0JIyEeeJAdt8ZUxyaw"/> |
98 | 106 |
</menus> |
... | ... | |
158 | 166 |
<elements xsi:type="commands:Command" xmi:id="_8C8AEKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.command.delete" commandName="%command.name.11"/> |
159 | 167 |
<elements xsi:type="commands:Command" xmi:id="_6iiY8LVbEeeZf_R8QJbACw" elementId="eu.etaxonomy.taxeditor.navigation.command.linkWithTaxon" commandName="Link with taxon"/> |
160 | 168 |
<elements xsi:type="commands:Command" xmi:id="_jd_XEJO5EeiqbJlqxN0v2w" elementId="eu.etaxonomy.taxeditor.navigation.command.aggregateTaxonDescriptions" commandName="Aggregate taxon descriptions"/> |
169 |
<elements xsi:type="commands:Command" xmi:id="_oghMkM0vEeiHbMP3rrIRKQ" elementId="eu.etaxonomy.taxeditor.navigator.command.update.setUnplaced" commandName="%command.name.setUnplaced"/> |
|
170 |
<elements xsi:type="commands:Command" xmi:id="_gMQnoM1AEeiHbMP3rrIRKQ" elementId="eu.etaxonomy.taxeditor.navigator.command.update.removeUnplaced" commandName="%command.name.removeUnplaced"/> |
|
161 | 171 |
</fragments> |
162 | 172 |
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_3CbhIK25EeeykrJkROy5EA" featurename="children" parentElementId="eu.etaxonomy.navigation.menu.new" positionInList="after:eu.etaxonomy.taxeditor.editor.menuseparator.22"> |
163 | 173 |
<elements xsi:type="menu:HandledMenuItem" xmi:id="_M9FakK26EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.commandlabel13" label="%command.label.13" tooltip="%command.label.13" command="_Nx06MJIvEeeJAdt8ZUxyaw"> |
eu.etaxonomy.taxeditor.navigation/plugin.xml | ||
---|---|---|
46 | 46 |
class="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester" |
47 | 47 |
id="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester" |
48 | 48 |
namespace="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester" |
49 |
properties="hasSynonyms,isClassification" |
|
49 |
properties="hasSynonyms,isClassification,isUnplaced,isExcluded"
|
|
50 | 50 |
type="java.lang.Object"> |
51 | 51 |
</propertyTester> |
52 | 52 |
|
53 |
<propertyTester |
|
53 |
<!--<propertyTester
|
|
54 | 54 |
class="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester" |
55 | 55 |
id="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester" |
56 | 56 |
namespace="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester" |
... | ... | |
63 | 63 |
namespace="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester" |
64 | 64 |
properties="hasTaxa" |
65 | 65 |
type="eu.etaxonomy.cdm.model.taxon.TaxonNode"> |
66 |
</propertyTester> |
|
66 |
</propertyTester>-->
|
|
67 | 67 |
<propertyTester |
68 | 68 |
class="eu.etaxonomy.taxeditor.preference.CdmStorePropertyTester" |
69 | 69 |
id="eu.etaxonomy.taxeditor.preference.CdmStorePropertyTester" |
... | ... | |
154 | 154 |
property="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester.isClassification"> |
155 | 155 |
</test> |
156 | 156 |
</definition> |
157 |
<definition |
|
158 |
id="isUnplaced"> |
|
159 |
<test |
|
160 |
property="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester.isUnplaced"> |
|
161 |
</test> |
|
162 |
</definition> |
|
163 |
<definition |
|
164 |
id="isNotUnplaced"> |
|
165 |
<not> |
|
166 |
<reference |
|
167 |
definitionId="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester.isUnplaced"> |
|
168 |
</reference> |
|
169 |
</not> |
|
170 |
</definition> |
|
171 |
<definition |
|
172 |
id="isExcluded"> |
|
173 |
<test |
|
174 |
property="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester.isExcluded"> |
|
175 |
</test> |
|
176 |
</definition> |
|
157 | 177 |
</extension> |
158 | 178 |
<extension |
159 | 179 |
id="eu.etaxonomy.taxeditor.navigation.workbench.model" |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/AppModelId.java | ||
---|---|---|
69 | 69 |
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_REFRESH = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.refresh"; |
70 | 70 |
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_SETPUBLISHFORSUBTREE = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.setpublishforsubtree"; |
71 | 71 |
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_SETSECFORSUBTREE = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.setsecforsubtree"; |
72 |
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_SETUNPLACED = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.setunplaced"; |
|
72 | 73 |
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_SYNCWITHTAXON = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.syncwithtaxon"; |
73 | 74 |
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENU_NEW_CLASSIFICATION = "eu.etaxonomy.taxeditor.navigation.menu.new.classification"; |
74 | 75 |
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENU_NEW_TAXON = "eu.etaxonomy.taxeditor.navigation.menu.new.taxon"; |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/Messages.java | ||
---|---|---|
181 | 181 |
public static String SetPublishForSubtreeOperation_CHANGE_PUBLISH_OP; |
182 | 182 |
public static String TaxonNavigatorLabels_SET_PUBLISH_FOR_CHILDREN; |
183 | 183 |
public static String TaxonNavigatorLabels_ACCEPTED_TAXA_NEED_TO_BE_FROM_SAME_CLASSIFICATION; |
184 |
public static String TaxonNavigatorLabels_SET_UNPLACED; |
|
184 | 185 |
|
185 | 186 |
static { |
186 | 187 |
// initialize resource bundle |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages.properties | ||
---|---|---|
157 | 157 |
TreeNodeDropAdapter_UNSAVED_PARENT_MESSAGE=There are unsaved changes in the parent taxon. Please save first. |
158 | 158 |
SetPublishForSubtreeOperation_CHANGE_PUBLISH_OP=Change publish flag for all children |
159 | 159 |
TaxonNavigatorLabels_SET_PUBLISH_FOR_CHILDREN=Change publish flag for all children |
160 |
TaxonNavigatorLabels_SET_UNPLACED=Set unplaced flag for taxonnode(s) |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages_de.properties | ||
---|---|---|
158 | 158 |
|
159 | 159 |
SetPublishForSubtreeOperation_CHANGE_PUBLISH_OP=Publish Flag f?r alle Kinder ?ndern |
160 | 160 |
TaxonNavigatorLabels_SET_PUBLISH_FOR_CHILDREN=?ndere Publish Flag f?r alle Kinder |
161 |
|
|
161 |
TaxonNavigatorLabels_SET_UNPLACED=Setze unplaced Flag f?r den/die Taxonknoten |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorLabels.java | ||
---|---|---|
30 | 30 |
public static final String UNSAVED_CHANGES_MESSAGE = Messages.TaxonNavigatorLabels_UNSAVED_CHANGES; |
31 | 31 |
public static final String CHANGE_SECUNDUM_FOR_SUBTREE = Messages.TaxonNavigatorLabels_SET_SEC_FOR_CHILDREN; |
32 | 32 |
public static final String ACCEPTED_TAXA_NEED_TO_BE_FROM_SAME_CLASSIFICATION = Messages.TaxonNavigatorLabels_ACCEPTED_TAXA_NEED_TO_BE_FROM_SAME_CLASSIFICATION; |
33 |
public static final String SET_UNPLACED = Messages.TaxonNavigatorLabels_SET_UNPLACED; |
|
33 | 34 |
|
34 | 35 |
|
35 | 36 |
|
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodePropertyTester.java | ||
---|---|---|
19 | 19 |
private static final Object HAS_SYNONYMS = "hasSynonyms"; //$NON-NLS-1$ |
20 | 20 |
private static final Object HAS_TAXA = "hasTaxa"; //$NON-NLS-1$ |
21 | 21 |
private static final Object IS_CLASSIFICATION = "isClassification"; //$NON-NLS-1$ |
22 |
|
|
22 |
private static final Object IS_UNPLACED = "isUnplaced"; |
|
23 |
private static final Object IS_EXCLUDED = "isExcluded"; |
|
23 | 24 |
/** {@inheritDoc} */ |
24 | 25 |
@Override |
25 | 26 |
public boolean test(Object receiver, String property, Object[] args, |
... | ... | |
48 | 49 |
TaxonNodeDto node = (TaxonNodeDto) receiver; |
49 | 50 |
return node.getTaxonUuid() == null; |
50 | 51 |
} |
52 |
if (receiver instanceof TaxonNodeDto && IS_UNPLACED.equals(property)) { |
|
53 |
TaxonNodeDto node = (TaxonNodeDto) receiver; |
|
54 |
return node.isUnplaced(); |
|
55 |
} |
|
56 |
if (receiver instanceof TaxonNodeDto && IS_EXCLUDED.equals(property)) { |
|
57 |
TaxonNodeDto node = (TaxonNodeDto) receiver; |
|
58 |
return node.isExcluded(); |
|
59 |
} |
|
51 | 60 |
|
52 | 61 |
return false; |
53 | 62 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RemotingChangeAcceptedTaxonToSynonymHandlerE4.java | ||
---|---|---|
142 | 142 |
|
143 | 143 |
@CanExecute |
144 | 144 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){ |
145 |
boolean canExecute = false; |
|
146 |
canExecute = selection.size()==1 |
|
147 |
&& selection.getFirstElement() instanceof TaxonNodeDto |
|
148 |
&& ((TaxonNodeDto)selection.getFirstElement()).getTaxonUuid() != null ; |
|
145 |
boolean canExecute = !selection.isEmpty(); |
|
146 |
Object[] array = selection.toArray(); |
|
147 |
for (Object object : array) { |
|
148 |
canExecute &= (object instanceof TaxonNodeDto) && ((TaxonNodeDto)selection.getFirstElement()).getTaxonUuid() != null; |
|
149 |
} |
|
149 | 150 |
menuItem.setVisible(canExecute); |
150 | 151 |
return canExecute; |
151 | 152 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RemoveUnplacedHandler.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2018 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler; |
|
10 |
|
|
11 |
import javax.inject.Named; |
|
12 |
|
|
13 |
import org.eclipse.core.commands.operations.AbstractOperation; |
|
14 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
15 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
|
16 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
|
17 |
import org.eclipse.e4.ui.services.IServiceConstants; |
|
18 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
19 |
import org.eclipse.jface.viewers.TreeSelection; |
|
20 |
import org.eclipse.swt.widgets.Shell; |
|
21 |
|
|
22 |
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto; |
|
23 |
import eu.etaxonomy.taxeditor.navigation.navigator.operation.SetUnplacedOperation; |
|
24 |
|
|
25 |
/** |
|
26 |
* @author k.luther |
|
27 |
* @since 11.10.2018 |
|
28 |
* |
|
29 |
*/ |
|
30 |
public class RemoveUnplacedHandler extends UnplacedHandler { |
|
31 |
@Override |
|
32 |
public AbstractOperation prepareOperation(IStructuredSelection selection, |
|
33 |
Shell shell, |
|
34 |
MPart activePart, |
|
35 |
MHandledMenuItem menuItem) { |
|
36 |
SetUnplacedOperation operation = |
|
37 |
new SetUnplacedOperation(getTrigger(), |
|
38 |
true, |
|
39 |
taxonNodes, |
|
40 |
false); |
|
41 |
|
|
42 |
return operation; |
|
43 |
} |
|
44 |
|
|
45 |
@CanExecute |
|
46 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){ |
|
47 |
boolean canExecute = !selection.isEmpty(); |
|
48 |
Object[] array = selection.toArray(); |
|
49 |
for (Object object : array) { |
|
50 |
canExecute &= (object instanceof TaxonNodeDto) && (((TaxonNodeDto)object).getUuid() != null) && ((TaxonNodeDto)object).isUnplaced(); |
|
51 |
} |
|
52 |
menuItem.setVisible(canExecute); |
|
53 |
return canExecute; |
|
54 |
} |
|
55 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/SetUnplacedHandler.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2018 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler; |
|
10 |
|
|
11 |
import javax.inject.Named; |
|
12 |
|
|
13 |
import org.eclipse.core.commands.operations.AbstractOperation; |
|
14 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
15 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
|
16 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
|
17 |
import org.eclipse.e4.ui.services.IServiceConstants; |
|
18 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
19 |
import org.eclipse.jface.viewers.TreeSelection; |
|
20 |
import org.eclipse.swt.widgets.Shell; |
|
21 |
|
|
22 |
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto; |
|
23 |
import eu.etaxonomy.taxeditor.navigation.navigator.operation.SetUnplacedOperation; |
|
24 |
|
|
25 |
/** |
|
26 |
* @author k.luther |
|
27 |
* @since 11.10.2018 |
|
28 |
* |
|
29 |
*/ |
|
30 |
public class SetUnplacedHandler extends UnplacedHandler { |
|
31 |
@Override |
|
32 |
public AbstractOperation prepareOperation(IStructuredSelection selection, |
|
33 |
Shell shell, |
|
34 |
MPart activePart, |
|
35 |
MHandledMenuItem menuItem) { |
|
36 |
SetUnplacedOperation operation = |
|
37 |
new SetUnplacedOperation(getTrigger(), |
|
38 |
true, |
|
39 |
taxonNodes, |
|
40 |
true); |
|
41 |
|
|
42 |
return operation; |
|
43 |
} |
|
44 |
|
|
45 |
@CanExecute |
|
46 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){ |
|
47 |
boolean canExecute = !selection.isEmpty(); |
|
48 |
Object[] array = selection.toArray(); |
|
49 |
for (Object object : array) { |
|
50 |
canExecute &= (object instanceof TaxonNodeDto) && (((TaxonNodeDto)object).getUuid() != null) && !((TaxonNodeDto)object).isUnplaced(); |
|
51 |
} |
|
52 |
menuItem.setVisible(canExecute); |
|
53 |
return canExecute; |
|
54 |
} |
|
55 |
|
|
56 |
|
|
57 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/UnplacedHandler.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2018 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler; |
|
10 |
|
|
11 |
import java.util.ArrayList; |
|
12 |
import java.util.Iterator; |
|
13 |
import java.util.List; |
|
14 |
import java.util.UUID; |
|
15 |
|
|
16 |
import org.eclipse.core.runtime.IStatus; |
|
17 |
import org.eclipse.core.runtime.Status; |
|
18 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
|
19 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
|
20 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
21 |
import org.eclipse.swt.widgets.Shell; |
|
22 |
|
|
23 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
|
24 |
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto; |
|
25 |
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels; |
|
26 |
import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4; |
|
27 |
|
|
28 |
/** |
|
29 |
* @author k.luther |
|
30 |
* @since 11.10.2018 |
|
31 |
* |
|
32 |
*/ |
|
33 |
public abstract class UnplacedHandler extends RemotingCdmHandlerE4{ |
|
34 |
protected List<UUID> taxonNodes ; |
|
35 |
|
|
36 |
public UnplacedHandler() { |
|
37 |
super(TaxonNavigatorLabels.SET_UNPLACED); |
|
38 |
} |
|
39 |
|
|
40 |
@Override |
|
41 |
public IStatus allowOperations(IStructuredSelection selection, |
|
42 |
Shell shell, |
|
43 |
MPart activePart, |
|
44 |
MHandledMenuItem menuItem) { |
|
45 |
|
|
46 |
|
|
47 |
// check for no taxon tree node selected |
|
48 |
if(selection.size() == 0) { |
|
49 |
return new Status(IStatus.ERROR, |
|
50 |
"unknown", //$NON-NLS-1$ |
|
51 |
TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE); |
|
52 |
} |
|
53 |
taxonNodes = new ArrayList<>(); |
|
54 |
// check that selected object is a taxon node |
|
55 |
Iterator<TaxonNodeDto> iterator = selection.iterator(); |
|
56 |
while(iterator.hasNext()){ |
|
57 |
Object obj = iterator.next(); |
|
58 |
if(obj instanceof TaxonNodeDto) { |
|
59 |
if(obj instanceof Classification){ |
|
60 |
taxonNodes.add(((Classification)obj).getRootNode().getUuid()); |
|
61 |
}else{ |
|
62 |
taxonNodes.add(((TaxonNodeDto)obj).getUuid()); |
|
63 |
} |
|
64 |
} else{ |
|
65 |
return new Status(IStatus.ERROR, |
|
66 |
"unknown", //$NON-NLS-1$ |
|
67 |
TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE); |
|
68 |
} |
|
69 |
} |
|
70 |
|
|
71 |
return Status.OK_STATUS; |
|
72 |
} |
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
@Override |
|
77 |
public void onComplete() { |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* {@inheritDoc} |
|
82 |
*/ |
|
83 |
@Override |
|
84 |
protected Object getTrigger() { |
|
85 |
return this; |
|
86 |
} |
|
87 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/SetUnplacedOperation.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2018 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.navigation.navigator.operation; |
|
10 |
|
|
11 |
import java.util.List; |
|
12 |
import java.util.UUID; |
|
13 |
|
|
14 |
import org.eclipse.core.runtime.IAdaptable; |
|
15 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
16 |
|
|
17 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
|
18 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action; |
|
19 |
import eu.etaxonomy.cdm.api.service.ITaxonNodeService; |
|
20 |
import eu.etaxonomy.cdm.api.service.UpdateResult; |
|
21 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
22 |
import eu.etaxonomy.cdm.persistence.dto.MergeResult; |
|
23 |
import eu.etaxonomy.taxeditor.navigation.l10n.Messages; |
|
24 |
import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation; |
|
25 |
|
|
26 |
/** |
|
27 |
* @author k.luther |
|
28 |
* @since 11.10.2018 |
|
29 |
* |
|
30 |
*/ |
|
31 |
public class SetUnplacedOperation extends RemotingCdmUpdateOperation { |
|
32 |
private final static String LABEL = Messages.TaxonNavigatorLabels_SET_UNPLACED; |
|
33 |
private List<UUID> sourceTaxonNodeUuids; |
|
34 |
private boolean unplaced; |
|
35 |
/** |
|
36 |
* @param source |
|
37 |
* @param async |
|
38 |
*/ |
|
39 |
public SetUnplacedOperation(Object source, |
|
40 |
boolean async, |
|
41 |
List<UUID> sourceTaxonNodeUuids, |
|
42 |
boolean unplaced) { |
|
43 |
super(LABEL, Action.Update, source, async); |
|
44 |
this.sourceTaxonNodeUuids = sourceTaxonNodeUuids; |
|
45 |
this.unplaced = unplaced; |
|
46 |
} |
|
47 |
|
|
48 |
/** |
|
49 |
* {@inheritDoc} |
|
50 |
*/ |
|
51 |
@Override |
|
52 |
protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception { |
|
53 |
|
|
54 |
List<TaxonNode> nodes = CdmApplicationState.getService(ITaxonNodeService.class).load(sourceTaxonNodeUuids, null); |
|
55 |
|
|
56 |
for (TaxonNode node: nodes){ |
|
57 |
node.setUnplaced(unplaced); |
|
58 |
} |
|
59 |
List<MergeResult<TaxonNode>> results = CdmApplicationState.getService(ITaxonNodeService.class).merge(nodes, true); |
|
60 |
UpdateResult updateResult = new UpdateResult(); |
|
61 |
for (MergeResult<TaxonNode>result: results){ |
|
62 |
updateResult.addUpdatedObject(result.getMergedEntity()); |
|
63 |
} |
|
64 |
return updateResult; |
|
65 |
} |
|
66 |
|
|
67 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/EditTaxonNodeWizard.java | ||
---|---|---|
65 | 65 |
super.setEntity(entity); |
66 | 66 |
} |
67 | 67 |
|
68 |
|
|
69 |
|
|
68 | 70 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java | ||
---|---|---|
100 | 100 |
@Override |
101 | 101 |
protected void createControls(ICdmFormElement formElement, |
102 | 102 |
ITaxonTreeNode entity, int style) { |
103 |
selection_classification = formFactory |
|
104 |
.createSelectionElement(Classification.class,//getConversationHolder(), |
|
105 |
formElement, "Classification", |
|
106 |
null, EntitySelectionElement.DELETABLE, style); |
|
107 |
selection_parentTaxonNode = formFactory |
|
108 |
.createTaxonNodeSelectionElement(getConversationHolder(), formElement, "Parent", null, |
|
109 |
EntitySelectionElement.DELETABLE, style); |
|
110 |
|
|
111 |
selection_reuseExistingTaxon = formFactory |
|
112 |
.createSelectionElement(Taxon.class,//getConversationHolder(), |
|
113 |
formElement, |
|
114 |
"Reuse existing taxon", null, |
|
115 |
EntitySelectionElement.DELETABLE, style); |
|
116 |
|
|
117 |
selection_reuseExistingName = formFactory |
|
118 |
.createSelectionElement(TaxonName.class,//getConversationHolder(), |
|
119 |
formElement, |
|
120 |
"Reuse existing name", null, |
|
121 |
EntitySelectionElement.DELETABLE, style); |
|
122 |
selection_SecRef = formFactory |
|
123 |
.createSelectionElement(Reference.class,//getConversationHolder(), |
|
124 |
formElement, "Secundum Reference", null, |
|
125 |
EntitySelectionElement.DELETABLE, style); |
|
126 |
selection_Ref = formFactory |
|
103 |
if (createNew){ |
|
104 |
selection_classification = formFactory |
|
105 |
.createSelectionElement(Classification.class,//getConversationHolder(), |
|
106 |
formElement, "Classification", |
|
107 |
null, EntitySelectionElement.DELETABLE, style); |
|
108 |
selection_parentTaxonNode = formFactory |
|
109 |
.createTaxonNodeSelectionElement(getConversationHolder(), formElement, "Parent", null, |
|
110 |
EntitySelectionElement.DELETABLE, style); |
|
111 |
|
|
112 |
selection_reuseExistingTaxon = formFactory |
|
113 |
.createSelectionElement(Taxon.class,//getConversationHolder(), |
|
114 |
formElement, |
|
115 |
"Reuse existing taxon", null, |
|
116 |
EntitySelectionElement.DELETABLE, style); |
|
117 |
|
|
118 |
selection_reuseExistingName = formFactory |
|
119 |
.createSelectionElement(TaxonName.class,//getConversationHolder(), |
|
120 |
formElement, |
|
121 |
"Reuse existing name", null, |
|
122 |
EntitySelectionElement.DELETABLE, style); |
|
123 |
selection_SecRef = formFactory |
|
124 |
.createSelectionElement(Reference.class,//getConversationHolder(), |
|
125 |
formElement, "Secundum Reference", null, |
|
126 |
EntitySelectionElement.DELETABLE, style); |
|
127 |
|
|
128 |
if (isCreateNew()){ |
|
129 |
textNewTaxonName = formFactory.createTextWithLabelElement(formElement,"New Taxon", "", style); |
|
130 |
textNewTaxonName.setFocus(); |
|
131 |
} else{ |
|
132 |
textNewTaxonName = formFactory.createTextWithLabelElement(formElement,"Taxon", "", style); |
|
133 |
|
|
134 |
} |
|
135 |
}else{ |
|
136 |
TextWithLabelElement textClassification = formFactory.createTextWithLabelElement(formElement,"Classification", ((TaxonNode)entity).getClassification().getTitleCache(), style); |
|
137 |
textClassification.setEnabled(false); |
|
138 |
|
|
139 |
TextWithLabelElement textTaxon = formFactory.createTextWithLabelElement(formElement,"Taxon", ((TaxonNode)entity).getTaxon().getTitleCache(), style); |
|
140 |
textTaxon.setEnabled(false); |
|
141 |
|
|
142 |
TextWithLabelElement textTaxonSec = formFactory.createTextWithLabelElement(formElement,"Secundum Reference", "", style); |
|
143 |
if (((TaxonNode)entity).getTaxon().getSec() != null){ |
|
144 |
textTaxonSec.setText(((TaxonNode)entity).getTaxon().getSec().getTitleCache()); |
|
145 |
} |
|
146 |
textTaxonSec.setEnabled(false); |
|
147 |
|
|
148 |
|
|
149 |
|
|
150 |
} |
|
151 |
|
|
152 |
selection_Ref = formFactory |
|
127 | 153 |
.createSelectionElement(Reference.class,//getConversationHolder(), |
128 | 154 |
formElement, "Parent Child Relationship Reference", null, |
129 | 155 |
EntitySelectionElement.DELETABLE, style); |
130 |
microReference = formFactory.createTextWithLabelElement(formElement,"Detail", "", style); |
|
131 |
if (!isCreateNew()){ |
|
132 |
selection_Ref.setEntity(entity.getReference()); |
|
133 |
} |
|
134 |
if (isCreateNew()){ |
|
135 |
textNewTaxonName = formFactory.createTextWithLabelElement(formElement,"New Taxon", "", style); |
|
136 |
textNewTaxonName.setFocus(); |
|
137 |
} else{ |
|
138 |
textNewTaxonName = formFactory.createTextWithLabelElement(formElement,"Taxon", "", style); |
|
156 |
microReference = formFactory.createTextWithLabelElement(formElement,"Detail", "", style); |
|
139 | 157 |
|
140 |
} |
|
158 |
if (!isCreateNew()){ |
|
159 |
selection_Ref.setEntity(entity.getReference()); |
|
160 |
} |
|
141 | 161 |
if (entity instanceof TaxonNode) { |
142 | 162 |
checkbox_publish = formFactory.createCheckbox(formElement, |
143 | 163 |
"Taxon is public", ((TaxonNode)entity).getTaxon().isPublish(), style); |
... | ... | |
170 | 190 |
checkbox_unplaced = formFactory.createCheckbox(formElement, |
171 | 191 |
"Taxon is unplaced", false, style); |
172 | 192 |
} |
173 |
|
|
174 |
preFillTaxonName(); |
|
193 |
if (isCreateNew()){ |
|
194 |
preFillTaxonName(); |
|
195 |
} |
|
175 | 196 |
|
176 | 197 |
if (entity instanceof TaxonNode) { |
177 | 198 |
checkbox_excluded = formFactory.createCheckbox(formElement, |
... | ... | |
335 | 356 |
private void setTreeNode(ITaxonTreeNode treeNode) { |
336 | 357 |
classification = HibernateProxyHelper |
337 | 358 |
.deproxy(((TaxonNode) treeNode).getClassification()); |
338 |
selection_classification.setEntity(classification); |
|
339 |
selection_parentTaxonNode.setEntity(((TaxonNode) treeNode).getParent()); |
|
340 |
selection_parentTaxonNode.setClassification(((TaxonNode) treeNode).getParent().getClassification()); |
|
341 |
selection_SecRef.setEntity(((TaxonNode)treeNode).getTaxon().getSec()); |
|
359 |
if (isCreateNew()){ |
|
360 |
selection_classification.setEntity(classification); |
|
361 |
selection_parentTaxonNode.setEntity(((TaxonNode) treeNode).getParent()); |
|
362 |
selection_parentTaxonNode.setClassification(((TaxonNode) treeNode).getParent().getClassification()); |
|
363 |
selection_SecRef.setEntity(((TaxonNode)treeNode).getTaxon().getSec()); |
|
364 |
} |
|
342 | 365 |
} |
343 | 366 |
|
344 | 367 |
private void setTaxon(Taxon taxon) { |
... | ... | |
424 | 447 |
this.checkbox_publish.setSelection(publish); |
425 | 448 |
} |
426 | 449 |
|
450 |
|
|
427 | 451 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeWizardPage.java | ||
---|---|---|
168 | 168 |
} |
169 | 169 |
} |
170 | 170 |
|
171 |
|
|
172 |
|
|
171 | 173 |
} |
Also available in: Unified diff
ref #7793: adapt taxonnode wizard and add menu item to set unplaced in navigator