Revision 6268cff8
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java | ||
---|---|---|
52 | 52 |
import eu.etaxonomy.taxeditor.model.IDirtyMarkable; |
53 | 53 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
54 | 54 |
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; |
55 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
|
56 | 55 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
57 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
|
58 | 56 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
59 |
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart; |
|
60 | 57 |
import eu.etaxonomy.taxeditor.workbench.part.IE4ViewerPart; |
61 | 58 |
|
62 | 59 |
/** |
... | ... | |
65 | 62 |
* @date 06.06.2017 |
66 | 63 |
* |
67 | 64 |
*/ |
68 |
public class FeatureTreeEditor implements ICdmEntitySessionEnabled, ISelectionChangedListener,
|
|
69 |
IE4ViewerPart, IE4SavablePart, IPartContentHasDetails, IPartContentHasSupplementalData,
|
|
70 |
IContextListener, IConversationEnabled, IDirtyMarkable, IPostOperationEnabled {
|
|
65 |
public class FeatureTreeEditor implements IFeatureTreeEditor, ISelectionChangedListener,
|
|
66 |
IE4ViewerPart, IPartContentHasDetails, IPartContentHasSupplementalData, |
|
67 |
IContextListener, IConversationEnabled, IDirtyMarkable { |
|
71 | 68 |
|
72 | 69 |
private ConversationHolder conversation; |
73 | 70 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/IFeatureTreeEditor.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.featuretree.e4; |
|
10 |
|
|
11 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
|
12 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
|
13 |
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart; |
|
14 |
|
|
15 |
/** |
|
16 |
* @author pplitzner |
|
17 |
* @since Nov 22, 2018 |
|
18 |
* |
|
19 |
*/ |
|
20 |
public interface IFeatureTreeEditor extends IPostOperationEnabled, IE4SavablePart, ICdmEntitySessionEnabled { |
|
21 |
|
|
22 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/AddChildFeatureHandler.java | ||
---|---|---|
27 | 27 |
import eu.etaxonomy.cdm.model.description.Feature; |
28 | 28 |
import eu.etaxonomy.cdm.model.description.FeatureNode; |
29 | 29 |
import eu.etaxonomy.taxeditor.featuretree.AvailableFeaturesWizard; |
30 |
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor; |
|
30 |
import eu.etaxonomy.taxeditor.featuretree.e4.IFeatureTreeEditor;
|
|
31 | 31 |
import eu.etaxonomy.taxeditor.featuretree.e4.operation.AddFeatureOperation; |
32 | 32 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
33 | 33 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
... | ... | |
44 | 44 |
@Named(IServiceConstants.ACTIVE_PART)MPart thisPart, |
45 | 45 |
@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection, |
46 | 46 |
UISynchronize sync) { |
47 |
FeatureTreeEditor editor = ((FeatureTreeEditor) thisPart.getObject());
|
|
47 |
IFeatureTreeEditor editor = ((IFeatureTreeEditor) thisPart.getObject());
|
|
48 | 48 |
if (StoreUtil.checkDirty(editor)) { |
49 | 49 |
return; |
50 | 50 |
} |
... | ... | |
69 | 69 |
@Named(IServiceConstants.ACTIVE_PART)MPart thisPart, |
70 | 70 |
MHandledMenuItem menuItem) { |
71 | 71 |
boolean canExecute = false; |
72 |
canExecute = thisPart.getObject() instanceof FeatureTreeEditor |
|
72 |
canExecute = thisPart.getObject() instanceof IFeatureTreeEditor
|
|
73 | 73 |
&& selection!=null |
74 | 74 |
&& selection.size()==1 |
75 | 75 |
&& selection.getFirstElement() instanceof FeatureNode; |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/AddFeatureHandler.java | ||
---|---|---|
27 | 27 |
import eu.etaxonomy.cdm.model.description.Feature; |
28 | 28 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
29 | 29 |
import eu.etaxonomy.taxeditor.featuretree.AvailableFeaturesWizard; |
30 |
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor; |
|
30 |
import eu.etaxonomy.taxeditor.featuretree.e4.IFeatureTreeEditor;
|
|
31 | 31 |
import eu.etaxonomy.taxeditor.featuretree.e4.operation.AddFeatureOperation; |
32 | 32 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
33 | 33 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
... | ... | |
43 | 43 |
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, |
44 | 44 |
@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection, |
45 | 45 |
@Named(IServiceConstants.ACTIVE_PART)MPart thisPart, UISynchronize sync) { |
46 |
FeatureTreeEditor editor = ((FeatureTreeEditor) thisPart.getObject());
|
|
46 |
IFeatureTreeEditor editor = ((IFeatureTreeEditor) thisPart.getObject());
|
|
47 | 47 |
|
48 | 48 |
if (StoreUtil.checkDirty(editor)) { |
49 | 49 |
return; |
... | ... | |
69 | 69 |
@Named(IServiceConstants.ACTIVE_PART)MPart thisPart, |
70 | 70 |
MHandledMenuItem menuItem) { |
71 | 71 |
boolean canExecute = false; |
72 |
canExecute = thisPart.getObject() instanceof FeatureTreeEditor |
|
72 |
canExecute = thisPart.getObject() instanceof IFeatureTreeEditor
|
|
73 | 73 |
&& selection!=null |
74 | 74 |
&& selection.size()==1 |
75 | 75 |
&& selection.getFirstElement() instanceof FeatureTree; |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/CopyFeatureHandler.java | ||
---|---|---|
13 | 13 |
import org.eclipse.jface.viewers.IStructuredSelection; |
14 | 14 |
|
15 | 15 |
import eu.etaxonomy.cdm.model.description.FeatureNode; |
16 |
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor; |
|
16 |
import eu.etaxonomy.taxeditor.featuretree.e4.IFeatureTreeEditor;
|
|
17 | 17 |
|
18 | 18 |
public class CopyFeatureHandler { |
19 | 19 |
|
20 | 20 |
@Execute |
21 |
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart part, |
|
22 |
@Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection){ |
|
21 |
public void execute(@Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection){ |
|
23 | 22 |
LocalSelectionTransfer.getTransfer().setSelection(selection); |
24 | 23 |
} |
25 | 24 |
|
... | ... | |
28 | 27 |
@Named(IServiceConstants.ACTIVE_PART) MPart part, |
29 | 28 |
MHandledMenuItem menuItem){ |
30 | 29 |
boolean canExecute = false; |
31 |
canExecute =part.getObject() instanceof FeatureTreeEditor |
|
30 |
canExecute =part.getObject() instanceof IFeatureTreeEditor
|
|
32 | 31 |
&& selection!=null |
33 | 32 |
&& selection.size()==1 |
34 | 33 |
&& selection.getFirstElement() instanceof FeatureNode; |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/CreateFeatureTreeHandler.java | ||
---|---|---|
18 | 18 |
import org.eclipse.e4.ui.services.IServiceConstants; |
19 | 19 |
|
20 | 20 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
21 |
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor; |
|
21 |
import eu.etaxonomy.taxeditor.featuretree.e4.IFeatureTreeEditor;
|
|
22 | 22 |
import eu.etaxonomy.taxeditor.featuretree.e4.operation.CreateFeatureTreeOperation; |
23 | 23 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
24 | 24 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
... | ... | |
32 | 32 |
|
33 | 33 |
@Execute |
34 | 34 |
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart thisPart, UISynchronize sync){ |
35 |
FeatureTreeEditor editor = (FeatureTreeEditor) thisPart.getObject();
|
|
35 |
IFeatureTreeEditor editor = (IFeatureTreeEditor) thisPart.getObject();
|
|
36 | 36 |
|
37 | 37 |
if (StoreUtil.checkDirty(editor)) { |
38 | 38 |
return; |
... | ... | |
50 | 50 |
@Named(IServiceConstants.ACTIVE_PART)MPart thisPart, |
51 | 51 |
MHandledMenuItem menuItem) { |
52 | 52 |
boolean canExecute = false; |
53 |
canExecute = thisPart.getObject() instanceof FeatureTreeEditor; |
|
53 |
canExecute = thisPart.getObject() instanceof IFeatureTreeEditor;
|
|
54 | 54 |
menuItem.setVisible(canExecute); |
55 | 55 |
return canExecute; |
56 | 56 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/FeatureTreeExportHandler.java | ||
---|---|---|
28 | 28 |
import eu.etaxonomy.cdm.io.descriptive.word.out.WordExportConfigurator; |
29 | 29 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
30 | 30 |
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureNodeDropAdapter; |
31 |
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor; |
|
31 |
import eu.etaxonomy.taxeditor.featuretree.e4.IFeatureTreeEditor;
|
|
32 | 32 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
33 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
|
33 | 34 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
34 | 35 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
35 | 36 |
|
... | ... | |
44 | 45 |
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, |
45 | 46 |
@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection, |
46 | 47 |
@Named(IServiceConstants.ACTIVE_PART)MPart thisPart){ |
47 |
FeatureTreeEditor editor = (FeatureTreeEditor) thisPart.getObject();
|
|
48 |
IFeatureTreeEditor editor = (IFeatureTreeEditor) thisPart.getObject();
|
|
48 | 49 |
|
49 | 50 |
if (editor.isDirty()) { |
50 | 51 |
if (MessagingUtils.confirmDialog(FeatureNodeDropAdapter.SAVE_CHANGES_TITLE, |
... | ... | |
75 | 76 |
@Optional@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection, |
76 | 77 |
MHandledMenuItem menuItem) { |
77 | 78 |
boolean canExecute = false; |
78 |
canExecute = PreferencesUtil.getBooleanValue(PreferencesUtil.SHOW_EXPERIMENTAL_FEATURES)
|
|
79 |
canExecute = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES)
|
|
79 | 80 |
&& selection!=null |
80 | 81 |
&& selection.size()==1 |
81 | 82 |
&& selection.getFirstElement() instanceof FeatureTree; |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/PasteFeatureHandler.java | ||
---|---|---|
15 | 15 |
import org.eclipse.jface.viewers.IStructuredSelection; |
16 | 16 |
|
17 | 17 |
import eu.etaxonomy.cdm.model.description.FeatureNode; |
18 |
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor; |
|
18 |
import eu.etaxonomy.taxeditor.featuretree.e4.IFeatureTreeEditor;
|
|
19 | 19 |
import eu.etaxonomy.taxeditor.featuretree.e4.operation.AddFeatureOperation; |
20 | 20 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
21 | 21 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
... | ... | |
25 | 25 |
@Execute |
26 | 26 |
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart part, |
27 | 27 |
@Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection, UISynchronize sync){ |
28 |
FeatureTreeEditor editor = (FeatureTreeEditor)part.getObject();
|
|
28 |
IFeatureTreeEditor editor = (IFeatureTreeEditor)part.getObject();
|
|
29 | 29 |
|
30 | 30 |
if (StoreUtil.checkDirty(editor)) { |
31 | 31 |
return; |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/RemoveFeatureHandler.java | ||
---|---|---|
20 | 20 |
import org.eclipse.jface.viewers.IStructuredSelection; |
21 | 21 |
|
22 | 22 |
import eu.etaxonomy.cdm.model.description.FeatureNode; |
23 |
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor; |
|
23 |
import eu.etaxonomy.taxeditor.featuretree.e4.IFeatureTreeEditor;
|
|
24 | 24 |
import eu.etaxonomy.taxeditor.featuretree.e4.operation.RemoveFeatureOperation; |
25 | 25 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
26 | 26 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
27 |
import eu.etaxonomy.taxeditor.workbench.part.IE4ViewerPart; |
|
28 | 27 |
|
29 | 28 |
/** |
30 | 29 |
* @author pplitzner |
... | ... | |
36 | 35 |
@Execute |
37 | 36 |
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart thisPart, |
38 | 37 |
@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection, UISynchronize sync){ |
39 |
FeatureTreeEditor editor = (FeatureTreeEditor) thisPart.getObject();
|
|
38 |
IFeatureTreeEditor editor = (IFeatureTreeEditor) thisPart.getObject();
|
|
40 | 39 |
|
41 | 40 |
if (StoreUtil.checkDirty(editor)) { |
42 | 41 |
return; |
... | ... | |
63 | 62 |
canExecute &= object instanceof FeatureNode; |
64 | 63 |
} |
65 | 64 |
} |
66 |
canExecute &= thisPart.getObject() instanceof IE4ViewerPart;
|
|
65 |
canExecute &= thisPart.getObject() instanceof IFeatureTreeEditor;
|
|
67 | 66 |
menuItem.setVisible(canExecute); |
68 | 67 |
return canExecute; |
69 | 68 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/RemoveFeatureTreeHandler.java | ||
---|---|---|
20 | 20 |
import org.eclipse.jface.viewers.IStructuredSelection; |
21 | 21 |
|
22 | 22 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
23 |
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor; |
|
23 |
import eu.etaxonomy.taxeditor.featuretree.e4.IFeatureTreeEditor;
|
|
24 | 24 |
import eu.etaxonomy.taxeditor.featuretree.e4.operation.RemoveFeatureTreeOperation; |
25 | 25 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
26 | 26 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
... | ... | |
35 | 35 |
@Execute |
36 | 36 |
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart thisPart, |
37 | 37 |
@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection, UISynchronize sync){ |
38 |
FeatureTreeEditor editor = (FeatureTreeEditor) thisPart.getObject();
|
|
38 |
IFeatureTreeEditor editor = (IFeatureTreeEditor) thisPart.getObject();
|
|
39 | 39 |
|
40 | 40 |
if (StoreUtil.checkDirty(editor)) { |
41 | 41 |
return; |
... | ... | |
62 | 62 |
canExecute &= object instanceof FeatureTree; |
63 | 63 |
} |
64 | 64 |
} |
65 |
canExecute &= thisPart.getObject() instanceof FeatureTreeEditor; |
|
65 |
canExecute &= thisPart.getObject() instanceof IFeatureTreeEditor;
|
|
66 | 66 |
menuItem.setVisible(canExecute); |
67 | 67 |
return canExecute; |
68 | 68 |
} |
Also available in: Unified diff
ref #7923 Extract common interface for feature tree editors