Revision 10041c67
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/plugin.xml | ||
---|---|---|
343 | 343 |
</reference> |
344 | 344 |
</visibleWhen> |
345 | 345 |
</command> |
346 |
<command |
|
347 |
commandId="eu.etaxonomy.taxeditor.editor.openSpecimenEditor" |
|
348 |
label="Derivative Editor" |
|
349 |
style="push"> |
|
350 |
<visibleWhen |
|
351 |
checkEnabled="true"> |
|
352 |
<reference |
|
353 |
definitionId="isCdmStoreConnected"> |
|
354 |
</reference> |
|
355 |
</visibleWhen> |
|
356 |
</command> |
|
346 | 357 |
<command |
347 | 358 |
commandId="org.eclipse.ui.views.showView" |
348 | 359 |
label="%command.label.6" |
... | ... | |
1533 | 1544 |
<command |
1534 | 1545 |
defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler" |
1535 | 1546 |
id="eu.etaxonomy.taxeditor.editor.openSpecimenEditor" |
1536 |
name="Open Specimen Editor">
|
|
1547 |
name="Open Derivative Editor">
|
|
1537 | 1548 |
<commandParameter |
1538 | 1549 |
id="eu.etaxonomy.taxeditor.specimenUuidParameter" |
1539 | 1550 |
name="Specimen UUID parameter" |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenDerivateViewHandler.java | ||
---|---|---|
24 | 24 |
@Override |
25 | 25 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
26 | 26 |
Set<UUID> selectedElementUUIDs = new HashSet<UUID>(); |
27 |
Object parameter; |
|
27 |
Object parameter = null;
|
|
28 | 28 |
//check if parameter is set |
29 |
try {
|
|
29 |
if(event.getParameter("eu.etaxonomy.taxeditor.specimenUuidParameter")!=null){
|
|
30 | 30 |
parameter = event.getObjectParameterForExecution("eu.etaxonomy.taxeditor.specimenUuidParameter"); |
31 |
} catch (ExecutionException e) { |
|
32 |
parameter = null; |
|
33 | 31 |
} |
34 | 32 |
if(parameter instanceof UUID){ |
35 | 33 |
selectedElementUUIDs.add((UUID) parameter); |
... | ... | |
53 | 51 |
} |
54 | 52 |
} |
55 | 53 |
} |
56 |
if(!selectedElementUUIDs.isEmpty()){ |
|
57 |
DerivateViewEditorInput input = new DerivateViewEditorInput(selectedElementUUIDs); |
|
58 |
try { |
|
59 |
EditorUtil.open(input); |
|
60 |
} catch (PartInitException e) { |
|
61 |
MessagingUtils.error(OpenDerivateViewHandler.class, "Could not open Derivative Editor", e); |
|
62 |
} catch (NullPointerException npe){ |
|
63 |
MessagingUtils.messageDialog("Failed to open Editor", OpenDerivateViewHandler.class, "Could not open Derivative Editor. The derivate hierarchy is corrupted!", npe); |
|
64 |
} |
|
65 |
} |
|
66 |
else{ |
|
67 |
MessagingUtils.informationDialog("Empty selection", "No Specimen selected."); |
|
54 |
DerivateViewEditorInput input = new DerivateViewEditorInput(selectedElementUUIDs); |
|
55 |
try { |
|
56 |
EditorUtil.open(input); |
|
57 |
} catch (PartInitException e) { |
|
58 |
MessagingUtils.error(OpenDerivateViewHandler.class, "Could not open Derivative Editor", e); |
|
59 |
} catch (NullPointerException npe){ |
|
60 |
MessagingUtils.messageDialog("Failed to open Editor", OpenDerivateViewHandler.class, "Could not open Derivative Editor. The derivate hierarchy is corrupted!", npe); |
|
68 | 61 |
} |
69 | 62 |
return null; |
70 | 63 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateViewEditorInput.java | ||
---|---|---|
30 | 30 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
31 | 31 |
import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput; |
32 | 32 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
33 |
import eu.etaxonomy.taxeditor.editor.Messages; |
|
34 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
35 | 33 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
36 | 34 |
import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider; |
37 | 35 |
|
... | ... | |
106 | 104 |
if(rootEntities.isEmpty()){ |
107 | 105 |
rootEntities = derivateEntities; |
108 | 106 |
} |
109 |
if(rootEntities.isEmpty()){ |
|
110 |
MessagingUtils.messageDialog(Messages.DerivateViewEditorInput_FAIL_INIT, DerivateViewEditorInput.class, Messages.DerivateViewEditorInput_NO_ROOT); |
|
111 |
} |
|
112 |
|
|
113 | 107 |
|
114 | 108 |
} |
115 | 109 |
|
... | ... | |
175 | 169 |
} |
176 | 170 |
} |
177 | 171 |
} |
172 |
if(name==null){ |
|
173 |
name = "Derivative Editor"; |
|
174 |
} |
|
178 | 175 |
return name; |
179 | 176 |
} |
180 | 177 |
|
Also available in: Unified diff
Add "Show View" entry for derivative editor