Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java')
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java97
1 files changed, 53 insertions, 44 deletions
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java
index e08edd9824b..15b64868042 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/editor/CoreMultiDiagramEditor.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2008, 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -97,15 +97,15 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
* implementation allows to register editors and context separately. An editor
* should specify which context it need to run. This multi diagram editor allows
* to show editor side by side in one or more sash windows.
- *
+ *
* The real implementation for the generic type T of SashMultiPageEditorPart is
* actually di2.Diagram
- *
+ *
* @author cedric dumoulin
* @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
* @author <a href="mailto:thomas.szadel@atosorigin.com">Thomas Szadel</a>
* Refactoring.
- *
+ *
* TODO : remove GMF dependency !
*/
public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implements IMultiDiagramEditor, ITabbedPropertySheetPageContributor, IGotoMarker {
@@ -149,9 +149,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* This method is called when the editor input is changed from the
* ISaveAndDirtyService.
- *
+ *
* @see org.eclipse.papyrus.infra.core.lifecycleevents.IEditorInputChangedListener#editorInputChanged(org.eclipse.ui.part.FileEditorInput)
- *
+ *
* @param fileEditorInput
*/
@Override
@@ -163,9 +163,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* The isDirty flag has changed, reflect its new value
- *
+ *
* @see org.eclipse.papyrus.infra.core.lifecycleevents.IEditorInputChangedListener#isDirtyChanged()
- *
+ *
*/
@Override
public void isDirtyChanged() {
@@ -176,8 +176,8 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
@Override
public void run() {
// editor can be null if this object has been finalized, but
- // still queued in the asyncExec queue.
- // This can happen if the editor is disposed, but some run still in
+ // still queued in the asyncExec queue.
+ // This can happen if the editor is disposed, but some run still in
// the exec queue.
// When the method is executed asynchronously, the object is already finalized, and so
// editor is null.
@@ -268,7 +268,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Get the contentOutlineRegistry. Create it if needed.
- *
+ *
* @return the contentOutlineRegistry
*/
protected ContentOutlineRegistry getContentOutlineRegistry() {
@@ -288,7 +288,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Returns the service registry associated to the editor.
- *
+ *
* @return the servicesRegistry The registry.
*/
@Override
@@ -301,7 +301,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Create the ServicesRegistry.
- *
+ *
* @return
*/
private ServicesRegistry createServicesRegistry() {
@@ -320,7 +320,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Do nothing as we create the provider before any calls to this method.
* Should not be called by subclasses.
- *
+ *
* @see org.eclipse.papyrus.infra.core.sasheditor.editor.AbstractMultiPageSashEditor#createPageProvider()
*/
@Override
@@ -330,14 +330,14 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Create the pageContentProvider.
- *
+ *
* Removed since 0.10.0
- *
+ *
* @param pageFactory
* @param diResource
* Resource used to load/save the SashModel.
- *
- *
+ *
+ *
*/
// protected ISashWindowsContentProvider createPageProvider(IPageModelFactory pageFactory, Resource diResource, TransactionalEditingDomain editingDomain) {
//
@@ -352,7 +352,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
* Get The {@link IPageMngr} used to add, open, remove or close a diagram in
* the SashWindow. This method is available as soon as the {@link CoreMultiDiagramEditor#init(IEditorSite, IEditorInput)} method is
* called.
- *
+ *
* @return
*/
protected IPageManager getIPageManager() throws IllegalStateException {
@@ -365,7 +365,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Get the ActionBarContributorRegistry. Creates it if necessary.
- *
+ *
* @return
*/
protected ActionBarContributorRegistry getActionBarContributorRegistry() {
@@ -389,7 +389,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Create the ActionBarContributorRegistry.
- *
+ *
* @return
*/
private ActionBarContributorRegistry createActionBarContributorRegistry() {
@@ -397,10 +397,10 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
}
/**
- *
- *
+ *
+ *
* @param adapter
- *
+ *
* @return
*/
@SuppressWarnings("rawtypes")
@@ -493,6 +493,11 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
@Override
public void run() {
+ //Because we are asynchronous, the editor may already have been disposed
+ //(Especially in the case of tests running in the UI Thread)
+ if(servicesRegistry == null) {
+ return;
+ }
getLifecycleManager().firePostDisplay(CoreMultiDiagramEditor.this);
}
});
@@ -628,6 +633,10 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
}
private InternalEditorLifecycleManager getLifecycleManager() {
+ //I've been disposed
+ if(servicesRegistry == null) {
+ return null;
+ }
try {
return (InternalEditorLifecycleManager)servicesRegistry.getService(EditorLifecycleManager.class);
} catch (ServiceException ex) {
@@ -739,9 +748,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides getPropertySheetPage.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor#getPropertySheetPage()
*/
public IPropertySheetPage getPropertySheetPage() {
@@ -752,7 +761,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* @see org.eclipse.papyrus.infra.core.sasheditor.editor.AbstractMultiPageSashEditor#dispose()
- *
+ *
*/
@Override
public void dispose() {
@@ -819,9 +828,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides doSave.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
@@ -845,9 +854,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides doSaveAs.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.ui.part.EditorPart#doSaveAs()
*/
@Override
@@ -858,9 +867,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides isSaveAsAllowed.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
*/
@Override
@@ -870,9 +879,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides getContributorId.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor#getContributorId()
*/
@Override
@@ -887,9 +896,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides getDiagram.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart#getDiagram()
*/
// public org.eclipse.gmf.runtime.notation.Diagram getDiagram() {
@@ -926,9 +935,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides getDiagramGraphicalViewer.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart#getDiagramGraphicalViewer()
*/
// public IDiagramGraphicalViewer getDiagramGraphicalViewer() {
@@ -942,9 +951,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Overrides getEditingDomain.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.emf.edit.domain.IEditingDomainProvider#getEditingDomain()
*/
public EditingDomain getEditingDomain() {
@@ -953,7 +962,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Throws an UnsupportedOperationException.
- *
+ *
* @see org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor#getDiagramEditDomain()
*/
// public DiagramEditDomain getDiagramEditDomain() {
@@ -964,9 +973,9 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen
/**
* Change the editor input.<BR>
* <U>Note</U>: that method should be called within the UI-Thread.
- *
+ *
* @see org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor#setEditorInput(org.eclipse.ui.IEditorInput)
- *
+ *
* @param newInput
* The new input
* @deprecated Not used anymore

Back to the top