Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2018-04-18 10:19:03 -0400
committerNicolas FAUVERGUE2018-05-22 11:59:19 -0400
commit9714b7607b138a564456b44221a927faeece9b6e (patch)
tree24baf74e72ae28f54feeccd99f161749910ca76c /plugins
parent35f5a0c41fc41805277fbebfc3a090077e9fd562 (diff)
downloadorg.eclipse.papyrus-9714b7607b138a564456b44221a927faeece9b6e.tar.gz
org.eclipse.papyrus-9714b7607b138a564456b44221a927faeece9b6e.tar.xz
org.eclipse.papyrus-9714b7607b138a564456b44221a927faeece9b6e.zip
Bug 533701: [Sequence Diagram] Stereotype or Shape Compartments should
not be displayed in CombinedFragments https://bugs.eclipse.org/bugs/show_bug.cgi?id=533701 Add 2 services, to support filtering generic Papyrus IViewProviders and IEditPolicyProviders. Also add a simple contribution for the Sequence Diagram, to disable Symbols compartments. Change-Id: I0d6e1af0ad4395daf3170409b5735df36dd02d46 Signed-off-by: Camille Letavernier <cletavernier@eclipsesource.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/EventListenerEditPolicyProvider.java4
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/MarkerEventListenerEditPolicyProvider.java4
-rw-r--r--plugins/infra/gmfdiag/expansion/org.eclipse.papyrus.infra.gmfdiag.expansion/src/main/java/org/eclipse/papyrus/infra/gmfdiag/expansion/expansionmodel/providers/ExpandViewProvider.java102
-rw-r--r--plugins/infra/gmfdiag/expansion/org.eclipse.papyrus.infra.gmfdiag.expansion/src/main/java/org/eclipse/papyrus/infra/gmfdiag/expansion/expansionmodel/providers/InducedRepresentationPolicyProvider.java31
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/.project5
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/.settings/org.eclipse.pde.ds.annotations.prefs8
-rwxr-xr-xplugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF8
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/OSGI-INF/org.eclipse.papyrus.infra.gmfdiag.common.internal.service.EditPolicyProviderServiceImpl.xml8
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/OSGI-INF/org.eclipse.papyrus.infra.gmfdiag.common.internal.service.ViewProviderServiceImpl.xml8
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/build.properties3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml12
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/internal/service/EditPolicyProviderServiceImpl.java41
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/internal/service/ViewProviderServiceImpl.java40
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/CustomAbstractViewProvider.java12
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/CustomEditPolicyProvider.java6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ExternalReferenceEditPolicyProvider.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/EditPolicyProviderService.java77
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/EditPolicyProviderTester.java39
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/ProviderServiceUtil.java130
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/ViewProviderService.java78
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/ViewProviderTester.java39
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/policy/CustomizableDropEditPolicyProvider.java6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/providers/HyperlinkEditPolicyProvider.java6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/provider/NavigationEditPolicyProvider.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/CommentEditPolicyProvider.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/CustomEditPolicyProvider.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.classpath7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.project33
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.settings/org.eclipse.pde.ds.annotations.prefs8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/META-INF/MANIFEST.MF15
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/OSGI-INF/org.eclipse.papyrus.uml.diagram.sequence.restrictions.SequenceEditPolicyProviderTester.xml7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/OSGI-INF/org.eclipse.papyrus.uml.diagram.sequence.restrictions.SequenceViewProviderTester.xml7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/about.html28
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/build.properties7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/pom.xml12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/src/org/eclipse/papyrus/uml/diagram/sequence/restrictions/SequenceEditPolicyProviderTester.java42
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/src/org/eclipse/papyrus/uml/diagram/sequence/restrictions/SequenceViewProviderTester.java45
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/CustomEditPolicyProvider.java7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/ShapeCompartmentViewProvider.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/ShapeEditPolicyProvider.java10
-rw-r--r--plugins/uml/diagram/pom.xml1
42 files changed, 859 insertions, 68 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/EventListenerEditPolicyProvider.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/EventListenerEditPolicyProvider.java
index 83e25a9444f..c405b974a4f 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/EventListenerEditPolicyProvider.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/EventListenerEditPolicyProvider.java
@@ -20,6 +20,7 @@ import org.eclipse.gmf.runtime.common.core.service.IOperation;
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ProviderServiceUtil;
import org.eclipse.papyrus.infra.gmfdiag.css.helper.CSSHelper;
/**
@@ -35,6 +36,9 @@ public class EventListenerEditPolicyProvider extends AbstractProvider implements
public boolean provides(IOperation operation) {
CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
EditPart editPart = epOperation.getEditPart();
+ if (!ProviderServiceUtil.isEnabled(this, editPart)) {
+ return false;
+ }
if (!(editPart instanceof GraphicalEditPart)) {
return false;
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/MarkerEventListenerEditPolicyProvider.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/MarkerEventListenerEditPolicyProvider.java
index a8e2bd07abc..e554468228c 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/MarkerEventListenerEditPolicyProvider.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/MarkerEventListenerEditPolicyProvider.java
@@ -20,6 +20,7 @@ import org.eclipse.gmf.runtime.common.core.service.IOperation;
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ProviderServiceUtil;
import org.eclipse.papyrus.infra.gmfdiag.css.helper.CSSHelper;
@@ -33,6 +34,9 @@ public class MarkerEventListenerEditPolicyProvider extends AbstractProvider impl
public boolean provides(IOperation operation) {
CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
EditPart editPart = epOperation.getEditPart();
+ if (!ProviderServiceUtil.isEnabled(this, editPart)) {
+ return false;
+ }
if (!(editPart instanceof GraphicalEditPart)) {
return false;
}
diff --git a/plugins/infra/gmfdiag/expansion/org.eclipse.papyrus.infra.gmfdiag.expansion/src/main/java/org/eclipse/papyrus/infra/gmfdiag/expansion/expansionmodel/providers/ExpandViewProvider.java b/plugins/infra/gmfdiag/expansion/org.eclipse.papyrus.infra.gmfdiag.expansion/src/main/java/org/eclipse/papyrus/infra/gmfdiag/expansion/expansionmodel/providers/ExpandViewProvider.java
index ee2abe66333..f33c8929c8f 100644
--- a/plugins/infra/gmfdiag/expansion/org.eclipse.papyrus.infra.gmfdiag.expansion/src/main/java/org/eclipse/papyrus/infra/gmfdiag/expansion/expansionmodel/providers/ExpandViewProvider.java
+++ b/plugins/infra/gmfdiag/expansion/org.eclipse.papyrus.infra.gmfdiag.expansion/src/main/java/org/eclipse/papyrus/infra/gmfdiag/expansion/expansionmodel/providers/ExpandViewProvider.java
@@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
import org.eclipse.papyrus.infra.gmfdiag.common.providers.CustomAbstractViewProvider;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ProviderServiceUtil;
import org.eclipse.papyrus.infra.gmfdiag.expansion.expansionmodel.AbstractRepresentation;
import org.eclipse.papyrus.infra.gmfdiag.expansion.expansionmodel.RepresentationKind;
import org.eclipse.papyrus.infra.gmfdiag.expansion.expansionmodel.rendering.DiagramExpansionSingleton;
@@ -35,10 +36,10 @@ import org.eclipse.papyrus.infra.tools.util.ClassLoaderHelper;
import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
/**
- *
+ *
* This class is a generic ViewProvider that is enable to create notation element by reading an expansion model
* See Requirement #Req org.eclipse.papyrus.infra.gmfdiag.expansion.Req_010
- * #Req org.eclipse.papyrus.infra.gmfdiag.expansion.Req_040
+ * #Req org.eclipse.papyrus.infra.gmfdiag.expansion.Req_040
*
*/
public class ExpandViewProvider extends CustomAbstractViewProvider implements IViewProvider {
@@ -76,44 +77,52 @@ public class ExpandViewProvider extends CustomAbstractViewProvider implements IV
@Override
protected boolean provides(CreateNodeViewOperation operation) {
+ if (!ProviderServiceUtil.isEnabled(this, operation.getContainerView())) {
+ return false;
+ }
return providesFromExpansionModel(operation);
}
+
@Override
protected boolean provides(CreateEdgeViewOperation operation) {
+ if (!ProviderServiceUtil.isEnabled(this, operation.getContainerView())) {
+ return false;
+ }
return providesFromExpansionModel(operation);
}
/**
* this method consults the expansion model to know if the view can be created in the current container.
- * @param operation the proposition of creation
+ *
+ * @param operation
+ * the proposition of creation
* @return true if the expansion model declare it, else false
*/
protected boolean providesFromExpansionModel(CreateChildViewOperation operation) {
String currentDiagramType = getDiagramType(operation.getContainerView());
- //this diagram is known as extended?
- if(diagramExpansionRegistry.mapChildreen.get(currentDiagramType)==null){
- Activator.log.trace(Activator.EXPANSION_TRACE,this.getClass().getName()+" " +currentDiagramType+ " not supported by loaded expansion model");
-
- //this diagram is unknown
+ // this diagram is known as extended?
+ if (diagramExpansionRegistry.mapChildreen.get(currentDiagramType) == null) {
+ Activator.log.trace(Activator.EXPANSION_TRACE, this.getClass().getName() + " " + currentDiagramType + " not supported by loaded expansion model");
+
+ // this diagram is unknown
return false;
}
- String graphicalType =operation.getSemanticHint();
+ String graphicalType = operation.getSemanticHint();
String containerType;
- if(operation.getContainerView() instanceof Diagram ){
- containerType=currentDiagramType;
- }
- else{
- containerType = operation.getContainerView().getType();
+ if (operation.getContainerView() instanceof Diagram) {
+ containerType = currentDiagramType;
+ } else {
+ containerType = operation.getContainerView().getType();
}
- Activator.log.trace(Activator.EXPANSION_TRACE,this.getClass().getName()+" try to create view in the container "+containerType+ " the view "+ operation.getSemanticHint()); //$NON-NLS-1$ //$NON-NLS-2$
- //get the list of childreen Id from a parent ID
- List<String> possibleChildreenIDs=diagramExpansionRegistry.mapChildreen.get(currentDiagramType).parentChildrenRelation.get(containerType);
- if(possibleChildreenIDs==null){
+ Activator.log.trace(Activator.EXPANSION_TRACE, this.getClass().getName() + " try to create view in the container " + containerType + " the view " + operation.getSemanticHint()); //$NON-NLS-1$ //$NON-NLS-2$
+ // get the list of childreen Id from a parent ID
+ List<String> possibleChildreenIDs = diagramExpansionRegistry.mapChildreen.get(currentDiagramType).parentChildrenRelation.get(containerType);
+ if (possibleChildreenIDs == null) {
return false;
}
- //the child ID is known?
- if(possibleChildreenIDs.contains(graphicalType)){
+ // the child ID is known?
+ if (possibleChildreenIDs.contains(graphicalType)) {
return true;
}
return false;
@@ -133,21 +142,20 @@ public class ExpandViewProvider extends CustomAbstractViewProvider implements IV
String currentDiagramType = getDiagramType(containerView);
// the map from the diagram ID
- if(diagramExpansionRegistry.mapChildreen.get(currentDiagramType)!=null){
- EObject eObject=diagramExpansionRegistry.mapChildreen.get(currentDiagramType).IDMap.get(graphicalType);
-
- //look for the representation and the view factory path
- if( eObject instanceof AbstractRepresentation){
- String viewFactoryPath=((AbstractRepresentation)eObject).getViewFactory();
- if( viewFactoryPath!=null&& (!"".equals(viewFactoryPath.trim()))){
- return ClassLoaderHelper.loadClass( viewFactoryPath);
- }
- else{
- RepresentationKind representationKind=((AbstractRepresentation)eObject).getKind();
- if(representationKind!=null){
- viewFactoryPath=representationKind.getViewFactory();
- if( viewFactoryPath!=null){
- return ClassLoaderHelper.loadClass( viewFactoryPath);
+ if (diagramExpansionRegistry.mapChildreen.get(currentDiagramType) != null) {
+ EObject eObject = diagramExpansionRegistry.mapChildreen.get(currentDiagramType).IDMap.get(graphicalType);
+
+ // look for the representation and the view factory path
+ if (eObject instanceof AbstractRepresentation) {
+ String viewFactoryPath = ((AbstractRepresentation) eObject).getViewFactory();
+ if (viewFactoryPath != null && (!"".equals(viewFactoryPath.trim()))) {
+ return ClassLoaderHelper.loadClass(viewFactoryPath);
+ } else {
+ RepresentationKind representationKind = ((AbstractRepresentation) eObject).getKind();
+ if (representationKind != null) {
+ viewFactoryPath = representationKind.getViewFactory();
+ if (viewFactoryPath != null) {
+ return ClassLoaderHelper.loadClass(viewFactoryPath);
}
}
}
@@ -158,20 +166,21 @@ public class ExpandViewProvider extends CustomAbstractViewProvider implements IV
/**
* get the diagram type from a view.
- * @param currentView the current view
+ *
+ * @param currentView
+ * the current view
* @return the diagram type it can be also a view point
*/
protected String getDiagramType(View currentView) {
- Diagram diagram=currentView.getDiagram();
- String currentDiagramType=null;
- ViewPrototype viewPrototype=org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getPrototype(diagram);
- if(viewPrototype!=null){
- currentDiagramType=viewPrototype.getLabel();
+ Diagram diagram = currentView.getDiagram();
+ String currentDiagramType = null;
+ ViewPrototype viewPrototype = org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getPrototype(diagram);
+ if (viewPrototype != null) {
+ currentDiagramType = viewPrototype.getLabel();
+ } else {
+ currentDiagramType = diagram.getType();
}
- else{
- currentDiagramType=diagram.getType();
- }
- diagramType=currentDiagramType;
+ diagramType = currentDiagramType;
return currentDiagramType;
}
@@ -182,11 +191,12 @@ public class ExpandViewProvider extends CustomAbstractViewProvider implements IV
protected Class<?> getEdgeViewClass(IAdaptable semanticAdapter, View containerView, String graphicalType) {
return getViewFactory(containerView, graphicalType);
}
+
/**
* {@inheritDoc}
*/
protected void initDiagramType() {
- diagramType=null;
+ diagramType = null;
}
diff --git a/plugins/infra/gmfdiag/expansion/org.eclipse.papyrus.infra.gmfdiag.expansion/src/main/java/org/eclipse/papyrus/infra/gmfdiag/expansion/expansionmodel/providers/InducedRepresentationPolicyProvider.java b/plugins/infra/gmfdiag/expansion/org.eclipse.papyrus.infra.gmfdiag.expansion/src/main/java/org/eclipse/papyrus/infra/gmfdiag/expansion/expansionmodel/providers/InducedRepresentationPolicyProvider.java
index 62548300d7b..0c0fafcb87b 100644
--- a/plugins/infra/gmfdiag/expansion/org.eclipse.papyrus.infra.gmfdiag.expansion/src/main/java/org/eclipse/papyrus/infra/gmfdiag/expansion/expansionmodel/providers/InducedRepresentationPolicyProvider.java
+++ b/plugins/infra/gmfdiag/expansion/org.eclipse.papyrus.infra.gmfdiag.expansion/src/main/java/org/eclipse/papyrus/infra/gmfdiag/expansion/expansionmodel/providers/InducedRepresentationPolicyProvider.java
@@ -21,6 +21,7 @@ import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPolicies
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ProviderServiceUtil;
import org.eclipse.papyrus.infra.gmfdiag.expansion.expansionmodel.rendering.DiagramExpansionSingleton;
import org.eclipse.papyrus.infra.gmfdiag.expansion.expansionmodel.rendering.DiagramExpansionsRegistry;
import org.eclipse.papyrus.infra.gmfdiag.expansion.expansionmodel.rendering.InducedRepresentationCreationEditPolicy;
@@ -34,7 +35,7 @@ import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
public class InducedRepresentationPolicyProvider extends AbstractProvider implements IEditPolicyProvider {
- private DiagramExpansionsRegistry diagramExpansionRegistry=null;
+ private DiagramExpansionsRegistry diagramExpansionRegistry = null;
/**
* Constructor.
@@ -46,40 +47,46 @@ public class InducedRepresentationPolicyProvider extends AbstractProvider implem
/**
* get the diagram type from a view.
- * @param currentView the current view
+ *
+ * @param currentView
+ * the current view
* @return the diagram type it can be also a view point
*/
protected String getDiagramType(View currentView) {
- Diagram diagram=currentView.getDiagram();
- String currentDiagramType=null;
- ViewPrototype viewPrototype=org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getPrototype(diagram);
- if(viewPrototype!=null){
- currentDiagramType=viewPrototype.getLabel();
- }
- else{
- currentDiagramType=diagram.getType();
+ Diagram diagram = currentView.getDiagram();
+ String currentDiagramType = null;
+ ViewPrototype viewPrototype = org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getPrototype(diagram);
+ if (viewPrototype != null) {
+ currentDiagramType = viewPrototype.getLabel();
+ } else {
+ currentDiagramType = diagram.getType();
}
return currentDiagramType;
}
+
/**
* {@inheritDoc}
*/
@Override
public boolean provides(IOperation operation) {
CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
+ if (!ProviderServiceUtil.isEnabled(this, epOperation.getEditPart())) {
+ return false;
+ }
if (!(epOperation.getEditPart() instanceof IGraphicalEditPart)) {
return false;
}
// Make sure this concern Block Definition Diagram only
IGraphicalEditPart gep = (IGraphicalEditPart) epOperation.getEditPart();
- String diagramType=getDiagramType(gep.getNotationView());
- if(diagramExpansionRegistry.mapChildreen.get(diagramType)!=null){
+ String diagramType = getDiagramType(gep.getNotationView());
+ if (diagramExpansionRegistry.mapChildreen.get(diagramType) != null) {
return true;
}
return false;
}
+
/**
* {@inheritDoc}
*/
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/.project b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/.project
index 05fd2ab6c76..74df1fb5be0 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/.project
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/.project
@@ -46,6 +46,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/.settings/org.eclipse.pde.ds.annotations.prefs b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/.settings/org.eclipse.pde.ds.annotations.prefs
new file mode 100644
index 00000000000..73a356b6d05
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/.settings/org.eclipse.pde.ds.annotations.prefs
@@ -0,0 +1,8 @@
+classpath=true
+dsVersion=V1_3
+eclipse.preferences.version=1
+enabled=true
+generateBundleActivationPolicyLazy=true
+path=OSGI-INF
+validationErrorLevel=error
+validationErrorLevel.missingImplicitUnbindMethod=error
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF
index bef69e99cdd..7fc026b8a63 100755
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF
@@ -4,8 +4,7 @@ Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.common;singleton:=true
Bundle-Version: 3.100.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle:
- org.eclipse.emf.ecore.edit;bundle-version="[2.9.0,3.0.0)",
+Require-Bundle: org.eclipse.emf.ecore.edit;bundle-version="[2.9.0,3.0.0)",
org.eclipse.gmf.runtime.diagram.ui.resources.editor;bundle-version="[1.7.0,2.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.emf.appearance;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
@@ -89,5 +88,8 @@ Export-Package: org.eclipse.papyrus.infra.gmfdiag.common,
org.eclipse.papyrus.infra.gmfdiag.internal.common.model;x-internal:=true
Import-Package: com.google.common.base;version="21.0.0",
com.google.common.collect;version="21.0.0",
- com.google.common.util.concurrent;version="21.0.0"
+ com.google.common.util.concurrent;version="21.0.0",
+ org.osgi.service.component.annotations;version="1.3.0";resolution:=optional
+Service-Component: OSGI-INF/org.eclipse.papyrus.infra.gmfdiag.common.internal.service.EditPolicyProviderServiceImpl.xml,
+ OSGI-INF/org.eclipse.papyrus.infra.gmfdiag.common.internal.service.ViewProviderServiceImpl.xml
Automatic-Module-Name: org.eclipse.papyrus.infra.gmfdiag.common
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/OSGI-INF/org.eclipse.papyrus.infra.gmfdiag.common.internal.service.EditPolicyProviderServiceImpl.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/OSGI-INF/org.eclipse.papyrus.infra.gmfdiag.common.internal.service.EditPolicyProviderServiceImpl.xml
new file mode 100644
index 00000000000..20616bc68ae
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/OSGI-INF/org.eclipse.papyrus.infra.gmfdiag.common.internal.service.EditPolicyProviderServiceImpl.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.papyrus.infra.gmfdiag.common.internal.service.EditPolicyProviderServiceImpl">
+ <service>
+ <provide interface="org.eclipse.papyrus.infra.gmfdiag.common.service.EditPolicyProviderService"/>
+ </service>
+ <reference bind="registerTester" interface="org.eclipse.papyrus.infra.gmfdiag.common.service.EditPolicyProviderTester" name="registerTester"/>
+ <implementation class="org.eclipse.papyrus.infra.gmfdiag.common.internal.service.EditPolicyProviderServiceImpl"/>
+</scr:component> \ No newline at end of file
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/OSGI-INF/org.eclipse.papyrus.infra.gmfdiag.common.internal.service.ViewProviderServiceImpl.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/OSGI-INF/org.eclipse.papyrus.infra.gmfdiag.common.internal.service.ViewProviderServiceImpl.xml
new file mode 100644
index 00000000000..f9fb788e860
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/OSGI-INF/org.eclipse.papyrus.infra.gmfdiag.common.internal.service.ViewProviderServiceImpl.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.papyrus.infra.gmfdiag.common.internal.service.ViewProviderServiceImpl">
+ <service>
+ <provide interface="org.eclipse.papyrus.infra.gmfdiag.common.service.ViewProviderService"/>
+ </service>
+ <reference bind="registerTester" interface="org.eclipse.papyrus.infra.gmfdiag.common.service.ViewProviderTester" name="registerTester"/>
+ <implementation class="org.eclipse.papyrus.infra.gmfdiag.common.internal.service.ViewProviderServiceImpl"/>
+</scr:component> \ No newline at end of file
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/build.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/build.properties
index a1b5cb5e1a2..b9f2a05f653 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/build.properties
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/build.properties
@@ -8,7 +8,8 @@ bin.includes = .options,\
plugin.xml,\
schema/,\
icons/,\
- model/
+ model/,\
+ OSGI-INF/
output.. = bin/
jars.compile.order=.
src.includes = about.html
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
index c45d6968703..60026473a38 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
@@ -127,6 +127,18 @@
priority="1"
startKind="lazy">
</service>
+ <serviceFactory
+ classname="org.eclipse.papyrus.infra.gmfdiag.common.service.ViewProviderService$Factory"
+ id="org.eclipse.papyrus.infra.gmfdiag.common.service.ViewProviderService"
+ priority="1"
+ startKind="lazy">
+ </serviceFactory>
+ <serviceFactory
+ classname="org.eclipse.papyrus.infra.gmfdiag.common.service.EditPolicyProviderService$Factory"
+ id="org.eclipse.papyrus.infra.gmfdiag.common.service.EditPolicyProviderService"
+ priority="1"
+ startKind="lazy">
+ </serviceFactory>
</extension>
<extension
point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider">
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/internal/service/EditPolicyProviderServiceImpl.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/internal/service/EditPolicyProviderServiceImpl.java
new file mode 100644
index 00000000000..ad13bf561cc
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/internal/service/EditPolicyProviderServiceImpl.java
@@ -0,0 +1,41 @@
+/*****************************************************************************
+ * Copyright (c) 2018 EclipseSource and others.
+ *
+ * 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:
+ * EclipseSource - Initial API and implementation (Bug 533701)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.internal.service;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.EditPolicyProviderService;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.EditPolicyProviderTester;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+
+import com.google.common.base.Predicates;
+
+@Component
+public class EditPolicyProviderServiceImpl implements EditPolicyProviderService {
+
+ private Set<EditPolicyProviderTester> testers = new HashSet<>();
+
+ @Override
+ public boolean isEnabled(IEditPolicyProvider provider, EditPart editPart) {
+ return testers.stream().map(tester -> tester.isEnabled(provider, editPart)).noneMatch(Predicates.equalTo(Boolean.FALSE));
+ }
+
+ @Reference
+ public void registerTester(EditPolicyProviderTester tester) {
+ testers.add(tester);
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/internal/service/ViewProviderServiceImpl.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/internal/service/ViewProviderServiceImpl.java
new file mode 100644
index 00000000000..64b6ed738ae
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/internal/service/ViewProviderServiceImpl.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2018 EclipseSource and others.
+ *
+ * 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:
+ * EclipseSource - Initial API and implementation (Bug 533701)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.internal.service;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.gmf.runtime.diagram.core.providers.IViewProvider;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ViewProviderService;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ViewProviderTester;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+
+@Component
+public class ViewProviderServiceImpl implements ViewProviderService {
+
+ private Set<ViewProviderTester> testers = new HashSet<>();
+
+ @Override
+ public boolean isEnabled(IViewProvider provider, View view) {
+ return testers.stream().map(tester -> tester.isEnabled(provider, view)).reduce(true, Boolean::logicalAnd);
+ }
+
+ @Reference
+ public void registerTester(ViewProviderTester tester) {
+ testers.add(tester);
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/CustomAbstractViewProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/CustomAbstractViewProvider.java
index eb02c910275..055aa16e510 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/CustomAbstractViewProvider.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/CustomAbstractViewProvider.java
@@ -24,6 +24,7 @@ import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ProviderServiceUtil;
import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
/**
@@ -61,6 +62,9 @@ public abstract class CustomAbstractViewProvider extends AbstractViewProvider {
*/
@Override
protected boolean provides(CreateViewForKindOperation op) {
+ if (!ProviderServiceUtil.isEnabled(this, op.getContainerView())) {
+ return false;
+ }
if (!isRelevantDiagram(op.getContainerView().getDiagram())) {
return false;
}
@@ -81,6 +85,9 @@ public abstract class CustomAbstractViewProvider extends AbstractViewProvider {
*/
@Override
protected boolean provides(CreateEdgeViewOperation operation) {
+ if (!ProviderServiceUtil.isEnabled(this, operation.getContainerView())) {
+ return false;
+ }
if (!isRelevantDiagram(operation.getContainerView().getDiagram())) {
return false;
}
@@ -93,6 +100,9 @@ public abstract class CustomAbstractViewProvider extends AbstractViewProvider {
*/
@Override
protected boolean provides(CreateNodeViewOperation operation) {
+ if (!ProviderServiceUtil.isEnabled(this, operation.getContainerView())) {
+ return false;
+ }
if (!isRelevantDiagram(operation.getContainerView().getDiagram())) {
return false;
}
@@ -138,7 +148,7 @@ public abstract class CustomAbstractViewProvider extends AbstractViewProvider {
/**
* This method is used to know id the diagram is conform to type, it may be a prototype view, or a generatedDiagram
- *
+ *
* @param diagram
* @return
*/
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/CustomEditPolicyProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/CustomEditPolicyProvider.java
index d3d717f2201..b3923d22860 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/CustomEditPolicyProvider.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/CustomEditPolicyProvider.java
@@ -23,6 +23,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.HighlightEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ProviderServiceUtil;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
/**
@@ -70,8 +71,11 @@ public class CustomEditPolicyProvider implements IEditPolicyProvider {
* {@inheritDoc}
*/
@Override
- public boolean provides(IOperation operation) {
+ public boolean provides(IOperation operation) {
CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
+ if (!ProviderServiceUtil.isEnabled(this, epOperation.getEditPart())) {
+ return false;
+ }
try {
EditPart editPart = epOperation.getEditPart();
if (!(editPart instanceof GraphicalEditPart)) {
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ExternalReferenceEditPolicyProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ExternalReferenceEditPolicyProvider.java
index 39dd468c4b0..df832001fad 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ExternalReferenceEditPolicyProvider.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ExternalReferenceEditPolicyProvider.java
@@ -19,6 +19,7 @@ import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvide
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalReferenceEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ProviderServiceUtil;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
/**
@@ -35,6 +36,9 @@ public class ExternalReferenceEditPolicyProvider extends AbstractProvider implem
public boolean provides(IOperation operation) {
if (operation instanceof CreateEditPoliciesOperation) {
CreateEditPoliciesOperation createOperation = (CreateEditPoliciesOperation) operation;
+ if (!ProviderServiceUtil.isEnabled(this, createOperation.getEditPart())) {
+ return false;
+ }
try {
if (ServiceUtilsForEditPart.getInstance().getServiceRegistry(createOperation.getEditPart()) != null) {
return createOperation.getEditPart().getModel() instanceof Node;
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/EditPolicyProviderService.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/EditPolicyProviderService.java
new file mode 100644
index 00000000000..ed026605c72
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/EditPolicyProviderService.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2018 EclipseSource and others.
+ *
+ * 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:
+ * EclipseSource - Initial API and implementation (Bug 533701)
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.common.service;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
+import org.eclipse.papyrus.infra.core.services.IServiceFactory;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * <p>
+ * A service used to increase the control diagrams have over the {@link IEditPolicyProvider}
+ * that should be enabled in that diagram. All generic Papyrus {@link IEditPolicyProvider} are expected to use this
+ * service before deciding if they should indeed be enabled.
+ * </p>
+ * <p>
+ * Note that this service is here to provide an additional pre-check to determine if a
+ * provider is allowed to work in a specific diagram. However, this service knows nothing
+ * about the internal requirements/dependencies of a specific provider, and should not
+ * <strong>replace</strong> the {@link IEditPolicyProvider#provides(org.eclipse.gmf.runtime.common.core.service.IOperation)}
+ * method (i.e. the actual provider is still expected to run its own checks, in addition
+ * to calling this service).
+ * </p>
+ *
+ * @since 3.100
+ */
+public interface EditPolicyProviderService {
+
+ /**
+ * Tests whether the given provider is allowed in the context of that edit part
+ *
+ * @param provider
+ * @param editPart
+ * @return
+ */
+ boolean isEnabled(IEditPolicyProvider provider, EditPart editPart);
+
+ public static class Factory implements IServiceFactory {
+
+ @Override
+ public void init(ServicesRegistry servicesRegistry) throws ServiceException {
+ // Nothing
+ }
+
+ @Override
+ public void startService() throws ServiceException {
+ // Nothing
+ }
+
+ @Override
+ public void disposeService() throws ServiceException {
+ // Nothing
+ }
+
+ @Override
+ public EditPolicyProviderService createServiceInstance() throws ServiceException {
+ BundleContext bundleContext = FrameworkUtil.getBundle(Factory.class).getBundleContext();
+ ServiceReference<EditPolicyProviderService> serviceReference = bundleContext.getServiceReference(EditPolicyProviderService.class);
+ return bundleContext.getService(serviceReference);
+ }
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/EditPolicyProviderTester.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/EditPolicyProviderTester.java
new file mode 100644
index 00000000000..7bfd7ad94dc
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/EditPolicyProviderTester.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2018 EclipseSource and others.
+ *
+ * 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:
+ * EclipseSource - Initial API and implementation (Bug 533701)
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.common.service;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
+
+/**
+ * <p>
+ * A contribution to the {@link EditPolicyProviderService}
+ * </p>
+ *
+ * @since 3.100
+ */
+public interface EditPolicyProviderTester {
+
+ /**
+ * Tests whether the given provider is allowed in the context of that edit part
+ *
+ * @param provider
+ * @param editPart
+ * @return
+ * <code>false</code> if this tester explicitly rejects this provider in the context of that edit part;
+ * <code>true</code> otherwise.
+ */
+ boolean isEnabled(IEditPolicyProvider provider, EditPart editPart);
+}
+
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/ProviderServiceUtil.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/ProviderServiceUtil.java
new file mode 100644
index 00000000000..adbbcde0f5e
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/ProviderServiceUtil.java
@@ -0,0 +1,130 @@
+/*****************************************************************************
+ * Copyright (c) 2018 EclipseSource and others.
+ *
+ * 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:
+ * EclipseSource - Initial API and implementation (Bug 533701)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.service;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.core.providers.IViewProvider;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
+
+/**
+ * <p>
+ * Utility methods to use the {@link ViewProviderService} and {@link EditPolicyProviderService}
+ * </p>
+ *
+ * @since 3.100
+ */
+public class ProviderServiceUtil {
+
+ /**
+ * <p>
+ * Tests if the given edit part is a Papyrus Edit Part, by testing if a Papyrus {@link ServicesRegistry}
+ * is present.
+ * </p>
+ *
+ * @param editPart
+ * The edit part to test
+ * @return
+ * <code>true</code> if this edit part is part of a Papyrus environment (Using a Papyrus {@link ServicesRegistry}), <code>false</code> otherwise
+ */
+ public static boolean isPapyrusPart(EditPart editPart) {
+ try {
+ return ServiceUtilsForEditPart.getInstance().getServiceRegistry(editPart) != null;
+ } catch (Exception ex) {
+ // Ignore & return
+ return false;
+ }
+ }
+
+ /**
+ * <p>
+ * Tests if the given View is a Papyrus View, by testing if a Papyrus {@link ServicesRegistry}
+ * is present.
+ * </p>
+ *
+ * @param view
+ * The view to test
+ * @return
+ * <code>true</code> if this view is part of a Papyrus environment (Using a Papyrus {@link ServicesRegistry}), <code>false</code> otherwise
+ */
+ public static boolean isPapyrusView(View view) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getServiceRegistry(view) != null;
+ } catch (Exception ex) {
+ // Ignore & return
+ return false;
+ }
+ }
+
+ /**
+ * <p>
+ * Helper method to use the {@link ViewProviderService}.
+ * </p>
+ * <p>
+ * This methods verifies that the edit part is a Papyrus Edit Part (Via {@link #isPapyrusPart(EditPart)}),
+ * and then calls {@link ViewProviderService#isEnabled(IViewProvider, EditPart)}
+ * </p>
+ *
+ * @param provider
+ * @param editPart
+ * @return
+ *
+ * @see ViewProviderService#isEnabled(IViewProvider, EditPart)
+ */
+ public static boolean isEnabled(IViewProvider provider, View view) {
+ if (isPapyrusView(view)) {
+ try {
+ ViewProviderService service = ServiceUtilsForEObject.getInstance().getService(ViewProviderService.class, view);
+ return service.isEnabled(provider, view);
+ } catch (Exception ex) {
+ // Ignore & return
+ return false;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * <p>
+ * Helper method to use the {@link EditPolicyProviderService}.
+ * </p>
+ * <p>
+ * This methods verifies that the edit part is a Papyrus Edit Part (Via {@link #isPapyrusPart(EditPart)}),
+ * and then calls {@link EditPolicyProviderService#isEnabled(IEditPolicyProvider, EditPart)}
+ * </p>
+ *
+ * @param provider
+ * @param editPart
+ * @return
+ *
+ * @see {@link EditPolicyProviderService#isEnabled(IEditPolicyProvider, EditPart)}
+ */
+ public static boolean isEnabled(IEditPolicyProvider provider, EditPart editPart) {
+ if (isPapyrusPart(editPart)) {
+ try {
+ EditPolicyProviderService service = ServiceUtilsForEditPart.getInstance().getService(EditPolicyProviderService.class, editPart);
+ return service.isEnabled(provider, editPart);
+ } catch (Exception ex) {
+ // Ignore & return
+ return false;
+ }
+ }
+
+ return false;
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/ViewProviderService.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/ViewProviderService.java
new file mode 100644
index 00000000000..7a16c39b72b
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/ViewProviderService.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * Copyright (c) 2018 EclipseSource and others.
+ *
+ * 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:
+ * EclipseSource - Initial API and implementation (Bug 533701)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.service;
+
+import org.eclipse.gmf.runtime.diagram.core.providers.IViewProvider;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.services.IServiceFactory;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * <p>
+ * A service used to increase the control diagrams have over the {@link IViewProvider}
+ * that should be enabled in that diagram. All generic Papyrus {@link IViewProvider} are expected to use this
+ * service before deciding if they should indeed be enabled.
+ * </p>
+ * <p>
+ * Note that this service is here to provide an additional pre-check to determine if a
+ * provider is allowed to work in a specific diagram. However, this service knows nothing
+ * about the internal requirements/dependencies of a specific provider, and should not
+ * <strong>replace</strong> the {@link IViewProvider#provides(org.eclipse.gmf.runtime.common.core.service.IOperation)}
+ * method (i.e. the actual provider is still expected to run its own checks, in addition
+ * to calling this service).
+ * </p>
+ *
+ * @since 3.100
+ */
+public interface ViewProviderService {
+ /**
+ * Tests whether the given provider is allowed in the context of that view
+ *
+ * @param provider
+ * @param view
+ * @return
+ */
+ boolean isEnabled(IViewProvider provider, View view);
+
+
+
+ public static class Factory implements IServiceFactory {
+
+ @Override
+ public void init(ServicesRegistry servicesRegistry) throws ServiceException {
+ // Nothing
+ }
+
+ @Override
+ public void startService() throws ServiceException {
+ // Nothing
+ }
+
+ @Override
+ public void disposeService() throws ServiceException {
+ // Nothing
+ }
+
+ @Override
+ public ViewProviderService createServiceInstance() throws ServiceException {
+ BundleContext bundleContext = FrameworkUtil.getBundle(Factory.class).getBundleContext();
+ ServiceReference<ViewProviderService> serviceReference = bundleContext.getServiceReference(ViewProviderService.class);
+ return bundleContext.getService(serviceReference);
+ }
+
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/ViewProviderTester.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/ViewProviderTester.java
new file mode 100644
index 00000000000..f2928331534
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/ViewProviderTester.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2018 EclipseSource and others.
+ *
+ * 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:
+ * EclipseSource - Initial API and implementation (Bug 533701)
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.common.service;
+
+import org.eclipse.gmf.runtime.diagram.core.providers.IViewProvider;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * <p>
+ * A contribution to the {@link ViewProviderService}
+ * </p>
+ *
+ * @since 3.100
+ */
+public interface ViewProviderTester {
+
+ /**
+ * Tests whether the given provider is allowed in the context of that edit part
+ *
+ * @param provider
+ * @param editPart
+ * @return
+ * <code>false</code> if this tester explicitly rejects this provider in the context of that edit part;
+ * <code>true</code> otherwise.
+ */
+ boolean isEnabled(IViewProvider provider, View view);
+}
+
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/policy/CustomizableDropEditPolicyProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/policy/CustomizableDropEditPolicyProvider.java
index 117555e8eff..24535b8498a 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/policy/CustomizableDropEditPolicyProvider.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/policy/CustomizableDropEditPolicyProvider.java
@@ -20,13 +20,18 @@ import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPolicies
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ProviderServiceUtil;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
public class CustomizableDropEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider {
+ @Override
public boolean provides(IOperation operation) {
CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
+ if (!ProviderServiceUtil.isEnabled(this, epOperation.getEditPart())) {
+ return false;
+ }
try {
ServicesRegistry registry = ServiceUtilsForEditPart.getInstance().getServiceRegistry(epOperation.getEditPart());
@@ -36,6 +41,7 @@ public class CustomizableDropEditPolicyProvider extends AbstractProvider impleme
}
}
+ @Override
public void createEditPolicies(EditPart editPart) {
EditPolicy defaultDropEditPolicy = editPart.getEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE);
EditPolicy defaultCreationEditPolicy = editPart.getEditPolicy(EditPolicyRoles.CREATION_ROLE);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/providers/HyperlinkEditPolicyProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/providers/HyperlinkEditPolicyProvider.java
index 10fab80d91b..198f033b389 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/providers/HyperlinkEditPolicyProvider.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/providers/HyperlinkEditPolicyProvider.java
@@ -22,6 +22,7 @@ import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPolicies
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ProviderServiceUtil;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
import org.eclipse.papyrus.infra.gmfdiag.hyperlink.editpolicies.HyperlinkNavigationMenuEditPolicy;
@@ -38,10 +39,14 @@ public class HyperlinkEditPolicyProvider extends AbstractProvider implements IEd
*
* This provider can handle GraphicalEditParts
*/
+ @Override
public boolean provides(IOperation operation) {
if (operation instanceof CreateEditPoliciesOperation) {
CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
EditPart editPart = epOperation.getEditPart();
+ if (!ProviderServiceUtil.isEnabled(this, editPart)) {
+ return false;
+ }
try {
ServicesRegistry registry = ServiceUtilsForEditPart.getInstance().getServiceRegistry(editPart);
if (registry == null) {
@@ -63,6 +68,7 @@ public class HyperlinkEditPolicyProvider extends AbstractProvider implements IEd
*
* Installs the Hyperlink and Navigation edit policies
*/
+ @Override
public void createEditPolicies(EditPart editPart) {
editPart.installEditPolicy(org.eclipse.papyrus.infra.gmfdiag.navigation.editpolicy.NavigationEditPolicy.EDIT_POLICY_ID, new HyperlinkNavigationMenuEditPolicy());
editPart.installEditPolicy(org.eclipse.papyrus.infra.gmfdiag.hyperlink.editpolicies.NavigationEditPolicy.NAVIGATION_POLICY, new org.eclipse.papyrus.infra.gmfdiag.hyperlink.editpolicies.NavigationEditPolicy());
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/provider/NavigationEditPolicyProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/provider/NavigationEditPolicyProvider.java
index 41bb3fce0fa..5526653b7f9 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/provider/NavigationEditPolicyProvider.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.navigation/src/org/eclipse/papyrus/infra/gmfdiag/navigation/provider/NavigationEditPolicyProvider.java
@@ -16,6 +16,7 @@ import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
import org.eclipse.gmf.runtime.common.core.service.IOperation;
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ProviderServiceUtil;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
import org.eclipse.papyrus.infra.gmfdiag.navigation.editpolicy.NavigationEditPolicy;
import org.eclipse.papyrus.infra.services.navigation.service.NavigationService;
@@ -28,6 +29,9 @@ public class NavigationEditPolicyProvider extends AbstractProvider implements IE
CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
EditPart editPart = epOperation.getEditPart();
+ if (!ProviderServiceUtil.isEnabled(this, editPart)) {
+ return false;
+ }
try {
NavigationService navigationService = ServiceUtilsForEditPart.getInstance().getService(NavigationService.class, editPart);
return navigationService != null;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/CommentEditPolicyProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/CommentEditPolicyProvider.java
index 5a5c0c9ab92..bcf1781579d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/CommentEditPolicyProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/CommentEditPolicyProvider.java
@@ -21,6 +21,7 @@ import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPolicies
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ProviderServiceUtil;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AbstractNameReferencesListenerEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CommentReferencesListenerEditPolicy;
import org.eclipse.papyrus.uml.tools.utils.UMLUtil;
@@ -38,6 +39,9 @@ public class CommentEditPolicyProvider extends AbstractProvider implements IEdit
@Override
public boolean provides(IOperation operation) {
CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
+ if (!ProviderServiceUtil.isEnabled(this, epOperation.getEditPart())) {
+ return false;
+ }
Element element = UMLUtil.resolveUMLElement(epOperation.getEditPart());
if (!(element instanceof Comment)) {
return false;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/CustomEditPolicyProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/CustomEditPolicyProvider.java
index 82506653ac6..8f770c24028 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/CustomEditPolicyProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/CustomEditPolicyProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2015 CEA LIST and others.
- *
+ *
* 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
@@ -8,7 +8,7 @@
*
* Contributors:
* Fanch Bonnabesse (ALL4TEC) fanch.bonnabesse@alltec.net - Bug 419357
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.providers;
@@ -21,6 +21,7 @@ import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPolicies
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ProviderServiceUtil;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomDefaultSemanticEditPolicy;
/**
@@ -35,6 +36,9 @@ public class CustomEditPolicyProvider extends AbstractProvider implements IEditP
public boolean provides(final IOperation operation) {
if (operation instanceof CreateEditPoliciesOperation) {
final EditPart editPart = ((CreateEditPoliciesOperation) operation).getEditPart();
+ if (!ProviderServiceUtil.isEnabled(this, editPart)) {
+ return false;
+ }
if (editPart instanceof NodeEditPart) {
final EditPolicy editPolicy = editPart.getEditPolicy(EditPolicyRoles.SEMANTIC_ROLE);
if (null != editPolicy) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.classpath b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.classpath
new file mode 100644
index 00000000000..eca7bdba8f0
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.classpath
@@ -0,0 +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/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.project b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.project
new file mode 100644
index 00000000000..e6d127a09a4
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.uml.diagram.sequence.restrictions</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.settings/org.eclipse.jdt.core.prefs b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..0c68a61dca8
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.settings/org.eclipse.pde.ds.annotations.prefs b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.settings/org.eclipse.pde.ds.annotations.prefs
new file mode 100644
index 00000000000..73a356b6d05
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/.settings/org.eclipse.pde.ds.annotations.prefs
@@ -0,0 +1,8 @@
+classpath=true
+dsVersion=V1_3
+eclipse.preferences.version=1
+enabled=true
+generateBundleActivationPolicyLazy=true
+path=OSGI-INF
+validationErrorLevel=error
+validationErrorLevel.missingImplicitUnbindMethod=error
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..2c9c9d70ad4
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SequenceDiagram Restrictions
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.sequence.restrictions
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: Eclipse Modeling Project
+Automatic-Module-Name: org.eclipse.papyrus.uml.diagram.sequence.restrictions
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
+Service-Component: OSGI-INF/org.eclipse.papyrus.uml.diagram.sequence.restrictions.SequenceEditPolicyProviderTester.xml,
+ OSGI-INF/org.eclipse.papyrus.uml.diagram.sequence.restrictions.SequenceViewProviderTester.xml
+Require-Bundle: org.eclipse.papyrus.uml.diagram.sequence;bundle-version="5.0.0",
+ org.eclipse.papyrus.infra.gmfdiag.common,
+ org.eclipse.papyrus.uml.diagram.symbols;bundle-version="1.2.0"
+Import-Package: org.osgi.service.component.annotations;version="1.3.0";resolution:=optional
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/OSGI-INF/org.eclipse.papyrus.uml.diagram.sequence.restrictions.SequenceEditPolicyProviderTester.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/OSGI-INF/org.eclipse.papyrus.uml.diagram.sequence.restrictions.SequenceEditPolicyProviderTester.xml
new file mode 100644
index 00000000000..f45599187af
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/OSGI-INF/org.eclipse.papyrus.uml.diagram.sequence.restrictions.SequenceEditPolicyProviderTester.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.papyrus.uml.diagram.sequence.restrictions.SequenceEditPolicyProviderTester">
+ <service>
+ <provide interface="org.eclipse.papyrus.infra.gmfdiag.common.service.EditPolicyProviderTester"/>
+ </service>
+ <implementation class="org.eclipse.papyrus.uml.diagram.sequence.restrictions.SequenceEditPolicyProviderTester"/>
+</scr:component> \ No newline at end of file
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/OSGI-INF/org.eclipse.papyrus.uml.diagram.sequence.restrictions.SequenceViewProviderTester.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/OSGI-INF/org.eclipse.papyrus.uml.diagram.sequence.restrictions.SequenceViewProviderTester.xml
new file mode 100644
index 00000000000..a7f239b7d7a
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/OSGI-INF/org.eclipse.papyrus.uml.diagram.sequence.restrictions.SequenceViewProviderTester.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.papyrus.uml.diagram.sequence.restrictions.SequenceViewProviderTester">
+ <service>
+ <provide interface="org.eclipse.papyrus.infra.gmfdiag.common.service.ViewProviderTester"/>
+ </service>
+ <implementation class="org.eclipse.papyrus.uml.diagram.sequence.restrictions.SequenceViewProviderTester"/>
+</scr:component> \ No newline at end of file
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/about.html b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/about.html
new file mode 100644
index 00000000000..d35d5aed64c
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) 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 <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/build.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/build.properties
new file mode 100644
index 00000000000..30c35d74ee2
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/,\
+ about.html
+src.includes = about.html
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/pom.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/pom.xml
new file mode 100644
index 00000000000..906786fae58
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/pom.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.uml-diagrams</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.uml.diagram.sequence.restrictions</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/src/org/eclipse/papyrus/uml/diagram/sequence/restrictions/SequenceEditPolicyProviderTester.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/src/org/eclipse/papyrus/uml/diagram/sequence/restrictions/SequenceEditPolicyProviderTester.java
new file mode 100644
index 00000000000..6acb2792bcf
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/src/org/eclipse/papyrus/uml/diagram/sequence/restrictions/SequenceEditPolicyProviderTester.java
@@ -0,0 +1,42 @@
+/*****************************************************************************
+ * Copyright (c) 2018 EclipseSource and others.
+ *
+ * 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:
+ * EclipseSource - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.sequence.restrictions;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.RootEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.EditPolicyProviderTester;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.SequenceDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.symbols.provider.ShapeEditPolicyProvider;
+import org.osgi.service.component.annotations.Component;
+
+@Component
+public class SequenceEditPolicyProviderTester implements EditPolicyProviderTester {
+
+ @Override
+ public boolean isEnabled(IEditPolicyProvider provider, EditPart editPart) {
+ if (isSequenceDiagram(editPart)) {
+ if (provider instanceof ShapeEditPolicyProvider) {
+ return false;
+ }
+ return true;
+ }
+ return true;
+ }
+
+ private boolean isSequenceDiagram(EditPart editPart) {
+ RootEditPart root = editPart.getRoot();
+ return root != null && root.getContents() instanceof SequenceDiagramEditPart;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/src/org/eclipse/papyrus/uml/diagram/sequence/restrictions/SequenceViewProviderTester.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/src/org/eclipse/papyrus/uml/diagram/sequence/restrictions/SequenceViewProviderTester.java
new file mode 100644
index 00000000000..438a3357232
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.restrictions/src/org/eclipse/papyrus/uml/diagram/sequence/restrictions/SequenceViewProviderTester.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2018 EclipseSource and others.
+ *
+ * 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:
+ * EclipseSource - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.sequence.restrictions;
+
+import org.eclipse.gmf.runtime.diagram.core.providers.IViewProvider;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ViewProviderTester;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.SequenceDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.symbols.provider.ShapeCompartmentViewProvider;
+import org.osgi.service.component.annotations.Component;
+
+@Component
+public class SequenceViewProviderTester implements ViewProviderTester {
+
+ @Override
+ public boolean isEnabled(IViewProvider provider, View view) {
+ if (isSequenceDiagram(view)) {
+ if (provider instanceof ShapeCompartmentViewProvider) {
+ return false;
+ }
+ return true;
+ }
+ return true;
+ }
+
+ private boolean isSequenceDiagram(View view) {
+ // XXX Should we use Architecture? We probably want to restrain only what we
+ // know,
+ // and let extension plug-ins provide their own restrictions if they need to.
+ Diagram diagram = view.getDiagram();
+ return diagram != null && SequenceDiagramEditPart.MODEL_ID.equals(diagram.getType());
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/CustomEditPolicyProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/CustomEditPolicyProvider.java
index f6dfd08d726..c36ef86bcd9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/CustomEditPolicyProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/CustomEditPolicyProvider.java
@@ -24,6 +24,7 @@ import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvide
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ProviderServiceUtil;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractCommentEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
@@ -44,6 +45,7 @@ public class CustomEditPolicyProvider extends AbstractProvider implements IEditP
*
* {@inheritDoc}
*/
+ @Override
public void createEditPolicies(EditPart editPart) {
if (editPart instanceof IPapyrusEditPart) {
if (!(editPart instanceof AppliedStereotypeMultilinePropertyEditPart)) {
@@ -71,8 +73,13 @@ public class CustomEditPolicyProvider extends AbstractProvider implements IEditP
*
* {@inheritDoc}
*/
+ @Override
public boolean provides(IOperation operation) {
CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
+ if (!ProviderServiceUtil.isEnabled(this, epOperation.getEditPart())) {
+ return false;
+ }
+
if (!(epOperation.getEditPart() instanceof GraphicalEditPart) && !(epOperation.getEditPart() instanceof ConnectionEditPart)) {
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/ShapeCompartmentViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/ShapeCompartmentViewProvider.java
index 6eb8fd16420..9d85d27aac4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/ShapeCompartmentViewProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/ShapeCompartmentViewProvider.java
@@ -19,6 +19,7 @@ import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOpera
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IShapeCompartmentEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.providers.AbstractShapeCompartmentViewProvider;
import org.eclipse.papyrus.infra.gmfdiag.common.providers.GraphicalTypeRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ProviderServiceUtil;
/**
* View Provider for Internal Block Diagram. It adds the shape compartment edit parts
@@ -50,6 +51,9 @@ public class ShapeCompartmentViewProvider extends AbstractShapeCompartmentViewPr
*/
@Override
protected boolean provides(CreateNodeViewOperation operation) {
+ if (!ProviderServiceUtil.isEnabled(this, operation.getContainerView())) {
+ return false;
+ }
return (getNodeViewClass(operation.getSemanticAdapter(), operation.getContainerView(), operation.getSemanticHint()) != null);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/ShapeEditPolicyProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/ShapeEditPolicyProvider.java
index 9b70c6595dd..c744fd84a7e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/ShapeEditPolicyProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/ShapeEditPolicyProvider.java
@@ -23,6 +23,7 @@ import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPolicies
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ShapeCompartmentEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.ProviderServiceUtil;
import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.RoundedBorderNamedElementEditPart;
import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure;
@@ -39,6 +40,9 @@ public class ShapeEditPolicyProvider extends AbstractProvider implements IEditPo
@Override
public boolean provides(IOperation operation) {
CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
+ if (!ProviderServiceUtil.isEnabled(this, epOperation.getEditPart())) {
+ return false;
+ }
if (!(epOperation.getEditPart() instanceof IGraphicalEditPart)) {
return false;
}
@@ -47,7 +51,7 @@ public class ShapeEditPolicyProvider extends AbstractProvider implements IEditPo
IGraphicalEditPart gep = (IGraphicalEditPart) epOperation.getEditPart();
return provides(gep);
}
-
+
/**
* {@inheritDoc}
*/
@@ -61,7 +65,9 @@ public class ShapeEditPolicyProvider extends AbstractProvider implements IEditPo
/**
* check whether edit part provides a symbol compartment
- * @param the edit part
+ *
+ * @param the
+ * edit part
* @return
*/
protected boolean provides(EditPart ep) {
diff --git a/plugins/uml/diagram/pom.xml b/plugins/uml/diagram/pom.xml
index 7920a0f8da0..647e89ad302 100644
--- a/plugins/uml/diagram/pom.xml
+++ b/plugins/uml/diagram/pom.xml
@@ -30,6 +30,7 @@
<module>org.eclipse.papyrus.uml.diagram.navigation</module>
<module>org.eclipse.papyrus.uml.diagram.profile</module>
<module>org.eclipse.papyrus.uml.diagram.sequence</module>
+ <module>org.eclipse.papyrus.uml.diagram.sequence.restrictions</module>
<module>org.eclipse.papyrus.uml.diagram.statemachine</module>
<module>org.eclipse.papyrus.uml.diagram.stereotype.edition</module>
<module>org.eclipse.papyrus.uml.diagram.symbols</module>

Back to the top