Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2014-04-04 08:09:24 -0400
committerptessier2014-04-04 08:09:24 -0400
commit18a004eb3fa268c6a8bf4bed30498a9e8154fa3f (patch)
tree38428e826f0c1a09fc853d644c585ef760bb62ca /plugins
parent0296a41791f35a5091fea5c0d7cfe34c407128a7 (diff)
parente6b92948d34a7a2f10c443f9e991ed99e4b61853 (diff)
downloadorg.eclipse.papyrus-18a004eb3fa268c6a8bf4bed30498a9e8154fa3f.tar.gz
org.eclipse.papyrus-18a004eb3fa268c6a8bf4bed30498a9e8154fa3f.tar.xz
org.eclipse.papyrus-18a004eb3fa268c6a8bf4bed30498a9e8154fa3f.zip
Merge branch 'master' of ssh://ptessier@git.eclipse.org/gitroot/papyrus/org.eclipse.papyrus.git
Diffstat (limited to 'plugins')
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/MoDiscoDropAdapter.java22
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java22
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml5
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/advice/DeletePageAdvice.java18
-rwxr-xr-xplugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramEditHelper.java93
-rw-r--r--plugins/infra/org.eclipse.papyrus.eclipse.project.editors/.classpath2
-rw-r--r--plugins/infra/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF4
-rwxr-xr-xplugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.preferences/META-INF/MANIFEST.MF4
8 files changed, 89 insertions, 81 deletions
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/MoDiscoDropAdapter.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/MoDiscoDropAdapter.java
index 64403b82f2a..efd6d56b7c2 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/MoDiscoDropAdapter.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/MoDiscoDropAdapter.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 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
@@ -13,27 +13,27 @@ package org.eclipse.papyrus.customization.properties.editor;
import java.util.Collection;
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.papyrus.customization.properties.util.ActionUtil;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.swt.widgets.Widget;
/**
* An adapter for Drag & Drop in the Context editor. The default Ecore drag & drop
* is not compatible with the EMF Facet Tree Elements
- *
+ *
* @author Camille Letavernier
*/
public class MoDiscoDropAdapter extends EditingDomainViewerDropAdapter {
/**
- *
+ *
* Constructor.
- *
+ *
* @param domain
* The Editing domain for this Drop Adapter
* @param viewer
@@ -45,19 +45,19 @@ public class MoDiscoDropAdapter extends EditingDomainViewerDropAdapter {
@Override
protected Collection<?> extractDragSource(Object object) {
- if(object instanceof ISelection)
+ if(object instanceof ISelection) {
return super.extractDragSource(ActionUtil.getAdaptedSelection((ISelection)object));
- else
+ } else {
return super.extractDragSource(object);
+ }
}
@Override
protected Object extractDropTarget(Widget item) {
Object dropTarget = super.extractDropTarget(item);
- if(dropTarget instanceof IAdaptable) {
- Object adapter = ((IAdaptable)dropTarget).getAdapter(EObject.class);
- if(adapter != null)
- return adapter;
+ EObject eObject = EMFHelper.getEObject(dropTarget);
+ if(eObject != null) {
+ return eObject;
}
return dropTarget;
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java
index a93321213d0..1d3e003df7d 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 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
@@ -20,12 +20,13 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
/**
* Utility class for Actions
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class ActionUtil {
@@ -36,7 +37,7 @@ public class ActionUtil {
* themselves. This method adapts a collections of such objects to their
* underlying EObjects, so that EMF can handle them.
* Objects that cannot be adapted remain as-is in the collection.
- *
+ *
* @param selection
* The collection to adapt
* @return
@@ -62,7 +63,7 @@ public class ActionUtil {
* themselves. This method adapts a ISelection of such objects to their
* underlying EObjects, so that EMF can handle them.
* Objects that cannot be adapted remain as-is in the selection.
- *
+ *
* @param sourceSelection
* The selection to adapt
* @return
@@ -76,12 +77,11 @@ public class ActionUtil {
Iterator<?> it = currentSelection.iterator();
while(it.hasNext()) {
Object object = it.next();
- if(object instanceof IAdaptable) {
- EObject eObject = (EObject)((IAdaptable)object).getAdapter(EObject.class);
- if(eObject != null)
- newSelection.add(eObject);
- else
- newSelection.add(object);
+ EObject eObject = EMFHelper.getEObject(object);
+ if(eObject != null) {
+ newSelection.add(eObject);
+ } else {
+ newSelection.add(object);
}
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml
index 201411fb724..120a7ce9d7d 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml
@@ -49,7 +49,7 @@
<adviceBinding
class="org.eclipse.papyrus.infra.emf.advice.DeletePageAdvice"
id="org.eclipse.papyrus.infra.emf.deletePageAdvice"
- inheritance="none"
+ inheritance="all"
typeId="*">
</adviceBinding>
<metamodelType
@@ -75,9 +75,6 @@
<elementType
ref="org.eclipse.papyrus.infra.emf.page">
</elementType>
- </binding>
- <binding
- context="org.eclipse.gmf.runtime.emf.type.core.defaultContext">
<elementType
ref="org.eclipse.papyrus.infra.emf.deletePageAdvice">
</elementType>
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/advice/DeletePageAdvice.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/advice/DeletePageAdvice.java
index 21894ef9909..8137e18e621 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/advice/DeletePageAdvice.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/advice/DeletePageAdvice.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,16 +14,17 @@ package org.eclipse.papyrus.infra.emf.advice;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
/**
* An EditHelperAdvice which applies to all Papyrus page identifiers (i.e. Tables, Diagrams, ...)
* When a page identifier object is deleted, the associated page is removed
- *
+ *
* This advice is used when an Object containing a page is deleted
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class DeletePageAdvice extends AbstractEditHelperAdvice {
@@ -37,4 +38,13 @@ public class DeletePageAdvice extends AbstractEditHelperAdvice {
return RemovePageHelper.getRemovePageCommand(request.getEditingDomain(), objectToDestroy);
}
+ @Override
+ protected ICommand getBeforeDestroyDependentsCommand(DestroyDependentsRequest request) {
+ final EObject objectToDestroy = request.getElementToDestroy();
+ if(objectToDestroy == null) {
+ return null;
+ }
+ return RemovePageHelper.getRemovePageCommand(request.getEditingDomain(), objectToDestroy);
+ }
+
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramEditHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramEditHelper.java
index 96a332820f5..5a69eaa862b 100755
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramEditHelper.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramEditHelper.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,62 +26,50 @@ import org.eclipse.gmf.runtime.common.core.command.AbstractCommand;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelper;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
/**
* Represents an Edit Helper for GMF Diagrams
+ *
* @author Laurent Wouters
*/
-public class DiagramEditHelper implements IEditHelper {
-
- /* (non-Javadoc)
- * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelper#canEdit(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest)
- */
- public boolean canEdit(IEditCommandRequest req) {
- return false;
- }
+public class DiagramEditHelper extends AbstractEditHelper {
- /* (non-Javadoc)
- * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelper#getEditCommand(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest)
- */
- public ICommand getEditCommand(final IEditCommandRequest req) {
- if (req instanceof DestroyElementRequest) {
- DestroyElementRequest r = (DestroyElementRequest)req;
- return getDestroyDiagramCommand((Diagram)r.getElementToDestroy());
- } else if (req instanceof SetRequest) {
- SetRequest r = (SetRequest)req;
- return GetSimpleSetCommand(r.getElementToEdit(), r.getFeature(), r.getValue());
- } else if (req instanceof CreateElementRequest) {
- CreateElementRequest r = (CreateElementRequest)req;
- EObject container = r.getContainer();
- if (container instanceof Diagram)
- return getCreateCommand((Diagram)container, r.getContainmentFeature(), r.getElementType());
+ @Override
+ protected ICommand getCreateCommand(CreateElementRequest req) {
+ EObject container = req.getContainer();
+ if(container instanceof Diagram) {
+ return getCreateCommand((Diagram)container, req.getContainmentFeature(), req.getElementType());
}
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelper#getContainedValues(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EReference)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelper#getContainedValues(org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.ecore.EReference)
*/
+ @Override
public List getContainedValues(EObject eContainer, EReference feature) {
throw new UnsupportedOperationException();
}
-
+
/**
* Gets the command for destroying the given diagram
- * @param diagram The diagram to destroy
+ *
+ * @param diagram
+ * The diagram to destroy
* @return The appropriate command
*/
private ICommand getDestroyDiagramCommand(final Diagram diagram) {
final Resource resource = diagram.eResource();
return new AbstractCommand("Destroy diagram") {
+
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
resource.getContents().remove(diagram);
@@ -101,18 +89,23 @@ public class DiagramEditHelper implements IEditHelper {
}
};
}
-
+
/**
* Gets the command for setting a property of a view
- * @param object The object to modify
- * @param feature The feature to modify
- * @param newValue The new value for the feature
+ *
+ * @param object
+ * The object to modify
+ * @param feature
+ * The feature to modify
+ * @param newValue
+ * The new value for the feature
* @return The appropriate command
*/
private ICommand GetSimpleSetCommand(final EObject object, final EStructuralFeature feature, final Object newValue) {
return new AbstractCommand("Edit property") {
+
private Object oldValue;
-
+
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
oldValue = object.eGet(feature);
@@ -133,29 +126,37 @@ public class DiagramEditHelper implements IEditHelper {
}
};
}
-
-
+
+
/**
* Gets the command for the creation of an element in a diagram
- * @param diagram The diagram to change
- * @param reference The containment feature
- * @param type The type of the element to be created
+ *
+ * @param diagram
+ * The diagram to change
+ * @param reference
+ * The containment feature
+ * @param type
+ * The type of the element to be created
* @return The appropriate command
*/
private ICommand getCreateCommand(final Diagram diagram, final EReference reference, final IElementType type) {
return new AbstractCommand("Create element") {
+
private EObject newElement;
+
private ModelAddData data;
-
+
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
data = PolicyChecker.getCurrent().getChildAddData(diagram, diagram.getElement().eClass(), type.getEClass());
- if (!data.isPermitted())
+ if(!data.isPermitted()) {
return CommandResult.newErrorCommandResult("The current active viewpoint policy prevents the addition of this element to the view");
+ }
newElement = type.getEClass().getEPackage().getEFactoryInstance().create(type.getEClass());
- if (data.isPathDefined()) {
- if (!data.execute(diagram.getElement(), newElement))
+ if(data.isPathDefined()) {
+ if(!data.execute(diagram.getElement(), newElement)) {
return CommandResult.newErrorCommandResult("Failed to follow the path");
+ }
} else {
diagram.getElement().eSet(reference, newElement);
}
diff --git a/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/.classpath b/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/.classpath
index 2d1a4302f04..7441b7f8c5f 100644
--- a/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/.classpath
+++ b/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/.classpath
@@ -2,6 +2,6 @@
<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 excluding="org/eclipse/papyrus/eclipse/project/editors/interfaces/IEMFFacetProjectEditor.java|org/eclipse/papyrus/eclipse/project/editors/project/EMFFacetProjectEditor.java" kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF b/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF
index 9e17e261a52..986aa259168 100644
--- a/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF
+++ b/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF
@@ -8,8 +8,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.resources,
org.eclipse.jdt.core,
org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0",
- org.eclipse.emf.facet.infra.facet,
- org.eclipse.pde.ui;bundle-version="3.6.100"
+ org.eclipse.pde.ui;bundle-version="3.6.100",
+ org.eclipse.emf.ecore;bundle-version="2.10.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.0.0.qualifier
diff --git a/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.preferences/META-INF/MANIFEST.MF b/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.preferences/META-INF/MANIFEST.MF
index b8f138e9477..a732bcc8b92 100755
--- a/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.preferences/META-INF/MANIFEST.MF
+++ b/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.preferences/META-INF/MANIFEST.MF
@@ -3,11 +3,11 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.emf.common,
org.eclipse.emf.ecore,
- org.eclipse.emf.facet.infra.common.core,
org.eclipse.papyrus.infra.core.pluginexplorer;bundle-version="1.0.0",
org.eclipse.papyrus.infra.viewpoints.iso42010;bundle-version="1.0.0",
org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0"
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0",
+ org.eclipse.core.resources;bundle-version="3.9.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.0.0.qualifier

Back to the top