diff options
Diffstat (limited to 'examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/UmlDiagramForMultiEditor.java')
-rw-r--r-- | examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/UmlDiagramForMultiEditor.java | 190 |
1 files changed, 98 insertions, 92 deletions
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/UmlDiagramForMultiEditor.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/UmlDiagramForMultiEditor.java index bb412fdc5a1..26b2e620059 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/UmlDiagramForMultiEditor.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/custom-src/org/eclipse/papyrus/example/diagram/simplediagram/UmlDiagramForMultiEditor.java @@ -1,92 +1,98 @@ -package org.eclipse.papyrus.example.diagram.simplediagram;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.core.editor.BackboneException;
-import org.eclipse.papyrus.core.services.ServiceException;
-import org.eclipse.papyrus.core.services.ServicesRegistry;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditor;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-
-
-
-public class UmlDiagramForMultiEditor extends UMLDiagramEditor {
- /**
- * The location of diagram icon in the plug-in
- */
- private static final String DIAG_IMG_PATH = "icons/obj16/newDiagramFile.gif";
-
- /**
- * The image descriptor of the diagram icon
- */
- private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlDiagramForMultiEditor.DIAG_IMG_PATH);
-
- /** The editor splitter. */
- private Composite splitter;
-
- /**
- * Constructor for SashSystem v2. Context and required objects are retrieved from the
- * ServiceRegistry.
- *
- * @throws BackboneException
- * @throws ServiceException
- *
- */
- public UmlDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException {
- super(servicesRegistry, diagram);
- }
-
- @Override
- public void setInput(IEditorInput input) {
- try {
- // Provide an URI with fragment in order to reuse the same Resource
- // and set the diagram to the fragment.
- URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
- doSetInput(uriInput, true);
- } catch (CoreException x) {
- String title = "Problem opening";
- String msg = "Cannot open input element:";
- Shell shell = getSite().getShell();
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
- }
-
- @Override
- public void init(IEditorSite site, IEditorInput input)
- throws PartInitException {
- // TODO Auto-generated method stub
- super.init(site, input);
- setPartName(getDiagram().getName());
- setTitleImage(DIAG_IMG_DESC.createImage());
- }
-
- @Override
- protected String getEditingDomainID() {
- // TODO Auto-generated method stub
- return "org.eclipse.papyrus.diagram.newdiagram.EditingDomain";
- }
-
- @Override
- public void setFocus() {
- splitter.setFocus();
- super.setFocus();
- }
-
- @Override
- protected void createGraphicalViewer(Composite parent) {
- splitter = parent;
- super.createGraphicalViewer(parent);
- }
-
-
-}
+/***************************************************************************** + * Copyright (c) 2014 CEA LIST & other. + * + * 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: + * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Bug 445097 + *****************************************************************************/ +package org.eclipse.papyrus.example.diagram.simplediagram; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.emf.common.ui.URIEditorInput; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditor; +import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.infra.core.editor.BackboneException; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; + + + +public class UmlDiagramForMultiEditor extends UMLDiagramEditor { + /** + * The location of diagram icon in the plug-in + */ + private static final String DIAG_IMG_PATH = "icons/obj16/newDiagramFile.gif"; + + /** + * The image descriptor of the diagram icon + */ + private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlDiagramForMultiEditor.DIAG_IMG_PATH); + + /** The editor splitter. */ + private Composite splitter; + + /** + * Constructor for SashSystem v2. Context and required objects are retrieved from the + * ServiceRegistry. + * + * @throws BackboneException + * @throws ServiceException + * + */ + public UmlDiagramForMultiEditor() throws BackboneException, ServiceException { + super(); + } + + @Override + public void setInput(IEditorInput input) { + try { + // Provide an URI with fragment in order to reuse the same Resource + // and set the diagram to the fragment. + URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram())); + doSetInput(uriInput, true); + } catch (CoreException x) { + String title = "Problem opening"; + String msg = "Cannot open input element:"; + Shell shell = getSite().getShell(); + ErrorDialog.openError(shell, title, msg, x.getStatus()); + } + } + + @Override + public void init(IEditorSite site, IEditorInput input) + throws PartInitException { + super.init(site, input); + setPartName(getDiagram().getName()); + setTitleImage(DIAG_IMG_DESC.createImage()); + } + + @Override + protected String getEditingDomainID() { + return "org.eclipse.papyrus.diagram.newdiagram.EditingDomain"; + } + + @Override + public void setFocus() { + splitter.setFocus(); + super.setFocus(); + } + + @Override + protected void createGraphicalViewer(Composite parent) { + splitter = parent; + super.createGraphicalViewer(parent); + } + + +} |