diff options
author | cdumoulin | 2010-01-04 12:43:25 +0000 |
---|---|---|
committer | cdumoulin | 2010-01-04 12:43:25 +0000 |
commit | 7b423967b1bf2087e600fe931381d4bfc2d32f7f (patch) | |
tree | 631c10b5522813a86d1b5700a42d09bd0a245bed | |
parent | 639f16e59f4461bef1e88ccae7de9a26f072bb2d (diff) | |
download | org.eclipse.papyrus-7b423967b1bf2087e600fe931381d4bfc2d32f7f.tar.gz org.eclipse.papyrus-7b423967b1bf2087e600fe931381d4bfc2d32f7f.tar.xz org.eclipse.papyrus-7b423967b1bf2087e600fe931381d4bfc2d32f7f.zip |
ASSIGNED - bug 290904: [backbone] Remove old and unused stuff
https://bugs.eclipse.org/bugs/show_bug.cgi?id=290904
Remove usage of BackboneContext. Replace all usages by appropriate call to a corresponding method in EditorUtils.
Remove unused methods and classes
19 files changed, 71 insertions, 783 deletions
diff --git a/plugins/core/org.eclipse.papyrus.core.adaptor.emf/src/org/eclipse/papyrus/core/adaptor/emf/CreateDiagramHandler.java b/plugins/core/org.eclipse.papyrus.core.adaptor.emf/src/org/eclipse/papyrus/core/adaptor/emf/CreateDiagramHandler.java index 9accb742df1..2cd418b85c8 100644 --- a/plugins/core/org.eclipse.papyrus.core.adaptor.emf/src/org/eclipse/papyrus/core/adaptor/emf/CreateDiagramHandler.java +++ b/plugins/core/org.eclipse.papyrus.core.adaptor.emf/src/org/eclipse/papyrus/core/adaptor/emf/CreateDiagramHandler.java @@ -18,25 +18,30 @@ import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.papyrus.core.editor.BackboneContext;
-import org.eclipse.papyrus.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.core.extension.diagrameditor.IEditorFactory;
import org.eclipse.papyrus.core.utils.EditorUtils;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
+import org.eclipse.papyrus.core.utils.NotationUtils;
/**
- * @author dumoulin
+ * Base class for create diagram Handlers.
+ *
+ * @author cedric dumoulin
*
*/
public abstract class CreateDiagramHandler extends AbstractHandler implements IHandler {
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
public Object execute(ExecutionEvent event) throws ExecutionException {
TransactionalEditingDomain editingDomain = getEditingDomain();
@@ -53,6 +58,9 @@ public abstract class CreateDiagramHandler extends AbstractHandler implements IH return null;
}
+ /**
+ * Subclasses should implements this method.
+ */
protected abstract void addNewDiagram();
/**
@@ -60,7 +68,7 @@ public abstract class CreateDiagramHandler extends AbstractHandler implements IH *
* @param diagram
* The diagram to add to graphical model. This will be the diagram provided to
- * {@link IEditorFactory#createEditorFor(org.eclipse.papyrus.backbone.IEditorContext, Object)}
+ * {@link IEditorFactory#createIPageModel(Object, org.eclipse.papyrus.core.services.ServicesRegistry)}
*/
protected void addNewDiagram(String name, String type, EObject diagram) {
@@ -76,7 +84,7 @@ public abstract class CreateDiagramHandler extends AbstractHandler implements IH di2Diagram.setName(name);
// Add it to resource, so that it will be saved.
- getDiResource().getContents().add(di2Diagram);
+ NotationUtils.getNotationResource().getContents().add(di2Diagram);
// Attach to sash in order to show it
// Add the diagram as a page to the current sash folder
@@ -84,41 +92,11 @@ public abstract class CreateDiagramHandler extends AbstractHandler implements IH }
/**
- * Get the current MultiDiagramEditor.
- *
- * @return
- */
- protected IMultiDiagramEditor getMultiDiagramEditor() {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IEditorPart editorPart = page.getActiveEditor();
- return (IMultiDiagramEditor)editorPart;
- }
-
- /**
- * Get the shared object.
- *
- * @return
- */
- protected BackboneContext getDefaultContext() {
- IMultiDiagramEditor editor = getMultiDiagramEditor();
- return (BackboneContext)editor.getDefaultContext();
- }
-
- /**
- * Get the di resource.
- *
- * @return
- */
- private Resource getDiResource() {
- return getDefaultContext().getResourceSet().getDiResource();
- }
-
- /**
* Get the main editing doamin.
*
* @return
*/
protected TransactionalEditingDomain getEditingDomain() {
- return getDefaultContext().getTransactionalEditingDomain();
+ return EditorUtils.getTransactionalEditingDomain();
}
}
diff --git a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/AbstractPapyrusGmfCreateDiagramCommandHandler.java b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/AbstractPapyrusGmfCreateDiagramCommandHandler.java index e350c03eaf3..05d035ddcfe 100644 --- a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/AbstractPapyrusGmfCreateDiagramCommandHandler.java +++ b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/AbstractPapyrusGmfCreateDiagramCommandHandler.java @@ -36,9 +36,9 @@ import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.core.editor.BackboneContext;
import org.eclipse.papyrus.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.core.extension.commands.ICreationCommand;
+import org.eclipse.papyrus.core.services.ServiceException;
import org.eclipse.papyrus.core.services.ServicesRegistry;
import org.eclipse.papyrus.core.utils.BusinessModelResolver;
import org.eclipse.papyrus.core.utils.DiResourceSet;
@@ -70,19 +70,12 @@ public abstract class AbstractPapyrusGmfCreateDiagramCommandHandler extends Abst */
public Object execute(ExecutionEvent event) throws ExecutionException {
- BackboneContext context;
- try {
- context = getDefaultContext();
- } catch (ClassCastException ex) {
- // Bad current editor. Skip
- throw new ExecutionException(Messages.AbstractPapyrusGmfCreateDiagramCommandHandler_NotSupportedEditor, ex);
- }
EObject container = null;
// if editor is open and active
if(getMultiDiagramEditor() != null) {
container = getSelectedElement();
}
- runAsTransaction(context, container);
+ runAsTransaction(container);
return null;
}
@@ -92,9 +85,17 @@ public abstract class AbstractPapyrusGmfCreateDiagramCommandHandler extends Abst * @param sharedObjects
* @param container
* The uml element to which the diagram should be attached, if possible.
+ * @throws ExecutionException
*/
- protected void runAsTransaction(BackboneContext sharedObjects, EObject container) {
- DiResourceSet diResourceSet = sharedObjects.getResourceSet();
+ protected void runAsTransaction(EObject container) throws ExecutionException {
+
+ DiResourceSet diResourceSet;
+ try {
+ diResourceSet = EditorUtils.getServiceRegistry().getService(DiResourceSet.class);
+ } catch (ServiceException e) {
+ throw new ExecutionException("Can't get diResourceSet", e);
+ }
+
runAsTransaction(diResourceSet, container, null);
}
@@ -291,16 +292,6 @@ public abstract class AbstractPapyrusGmfCreateDiagramCommandHandler extends Abst }
/**
- * Get the shared object.
- *
- * @return
- */
- protected BackboneContext getDefaultContext() {
- IMultiDiagramEditor editor = getMultiDiagramEditor();
- return editor.getDefaultContext();
- }
-
- /**
* Open popup to enter the new diagram name
*
* @param defaultValue
diff --git a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/GmfEditorContext.java b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/GmfEditorContext.java deleted file mode 100644 index c2be395096e..00000000000 --- a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/GmfEditorContext.java +++ /dev/null @@ -1,61 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2008 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.core.adaptor.gmf;
-
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider;
-import org.eclipse.papyrus.core.editor.BackboneException;
-import org.eclipse.papyrus.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.core.extension.editorcontext.AbstractEditorContext;
-
-/**
- * the GMFeditorContext for GMFeditor
- *
- * @author Cedric Dumoulin
- * @author Patrick Tessier
- * @author Remi Schnekenburger
- */
-@Deprecated
-public class GmfEditorContext extends AbstractEditorContext {
-
- /**
- * ID used to identify the GmfContext. This ID is used to retrieve the context from the factory,
- * and to register it in the factory (from extension point in plugin.xml).
- */
- static public String GMF_CONTEXT_ID = "com.cea.papyrus.gmf.editor.context"; //$NON-NLS-1$
-
- /**
- * The document provider used by GMF.
- */
- private IDocumentProvider documentProvider;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void init(IMultiDiagramEditor multiEditor) throws BackboneException {
- super.init(multiEditor);
- documentProvider = new GmfMultiDiagramDocumentProvider(multiEditor.getDefaultContext()
- .getTransactionalEditingDomain());
- }
-
- /**
- * Returns the document provider used by GMF.
- *
- * @return the document provider used by GMF
- */
- public IDocumentProvider getDocumentProvider() {
- return documentProvider;
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/GmfEditorFactory.java b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/GmfEditorFactory.java index 19ea7986f3e..342c4dd4451 100644 --- a/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/GmfEditorFactory.java +++ b/plugins/core/org.eclipse.papyrus.core.adaptor.gmf/src/org/eclipse/papyrus/core/adaptor/gmf/GmfEditorFactory.java @@ -20,7 +20,6 @@ import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.papyrus.core.editor.BackboneException;
import org.eclipse.papyrus.core.extension.diagrameditor.AbstractEditorFactory;
-import org.eclipse.papyrus.core.extension.editorcontext.IEditorContext;
import org.eclipse.papyrus.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
import org.eclipse.papyrus.core.services.ServiceException;
import org.eclipse.papyrus.core.services.ServicesRegistry;
@@ -56,67 +55,6 @@ public class GmfEditorFactory extends AbstractEditorFactory { }
/**
- * {@inheritDoc}
- */
- @Override
- public boolean isEditorFor(Object root) {
-
- if(root instanceof Diagram) {
- Diagram diagram = (Diagram)root;
- final String type = diagram.getType();
- return getExpectedType().equals(type);
- }
- // no
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public IEditorPart createEditorFor(IEditorContext context, Object root) throws BackboneException {
- assert (context instanceof GmfEditorContext);
- return createEditorFor((GmfEditorContext)context, root);
- }
-
- /**
- * It is used to create the editor by taking account the root element, for example a diagram
- *
- * @param context
- * the gmf context
- * @param root
- * the element on which the editor can be launch , for example the editor
- * @return the created editor
- * @throws BackboneException
- * editor could not be created
- */
- public IEditorPart createEditorFor(GmfEditorContext context, Object root) throws BackboneException {
- GraphicalEditor editor;
-
- // TODO Change next to remove dependency on di2.
- // Retrieve GMF diagram, if any.
- if(root instanceof Diagram) {
- Diagram diagram = (Diagram)root;
- if(!GMF_DIAGRAM.equals(diagram.getType()))
- throw new BackboneException(Messages.GmfEditorFactory_ErrorRetrievingDiagram);
- // Ok, this is a gmf diagram
- root = diagram.getElement();
- }
-
- try {
- Constructor<?> c = getDiagramClass().getConstructor(Diagram.class, GmfEditorContext.class);
- editor = (GraphicalEditor)c.newInstance((Diagram)root, context);
- // editor = new ClassDiagramEditor((Diagram)root, context.getModelMngr(),
- // context.getCommandStack(), context.getActionRegistry() );
- return editor;
-
- } catch (Exception e) {
- // Lets propagate. This is an implementation problem that should be solved by
- // programmer.
- throw new BackboneException(e);
- }
- }
-
- /**
* Return true if this PageModelFactory can create a PageModel for the specified pageIdentifier.
* The pageIdentifier is an instance of Diagram.
*
diff --git a/plugins/core/org.eclipse.papyrus.core/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.core/META-INF/MANIFEST.MF index 6ac8df6b4a2..33831f7a8f9 100644 --- a/plugins/core/org.eclipse.papyrus.core/META-INF/MANIFEST.MF +++ b/plugins/core/org.eclipse.papyrus.core/META-INF/MANIFEST.MF @@ -18,7 +18,6 @@ Export-Package: org.eclipse.papyrus.core, org.eclipse.papyrus.core.extension, org.eclipse.papyrus.core.extension.commands, org.eclipse.papyrus.core.extension.diagrameditor, - org.eclipse.papyrus.core.extension.editorcontext, org.eclipse.papyrus.core.listenerservice, org.eclipse.papyrus.core.multidiagram.actionbarcontributor, org.eclipse.papyrus.core.services, diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/BackboneContext.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/BackboneContext.java deleted file mode 100644 index d72389f0ec7..00000000000 --- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/BackboneContext.java +++ /dev/null @@ -1,93 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2008 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.core.editor;
-
-import java.io.IOException;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.core.extension.editorcontext.AbstractEditorContext;
-import org.eclipse.papyrus.core.utils.DiResourceSet;
-
-/**
- * Context used to load the base models and associated ResourceSet.
- */
-@Deprecated
-public class BackboneContext extends AbstractEditorContext {
-
- /**
- * ID used to identify the Context. This ID is used to retrieve the context from the factory,
- * and to register it in the factory (from extension point in plugin.xml).
- */
- public static final String BACKBONE_CONTEXT_ID = "defaultContext";
-
- /**
- * Model resolver used to find model element from any graphical artefact.
- */
- // protected BusinessModelResolver modelResolver;
-
- private CoreMultiDiagramEditor editor;
-
- /**
- * Constructor.
- */
- @Deprecated
- public BackboneContext(CoreMultiDiagramEditor editor) {
- this.editor = editor;
- // modelResolver = BusinessModelResolver.getInstance();
- }
-
- /**
- * @return the resourceSet
- */
- @Deprecated
- public DiResourceSet getResourceSet() {
- return editor.getResourceSet();
- }
-
- /**
- * Save the context.
- *
- * @param monitor
- * The monitor.
- * @throws IOException
- * IO Error.
- */
- @Deprecated
- public void save(IProgressMonitor monitor) throws IOException {
- getResourceSet().save(monitor);
- }
-
- /**
- * Save resources as specified path
- *
- * @param path
- * @throws IOException
- */
- @Deprecated
- public void saveAs(IPath path) throws IOException {
- getResourceSet().saveAs(path);
- }
-
- /**
- * Get the {@link TransactionalEditingDomain}.
- *
- * @return
- */
- @Deprecated
- public TransactionalEditingDomain getTransactionalEditingDomain() {
- return getResourceSet().getTransactionalEditingDomain();
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/CoreMultiDiagramEditor.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/CoreMultiDiagramEditor.java index 50b52a6cd56..9658c3b013a 100644 --- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/CoreMultiDiagramEditor.java +++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/CoreMultiDiagramEditor.java @@ -43,11 +43,7 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.papyrus.core.Activator;
import org.eclipse.papyrus.core.contentoutline.ContentOutlineRegistry;
import org.eclipse.papyrus.core.extension.diagrameditor.EditorFactoryRegistry;
-import org.eclipse.papyrus.core.extension.diagrameditor.EditorNotFoundException;
import org.eclipse.papyrus.core.extension.diagrameditor.IEditorFactoryRegistry;
-import org.eclipse.papyrus.core.extension.diagrameditor.MultiDiagramException;
-import org.eclipse.papyrus.core.extension.editorcontext.EditorContextRegistry;
-import org.eclipse.papyrus.core.extension.editorcontext.IEditorContextRegistry;
import org.eclipse.papyrus.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
import org.eclipse.papyrus.core.multidiagram.actionbarcontributor.CoreComposedActionBarContributor;
import org.eclipse.papyrus.core.services.ExtensionServicesRegistry;
@@ -72,7 +68,6 @@ import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.dialogs.SaveAsDialog;
-import org.eclipse.ui.part.EditorActionBarContributor;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.eclipse.ui.views.properties.IPropertySheetPage;
@@ -104,10 +99,6 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen /** Registry to store editor factories */
private IEditorFactoryRegistry editorRegistry;
- /** Registry for editor contexts */
- @Deprecated
- private IEditorContextRegistry editorContextRegistry;
-
/** ContentOutline registry */
private ContentOutlineRegistry contentOutlineRegistry;
@@ -122,12 +113,6 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen /** SashModelMngr to add pages */
protected DiSashModelMngr sashModelMngr;
- /**
- * Context associated to this backbone editor.
- */
- @Deprecated
- private BackboneContext defaultContext;
-
private TransactionalEditingDomain transactionalEditingDomain;
/**
@@ -170,8 +155,8 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen public void run() {
firePropertyChange(IEditorPart.PROP_DIRTY);
- }
- });
+ }
+ });
}
};
@@ -199,8 +184,8 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen public void run() {
firePropertyChange(IEditorPart.PROP_DIRTY);
- }
- });
+ }
+ });
}
}
@@ -210,67 +195,6 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen };
-
-
- /**
- * Create a PageEditor for the specified model. Default implementation delegates to pageEditorFactory.createPageEditorFor(model); Not intended for
- * external use.
- *
- * @param model
- * the diagram to be displayed
- * @return the Graphical Editor that displays the specified diagram
- * @throws EditorNotFoundException
- * No editor handling the model can be found.
- */
- public IEditorPart createPageEditor(Object model) throws MultiDiagramException {
- IEditorPart part = getEditorRegistry().createEditorFor(getContextRegistry(), model);
- return part;
- }
-
- /**
- * Get the EditorActionBarContributor that should be associated with the editor of the specified model.
- *
- * @param editorModel
- * @return
- * @throws MultiDiagramException
- *
- */
- public EditorActionBarContributor getActionBarContributor(Object editorModel) {
-
- try {
- Object contributorId = getEditorRegistry().getEditorDescriptorFor(editorModel).getActionBarContributorId();
- return getActionBarContributorRegistry().getActionBarContributor(contributorId);
- } catch (BackboneException e) {
- log.warning(e.getMessage());
- // e.printStackTrace();
- } catch (MultiDiagramException e) {
- log.warning(e.getMessage());
- // e.printStackTrace();
- }
- return null;
- }
-
- /**
- * Get the contextRegistry
- *
- * @return The context registry
- */
- @Deprecated
- public IEditorContextRegistry getContextRegistry() {
- return editorContextRegistry;
- }
-
- /**
- * Create the IEditorContextRegistry containing registered contexts. Subclass should implements this method in order to return the registry
- * associated to the extension point namespace.
- *
- * @return the IEditorContextRegistry for nested editor descriptors
- */
- @Deprecated
- private IEditorContextRegistry createEditorContextRegistry() {
- return new EditorContextRegistry(this, Activator.PLUGIN_ID);
- }
-
/**
* Get the contentOutlineRegistry. Create it if needed.
*
@@ -319,7 +243,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen *
* @return the servicesRegistry The registry.
*/
- protected ServicesRegistry getServicesRegistry() {
+ public ServicesRegistry getServicesRegistry() {
if(servicesRegistry == null) {
servicesRegistry = createServicesRegistry();
}
@@ -392,7 +316,7 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen *
* @return
*/
- public ActionBarContributorRegistry getActionBarContributorRegistry() {
+ protected ActionBarContributorRegistry getActionBarContributorRegistry() {
if(actionBarContributorRegistry != null) {
return actionBarContributorRegistry;
}
@@ -458,10 +382,6 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen }
}
- if(BackboneContext.class == adapter) {
- return defaultContext;
- }
-
if(EditingDomain.class == adapter) {
return transactionalEditingDomain;
}
@@ -518,23 +438,11 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen // Create Gef adaptor
gefAdaptorDelegate = new MultiDiagramEditorGefDelegate();
- // Just for backwards compatibility
- // FIXME Remove the following lines
- // =============
- // Create registries
- // editorContextRegistry should be created after site, input and
- // defaultContext are created.
- editorContextRegistry = createEditorContextRegistry();
- defaultContext = new BackboneContext(this);
- editorContextRegistry.registerContext(BackboneContext.BACKBONE_CONTEXT_ID, defaultContext);
- // =============
-
editorRegistry = createEditorRegistry();
// Create ServicesRegistry and register services
servicesRegistry = createServicesRegistry();
servicesRegistry.add(ActionBarContributorRegistry.class, 1, getActionBarContributorRegistry());
- servicesRegistry.add(IEditorContextRegistry.class, 1, editorContextRegistry);
servicesRegistry.add(TransactionalEditingDomain.class, 1, transactionalEditingDomain);
servicesRegistry.add(DiResourceSet.class, 1, resourceSet);
@@ -661,10 +569,10 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen try {
resourceSet.saveAs(path);
} catch (IOException ioe) {
- // Debug.log(ioe);
- }
+ // Debug.log(ioe);
}
- });
+ }
+ });
// set input to the new file
setInput(new FileEditorInput(file));
markSaveLocation();
@@ -691,14 +599,6 @@ public class CoreMultiDiagramEditor extends AbstractMultiPageSashEditor implemen }
/**
- * @see org.eclipse.papyrus.core.editor.IMultiDiagramEditor#getDefaultContext()
- */
- @Deprecated
- public BackboneContext getDefaultContext() {
- return defaultContext;
- }
-
- /**
* Overrides getContributorId.
*
* {@inheritDoc}
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/EditingDomainService.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/EditingDomainService.java deleted file mode 100644 index db14f1d39fc..00000000000 --- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/EditingDomainService.java +++ /dev/null @@ -1,213 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2008 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.core.editor;
-
-import java.util.Collections;
-import java.util.EventObject;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.commands.operations.IOperationHistory;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.commands.operations.ObjectUndoContext;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.EditDomain;
-import org.eclipse.gef.commands.CommandStack;
-import org.eclipse.gef.commands.CommandStackListener;
-import org.eclipse.gmf.runtime.common.ui.action.ActionManager;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain;
-import org.eclipse.gmf.runtime.emf.commands.core.command.EditingDomainUndoContext;
-
-
-/**
- * Initialize editing domain.
- *
- *
- */
-public class EditingDomainService implements CommandStackListener, org.eclipse.emf.common.command.CommandStackListener {
-
- /**
- * undo context.
- */
- private IUndoContext undoContext;
-
- private BackboneContext defaultContext;
-
-
- private Set<CommandStackListener> commandStackListeners = Collections
- .synchronizedSet(new HashSet<CommandStackListener>());
-
-
- /**
- * @param defaultContext
- * @param commandStackListener
- */
- public EditingDomainService(BackboneContext defaultContext) {
- this.defaultContext = defaultContext;
- configureDiagramEditDomain();
- }
-
- /**
- * Returns the diagram edit domain.
- *
- * @return The diagram edit domain.
- */
- private DiagramEditDomain getDiagramEditDomain() {
- return defaultContext.getDiagramEditDomain();
- }
-
- /**
- * Returns the edit domain.
- *
- * @return The edit domain.
- */
- public EditDomain getEditDomain() {
- return defaultContext.getDiagramEditDomain();
- }
-
- /**
- * Returns the editing domain.
- *
- * @return the editing domain.
- */
- public TransactionalEditingDomain getEditingDomain() {
- return defaultContext.getTransactionalEditingDomain();
- }
-
- /**
- * TODO move it to GmfContext ?
- */
- private ActionManager createActionManager() {
- return new ActionManager(createOperationHistory());
- }
-
- /**
- * Gets the action manager for this diagram editor. The action manager's command manager is used by my edit domain's command stack when executing
- * commands. This is the action manager that is
- * returned when I am asked to adapt to an <code>ActionManager</code>.
- *
- * @return the action manager
- */
- private ActionManager getActionManager() {
- return getDiagramEditDomain().getActionManager();
- }
-
- /**
- * Create my operation history.
- *
- * @return my operation history
- * TODO move it to GmfContext ?
- */
- private IOperationHistory createOperationHistory() {
- return OperationHistoryFactory.getOperationHistory();
- }
-
- /**
- * Gets my undo context. Lazily initializes my undo context if it has not been set.
- *
- * @return my undo context
- * TODO move it to GmfContext ?
- */
- private IUndoContext getUndoContext() {
-
- if(undoContext == null) {
- TransactionalEditingDomain domain = defaultContext.getTransactionalEditingDomain();
-
- if(domain != null) {
- undoContext = new EditingDomainUndoContext(domain);
-
- } else {
- undoContext = new ObjectUndoContext(this);
- }
- }
- return undoContext;
- }
-
- /**
- * Configures my diagram edit domain with its command stack.
- *
- * TODO move it to GmfContext ?
- */
- protected void configureDiagramEditDomain() {
-
- DiagramEditDomain editDomain = getDiagramEditDomain();
-
- if(editDomain != null) {
- CommandStack stack = editDomain.getCommandStack();
-
- if(stack != null) {
- stack.removeCommandStackListener(this);
- // dispose the old stack
- stack.dispose();
- }
-
- // create and assign the new stack
- DiagramCommandStack diagramStack = new DiagramCommandStack(getDiagramEditDomain());
- // editDomain.setActionManager(createActionManager());
- // diagramStack.setOperationHistory(getOperationHistory());
- editDomain.setCommandStack(diagramStack);
-
- diagramStack.addCommandStackListener(this);
- defaultContext.getTransactionalEditingDomain().getCommandStack().addCommandStackListener(this);
-
- // changes made on the stack can be undone from this editor
- diagramStack.setUndoContext(getUndoContext());
-
- }
-
- }
-
- /**
- * Returns the operation history from my action manager.
- *
- * @return the operation history
- */
- private IOperationHistory getOperationHistory() {
- return getActionManager().getOperationHistory();
- }
-
- /**
- * Add a command stack listener.
- * Actual implementation only allows one listener. If we need more listener, change the implementation to allow it.
- *
- * @param listener
- */
- public void addCommandStackListener(CommandStackListener listener) {
- commandStackListeners.add(listener);
- }
-
- /**
- * Remove the specified command stack listener.
- *
- * @param listener
- */
- public void removeCommandStackListener(CommandStackListener listener) {
- commandStackListeners.remove(listener);
- }
-
- /**
- * Relay the event from the stack to the listeners.
- *
- * @param event
- */
- public void commandStackChanged(EventObject event) {
- for(CommandStackListener listener : commandStackListeners) {
- listener.commandStackChanged(event);
- }
- }
-
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/IMultiDiagramEditor.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/IMultiDiagramEditor.java index 8fb9de6967f..7d722482ebb 100644 --- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/IMultiDiagramEditor.java +++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/editor/IMultiDiagramEditor.java @@ -15,8 +15,8 @@ package org.eclipse.papyrus.core.editor; import org.eclipse.emf.edit.domain.IEditingDomainProvider;
import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain;
-import org.eclipse.papyrus.core.extension.editorcontext.IEditorContextRegistry;
import org.eclipse.papyrus.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
+import org.eclipse.papyrus.core.services.ServicesRegistry;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
@@ -33,10 +33,12 @@ import org.eclipse.ui.views.properties.IPropertySheetPage; public interface IMultiDiagramEditor extends IEditorPart, IEditingDomainProvider {
/**
- * @return the defaultContext
+ * Returns the service registry associated to the editor.
+ *
+ * @return the servicesRegistry The registry.
*/
- @Deprecated
- public BackboneContext getDefaultContext();
+ public ServicesRegistry getServicesRegistry();
+
/**
* Return the editor site.
@@ -53,12 +55,6 @@ public interface IMultiDiagramEditor extends IEditorPart, IEditingDomainProvider public IEditorInput getEditorInput();
/**
- * Get the associated context registry.
- */
- @Deprecated
- public IEditorContextRegistry getContextRegistry();
-
- /**
* Returns the edit domain shared among editors
*
* @return the edit domain shared among editors
@@ -72,13 +68,6 @@ public interface IMultiDiagramEditor extends IEditorPart, IEditingDomainProvider public IEditorPart getActiveEditor();
/**
- * Get the ActionBarContributorRegistry.
- *
- * @return
- */
- public ActionBarContributorRegistry getActionBarContributorRegistry();
-
- /**
* Get the property sheet page associated to the Editor.
*
* @return the property sheet page associated to the Editor.
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/AbstractEditorFactory.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/AbstractEditorFactory.java index 5e46a97519e..5edadff13b4 100644 --- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/AbstractEditorFactory.java +++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/AbstractEditorFactory.java @@ -14,9 +14,6 @@ package org.eclipse.papyrus.core.extension.diagrameditor;
import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.core.editor.BackboneException;
-import org.eclipse.papyrus.core.extension.editorcontext.IEditorContext;
-import org.eclipse.ui.IEditorPart;
/**
* @author Remi Schnekenburger
@@ -71,24 +68,6 @@ public abstract class AbstractEditorFactory implements IEditorFactory { }
/**
- * {@inheritDoc}
- * @Deprecated Use createIPageModel() instead
- */
- public IEditorPart createEditorFor(IEditorContext context, Object root) throws BackboneException
- {
- return null;
- }
-
- /**
- * {@inheritDoc} This method should be implemented by subclasses
- * @deprecated isPageModelFactoryFor() is used instead.
- */
- public boolean isEditorFor(Object root)
- {
- return isPageModelFactoryFor(root);
- }
-
- /**
* @return the editorDescriptor
*/
public EditorDescriptor getEditorDescriptor() {
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/EditorDescriptor.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/EditorDescriptor.java index ec91f73399d..fa5eeb060a1 100644 --- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/EditorDescriptor.java +++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/EditorDescriptor.java @@ -27,7 +27,7 @@ import org.eclipse.ui.IEditorPart; * @author Cedric Dumoulin
*
*/
-public class EditorDescriptor implements IEditorDescriptor {
+public class EditorDescriptor {
/**
* Editor factory implementation class.
@@ -148,30 +148,6 @@ public class EditorDescriptor implements IEditorDescriptor { }
/**
- * This method is used in order to know if the editor associated to this description can edit the root object. example a diagram di2 or notation
- *
- * @param root
- * the element that can be edited
- * @return boolean true if the editor can edit it.
- */
- public boolean isEditorFor(Object root) {
- return getEditorFactory().isEditorFor(root);
- }
-
- /**
- * @see org.eclipse.papyrus.core.extension.diagrameditor.IEditorDescriptor#createEditorFor(org.eclipse.papyrus.core.extension.editorcontext.IEditorContext,
- * java.lang.Object)
- * @param context
- * @param root
- * @return
- * @throws BackboneException
- *
- */
- public IEditorPart createEditorFor(IEditorContext context, Object root) throws BackboneException {
- return getEditorFactory().createEditorFor(context, root);
- }
-
- /**
* Return true if the descriptor is for the specified pageIdentifier.
* Delegate to the PageModelFactory s.
*
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/EditorFactoryRegistry.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/EditorFactoryRegistry.java index f380c77f3c4..8ee0bcecf6d 100644 --- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/EditorFactoryRegistry.java +++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/EditorFactoryRegistry.java @@ -19,20 +19,16 @@ import java.util.List; import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.core.editor.BackboneException;
import org.eclipse.papyrus.core.extension.ExtensionException;
-import org.eclipse.papyrus.core.extension.NotFoundException;
-import org.eclipse.papyrus.core.extension.editorcontext.IEditorContext;
-import org.eclipse.papyrus.core.extension.editorcontext.IEditorContextRegistry;
import org.eclipse.papyrus.core.services.ServicesRegistry;
import org.eclipse.papyrus.core.utils.IDebugChannel;
import org.eclipse.papyrus.core.utils.PapyrusTrace;
import org.eclipse.papyrus.sasheditor.contentprovider.IPageModel;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorPart;
/**
* A registry recording possible editor descriptors. This class use the eclipse extension mechanism.
+ * This registry also read editor descriptors from the Eclipse extension mechanism.
*/
public class EditorFactoryRegistry implements IEditorFactoryRegistry {
@@ -50,7 +46,8 @@ public class EditorFactoryRegistry implements IEditorFactoryRegistry { /**
- * Create a new Registry reading extension from the specified namespace. The namespace is usually the name of the plugin owning the registry.
+ * Create a new Registry reading extension from the specified namespace. The namespace is
+ * usually the name of the plugin owning the registry.
*
* @param extensionPointNamespace
*/
@@ -61,36 +58,6 @@ public class EditorFactoryRegistry implements IEditorFactoryRegistry { }
/**
- * Create a new editor for the specified diagram root.
- *
- * @throws EditorNotFoundException
- * No editor handling the model can be found.
- */
- public IEditorPart createEditorFor(IEditorContextRegistry contextFactoryRegistry, Object model) throws MultiDiagramException {
- for(EditorDescriptor desc : getEditorDescriptors()) {
- if(desc.isEditorFor(model)) {
- {
- // Get requested context
- IEditorContext context;
- try {
- PapyrusTrace.trace(IDebugChannel.PAPYRUS_CORE, this, "creation of an editor");
- context = contextFactoryRegistry.getContext(desc.getRequestedContextId());
- return desc.createEditorFor(context, model);
- } catch (NotFoundException e) {
- throw new EditorNotFoundException(e);
- } catch (ExtensionException e) {
- throw new EditorNotFoundException(e);
- } catch (BackboneException e) {
- throw new MultiDiagramException(e);
- }
- }
- }
- }
- // no editor found !
- throw new EditorNotFoundException("No editor registered for '" + model + "'.");
- }
-
- /**
* Create the IPageModel for the specified identifier. {@inheritDoc}
*
* @see org.eclipse.papyrus.sasheditor.contentprovider.di.IPageModelFactory#createIPageModel(java.lang.Object)
@@ -110,24 +77,6 @@ public class EditorFactoryRegistry implements IEditorFactoryRegistry { }
/**
- * Get the editor descriptor for the specified model.
- *
- * @throws EditorNotFoundException
- * No editor handling the model can be found.
- */
- public EditorDescriptor getEditorDescriptorFor(Object model) throws MultiDiagramException {
- for(EditorDescriptor desc : getEditorDescriptors()) {
- if(desc.isEditorFor(model)) {
- {
- return desc;
- }
- }
- }
- // no editor found !
- throw new EditorNotFoundException("No editor registered for '" + model + "'.");
- }
-
- /**
* Get the list of editor descriptor.
*
* @return the list of editor descriptor.
@@ -167,7 +116,7 @@ public class EditorFactoryRegistry implements IEditorFactoryRegistry { */
public Image getEditorIcon(Object model) {
for(EditorDescriptor desc : getEditorDescriptors()) {
- if(desc.isEditorFor(model)) {
+ if(desc.isDescriptorForPage(model)) {
// if (model instanceof org.eclipse.papyrus.di.Diagram) {
// org.eclipse.papyrus.di.Diagram di2Diagram = (org.eclipse.papyrus.di.Diagram) model;
// if (!GMF_DIAGRAM.equals(di2Diagram.getType()))
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/IEditorDescriptor.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/IEditorDescriptor.java deleted file mode 100644 index 8c7d5c45ec4..00000000000 --- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/IEditorDescriptor.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.eclipse.papyrus.core.extension.diagrameditor;
-
-
-public interface IEditorDescriptor {
-
- /**
- * to obtain the requestedContextId
- *
- * @return the requestedContextId
- */
- public String getRequestedContextId();
-
- /**
- * @return the actionBarContributorId
- */
- public String getActionBarContributorId();
-
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/IEditorFactory.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/IEditorFactory.java index 8340bd73364..b8508e3995f 100644 --- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/IEditorFactory.java +++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/IEditorFactory.java @@ -29,28 +29,6 @@ import org.eclipse.ui.IEditorPart; public interface IEditorFactory {
/**
- * This method is used in order to know if the editor can edit the root object. example a diagram di2 or notation
- *
- * @param root
- * the element that can be edited
- * @return boolean true if the editor can edit it.
- */
- public boolean isEditorFor(Object root);
-
- /**
- * It is used to create the editor by taking account the root element, for example a diagram
- *
- * @param context
- * @param root
- * the element on which the editor can be launch , for example the editor
- * @return the created editor
- * @throws BackboneException
- * editor could not be created
- * @deprecated use createIPageModel
- */
- public IEditorPart createEditorFor(IEditorContext context, Object root) throws BackboneException;
-
- /**
* Create the {@link IPageModel} for the specified identifier.
*
* @param pageIdentifier
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/IEditorFactoryRegistry.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/IEditorFactoryRegistry.java index 617db0f442e..e92bc44b242 100644 --- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/IEditorFactoryRegistry.java +++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/diagrameditor/IEditorFactoryRegistry.java @@ -15,6 +15,7 @@ package org.eclipse.papyrus.core.extension.diagrameditor; import org.eclipse.papyrus.core.extension.editorcontext.IEditorContextRegistry;
import org.eclipse.papyrus.core.services.ServicesRegistry;
+import org.eclipse.papyrus.sasheditor.contentprovider.IEditorModel;
import org.eclipse.papyrus.sasheditor.contentprovider.IPageModel;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorPart;
@@ -27,29 +28,13 @@ import org.eclipse.ui.IEditorPart; public interface IEditorFactoryRegistry {
/**
- * Create a new editor for the specified diagram root.
- *
- * @param contextFactoryRegistry
- * *
- * @param model
- * @throws EditorNotFoundException
- * No editor handling the model can be found.
- */
- public IEditorPart createEditorFor(IEditorContextRegistry contextFactoryRegistry, Object model) throws MultiDiagramException;
-
- /**
- * Get the editor descriptor for the specified model.
- *
- * @throws EditorNotFoundException
- * No editor handling the model can be found.
- */
- public IEditorDescriptor getEditorDescriptorFor(Object model) throws MultiDiagramException;
-
- /**
* Get the editor icon.
- *
+ * Return the icon associated to this kind of editor.
+ * TODO CDM : Not sure that this method should be here. May be a method from the sasheditor
+ * should be used instead of this one. For example, we can have sash method returning the
+ * {@link IEditorModel} for a model. From this model, it is possible to get the icon.
* @param model
- * the model object
+ * the model representing the Editor. This is usually the EObject used to reconstruct the editor.
* @return the icon representing the editor
*/
public Image getEditorIcon(Object model);
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/editorcontext/EditorContextRegistry.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/editorcontext/EditorContextRegistry.java index 4d9788d192b..79239406244 100644 --- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/editorcontext/EditorContextRegistry.java +++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/extension/editorcontext/EditorContextRegistry.java @@ -66,7 +66,6 @@ public class EditorContextRegistry implements IEditorContextRegistry, IService { // Check parameters
assert (multiEditor.getEditorInput() != null);
assert (multiEditor.getEditorSite() != null);
- assert (multiEditor.getDefaultContext() != null);
// Check parameters. To be removed later
if(multiEditor.getEditorInput() == null || multiEditor.getEditorSite() == null /* || multiEditor.getDefaultContext() == null */) {
throw new IllegalArgumentException("IMultiDiagramEditor should be initialized before calling constructor " + getClass().getSimpleName() + "(IMultiDiagramEditor multiEditor)");
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/multidiagram/actionbarcontributor/CoreComposedActionBarContributor.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/multidiagram/actionbarcontributor/CoreComposedActionBarContributor.java index cbd6929ef51..f5ede425ca8 100644 --- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/multidiagram/actionbarcontributor/CoreComposedActionBarContributor.java +++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/multidiagram/actionbarcontributor/CoreComposedActionBarContributor.java @@ -103,7 +103,7 @@ public class CoreComposedActionBarContributor extends ComposedActionBarContribut public void setActiveEditor(IEditorPart targetEditor) {
- System.err.println(this.getClass().getSimpleName() + ".setActiveEditor(" + targetEditor + ") ");
+// System.err.println(this.getClass().getSimpleName() + ".setActiveEditor(" + targetEditor + ") ");
super.setActiveEditor(targetEditor);
}
diff --git a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/utils/NotationUtils.java b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/utils/NotationUtils.java index 7fa9e419c74..4d1de9878ef 100644 --- a/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/utils/NotationUtils.java +++ b/plugins/core/org.eclipse.papyrus.core/src/org/eclipse/papyrus/core/utils/NotationUtils.java @@ -26,6 +26,16 @@ import org.eclipse.gmf.runtime.notation.Diagram; */
public class NotationUtils {
+
+ /**
+ * Get the notation Resource.
+ *
+ * @return
+ */
+ public static Resource getNotationResource() {
+ return EditorUtils.getDiResourceSet().getNotationResource();
+ }
+
/**
* Gets the direct associated diagram of the specified eObject.
*
diff --git a/plugins/core/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java b/plugins/core/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java index 0ddb3cad087..7856555cc0e 100644 --- a/plugins/core/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java +++ b/plugins/core/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/OpenEmbeddedTextEditorObjectActionDelegate.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; import org.eclipse.jface.action.IAction;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.core.editor.CoreMultiDiagramEditor;
+import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
import org.eclipse.papyrus.extensionpoints.editors.definition.DirectEditorExtensionPoint;
import org.eclipse.swt.graphics.Point;
@@ -136,7 +137,9 @@ public abstract class OpenEmbeddedTextEditorObjectActionDelegate implements IObj // retrieves the source viewer configuration
final CoreMultiDiagramEditor multiDiagramEditor = (CoreMultiDiagramEditor)part.getSite().getPage()
.getActiveEditor();
- TransactionalEditingDomain domain = multiDiagramEditor.getDefaultContext().getTransactionalEditingDomain();
+ TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+
+
DiagramCommandStack diagramCommandStack = multiDiagramEditor.getDiagramEditDomain().getDiagramCommandStack();
return new EmbeddedTextEditor(directEditorExtensionPoint.getDirectEditorConfiguration(), diagramCommandStack,
domain);
|