Revision dbc398cf
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/META-INF/MANIFEST.MF | ||
---|---|---|
34 | 34 |
org.eclipse.e4.core.di, |
35 | 35 |
org.eclipse.e4.ui.model.workbench, |
36 | 36 |
org.eclipse.e4.ui.di, |
37 |
org.eclipse.e4.core.commands |
|
37 |
org.eclipse.e4.core.commands, |
|
38 |
org.eclipse.e4.core.contexts |
|
38 | 39 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.8 |
39 | 40 |
Bundle-ActivationPolicy: lazy |
40 | 41 |
Import-Package: javax.annotation;version="1.0.0";resolution:=optional, |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java | ||
---|---|---|
24 | 24 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
25 | 25 |
import org.eclipse.e4.ui.services.EMenuService; |
26 | 26 |
import org.eclipse.e4.ui.services.IServiceConstants; |
27 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
|
27 | 28 |
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; |
28 | 29 |
import org.eclipse.jface.util.LocalSelectionTransfer; |
29 | 30 |
import org.eclipse.jface.viewers.AbstractTreeViewer; |
... | ... | |
149 | 150 |
|
150 | 151 |
private ISelectionChangedListener selectionChangedListener; |
151 | 152 |
|
153 |
@Inject |
|
154 |
private MPart thisPart; |
|
155 |
|
|
152 | 156 |
/** |
153 | 157 |
* Default constructor |
154 | 158 |
*/ |
... | ... | |
585 | 589 |
*/ |
586 | 590 |
@Override |
587 | 591 |
public void contextStop(IMemento memento, IProgressMonitor monitor) { |
588 |
derivateSearchCompositeController.setEnabled(false); |
|
589 |
if(!viewer.getTree().isDisposed()) { |
|
590 |
viewer.getTree().setEnabled(false); |
|
591 |
viewer.setInput(null); |
|
592 |
//close view when workbench closes |
|
593 |
try{ |
|
594 |
thisPart.getContext().get(EPartService.class).hidePart(thisPart); |
|
595 |
} |
|
596 |
catch(Exception e){ |
|
597 |
//nothing |
|
592 | 598 |
} |
593 | 599 |
} |
594 | 600 |
|
... | ... | |
597 | 603 |
*/ |
598 | 604 |
@Override |
599 | 605 |
public void contextStart(IMemento memento, IProgressMonitor monitor) { |
600 |
derivateSearchCompositeController.setEnabled(!listenToSelectionChange); |
|
601 |
if(!viewer.getTree().isDisposed()){ |
|
602 |
viewer.getTree().setEnabled(true); |
|
603 |
} |
|
604 |
refreshTree(); |
|
605 | 606 |
} |
606 | 607 |
|
607 | 608 |
/** |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermEditorE4.java | ||
---|---|---|
18 | 18 |
import org.eclipse.e4.ui.model.application.ui.MDirtyable; |
19 | 19 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
20 | 20 |
import org.eclipse.e4.ui.services.EMenuService; |
21 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
|
21 | 22 |
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; |
22 | 23 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
23 | 24 |
import org.eclipse.jface.viewers.StructuredSelection; |
... | ... | |
29 | 30 |
import org.eclipse.swt.dnd.Transfer; |
30 | 31 |
import org.eclipse.swt.layout.FillLayout; |
31 | 32 |
import org.eclipse.swt.widgets.Composite; |
33 |
import org.eclipse.ui.IMemento; |
|
32 | 34 |
|
33 | 35 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
34 | 36 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
... | ... | |
40 | 42 |
import eu.etaxonomy.taxeditor.editor.definedterm.TermTransfer; |
41 | 43 |
import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput; |
42 | 44 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
45 |
import eu.etaxonomy.taxeditor.model.IContextListener; |
|
43 | 46 |
import eu.etaxonomy.taxeditor.model.IDirtyMarkable; |
44 | 47 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
45 | 48 |
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; |
... | ... | |
55 | 58 |
* |
56 | 59 |
*/ |
57 | 60 |
public class DefinedTermEditorE4 implements IConversationEnabled, IDirtyMarkable, IPostOperationEnabled, |
58 |
IPartContentHasDetails, IPartContentHasSupplementalData, IE4SavablePart { |
|
61 |
IPartContentHasDetails, IPartContentHasSupplementalData, IE4SavablePart, IContextListener {
|
|
59 | 62 |
|
60 | 63 |
public static final String OPEN_COMMAND_ID = "eu.etaxonomy.taxeditor.store.openDefinedTermEditor"; |
61 | 64 |
|
... | ... | |
79 | 82 |
|
80 | 83 |
@Inject |
81 | 84 |
public DefinedTermEditorE4() { |
85 |
CdmStore.getContextManager().addContextListener(this); |
|
82 | 86 |
} |
83 | 87 |
|
84 | 88 |
@PostConstruct |
... | ... | |
230 | 234 |
return input; |
231 | 235 |
} |
232 | 236 |
|
237 |
/** |
|
238 |
* {@inheritDoc} |
|
239 |
*/ |
|
240 |
@Override |
|
241 |
public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) { |
|
242 |
} |
|
243 |
|
|
244 |
/** |
|
245 |
* {@inheritDoc} |
|
246 |
*/ |
|
247 |
@Override |
|
248 |
public void contextStop(IMemento memento, IProgressMonitor monitor) { |
|
249 |
//close view when workbench closes |
|
250 |
try{ |
|
251 |
thisPart.getContext().get(EPartService.class).hidePart(thisPart); |
|
252 |
} |
|
253 |
catch(Exception e){ |
|
254 |
//nothing |
|
255 |
} |
|
256 |
} |
|
257 |
|
|
258 |
/** |
|
259 |
* {@inheritDoc} |
|
260 |
*/ |
|
261 |
@Override |
|
262 |
public void contextStart(IMemento memento, IProgressMonitor monitor) { |
|
263 |
} |
|
264 |
|
|
265 |
/** |
|
266 |
* {@inheritDoc} |
|
267 |
*/ |
|
268 |
@Override |
|
269 |
public void contextRefresh(IProgressMonitor monitor) { |
|
270 |
} |
|
271 |
|
|
272 |
/** |
|
273 |
* {@inheritDoc} |
|
274 |
*/ |
|
275 |
@Override |
|
276 |
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) { |
|
277 |
} |
|
278 |
|
|
233 | 279 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/OpenDefinedTermEditorHandlerE4.java | ||
---|---|---|
36 | 36 |
UUID termTypeUuid = (UUID) menuItem.getTransientData().get(commandId+".termTypeUuid"); |
37 | 37 |
|
38 | 38 |
TermEditorInput termEditorInput = new TermEditorInput(TermType.getByUuid(termTypeUuid)); |
39 |
MPart mPart = partService.showPart("eu.etaxonomy.taxeditor.editor.definedTerm", PartState.ACTIVATE); |
|
39 |
MPart mPart = partService.createPart("eu.etaxonomy.taxeditor.editor.definedTerm"); |
|
40 |
partService.showPart(mPart, PartState.ACTIVATE); |
|
40 | 41 |
DefinedTermEditorE4 termEditor = (DefinedTermEditorE4) mPart.getObject(); |
41 | 42 |
termEditor.init(termEditorInput); |
42 | 43 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java | ||
---|---|---|
19 | 19 |
import javax.annotation.PreDestroy; |
20 | 20 |
import javax.inject.Inject; |
21 | 21 |
|
22 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
22 | 23 |
import org.eclipse.e4.ui.di.Focus; |
23 | 24 |
import org.eclipse.e4.ui.di.Persist; |
24 | 25 |
import org.eclipse.e4.ui.model.application.ui.MDirtyable; |
26 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
|
25 | 27 |
import org.eclipse.e4.ui.services.EMenuService; |
28 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
|
26 | 29 |
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; |
27 | 30 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
28 | 31 |
import org.eclipse.jface.viewers.IStructuredSelection; |
... | ... | |
34 | 37 |
import org.eclipse.swt.events.SelectionAdapter; |
35 | 38 |
import org.eclipse.swt.events.SelectionEvent; |
36 | 39 |
import org.eclipse.swt.widgets.Composite; |
40 |
import org.eclipse.ui.IMemento; |
|
37 | 41 |
|
38 | 42 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
39 | 43 |
import eu.etaxonomy.cdm.api.service.IFeatureTreeService; |
40 | 44 |
import eu.etaxonomy.cdm.model.description.FeatureNode; |
41 | 45 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
42 | 46 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
47 |
import eu.etaxonomy.taxeditor.model.IContextListener; |
|
43 | 48 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
44 | 49 |
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; |
45 | 50 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
... | ... | |
55 | 60 |
* @date 06.06.2017 |
56 | 61 |
* |
57 | 62 |
*/ |
58 |
public class FeatureTreeEditor implements ICdmEntitySessionEnabled, |
|
59 |
ModifyListener, ISelectionChangedListener, IE4ViewerPart, IPartContentHasDetails, IPartContentHasSupplementalData {
|
|
63 |
public class FeatureTreeEditor implements ICdmEntitySessionEnabled, ModifyListener, ISelectionChangedListener,
|
|
64 |
IE4ViewerPart, IPartContentHasDetails, IPartContentHasSupplementalData, IContextListener {
|
|
60 | 65 |
|
61 | 66 |
private ConversationHolder conversation; |
62 | 67 |
|
... | ... | |
70 | 75 |
|
71 | 76 |
private FeatureTreeEditorComposite composite; |
72 | 77 |
|
78 |
@Inject |
|
79 |
private MPart thisPart; |
|
80 |
|
|
73 | 81 |
@Inject |
74 | 82 |
public FeatureTreeEditor() { |
83 |
CdmStore.getContextManager().addContextListener(this); |
|
75 | 84 |
} |
76 | 85 |
|
77 | 86 |
/** {@inheritDoc} */ |
... | ... | |
221 | 230 |
return root; |
222 | 231 |
} |
223 | 232 |
|
233 |
/** |
|
234 |
* {@inheritDoc} |
|
235 |
*/ |
|
236 |
@Override |
|
237 |
public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) { |
|
238 |
} |
|
239 |
|
|
240 |
/** |
|
241 |
* {@inheritDoc} |
|
242 |
*/ |
|
243 |
@Override |
|
244 |
public void contextStop(IMemento memento, IProgressMonitor monitor) { |
|
245 |
//close view when workbench closes |
|
246 |
try{ |
|
247 |
thisPart.getContext().get(EPartService.class).hidePart(thisPart); |
|
248 |
} |
|
249 |
catch(Exception e){ |
|
250 |
//nothing |
|
251 |
} |
|
252 |
} |
|
253 |
|
|
254 |
/** |
|
255 |
* {@inheritDoc} |
|
256 |
*/ |
|
257 |
@Override |
|
258 |
public void contextStart(IMemento memento, IProgressMonitor monitor) { |
|
259 |
} |
|
260 |
|
|
261 |
/** |
|
262 |
* {@inheritDoc} |
|
263 |
*/ |
|
264 |
@Override |
|
265 |
public void contextRefresh(IProgressMonitor monitor) { |
|
266 |
} |
|
267 |
|
|
268 |
/** |
|
269 |
* {@inheritDoc} |
|
270 |
*/ |
|
271 |
@Override |
|
272 |
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) { |
|
273 |
} |
|
274 |
|
|
224 | 275 |
} |
Also available in: Unified diff
ref #6922, #6925 Close editors when reconnecting