Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-11-04 15:25:26 +0000
committerCamille Letavernier2014-11-04 15:25:26 +0000
commitf8a0549609b4b0c149bd8b6a9a76fbde61afbc98 (patch)
tree6b25d0b6b632e1fdffc4d3637d128b884608bcc1 /plugins
parent5fb9f39b4d50f0d6634abc4a0d3d5a61f6be781d (diff)
downloadorg.eclipse.papyrus-f8a0549609b4b0c149bd8b6a9a76fbde61afbc98.tar.gz
org.eclipse.papyrus-f8a0549609b4b0c149bd8b6a9a76fbde61afbc98.tar.xz
org.eclipse.papyrus-f8a0549609b4b0c149bd8b6a9a76fbde61afbc98.zip
351804: [EMF Embedded Editor] Papyrus shall provide an embedded EMF
Editor https://bugs.eclipse.org/bugs/show_bug.cgi?id=351804 - Update the generic/customizable Papyrus Tree Editor to use the latest New Child component - Fix various issues to let the UML Properties view work with the Customizable Papyrus Tree Editor
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/.classpath14
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF9
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/plugin.xml12
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/ActionBarContributor.java19
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor2.java)92
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.newchild/META-INF/MANIFEST.MF7
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.newchild/src/org/eclipse/papyrus/infra/newchild/ui/DynamicNewChild.java (renamed from plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/DynamicNewChild.java)8
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/SemanticUMLContentProvider.java11
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java5
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/META-INF/MANIFEST.MF2
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/plugin.xml2
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java2
13 files changed, 104 insertions, 86 deletions
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/.classpath b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/.classpath
index 94c7bb7e8ed..8a8f1668cdc 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/.classpath
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath> \ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/.settings/org.eclipse.jdt.core.prefs
index 8bca62fefcf..f287d53cf45 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,7 @@
-#Wed Jul 27 11:41:38 CEST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF
index 03ea0139cbc..78021654d14 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF
@@ -1,13 +1,11 @@
Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.infra.emf.editor.part,
- org.eclipse.papyrus.infra.emf.editor.providers
+Export-Package: org.eclipse.papyrus.infra.emf.editor.part
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.emf.ecore;bundle-version="2.7.0",
org.eclipse.emf.ecore.editor;bundle-version="2.7.0",
org.eclipse.core.resources;bundle-version="3.7.100",
org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.200",
- org.eclipse.papyrus.infra.emf.newchild;bundle-version="1.1.0",
org.eclipse.papyrus.views.properties;bundle-version="1.1.0",
org.eclipse.papyrus.infra.widgets;bundle-version="1.1.0",
org.eclipse.emf.transaction;bundle-version="1.4.0",
@@ -17,7 +15,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.emf;bundle-version="1.1.0",
org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
org.eclipse.papyrus.infra.core.log;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.1.0"
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.newchild;bundle-version="1.1.0"
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.1.0.qualifier
@@ -27,5 +26,5 @@ Bundle-Activator: org.eclipse.papyrus.infra.emf.editor.Activator
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.editor;singleton:=t
rue
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/plugin.xml b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/plugin.xml
index d2a34ed27c8..c8170edb38b 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/plugin.xml
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/plugin.xml
@@ -18,19 +18,9 @@
class="org.eclipse.papyrus.infra.emf.editor.part.PapyrusEditor"
contributorClass="org.eclipse.papyrus.infra.emf.editor.part.ActionBarContributor"
default="false"
- extensions="xmi"
icon="icons/papyrus_model.png"
id="org.eclipse.papyrus.emf.editor"
- name="Papyrus EMF Editor (EMF Facet 0.1)">
- </editor>
- <editor
- class="org.eclipse.papyrus.infra.emf.editor.part.PapyrusEditor2"
- contributorClass="org.eclipse.papyrus.infra.emf.editor.part.ActionBarContributor"
- default="false"
- extensions="xmi"
- icon="icons/papyrus_model.png"
- id="org.eclipse.papyrus.emf.editor2"
- name="Papyrus EMF Editor (EMF Facet 0.2)">
+ name="Papyrus EMF Editor">
</editor>
</extension>
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/ActionBarContributor.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/ActionBarContributor.java
index 47b01f7e4dd..45df42eb359 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/ActionBarContributor.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/ActionBarContributor.java
@@ -22,9 +22,7 @@ import org.eclipse.emf.edit.ui.action.DeleteAction;
import org.eclipse.emf.edit.ui.action.PasteAction;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.papyrus.infra.emf.editor.actions.MoDiscoCopyAction;
import org.eclipse.papyrus.infra.emf.editor.actions.MoDiscoCutAction;
@@ -32,7 +30,8 @@ import org.eclipse.papyrus.infra.emf.editor.actions.MoDiscoDeleteAction;
import org.eclipse.papyrus.infra.emf.editor.actions.MoDiscoPasteAction;
import org.eclipse.papyrus.infra.emf.editor.actions.ValidationAction;
import org.eclipse.papyrus.infra.emf.editor.util.ActionUtil;
-import org.eclipse.papyrus.infra.emf.newchild.runtime.NewchildManager;
+import org.eclipse.papyrus.infra.newchild.CreationMenuRegistry;
+import org.eclipse.papyrus.infra.newchild.ui.DynamicNewChild;
/**
* The Action bar contributor for the Context Editor
@@ -43,7 +42,7 @@ import org.eclipse.papyrus.infra.emf.newchild.runtime.NewchildManager;
*/
public class ActionBarContributor extends EcoreActionBarContributor {
- protected IStructuredSelection lastSelection;
+ DynamicNewChild contribution = new DynamicNewChild();
/**
*
@@ -55,6 +54,8 @@ public class ActionBarContributor extends EcoreActionBarContributor {
validateAction = new ValidationAction();
}
+ protected CreationMenuRegistry creationMenuRegistry = new CreationMenuRegistry();
+
public void setEditingDomain(EditingDomain domain) {
if (validateAction instanceof ValidationAction) {
((ValidationAction) validateAction).setEditingDomain(domain);
@@ -69,8 +70,8 @@ public class ActionBarContributor extends EcoreActionBarContributor {
@Override
public void menuAboutToShow(IMenuManager menuManager) {
super.menuAboutToShow(menuManager);
- menuManager.insertBefore("edit", new Separator(NewchildManager.TOP)); //$NON-NLS-1$
- NewchildManager.instance.fillMenu(menuManager, lastSelection);
+
+ menuManager.insertBefore("edit", contribution);
}
@Override
@@ -90,12 +91,6 @@ public class ActionBarContributor extends EcoreActionBarContributor {
SelectionChangedEvent newEvent = new SelectionChangedEvent(event.getSelectionProvider(), newSelection);
super.selectionChanged(newEvent);
-
- if (newSelection instanceof IStructuredSelection) {
- this.lastSelection = (IStructuredSelection) newSelection;
- } else {
- this.lastSelection = null;
- }
}
@Override
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor2.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor.java
index a8555e8bb3d..f5247a3c285 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor2.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/src/org/eclipse/papyrus/infra/emf/editor/part/PapyrusEditor.java
@@ -1,3 +1,14 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
package org.eclipse.papyrus.infra.emf.editor.part;
import java.util.EventObject;
@@ -12,17 +23,14 @@ import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.command.CommandStackListener;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.presentation.EcoreEditor;
-import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
-import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;
import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;
-import org.eclipse.emf.transaction.TransactionalCommandStack;
-import org.eclipse.emf.transaction.impl.TransactionalCommandStackImpl;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
@@ -33,8 +41,11 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationManager;
import org.eclipse.papyrus.emf.facet.custom.ui.ICustomizedContentProviderFactory;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.editor.Activator;
import org.eclipse.papyrus.infra.emf.editor.actions.MoDiscoDropAdapter;
-import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl;
import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
import org.eclipse.papyrus.infra.widgets.editors.ICommitListener;
import org.eclipse.papyrus.infra.widgets.editors.StringEditor;
@@ -69,7 +80,7 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
* @author Camille Letavernier
*
*/
-public class PapyrusEditor2 extends EcoreEditor implements ITabbedPropertySheetPageContributor, CommandStackListener {
+public class PapyrusEditor extends EcoreEditor implements ITabbedPropertySheetPageContributor, CommandStackListener {
public static final String PROPERTY_VIEW_ID = "CustomizablePropertyView"; //$NON-NLS-1$
@@ -108,6 +119,7 @@ public class PapyrusEditor2 extends EcoreEditor implements ITabbedPropertySheetP
final StringEditor filterPattern = new StringEditor(parent, SWT.NONE, "Filter");
filterPattern.addCommitListener(new ICommitListener() {
+ @Override
public void commit(AbstractEditor editor) {
filter.setPattern((String) filterPattern.getValue());
selectionViewer.refresh();
@@ -144,10 +156,6 @@ public class PapyrusEditor2 extends EcoreEditor implements ITabbedPropertySheetP
setActivePage(0);
- // Preview preview = new Preview(this);
- // preview.createPartControl(parent);
- // addPreview(preview);
-
parent.layout();
}
@@ -175,6 +183,12 @@ public class PapyrusEditor2 extends EcoreEditor implements ITabbedPropertySheetP
updateProblemIndication();
}
+ @Override
+ protected void handleChangedResources() {
+ super.handleChangedResources();
+ getViewer().setInput(getTreeViewerInput());
+ }
+
protected Object getTreeViewerInput() {
List<EObject> roots = new LinkedList<EObject>();
for (Resource resource : getResourceSet().getResources()) {
@@ -191,25 +205,19 @@ public class PapyrusEditor2 extends EcoreEditor implements ITabbedPropertySheetP
@Override
protected void initializeEditingDomain() {
- // Create an adapter factory that yields item providers.
- //
- adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
-
- adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
- adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
- adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
+ ResourceSet resourceSet = new ResourceSetImpl();
- // Create the command stack that will notify this editor as commands are executed.
- //
- TransactionalCommandStack commandStack = new TransactionalCommandStackImpl();
+ editingDomain = (TransactionalEditingDomainImpl) TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(resourceSet);
+ editingDomain.setResourceToReadOnlyMap(new HashMap<Resource, Boolean>());
// 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() {
+ editingDomain.getCommandStack().addCommandStackListener(new CommandStackListener() {
+ @Override
public void commandStackChanged(final EventObject event) {
getContainer().getDisplay().asyncExec(new Runnable() {
+ @Override
public void run() {
firePropertyChange(IEditorPart.PROP_DIRTY);
@@ -234,20 +242,20 @@ public class PapyrusEditor2 extends EcoreEditor implements ITabbedPropertySheetP
}
});
- // Create the editing domain with a special command stack.
- //
- editingDomain = new TransactionalEditingDomainImpl(adapterFactory, commandStack);
- editingDomain.setResourceToReadOnlyMap(new HashMap<Resource, Boolean>());
+ adapterFactory = (ComposedAdapterFactory) editingDomain.getAdapterFactory();
}
@Override
protected void createContextMenuFor(StructuredViewer viewer) {
MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$
+ contextMenu.add(new Separator("newChild")); //$NON-NLS-1$
contextMenu.add(new Separator("additions")); //$NON-NLS-1$
contextMenu.setRemoveAllWhenShown(true);
contextMenu.addMenuListener(this);
Menu menu = contextMenu.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
+ System.out.println(menu.hashCode());
+ System.out.println(contextMenu.hashCode());
int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };
@@ -263,20 +271,23 @@ public class PapyrusEditor2 extends EcoreEditor implements ITabbedPropertySheetP
return iPropertySheetPage;
}
- protected ICustomizationManager getCustomizationManager() {
+ protected final ICustomizationManager getCustomizationManager() {
+ if (customizationManager == null) {
+ customizationManager = createCustomizationManager();
+ }
+ return customizationManager;
+ }
+
+ protected ICustomizationManager createCustomizationManager() {
return org.eclipse.papyrus.infra.emf.Activator.getDefault().getCustomizationManager();
- // if(customizationManager == null) {
- // customizationManager = ICustomizationManagerFactory.DEFAULT.getOrCreateICustomizationManager(getResourceSet());
- // }
- // return customizationManager;
}
protected void initializeCustomizationCatalogManager() {
// ICustomizationCatalogManager customCatalog = ICustomizationCatalogManagerFactory.DEFAULT.getOrCreateCustomizationCatalogManager(getResourceSet());
- // ICustomizationCatalogManager customCatalog = Activator.getDefault().getCustomizationManager()
+ // ICustomizationCatalogManager customCatalog = Activator.getDefault().getCustomizationManager();
// List<Customization> allCustomizations = customCatalog.getRegisteredCustomizations();
- // for(Customization customization : allCustomizations) {
- // if(customization.isMustBeLoadedByDefault()) {
+ // for (Customization customization : allCustomizations) {
+ // if (customization.isMustBeLoadedByDefault()) {
// System.out.println("Apply default customization: " + customization.getName());
// getCustomizationManager().getManagedCustomizations().add(customization);
// }
@@ -292,10 +303,16 @@ public class PapyrusEditor2 extends EcoreEditor implements ITabbedPropertySheetP
}
protected ILabelProvider createLabelProvider() {
- // return IResolvingCustomizedLabelProviderFactory.DEFAULT.createCustomizedLabelProvider(getCustomizationManager());
- return new EMFLabelProvider();
+ LabelProviderService labelService = new LabelProviderServiceImpl();
+ try {
+ labelService.startService();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ }
+ return labelService.getLabelProvider();
}
+ @Override
public void commandStackChanged(EventObject event) {
getViewer().refresh();
}
@@ -305,6 +322,7 @@ public class PapyrusEditor2 extends EcoreEditor implements ITabbedPropertySheetP
super.doSave(monitor);
}
+ @Override
public String getContributorId() {
return PROPERTY_VIEW_ID;
}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.newchild/META-INF/MANIFEST.MF b/plugins/infra/org.eclipse.papyrus.infra.newchild/META-INF/MANIFEST.MF
index 2497b8847e3..afb9b97724f 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.newchild/META-INF/MANIFEST.MF
+++ b/plugins/infra/org.eclipse.papyrus.infra.newchild/META-INF/MANIFEST.MF
@@ -2,7 +2,8 @@ Manifest-Version: 1.0
Export-Package: org.eclipse.papyrus.infra.newchild,
org.eclipse.papyrus.infra.newchild.elementcreationmenumodel,
org.eclipse.papyrus.infra.newchild.elementcreationmenumodel.impl,
- org.eclipse.papyrus.infra.newchild.elementcreationmenumodel.util
+ org.eclipse.papyrus.infra.newchild.elementcreationmenumodel.util,
+ org.eclipse.papyrus.infra.newchild.ui
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.emf;bundle-version="2.6.0",
@@ -16,7 +17,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.services.edit;bundle-version="1.1.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.1.0",
org.eclipse.papyrus.infra.core.log;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.1.0"
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.1.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/DynamicNewChild.java b/plugins/infra/org.eclipse.papyrus.infra.newchild/src/org/eclipse/papyrus/infra/newchild/ui/DynamicNewChild.java
index b64bbfb2986..ec502c3a7df 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/DynamicNewChild.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.newchild/src/org/eclipse/papyrus/infra/newchild/ui/DynamicNewChild.java
@@ -12,7 +12,7 @@
* Christian W. Damus (CEA) - bug 413703
*
*****************************************************************************/
-package org.eclipse.papyrus.views.modelexplorer.newchild;
+package org.eclipse.papyrus.infra.newchild.ui;
import java.util.ArrayList;
@@ -21,6 +21,7 @@ import java.util.Iterator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.viewers.ISelection;
@@ -80,7 +81,7 @@ public class DynamicNewChild extends ContributionItem {
@Override
public void fill(Menu menu, int index) {
EObject eObject = getSelection();
- if (eObject != null) {
+ if (eObject != null && editingDomain != null) {
CreationMenuFactory creationMenuFactory = new CreationMenuFactory(editingDomain);
ArrayList<Folder> folders = creationMenuRegistry.getRootFolder();
Iterator<Folder> iterFolder = folders.iterator();
@@ -125,7 +126,8 @@ public class DynamicNewChild extends ContributionItem {
try {
editingDomain = ServiceUtilsForEObject.getInstance().getService(org.eclipse.emf.transaction.TransactionalEditingDomain.class, editingDomainCitizen);
} catch (Exception ex) {
- // Nothing to do. We can't handle this case
+ // If the service/service registry is not available, try to retrieve directly from the EObject
+ editingDomain = TransactionUtil.getEditingDomain(editingDomainCitizen);
}
return selectedEObject;
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/SemanticUMLContentProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/SemanticUMLContentProvider.java
index 125f1b5408b..f408a2bac49 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/SemanticUMLContentProvider.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/SemanticUMLContentProvider.java
@@ -82,6 +82,10 @@ public class SemanticUMLContentProvider extends SemanticEMFContentProvider {
}
protected static EObject[] getRoots(ResourceSet root) {
+ if (root == null) {
+ throw new IllegalArgumentException("Cannot retrieve the roots of the Model without a ResourceSet");
+ }
+
EObject rootElement = null;
if (root instanceof ModelSet) {
@@ -94,6 +98,13 @@ public class SemanticUMLContentProvider extends SemanticEMFContentProvider {
// Ignore and treat the ModelSet as a standard resource set
}
}
+ } else { // Standard resource set, used e.g. in a Papyrus generic Tree Editor
+ for (Resource resource : root.getResources()) {
+ if ("uml".equals(resource.getURI().fileExtension()) && !resource.getContents().isEmpty()) {
+ rootElement = resource.getContents().get(0);
+ break;
+ }
+ }
}
List<EObject> rootElements = new LinkedList<EObject>();
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java
index cc6b3963b72..ecfd55aaff8 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java
@@ -136,15 +136,16 @@ public class UMLContentProvider extends EncapsulatedContentProvider {
if (root == null && eObject.eResource() != null) {
try {
// try to retrieve the root from the object to edit
- root = ServiceUtilsForResource.getInstance().getModelSet(eObject.eResource());
+ root = ServiceUtilsForResource.getInstance().getService(ResourceSet.class, eObject.eResource());
} catch (ServiceException e) {
+ root = eObject.eResource().getResourceSet();
// Nothing
}
}
if (root == null) {
// try to retrieve the root from the current editor
try {
- root = ServiceUtilsForActionHandlers.getInstance().getModelSet();
+ root = ServiceUtilsForActionHandlers.getInstance().getServiceRegistry().getService(ResourceSet.class);
} catch (ServiceException e) {
// Nothing
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/META-INF/MANIFEST.MF b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/META-INF/MANIFEST.MF
index 75ecc7e0c7b..0e9a8fabb4d 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/META-INF/MANIFEST.MF
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/META-INF/MANIFEST.MF
@@ -26,5 +26,5 @@ Bundle-Description: The purpose of this plugin is to do the connectio
he docs directory of the plugin org.eclipse.papyrus.infra.newchild
Bundle-SymbolicName: org.eclipse.papyrus.views.modelexplorer.newchild;
singleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/plugin.xml b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/plugin.xml
index bd442c984e7..4c87dee2001 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/plugin.xml
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/plugin.xml
@@ -6,7 +6,7 @@
allPopups="false"
locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup?before=org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
<dynamic
- class="org.eclipse.papyrus.views.modelexplorer.newchild.DynamicNewChild"
+ class="org.eclipse.papyrus.infra.newchild.ui.DynamicNewChild"
id="org.eclipse.papyrus.views.modelexplorer.newchild.dynamic">
</dynamic>
</menuContribution>
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java
index b132441dbfa..6e5daf70755 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java
@@ -209,7 +209,7 @@ public class EMFModelElement extends AbstractModelElement {
: ServiceUtilsForResourceSet.getInstance().getService(LabelProviderService.class, NestedEditingDialogContext.getInstance().getResourceSet());
return lpSvc.getLabelProvider();
} catch (ServiceException ex) {
- Activator.log.error(ex);
+ // The service registry isn't always present in the properties view. Don't log an error and use a standard label provider
return new EMFLabelProvider();
}
}

Back to the top