Revision 2c5756ad
Added by Patrick Plitzner about 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/RemoveFeatureTreeHandler.java | ||
---|---|---|
35 | 35 |
@Execute |
36 | 36 |
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart thisPart, |
37 | 37 |
@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection){ |
38 |
FeatureTreeEditor editor = (FeatureTreeEditor) thisPart.getObject(); |
|
39 |
List<FeatureTree> trees = (List<FeatureTree>) editor.getViewer().getInput(); |
|
38 | 40 |
for (Object selectedObject : selection.toArray()) { |
39 | 41 |
FeatureTree featureTree = (FeatureTree) selectedObject; |
40 | 42 |
CdmStore.getService(IFeatureTreeService.class).delete(featureTree.getUuid()); |
43 |
trees.remove(featureTree); |
|
41 | 44 |
} |
42 |
FeatureTreeEditor editor = (FeatureTreeEditor) thisPart.getObject(); |
|
43 |
List<FeatureTree> trees = CdmStore.getService(IFeatureTreeService.class).list(FeatureTree.class, null, null, null, null); |
|
44 | 45 |
editor.getViewer().setInput(trees); |
45 | 46 |
} |
46 | 47 |
|
... | ... | |
49 | 50 |
@Optional@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection, |
50 | 51 |
@Named(IServiceConstants.ACTIVE_PART)MPart thisPart, |
51 | 52 |
MHandledMenuItem menuItem) { |
52 |
boolean canExecute = false;
|
|
53 |
if(selection!=null && !selection.isEmpty()){
|
|
53 |
boolean canExecute = selection!=null && !selection.isEmpty();
|
|
54 |
if(canExecute){
|
|
54 | 55 |
for(Object object:selection.toArray()){ |
55 | 56 |
canExecute &= object instanceof FeatureTree; |
56 | 57 |
} |
Also available in: Unified diff
ref #6746 Add "Create Feature Tree" menu item