From 3e342321e8bceacb29946a095b59258576e688c8 Mon Sep 17 00:00:00 2001
From: cletavernie
Date: Wed, 2 Nov 2011 10:29:12 +0000
Subject: 362162: [Architecture - Refactoring] The plug-ins should be renamed
to match their layer's qualified name
https://bugs.eclipse.org/bugs/show_bug.cgi?id=362162
---
.../org.eclipse.papyrus.diagram.emftree/.classpath | 7 -
.../org.eclipse.papyrus.diagram.emftree/.project | 28 ---
.../.settings/org.eclipse.jdt.core.prefs | 7 -
.../META-INF/MANIFEST.MF | 15 --
.../org.eclipse.papyrus.diagram.emftree/about.html | 28 ---
.../build.properties | 7 -
.../icons/EmfTree.gif | Bin 369 -> 0 bytes
.../plugin.properties | 12 --
.../org.eclipse.papyrus.diagram.emftree/plugin.xml | 66 -------
.../eclipse/papyrus/diagram/emftree/Activator.java | 65 -------
.../emftree/CreateEMFTreeDiagramHandler.java | 25 ---
.../emftree/EmfTreeDiagramEditorFactory.java | 209 ---------------------
.../eclipse/papyrus/diagram/emftree/UMLEditor.java | 192 -------------------
.../.classpath | 7 +
.../.project | 28 +++
.../.settings/org.eclipse.jdt.core.prefs | 7 +
.../META-INF/MANIFEST.MF | 15 ++
.../about.html | 28 +++
.../build.properties | 7 +
.../icons/EmfTree.gif | Bin 0 -> 369 bytes
.../plugin.properties | 12 ++
.../plugin.xml | 66 +++++++
.../eclipse/papyrus/diagram/emftree/Activator.java | 65 +++++++
.../emftree/CreateEMFTreeDiagramHandler.java | 25 +++
.../emftree/EmfTreeDiagramEditorFactory.java | 209 +++++++++++++++++++++
.../eclipse/papyrus/diagram/emftree/UMLEditor.java | 192 +++++++++++++++++++
26 files changed, 661 insertions(+), 661 deletions(-)
delete mode 100644 plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/.classpath
delete mode 100644 plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/.project
delete mode 100644 plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/.settings/org.eclipse.jdt.core.prefs
delete mode 100644 plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/META-INF/MANIFEST.MF
delete mode 100644 plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/about.html
delete mode 100644 plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/build.properties
delete mode 100644 plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/icons/EmfTree.gif
delete mode 100644 plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/plugin.properties
delete mode 100644 plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/plugin.xml
delete mode 100644 plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/Activator.java
delete mode 100644 plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/CreateEMFTreeDiagramHandler.java
delete mode 100644 plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/EmfTreeDiagramEditorFactory.java
delete mode 100644 plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/UMLEditor.java
create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/.classpath
create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/.project
create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.jdt.core.prefs
create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/META-INF/MANIFEST.MF
create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/about.html
create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/build.properties
create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/icons/EmfTree.gif
create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/plugin.properties
create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/plugin.xml
create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/Activator.java
create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/CreateEMFTreeDiagramHandler.java
create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/EmfTreeDiagramEditorFactory.java
create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/UMLEditor.java
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/.classpath b/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/.classpath
deleted file mode 100644
index 2d1a4302f04..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/.project b/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/.project
deleted file mode 100644
index fc0b2154007..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- org.eclipse.papyrus.diagram.emftree
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/.settings/org.eclipse.jdt.core.prefs b/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index abc1a87263c..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Thu Nov 06 14:34:55 CET 2008
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/META-INF/MANIFEST.MF
deleted file mode 100644
index 9394a9a199b..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,15 +0,0 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.papyrus.core.adaptor.emf;bundle-version="0.9.0",
- org.eclipse.papyrus.core;bundle-version="0.9.0",
- org.eclipse.uml2.uml.editor;bundle-version="3.0.0"
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 0.9.0.qualifier
-Bundle-Localization: plugin
-Bundle-Name: %pluginName
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.diagram.emftree.Activator
-Bundle-SymbolicName: org.eclipse.papyrus.diagram.emftree;singleton:=tr
- ue
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/about.html b/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/about.html
deleted file mode 100644
index 82d49bf5f81..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-About
-
-
-About This Content
-
-June 5, 2007
-License
-
-The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at http://www.eclipse.org/legal/epl-v10.html.
-For purposes of the EPL, "Program" will mean the Content.
-
-If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at http://www.eclipse.org.
-
-
-
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/build.properties b/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/build.properties
deleted file mode 100644
index 6cf3ea954b3..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-#Mon Sep 12 09:29:46 CEST 2011
-bin.includes=META-INF/,.,plugin.xml,icons/,about.html,plugin.properties
-output..=bin/
-src.includes=about.html,plugin.xml,icons/,plugin.properties,META-INF/,.
-source..=src/
-bin..=bin/
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/icons/EmfTree.gif b/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/icons/EmfTree.gif
deleted file mode 100644
index d07712589ae..00000000000
Binary files a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/icons/EmfTree.gif and /dev/null differ
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/plugin.properties b/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/plugin.properties
deleted file mode 100644
index ae2d8caf694..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/plugin.properties
+++ /dev/null
@@ -1,12 +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:
-# CEA LIST - initial API and implementation
-##################################################################################
-pluginName=Papyrus EMF Tree (Incubation)
-providerName=Eclipse Modeling Project
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/plugin.xml
deleted file mode 100644
index 496f080796e..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/plugin.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/Activator.java b/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/Activator.java
deleted file mode 100644
index 8b9ee062e27..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/Activator.java
+++ /dev/null
@@ -1,65 +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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.diagram.emftree;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.diagram.emftree";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/CreateEMFTreeDiagramHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/CreateEMFTreeDiagramHandler.java
deleted file mode 100644
index 06c068ac7d5..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/CreateEMFTreeDiagramHandler.java
+++ /dev/null
@@ -1,25 +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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.diagram.emftree;
-
-import org.eclipse.papyrus.core.adaptor.emf.CreateDiagramHandler;
-
-public class CreateEMFTreeDiagramHandler extends CreateDiagramHandler {
-
- @Override
- protected void addNewDiagram() {
- addNewDiagram("Emf Tree", EmfTreeDiagramEditorFactory.EMF_DIAGRAM_TYPE, null);
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/EmfTreeDiagramEditorFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/EmfTreeDiagramEditorFactory.java
deleted file mode 100644
index 9d8281f0058..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/EmfTreeDiagramEditorFactory.java
+++ /dev/null
@@ -1,209 +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:
- * CEA LIST - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.diagram.emftree;
-
-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.EditorDescriptor;
-import org.eclipse.papyrus.core.extension.diagrameditor.IPluggableEditorFactory;
-import org.eclipse.papyrus.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
-import org.eclipse.papyrus.core.services.ServiceException;
-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;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.EditorActionBarContributor;
-
-/**
- * @author Cedric Dumoulin
- * @author Remi Schnekenburger
- * @author Patrick Tessier
- */
-public class EmfTreeDiagramEditorFactory implements IPluggableEditorFactory {
-
- /**
- * Descriptor of the editor. Values come from the declaration in the extension point. The
- * descriptor is set by the EditorFactory.
- */
- private EditorDescriptor editorDescriptor;
-
- /**
- * ServiceRegistry that can be provided to created editors.
- */
- private ServicesRegistry serviceRegistry;
-
- /** name of the emf diagram in Di2 type diagram */
- public static final String EMF_DIAGRAM_TYPE = "emftree";
-
- public EmfTreeDiagramEditorFactory() {
- }
-
- /**
- * Initialize the factory with useful Classes.
- * @see IPluggableEditorFactory#init(ServicesRegistry, EditorDescriptor)
- *
- * @param serviceRegistry Service registry that will be provided to created editor.
- * @param editorDescriptor Descriptor containing data from the Eclipse Extension.
- */
- public void init(ServicesRegistry serviceRegistry, EditorDescriptor editorDescriptor) {
- this.editorDescriptor = editorDescriptor;
- this.serviceRegistry = serviceRegistry;
-
- }
-
- /**
- * TODO Implements next methods
- *
- * @see org.eclipse.papyrus.core.extension.diagrameditor.IPluggableEditorFactory#createIPageModel(java.lang.Object)
- * @param pageIdentifier
- * @return
- *
- */
- public IPageModel createIPageModel(Object pageIdentifier) {
- return new EmfTreeEditorModel((Diagram)pageIdentifier, serviceRegistry);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.core.extension.diagrameditor.IPluggableEditorFactory#isPageModelFactoryFor(java.lang.Object)
- * @param pageIdentifier
- * @return
- *
- */
- public boolean isPageModelFactoryFor(Object pageIdentifier) {
- if(pageIdentifier instanceof Diagram) {
- Diagram diagram = (Diagram)pageIdentifier;
-
- if(EMF_DIAGRAM_TYPE.equals(diagram.getType())) {
- return true;
- }
- }
- // no
- return false;
- }
-
- /**
- * Model used to describe an instance of this editor in the SashSystem.
- *
- * @author dumoulin
- *
- */
- public class EmfTreeEditorModel implements IEditorModel {
-
- /**
- * The object used as page identifier and rawModel.
- */
- private Diagram pageIdentifier;
-
- private ServicesRegistry servicesRegistry;
-
- /**
- *
- * Constructor.
- *
- * @param pageIdentifier
- * @param servicesRegistry
- */
- public EmfTreeEditorModel(Diagram pageIdentifier, ServicesRegistry servicesRegistry) {
- this.pageIdentifier = pageIdentifier;
- this.servicesRegistry = servicesRegistry;
- }
-
- /**
- * Create the instance of the editor.
- *
- * @see org.eclipse.papyrus.sasheditor.contentprovider.IEditorModel#createIEditorPart()
- * @return
- * @throws PartInitException
- *
- */
- public IEditorPart createIEditorPart() throws PartInitException {
- try {
- return new UMLEditor(servicesRegistry);
- } catch (ServiceException e) {
- throw new PartInitException("Can't create Di2Editor.", e);
- } catch (BackboneException e) {
- throw new PartInitException("Can't create Di2Editor.", e);
- }
- }
-
- public EditorActionBarContributor getActionBarContributor() {
-
- String actionBarId = editorDescriptor.getActionBarContributorId();
-
- // Do nothing if no EditorActionBarContributor is specify.
- if(actionBarId == null || actionBarId.length() == 0) {
- return null;
- }
-
- // Try to get it.
-
- // Get ServiceRegistry
- ActionBarContributorRegistry registry;
- try {
- registry = (ActionBarContributorRegistry)servicesRegistry
- .getService(ActionBarContributorRegistry.class);
- } catch (ServiceException e) {
- // Service not found
- // TODO Log the error
- e.printStackTrace();
- return null;
- }
-
- try {
- return registry.getActionBarContributor(actionBarId);
- } catch (BackboneException e) {
- // TODO Log the error and throw an exception instead
- e.printStackTrace();
- return null;
- }
- }
-
- /**
- *
- * @see org.eclipse.papyrus.sasheditor.contentprovider.IPageModel#getRawModel()
- * @return
- *
- */
- public Object getRawModel() {
- return pageIdentifier;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.sasheditor.contentprovider.IPageModel#getTabIcon()
- * @return
- *
- */
- public Image getTabIcon() {
- ImageDescriptor imageDescriptor = editorDescriptor.getIcon();
- if(imageDescriptor == null)
- return null;
-
- return imageDescriptor.createImage();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.sasheditor.contentprovider.IPageModel#getTabTitle()
- * @return
- *
- */
- public String getTabTitle() {
- return "EmfTree";
- }
-
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/UMLEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/UMLEditor.java
deleted file mode 100644
index c5c92fca2e1..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/UMLEditor.java
+++ /dev/null
@@ -1,192 +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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.diagram.emftree;
-
-import java.util.EventObject;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.command.CommandStackListener;
-import org.eclipse.emf.common.ui.viewer.IViewerProvider;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.papyrus.core.editor.BackboneException;
-import org.eclipse.papyrus.core.services.ServiceException;
-import org.eclipse.papyrus.core.services.ServicesRegistry;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.ide.IGotoMarker;
-import org.eclipse.ui.views.properties.IPropertySheetPage;
-
-/**
- * This is an example of a EMF UML model editor.
- *
- * @generated
- */
-public class UMLEditor extends org.eclipse.uml2.uml.editor.presentation.UMLEditor implements IEditingDomainProvider,
- ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker {
-
- /**
- * ServiceRegistry used to retrieve needed services. This registry is provided by the multieditor.
- */
- protected ServicesRegistry servicesRegistry;
- /**
- *
- * Constructor. Create an DiEditor using the {@link ServicesRegistry}.
- *
- * @param servicesRegistry
- */
- public UMLEditor(ServicesRegistry servicesRegistry) throws ServiceException, BackboneException {
- this.servicesRegistry = servicesRegistry;
- initEditor();
- }
-
- /**
- * Init the editor from the specified context.
- *
- * @param editorContext
- * @throws ServiceException
- */
- private void initEditor() throws ServiceException {
-
- TransactionalEditingDomain papyrusEditingDomain = servicesRegistry.getService(TransactionalEditingDomain.class);
- CommandStack commandStack = papyrusEditingDomain.getCommandStack();
-
- // Add a listener to set the most recent command's affected objects to be the selection of
- // the viewer with focus.
- //
- commandStack.addCommandStackListener(new CommandStackListener() {
-
- public void commandStackChanged(final EventObject event) {
- getContainer().getDisplay().asyncExec(new Runnable() {
-
- public void run() {
- firePropertyChange(IEditorPart.PROP_DIRTY);
-
- // Try to select the affected objects.
- //
- Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
- if(mostRecentCommand != null) {
- setSelectionToViewer(mostRecentCommand.getAffectedObjects());
- }
- if(propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) {
- propertySheetPage.refresh();
- }
- }
- });
- }
-
- });
-
- // Create the editing domain with a special command stack.
- //
- // Set the resourceSet wth our own resourceSet.
- // editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new
- // HashMap());
-
- ResourceSet resourceSet = papyrusEditingDomain.getResourceSet();
- editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, resourceSet);
-
- // editingDomain = editorContext.getTransactionalEditingDomain();
- // editingDomain.setResourceToReadOnlyMap(new HashMap());
- }
-
- /**
- * This is the method called to load a resource into the editing domain's resource set based on
- * the editor's input. Put the existing model into the editingDomain.
- *
- *
- * @generated
- */
- @Override
- public void createModel() {
- // model is already created and loaded. Do nothing.
- }
-
- /**
- * This is for implementing {@link IEditorPart} and simply saves the model file.
- *
- * @generated
- */
- @Override
- public void doSave(IProgressMonitor progressMonitor) {
- }
-
- /**
- * This also changes the editor's input.
- *
- * @generated
- */
- @Override
- public void doSaveAs() {
- }
-
- /**
- *
- *
- * @generated
- */
- @Override
- protected void doSaveAs(URI uri, IEditorInput editorInput) {
- }
-
- @Override
- public void init(IEditorSite site, IEditorInput editorInput) {
- System.out.println(this.getClass().getSimpleName() + ".init()");
- super.init(site, editorInput);
- setPartName("emf tree");
- }
-
- /**
- *
- *
- * @generated
- */
- @Override
- public IActionBars getActionBars() {
- try {
- return getActionBarContributor().getActionBars();
- } catch (NullPointerException e) {
- // If we are nested, we have not access to ActionBarContributor()
- return null;
- }
- }
-
- /**
- * Has we have no actionBarContributor, we can't get the status line. So skip this method.
- */
- @Override
- public void setStatusLineManager(ISelection selection) {
-
- }
-
- /**
- * Disable the native property sheet page.
- */
- @Override
- public IPropertySheetPage getPropertySheetPage() {
-
- return null;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/.classpath b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/.project b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/.project
new file mode 100644
index 00000000000..fc0b2154007
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/.project
@@ -0,0 +1,28 @@
+
+
+ org.eclipse.papyrus.diagram.emftree
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.jdt.core.prefs b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..abc1a87263c
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Thu Nov 06 14:34:55 CET 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..9394a9a199b
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.papyrus.core.adaptor.emf;bundle-version="0.9.0",
+ org.eclipse.papyrus.core;bundle-version="0.9.0",
+ org.eclipse.uml2.uml.editor;bundle-version="3.0.0"
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.9.0.qualifier
+Bundle-Localization: plugin
+Bundle-Name: %pluginName
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.diagram.emftree.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.diagram.emftree;singleton:=tr
+ ue
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/about.html b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/about.html
@@ -0,0 +1,28 @@
+
+
+
+
+About
+
+
+About This Content
+
+June 5, 2007
+License
+
+The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content.
+
+If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at http://www.eclipse.org.
+
+
+
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/build.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/build.properties
new file mode 100644
index 00000000000..6cf3ea954b3
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/build.properties
@@ -0,0 +1,7 @@
+#
+#Mon Sep 12 09:29:46 CEST 2011
+bin.includes=META-INF/,.,plugin.xml,icons/,about.html,plugin.properties
+output..=bin/
+src.includes=about.html,plugin.xml,icons/,plugin.properties,META-INF/,.
+source..=src/
+bin..=bin/
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/icons/EmfTree.gif b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/icons/EmfTree.gif
new file mode 100644
index 00000000000..d07712589ae
Binary files /dev/null and b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/icons/EmfTree.gif differ
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/plugin.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/plugin.properties
new file mode 100644
index 00000000000..ae2d8caf694
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/plugin.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# 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:
+# CEA LIST - initial API and implementation
+##################################################################################
+pluginName=Papyrus EMF Tree (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/plugin.xml
new file mode 100644
index 00000000000..496f080796e
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/plugin.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/Activator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/Activator.java
new file mode 100644
index 00000000000..8b9ee062e27
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/Activator.java
@@ -0,0 +1,65 @@
+/*****************************************************************************
+ * 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.emftree;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.diagram.emftree";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/CreateEMFTreeDiagramHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/CreateEMFTreeDiagramHandler.java
new file mode 100644
index 00000000000..06c068ac7d5
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/CreateEMFTreeDiagramHandler.java
@@ -0,0 +1,25 @@
+/*****************************************************************************
+ * 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.emftree;
+
+import org.eclipse.papyrus.core.adaptor.emf.CreateDiagramHandler;
+
+public class CreateEMFTreeDiagramHandler extends CreateDiagramHandler {
+
+ @Override
+ protected void addNewDiagram() {
+ addNewDiagram("Emf Tree", EmfTreeDiagramEditorFactory.EMF_DIAGRAM_TYPE, null);
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/EmfTreeDiagramEditorFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/EmfTreeDiagramEditorFactory.java
new file mode 100644
index 00000000000..9d8281f0058
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/EmfTreeDiagramEditorFactory.java
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * 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:
+ * CEA LIST - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.diagram.emftree;
+
+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.EditorDescriptor;
+import org.eclipse.papyrus.core.extension.diagrameditor.IPluggableEditorFactory;
+import org.eclipse.papyrus.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
+import org.eclipse.papyrus.core.services.ServiceException;
+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;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.EditorActionBarContributor;
+
+/**
+ * @author Cedric Dumoulin
+ * @author Remi Schnekenburger
+ * @author Patrick Tessier
+ */
+public class EmfTreeDiagramEditorFactory implements IPluggableEditorFactory {
+
+ /**
+ * Descriptor of the editor. Values come from the declaration in the extension point. The
+ * descriptor is set by the EditorFactory.
+ */
+ private EditorDescriptor editorDescriptor;
+
+ /**
+ * ServiceRegistry that can be provided to created editors.
+ */
+ private ServicesRegistry serviceRegistry;
+
+ /** name of the emf diagram in Di2 type diagram */
+ public static final String EMF_DIAGRAM_TYPE = "emftree";
+
+ public EmfTreeDiagramEditorFactory() {
+ }
+
+ /**
+ * Initialize the factory with useful Classes.
+ * @see IPluggableEditorFactory#init(ServicesRegistry, EditorDescriptor)
+ *
+ * @param serviceRegistry Service registry that will be provided to created editor.
+ * @param editorDescriptor Descriptor containing data from the Eclipse Extension.
+ */
+ public void init(ServicesRegistry serviceRegistry, EditorDescriptor editorDescriptor) {
+ this.editorDescriptor = editorDescriptor;
+ this.serviceRegistry = serviceRegistry;
+
+ }
+
+ /**
+ * TODO Implements next methods
+ *
+ * @see org.eclipse.papyrus.core.extension.diagrameditor.IPluggableEditorFactory#createIPageModel(java.lang.Object)
+ * @param pageIdentifier
+ * @return
+ *
+ */
+ public IPageModel createIPageModel(Object pageIdentifier) {
+ return new EmfTreeEditorModel((Diagram)pageIdentifier, serviceRegistry);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.core.extension.diagrameditor.IPluggableEditorFactory#isPageModelFactoryFor(java.lang.Object)
+ * @param pageIdentifier
+ * @return
+ *
+ */
+ public boolean isPageModelFactoryFor(Object pageIdentifier) {
+ if(pageIdentifier instanceof Diagram) {
+ Diagram diagram = (Diagram)pageIdentifier;
+
+ if(EMF_DIAGRAM_TYPE.equals(diagram.getType())) {
+ return true;
+ }
+ }
+ // no
+ return false;
+ }
+
+ /**
+ * Model used to describe an instance of this editor in the SashSystem.
+ *
+ * @author dumoulin
+ *
+ */
+ public class EmfTreeEditorModel implements IEditorModel {
+
+ /**
+ * The object used as page identifier and rawModel.
+ */
+ private Diagram pageIdentifier;
+
+ private ServicesRegistry servicesRegistry;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param pageIdentifier
+ * @param servicesRegistry
+ */
+ public EmfTreeEditorModel(Diagram pageIdentifier, ServicesRegistry servicesRegistry) {
+ this.pageIdentifier = pageIdentifier;
+ this.servicesRegistry = servicesRegistry;
+ }
+
+ /**
+ * Create the instance of the editor.
+ *
+ * @see org.eclipse.papyrus.sasheditor.contentprovider.IEditorModel#createIEditorPart()
+ * @return
+ * @throws PartInitException
+ *
+ */
+ public IEditorPart createIEditorPart() throws PartInitException {
+ try {
+ return new UMLEditor(servicesRegistry);
+ } catch (ServiceException e) {
+ throw new PartInitException("Can't create Di2Editor.", e);
+ } catch (BackboneException e) {
+ throw new PartInitException("Can't create Di2Editor.", e);
+ }
+ }
+
+ public EditorActionBarContributor getActionBarContributor() {
+
+ String actionBarId = editorDescriptor.getActionBarContributorId();
+
+ // Do nothing if no EditorActionBarContributor is specify.
+ if(actionBarId == null || actionBarId.length() == 0) {
+ return null;
+ }
+
+ // Try to get it.
+
+ // Get ServiceRegistry
+ ActionBarContributorRegistry registry;
+ try {
+ registry = (ActionBarContributorRegistry)servicesRegistry
+ .getService(ActionBarContributorRegistry.class);
+ } catch (ServiceException e) {
+ // Service not found
+ // TODO Log the error
+ e.printStackTrace();
+ return null;
+ }
+
+ try {
+ return registry.getActionBarContributor(actionBarId);
+ } catch (BackboneException e) {
+ // TODO Log the error and throw an exception instead
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.sasheditor.contentprovider.IPageModel#getRawModel()
+ * @return
+ *
+ */
+ public Object getRawModel() {
+ return pageIdentifier;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.sasheditor.contentprovider.IPageModel#getTabIcon()
+ * @return
+ *
+ */
+ public Image getTabIcon() {
+ ImageDescriptor imageDescriptor = editorDescriptor.getIcon();
+ if(imageDescriptor == null)
+ return null;
+
+ return imageDescriptor.createImage();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.sasheditor.contentprovider.IPageModel#getTabTitle()
+ * @return
+ *
+ */
+ public String getTabTitle() {
+ return "EmfTree";
+ }
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/UMLEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/UMLEditor.java
new file mode 100644
index 00000000000..c5c92fca2e1
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/diagram/emftree/UMLEditor.java
@@ -0,0 +1,192 @@
+/*****************************************************************************
+ * 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.emftree;
+
+import java.util.EventObject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.common.command.CommandStackListener;
+import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.papyrus.core.editor.BackboneException;
+import org.eclipse.papyrus.core.services.ServiceException;
+import org.eclipse.papyrus.core.services.ServicesRegistry;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.ide.IGotoMarker;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+
+/**
+ * This is an example of a EMF UML model editor.
+ *
+ * @generated
+ */
+public class UMLEditor extends org.eclipse.uml2.uml.editor.presentation.UMLEditor implements IEditingDomainProvider,
+ ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker {
+
+ /**
+ * ServiceRegistry used to retrieve needed services. This registry is provided by the multieditor.
+ */
+ protected ServicesRegistry servicesRegistry;
+ /**
+ *
+ * Constructor. Create an DiEditor using the {@link ServicesRegistry}.
+ *
+ * @param servicesRegistry
+ */
+ public UMLEditor(ServicesRegistry servicesRegistry) throws ServiceException, BackboneException {
+ this.servicesRegistry = servicesRegistry;
+ initEditor();
+ }
+
+ /**
+ * Init the editor from the specified context.
+ *
+ * @param editorContext
+ * @throws ServiceException
+ */
+ private void initEditor() throws ServiceException {
+
+ TransactionalEditingDomain papyrusEditingDomain = servicesRegistry.getService(TransactionalEditingDomain.class);
+ CommandStack commandStack = papyrusEditingDomain.getCommandStack();
+
+ // Add a listener to set the most recent command's affected objects to be the selection of
+ // the viewer with focus.
+ //
+ commandStack.addCommandStackListener(new CommandStackListener() {
+
+ public void commandStackChanged(final EventObject event) {
+ getContainer().getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+
+ // Try to select the affected objects.
+ //
+ Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
+ if(mostRecentCommand != null) {
+ setSelectionToViewer(mostRecentCommand.getAffectedObjects());
+ }
+ if(propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) {
+ propertySheetPage.refresh();
+ }
+ }
+ });
+ }
+
+ });
+
+ // Create the editing domain with a special command stack.
+ //
+ // Set the resourceSet wth our own resourceSet.
+ // editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new
+ // HashMap());
+
+ ResourceSet resourceSet = papyrusEditingDomain.getResourceSet();
+ editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, resourceSet);
+
+ // editingDomain = editorContext.getTransactionalEditingDomain();
+ // editingDomain.setResourceToReadOnlyMap(new HashMap());
+ }
+
+ /**
+ * This is the method called to load a resource into the editing domain's resource set based on
+ * the editor's input. Put the existing model into the editingDomain.
+ *
+ *
+ * @generated
+ */
+ @Override
+ public void createModel() {
+ // model is already created and loaded. Do nothing.
+ }
+
+ /**
+ * This is for implementing {@link IEditorPart} and simply saves the model file.
+ *
+ * @generated
+ */
+ @Override
+ public void doSave(IProgressMonitor progressMonitor) {
+ }
+
+ /**
+ * This also changes the editor's input.
+ *
+ * @generated
+ */
+ @Override
+ public void doSaveAs() {
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ protected void doSaveAs(URI uri, IEditorInput editorInput) {
+ }
+
+ @Override
+ public void init(IEditorSite site, IEditorInput editorInput) {
+ System.out.println(this.getClass().getSimpleName() + ".init()");
+ super.init(site, editorInput);
+ setPartName("emf tree");
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public IActionBars getActionBars() {
+ try {
+ return getActionBarContributor().getActionBars();
+ } catch (NullPointerException e) {
+ // If we are nested, we have not access to ActionBarContributor()
+ return null;
+ }
+ }
+
+ /**
+ * Has we have no actionBarContributor, we can't get the status line. So skip this method.
+ */
+ @Override
+ public void setStatusLineManager(ISelection selection) {
+
+ }
+
+ /**
+ * Disable the native property sheet page.
+ */
+ @Override
+ public IPropertySheetPage getPropertySheetPage() {
+
+ return null;
+ }
+}
--
cgit v1.2.3