Revision 6a1330fd
Added by Patrick Plitzner almost 9 years ago
- added context menu option to create a new FieldUnit in DerivateEditor
.gitattributes | ||
---|---|---|
546 | 546 |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/CreateDerivateContextMenu.java -text |
547 | 547 |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/DerivateViewContextMenu.java -text |
548 | 548 |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/SingleReadSequenceContextMenu.java -text |
549 |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/CreateFieldUnitHandler.java -text |
|
549 | 550 |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java -text |
550 | 551 |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivateEditorForTaxonHandler.java -text |
551 | 552 |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/DeleteDerivateOperation.java -text |
eu.etaxonomy.taxeditor.editor/plugin.xml | ||
---|---|---|
610 | 610 |
label="Delete" |
611 | 611 |
style="push"> |
612 | 612 |
</command> |
613 |
<command |
|
614 |
commandId="eu.etaxonomy.taxeditor.editor.derivate.createFieldUnit" |
|
615 |
label="Create Field Unit" |
|
616 |
style="push"> |
|
617 |
</command> |
|
618 |
<command |
|
619 |
commandId="eu.etaxonomy.taxeditor.editor.derivate.deepDelete" |
|
620 |
label="Delete (with children)" |
|
621 |
style="push"> |
|
622 |
</command> |
|
613 | 623 |
</menuContribution> |
614 | 624 |
<menuContribution |
615 | 625 |
locationURI="popup:eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportEditor"> |
... | ... | |
1271 | 1281 |
id="eu.etaxonomy.taxeditor.editor.taxonParameterType" |
1272 | 1282 |
type="eu.etaxonomy.cdm.model.taxon.TaxonBase"> |
1273 | 1283 |
</commandParameterType> |
1284 |
<command |
|
1285 |
defaultHandler="eu.etaxonomy.taxeditor.editor.view.derivate.handler.CreateFieldUnitHandler" |
|
1286 |
id="eu.etaxonomy.taxeditor.editor.derivate.createFieldUnit" |
|
1287 |
name="Create Field Unit"> |
|
1288 |
</command> |
|
1289 |
<command |
|
1290 |
defaultHandler="eu.etaxonomy.taxeditor.editor.view.derivate.handler.DeleteDerivateHandler" |
|
1291 |
id="eu.etaxonomy.taxeditor.editor.derivate.deepDelete" |
|
1292 |
name="Deep Delete"> |
|
1293 |
</command> |
|
1274 | 1294 |
</extension> |
1275 | 1295 |
<extension |
1276 | 1296 |
point="org.eclipse.core.expressions.definitions"> |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateViewEditorInput.java | ||
---|---|---|
40 | 40 |
/** |
41 | 41 |
* The selected derivate {@link UUID}s |
42 | 42 |
*/ |
43 |
private Set<UUID> derivateUUIDs; |
|
43 |
private final Set<UUID> derivateUUIDs;
|
|
44 | 44 |
/** |
45 | 45 |
* List of the {@link UUID}s of the root elements of the hierarchy (may be the same objects as the derivates) |
46 | 46 |
*/ |
... | ... | |
153 | 153 |
return derivateUUIDs; |
154 | 154 |
} |
155 | 155 |
|
156 |
public void setRootAsDerivate(){
|
|
157 |
this.derivateUUIDs = this.rootUUIDs;
|
|
156 |
public void addRootUuid(UUID root){
|
|
157 |
rootUUIDs.add(root);
|
|
158 | 158 |
} |
159 | 159 |
|
160 |
|
|
160 | 161 |
public ConversationHolder getConversationHolder() { |
161 | 162 |
return conversationHolder; |
162 | 163 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/CreateFieldUnitHandler.java | ||
---|---|---|
1 |
package eu.etaxonomy.taxeditor.editor.view.derivate.handler; |
|
2 |
|
|
3 |
import org.eclipse.core.commands.AbstractHandler; |
|
4 |
import org.eclipse.core.commands.ExecutionEvent; |
|
5 |
import org.eclipse.core.commands.ExecutionException; |
|
6 |
|
|
7 |
import eu.etaxonomy.cdm.api.service.IOccurrenceService; |
|
8 |
import eu.etaxonomy.cdm.model.occurrence.FieldUnit; |
|
9 |
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView; |
|
10 |
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput; |
|
11 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
|
12 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
13 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
14 |
|
|
15 |
public class CreateFieldUnitHandler extends AbstractHandler { |
|
16 |
|
|
17 |
@Override |
|
18 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
19 |
if(AbstractUtility.getActivePart() instanceof DerivateView){ |
|
20 |
DerivateView derivateView = (DerivateView)AbstractUtility.getActivePart(); |
|
21 |
if(derivateView.isDirty()){ |
|
22 |
MessagingUtils.warningDialog("View has unsaved changes", this, "You need to save before performing this action"); |
|
23 |
return null; |
|
24 |
} |
|
25 |
FieldUnit fieldUnit = FieldUnit.NewInstance(); |
|
26 |
CdmStore.getService(IOccurrenceService.class).save(fieldUnit); |
|
27 |
derivateView.getConversationHolder().commit(); |
|
28 |
DerivateViewEditorInput input = (DerivateViewEditorInput) derivateView.getEditorInput(); |
|
29 |
input.addRootUuid(fieldUnit.getUuid()); |
|
30 |
derivateView.refreshTree(); |
|
31 |
} |
|
32 |
return null; |
|
33 |
} |
|
34 |
|
|
35 |
} |
Also available in: Unified diff