Revision 99d4f2d2
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/e4/AbstractGraphKeyEditorE4.java | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import javax.inject.Inject; |
7 | 7 |
|
8 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
8 | 9 |
import org.eclipse.e4.ui.di.Focus; |
9 | 10 |
import org.eclipse.e4.ui.di.Persist; |
10 | 11 |
import org.eclipse.e4.ui.model.application.ui.MDirtyable; |
... | ... | |
33 | 34 |
import eu.etaxonomy.taxeditor.model.IDirtyMarkable; |
34 | 35 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
35 | 36 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
37 |
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart; |
|
36 | 38 |
|
37 | 39 |
/** |
38 | 40 |
* |
... | ... | |
42 | 44 |
* @param <T> |
43 | 45 |
*/ |
44 | 46 |
public abstract class AbstractGraphKeyEditorE4<T extends IIdentificationKey> |
45 |
implements IConversationEnabled, |
|
47 |
implements IConversationEnabled, IE4SavablePart,
|
|
46 | 48 |
IZoomableWorkbenchPart, IPostOperationEnabled, |
47 | 49 |
IDirtyMarkable { |
48 | 50 |
|
... | ... | |
69 | 71 |
private MPart thisPart; |
70 | 72 |
|
71 | 73 |
@Persist |
72 |
public void doSave() {
|
|
74 |
public void save(IProgressMonitor monitor) {
|
|
73 | 75 |
getConversationHolder().commit(true); |
74 | 76 |
setDirty(false); |
75 | 77 |
viewer.refresh(); |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/CharacterEditor.java | ||
---|---|---|
20 | 20 |
import javax.annotation.PreDestroy; |
21 | 21 |
import javax.inject.Inject; |
22 | 22 |
|
23 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
23 | 24 |
import org.eclipse.e4.ui.di.Focus; |
24 | 25 |
import org.eclipse.e4.ui.di.Persist; |
25 | 26 |
import org.eclipse.e4.ui.model.application.ui.MDirtyable; |
... | ... | |
62 | 63 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
63 | 64 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
64 | 65 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.FeatureTreeSelectionDialog; |
66 |
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart; |
|
65 | 67 |
import eu.etaxonomy.taxeditor.workbench.part.IE4ViewerPart; |
66 | 68 |
|
67 | 69 |
/** |
... | ... | |
71 | 73 |
*/ |
72 | 74 |
public class CharacterEditor |
73 | 75 |
implements ICdmEntitySessionEnabled, ISelectionChangedListener, ModifyListener, IE4ViewerPart |
74 |
, IPartContentHasDetails, IPartContentHasSupplementalData{ |
|
76 |
, IPartContentHasDetails, IPartContentHasSupplementalData, IE4SavablePart{
|
|
75 | 77 |
|
76 | 78 |
private FeatureTreeEditorComposite characterTreeEditorComposite; |
77 | 79 |
private FeatureTreeEditorComposite propertiesTreeEditorComposite; |
... | ... | |
226 | 228 |
}); |
227 | 229 |
} |
228 | 230 |
|
231 |
@Override |
|
229 | 232 |
@Persist |
230 |
public void save(){ |
|
233 |
public void save(IProgressMonitor monitor){
|
|
231 | 234 |
if (!conversation.isBound()) { |
232 | 235 |
conversation.bind(); |
233 | 236 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java | ||
---|---|---|
20 | 20 |
import javax.inject.Inject; |
21 | 21 |
|
22 | 22 |
import org.eclipse.core.runtime.IProgressMonitor; |
23 |
import org.eclipse.core.runtime.NullProgressMonitor; |
|
23 | 24 |
import org.eclipse.e4.ui.di.Focus; |
24 | 25 |
import org.eclipse.e4.ui.di.Persist; |
25 | 26 |
import org.eclipse.e4.ui.model.application.ui.MDirtyable; |
... | ... | |
54 | 55 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
55 | 56 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
56 | 57 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.FeatureTreeSelectionDialog; |
58 |
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart; |
|
57 | 59 |
import eu.etaxonomy.taxeditor.workbench.part.IE4ViewerPart; |
58 | 60 |
|
59 | 61 |
/** |
... | ... | |
63 | 65 |
* |
64 | 66 |
*/ |
65 | 67 |
public class FeatureTreeEditor implements ICdmEntitySessionEnabled, ModifyListener, ISelectionChangedListener, |
66 |
IE4ViewerPart, IPartContentHasDetails, IPartContentHasSupplementalData, IContextListener, IConversationEnabled { |
|
68 |
IE4ViewerPart, IE4SavablePart, IPartContentHasDetails, IPartContentHasSupplementalData, IContextListener, IConversationEnabled {
|
|
67 | 69 |
|
68 | 70 |
private ConversationHolder conversation; |
69 | 71 |
|
... | ... | |
106 | 108 |
public void widgetSelected(SelectionEvent e) { |
107 | 109 |
if(isDirty()){ |
108 | 110 |
if(MessagingUtils.confirmDialog("Editor has to be saved", "You have to save before loading another feature tree. Save now?")){ |
109 |
save(); |
|
111 |
save(new NullProgressMonitor());
|
|
110 | 112 |
} |
111 | 113 |
else{ |
112 | 114 |
return; |
... | ... | |
188 | 190 |
return conversation; |
189 | 191 |
} |
190 | 192 |
|
191 |
@Persist |
|
192 |
public void save(){ |
|
193 |
@Override |
|
194 |
@Persist |
|
195 |
public void save(IProgressMonitor monitor){ |
|
193 | 196 |
if (!conversation.isBound()) { |
194 | 197 |
conversation.bind(); |
195 | 198 |
} |
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/OpenPartHandler.java | ||
---|---|---|
6 | 6 |
import org.eclipse.core.commands.ParameterizedCommand; |
7 | 7 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
8 | 8 |
import org.eclipse.e4.core.di.annotations.Execute; |
9 |
import org.eclipse.e4.ui.model.application.MApplication; |
|
9 | 10 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
11 |
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; |
|
12 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
10 | 13 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
11 | 14 |
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; |
12 | 15 |
|
16 |
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart; |
|
17 |
|
|
13 | 18 |
public class OpenPartHandler { |
14 | 19 |
|
15 | 20 |
@Execute |
16 |
public void execute(ParameterizedCommand commandParameters, EPartService partService) { |
|
21 |
public void execute(ParameterizedCommand commandParameters, EPartService partService, MApplication application, EModelService modelService) {
|
|
17 | 22 |
|
18 | 23 |
if (null == commandParameters) { |
19 | 24 |
return; |
... | ... | |
22 | 27 |
String partId = parameterMap.get(AppModelId.COMMANDPARAMETER_EU_ETAXONOMY_TAXEDITOR_WORKBENCH_COMMANDPARAMETER_PARTNAME).toString(); |
23 | 28 |
MPart part = partService.createPart(partId); |
24 | 29 |
part = partService.showPart(part, PartState.ACTIVATE); |
30 |
if(part.getObject() instanceof IE4SavablePart){ |
|
31 |
MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService); |
|
32 |
if(editorAreaPartStack!=null){ |
|
33 |
editorAreaPartStack.getChildren().add(part); |
|
34 |
} |
|
35 |
part = partService.showPart(part, PartState.VISIBLE); |
|
36 |
} |
|
25 | 37 |
} |
26 | 38 |
|
27 | 39 |
@CanExecute |
Also available in: Unified diff
ref #6925 Open "editors" in editor area