Revision 1b6fc97e
Added by Patrick Plitzner about 7 years ago
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties | ||
---|---|---|
184 | 184 |
|
185 | 185 |
viewCommandMapping.viewerName.NAME_EDITOR = Name Editor |
186 | 186 |
viewCommandMapping.viewerName.SPECIMEN_EDITOR = Derivative Editor |
187 |
viewCommandMapping.viewerName.CHECKLIST_EDITOR = Checklist Editor |
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_de.properties | ||
---|---|---|
182 | 182 |
command.name.TOGGLE_LINK_WITH_TAXON_SELECTION = De-/Aktiviere Verkn?pfung mit Taxonauswahl |
183 | 183 |
|
184 | 184 |
viewCommandMapping.viewerName.NAME_EDITOR = Namenseditor |
185 |
viewCommandMapping.viewerName.SPECIMEN_EDITOR = Specimen-Editor |
|
185 |
viewCommandMapping.viewerName.SPECIMEN_EDITOR = Specimen-Editor |
|
186 |
viewCommandMapping.viewerName.CHECKLIST_EDITOR = Checklisten-Editor |
eu.etaxonomy.taxeditor.editor/plugin.xml | ||
---|---|---|
1231 | 1231 |
</with> |
1232 | 1232 |
</activeWhen> |
1233 | 1233 |
</handler> |
1234 |
<handler |
|
1235 |
class="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistEditorHandler" |
|
1236 |
commandId="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistEditorHandler"> |
|
1237 |
</handler> |
|
1238 | 1234 |
<handler |
1239 | 1235 |
class="eu.etaxonomy.taxeditor.editor.view.derivate.handler.DeleteDerivateHandler" |
1240 | 1236 |
commandId="org.eclipse.ui.edit.delete"> |
... | ... | |
1305 | 1301 |
</with> |
1306 | 1302 |
</activeWhen> |
1307 | 1303 |
</handler> |
1304 |
<handler |
|
1305 |
class="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistEditorHandler" |
|
1306 |
commandId="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler"> |
|
1307 |
<activeWhen> |
|
1308 |
<and> |
|
1309 |
<reference |
|
1310 |
definitionId="isChecklistEditorEnabled"> |
|
1311 |
</reference> |
|
1312 |
<or> |
|
1313 |
<reference |
|
1314 |
definitionId="isTaxonNode"> |
|
1315 |
</reference> |
|
1316 |
<reference |
|
1317 |
definitionId="isClassification"> |
|
1318 |
</reference> |
|
1319 |
</or> |
|
1320 |
</and> |
|
1321 |
</activeWhen> |
|
1322 |
</handler> |
|
1308 | 1323 |
</extension> |
1309 | 1324 |
<extension |
1310 | 1325 |
name="%extension.name" |
... | ... | |
1597 | 1612 |
name="%command.name.34"> |
1598 | 1613 |
</command> |
1599 | 1614 |
<command |
1600 |
defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistEditorHandler" |
|
1601 | 1615 |
id="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler" |
1602 | 1616 |
name="%command.name.38"> |
1617 |
<commandParameter |
|
1618 |
id="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler.uuid" |
|
1619 |
name="taxonNodeUuid" |
|
1620 |
optional="true" |
|
1621 |
typeId="eu.etaxonomy.taxeditor.uuidParameterType"> |
|
1622 |
</commandParameter> |
|
1603 | 1623 |
</command> |
1604 | 1624 |
<command |
1605 | 1625 |
categoryId="eu.etaxonomy.taxeditor.editor.new.category" |
... | ... | |
2008 | 2028 |
selection="eu.etaxonomy.cdm.model.taxon.TaxonNode" |
2009 | 2029 |
viewerName="%viewCommandMapping.viewerName.SPECIMEN_EDITOR"> |
2010 | 2030 |
</viewCommandMapping> |
2031 |
<viewCommandMapping |
|
2032 |
commandId="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler" |
|
2033 |
selection="eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode" |
|
2034 |
viewerName="%viewCommandMapping.viewerName.CHECKLIST_EDITOR"> |
|
2035 |
</viewCommandMapping> |
|
2011 | 2036 |
</extension> |
2012 | 2037 |
</plugin> |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenChecklistEditorHandler.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.taxeditor.editor.handler; |
2 | 2 |
|
3 |
import org.apache.log4j.Logger;
|
|
4 |
import org.eclipse.core.commands.AbstractHandler; |
|
3 |
import java.util.UUID;
|
|
4 |
|
|
5 | 5 |
import org.eclipse.core.commands.ExecutionEvent; |
6 |
import org.eclipse.core.commands.ExecutionException; |
|
7 |
import org.eclipse.jface.viewers.ISelection; |
|
8 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
9 | 6 |
import org.eclipse.ui.PartInitException; |
10 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
11 | 7 |
|
8 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
|
9 |
import eu.etaxonomy.cdm.api.service.ITaxonNodeService; |
|
12 | 10 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
11 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
|
13 | 12 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
14 | 13 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
15 | 14 |
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput; |
16 |
import eu.etaxonomy.taxeditor.model.AbstractUtility;
|
|
15 |
import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
|
|
17 | 16 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
18 | 17 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
19 | 18 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
19 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
20 | 20 |
|
21 |
public class OpenChecklistEditorHandler extends AbstractHandler {
|
|
21 |
public class OpenChecklistEditorHandler extends DefaultOpenHandlerBase<ITaxonTreeNode> {
|
|
22 | 22 |
|
23 |
private static final Logger logger = Logger.getLogger(OpenChecklistEditorHandler.class); |
|
23 |
@Override |
|
24 |
protected ITaxonTreeNode getEntity(UUID uuid) { |
|
25 |
ITaxonTreeNode taxonTreeNode = CdmStore.getService(ITaxonNodeService.class).load(uuid); |
|
26 |
if(taxonTreeNode==null){ |
|
27 |
taxonTreeNode = CdmStore.getService(IClassificationService.class).load(uuid); |
|
28 |
} |
|
29 |
return taxonTreeNode; |
|
30 |
} |
|
24 | 31 |
|
25 |
/* |
|
26 |
* (non-Javadoc) |
|
27 |
* |
|
28 |
* @see |
|
29 |
* org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands. |
|
30 |
* ExecutionEvent) |
|
31 |
*/ |
|
32 |
@Override |
|
33 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
34 |
boolean isChecklistEditorActivated = PreferencesUtil.getPreferenceStore().getBoolean( |
|
35 |
IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE); |
|
36 |
if (isChecklistEditorActivated) { |
|
37 |
ISelection currentSelection = HandlerUtil.getCurrentSelection(event); |
|
38 |
if (currentSelection instanceof IStructuredSelection) { |
|
39 |
Object selectedElement = ((IStructuredSelection) currentSelection).getFirstElement(); |
|
40 |
if (selectedElement instanceof Classification) { |
|
41 |
ChecklistEditorInput input = new ChecklistEditorInput(((Classification) selectedElement)); |
|
42 |
try { |
|
43 |
EditorUtil.open(input); |
|
44 |
} catch (PartInitException e) { |
|
45 |
MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open ChecklistView", e); |
|
46 |
} catch (NullPointerException npe) { |
|
47 |
MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class, |
|
48 |
"Could not open ChecklistView. The hierarchy is corrupted!", npe); |
|
49 |
} |
|
50 |
} else if (selectedElement instanceof TaxonNode) { |
|
51 |
ChecklistEditorInput input = new ChecklistEditorInput(((TaxonNode) selectedElement)); |
|
52 |
try { |
|
53 |
EditorUtil.open(input); |
|
54 |
} catch (PartInitException e) { |
|
55 |
MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open ChecklistView", e); |
|
56 |
} catch (NullPointerException npe) { |
|
57 |
MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class, |
|
58 |
"Could not open ChecklistView. The hierarchy is corrupted!", npe); |
|
59 |
} |
|
60 |
} |
|
61 |
} |
|
62 |
} |
|
63 |
return null; |
|
64 |
} |
|
32 |
@Override |
|
33 |
protected void open(ExecutionEvent event, ITaxonTreeNode entity) { |
|
34 |
if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE)) { |
|
35 |
if (entity instanceof Classification) { |
|
36 |
ChecklistEditorInput input = new ChecklistEditorInput(((Classification) entity)); |
|
37 |
try { |
|
38 |
EditorUtil.open(input); |
|
39 |
} catch (PartInitException e) { |
|
40 |
MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open ChecklistView", e); |
|
41 |
} catch (NullPointerException npe) { |
|
42 |
MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class, |
|
43 |
"Could not open ChecklistView. The hierarchy is corrupted!", npe); |
|
44 |
} |
|
45 |
} else if (entity instanceof TaxonNode) { |
|
46 |
ChecklistEditorInput input = new ChecklistEditorInput((TaxonNode) entity); |
|
47 |
try { |
|
48 |
EditorUtil.open(input); |
|
49 |
} catch (PartInitException e) { |
|
50 |
MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open ChecklistView", e); |
|
51 |
} catch (NullPointerException npe) { |
|
52 |
MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class, |
|
53 |
"Could not open ChecklistView. The hierarchy is corrupted!", npe); |
|
54 |
} |
|
55 |
} |
|
56 |
} |
|
57 |
} |
|
65 | 58 |
} |
eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle.properties | ||
---|---|---|
8 | 8 |
menu.label = New |
9 | 9 |
command.label.2 = Taxon |
10 | 10 |
command.label.3 = Classification |
11 |
command.label.4 = Open in Checklist Editor |
|
12 | 11 |
command.label.5 = Edit |
13 | 12 |
command.label.6 = Change accepted taxon to synonym |
14 | 13 |
command.label.7 = Move taxon (with child taxa) |
eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle_de.properties | ||
---|---|---|
8 | 8 |
menu.label = Neu |
9 | 9 |
command.label.2 = Taxon |
10 | 10 |
command.label.3 = Klassifikation |
11 |
command.label.4 = \u00D6ffne im Checklisten Editor |
|
12 | 11 |
command.label.5 = Bearbeiten |
13 | 12 |
command.label.6 = Akzeptiertes Taxon zum Synonym umwandeln |
14 | 13 |
command.label.7 = Verschiebe Taxon (mit Kindern) |
eu.etaxonomy.taxeditor.navigation/plugin.xml | ||
---|---|---|
134 | 134 |
</reference> |
135 | 135 |
</visibleWhen> |
136 | 136 |
</menu> |
137 |
<command |
|
138 |
commandId="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler" |
|
139 |
icon="icons/check.png" |
|
140 |
label="%command.label.4" |
|
141 |
style="push"> |
|
142 |
<visibleWhen |
|
143 |
checkEnabled="true"> |
|
144 |
<and> |
|
145 |
<reference |
|
146 |
definitionId="isChecklistEditorEnabled"> |
|
147 |
</reference> |
|
148 |
<or> |
|
149 |
<reference |
|
150 |
definitionId="isClassification"> |
|
151 |
</reference> |
|
152 |
<reference |
|
153 |
definitionId="isTaxonNode"> |
|
154 |
</reference> |
|
155 |
</or> |
|
156 |
</and> |
|
157 |
</visibleWhen> |
|
158 |
</command> |
|
159 | 137 |
<command |
160 | 138 |
commandId="eu.etaxonomy.taxeditor.navigation.navigator.handler.OpenFixClassificationHierarchyHandler" |
161 | 139 |
label="%command.label.fixClassificationHierarchy" |
Also available in: Unified diff
fix #5988 Add Checklist Editor to generic "Open in..." menu