Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/AcceptTimeEventActionStereotypeExternalNodeEditPolicy.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/DefferedAppliedStereotypeToDisplayCommand.java7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/DefferedAppliedStereotypeToDisplayCommand.java7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/UMLConnectionNodeEditPart.java30
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AbstractAppliedStereotypeDisplayEditPolicy.java131
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeExternalNodeEditPolicy.java77
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeNodeLabelDisplayEditPolicy.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ApplyStereotypeEditPolicy.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/CommentShapeForAppliedStereotypeEditPolicy.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ImportedElementEditPolicy.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/CornerBentFigure.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/StereotypedElementLabelHelper.java29
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/StereotypePropertyParser.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedStereotypeParser.java18
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/ChangeStereotypeDisplayPostAction.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePostAction.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePropertiesInCompartmentPostAction.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/StereotypePostAction.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/StereotypeLocationEnum.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/IStereotypeViewFactory.java78
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/IStereotypeViewProvider.java79
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/StereotypeViewFactory.java207
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/StereotypeViewProvider.java225
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/AddAppliedQNStereotypeToDisplayCommand.java70
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/AddAppliedStereotypePropertiesToDisplayCommand.java85
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/AddAppliedStereotypeToDisplayCommand.java71
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/CreateAppliedStereotypeCommentViewCommand.java (renamed from plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/CreateAppliedStereotypeCommentViewCommand.java)11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/CreateAppliedStereotypeCompartmentCommand.java (renamed from plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/CreateAppliedStereotypeViewCommand.java)14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/CreateAppliedStereotypePropertyViewCommand.java (renamed from plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/CreateAppliedStereotypePropertyViewCommand.java)5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/CreateStereotypeLabelCommand.java (renamed from plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/CreateStereotypeLabelCommand.java)9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/RemoveAppliedStereotypePropertiesToDisplayCommand.java78
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/RemoveAppliedStereotypeToDisplayCommand.java67
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/SetPersistentViewCommand.java (renamed from plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/SetPersistentViewCommand.java)11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/UnsetPersistentViewCommand.java (renamed from plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/UnsetPersistentViewCommand.java)2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/helper/StereotypeDisplayCommandExecution.java228
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/helper/StereotypeDisplayConstant.java (renamed from plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/StereotypeDisplayUtils.java)26
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/helper/StereotypeDisplayUtil.java (renamed from plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/StereotypeDisplayHelper.java)323
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/helper/StereotypeUserActionHelper.java123
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/StereotypeDisplayMigrationConstant.java61
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/StereotypeMigrationHelper.java416
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypeCommentPropertiesMigrationCommand.java103
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypeLabelMigrationCommand.java248
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypeNestedPropertiesMigrationCommand.java61
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypePropertiesMigrationCommand.java314
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationLabelMigrationEditPolicy.java85
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationMigrationEditPolicy.java167
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationNestedMigrationEditPolicy.java79
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationPropertiesMigrationEditPolicy.java97
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/CommandUtil.java177
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java48
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/helper/CSSDOMUMLSemanticElementHelper.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/theme/umlBase.css86
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/SetStereotypeVisibleOnMetaclassCommand.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateAppliedStereotypeCommentViewCommandEx.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/META-INF/MANIFEST.MF2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/plugin.xml6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCommentEditPart.java87
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCompartmentEditPart.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeMultilinePropertyEditPart.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentEditPolicy.java23
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentForCommentShapeEditPolicy.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeLabelEditPolicy.java10
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/CustomEditPolicyProvider.java10
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/DisplayedProfileElementLabelProvider.java10
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypeDisplayMigrationEditPolicyProvider.java108
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypePropertiesEditPartProvider.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/StereotypedElementShapeProvider.java100
69 files changed, 3945 insertions, 529 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/AcceptTimeEventActionStereotypeExternalNodeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/AcceptTimeEventActionStereotypeExternalNodeEditPolicy.java
index 176eec30c0b..2a623960660 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/AcceptTimeEventActionStereotypeExternalNodeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/AcceptTimeEventActionStereotypeExternalNodeEditPolicy.java
@@ -18,7 +18,7 @@ import org.eclipse.emf.common.notify.Notification;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayHelper;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
import org.eclipse.uml2.uml.AcceptEventAction;
import org.eclipse.uml2.uml.TimeEvent;
import org.eclipse.uml2.uml.UMLPackage;
@@ -76,7 +76,7 @@ public class AcceptTimeEventActionStereotypeExternalNodeEditPolicy extends Appli
}
// try to display stereotype properties
- String stereotypesToDisplay = StereotypeDisplayHelper.getInstance().getStereotypeTextToDisplay(parentView);
+ String stereotypesToDisplay = StereotypeDisplayUtil.getInstance().getStereotypeTextToDisplay(parentView);
return stereotypesToDisplay;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/DefferedAppliedStereotypeToDisplayCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/DefferedAppliedStereotypeToDisplayCommand.java
index 74d38878380..72844000775 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/DefferedAppliedStereotypeToDisplayCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/DefferedAppliedStereotypeToDisplayCommand.java
@@ -29,7 +29,12 @@ import org.eclipse.uml2.uml.Stereotype;
/**
* The Class DefferedAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to
* display
+ *
+ * @deprecated The Display of stereotype is now treated with notation View (Bug 455311)
+ * use the command into oep.uml.diagram.common.stereotype.display.command instead
+ *
*/
+@Deprecated
public class DefferedAppliedStereotypeToDisplayCommand extends CreateEAnnotationCommand {
/** The qualified namedepht. */
@@ -69,7 +74,7 @@ public class DefferedAppliedStereotypeToDisplayCommand extends CreateEAnnotation
*/
@Override
protected void doExecute() {
- View view = (View) adapter.getAdapter(View.class);
+ View view = adapter.getAdapter(View.class);
EObject view_element = view.getElement();
Element element = (Element) view_element;
Iterator<?> listStereotype = element.getAppliedStereotypes().iterator();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF
index 5d8a68c0840..3b4fbd1f950 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF
@@ -35,6 +35,10 @@ Export-Package: org.eclipse.papyrus.uml.diagram.common,
org.eclipse.papyrus.uml.diagram.common.service.palette,
org.eclipse.papyrus.uml.diagram.common.sheet,
org.eclipse.papyrus.uml.diagram.common.stereotype,
+ org.eclipse.papyrus.uml.diagram.common.stereotype.display.command,
+ org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper,
+ org.eclipse.papyrus.uml.diagram.common.stereotype.migration,
+ org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies,
org.eclipse.papyrus.uml.diagram.common.strategy.paste,
org.eclipse.papyrus.uml.diagram.common.ui.dialogs,
org.eclipse.papyrus.uml.diagram.common.ui.helper,
@@ -74,7 +78,6 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
com.google.guava;bundle-version="11.0.0",
org.eclipse.papyrus.uml.profile;bundle-version="1.1.0",
org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.appearance;bundle-version="1.1.0",
org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
org.eclipse.papyrus.infra.core.log;bundle-version="1.1.0",
org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.1.0",
@@ -103,14 +106,17 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.1.0",
org.eclipse.papyrus.infra.gmfdiag.menu;bundle-version="1.1.0",
org.eclipse.e4.ui.css.core,
- org.eclipse.papyrus.infra.gmfdiag.canonical;bundle-version="1.1.0",
org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.gef
+ org.eclipse.papyrus.infra.gmfdiag.canonical;bundle-version="1.1.0",
+ org.eclipse.gef,
+ org.eclipse.papyrus.uml.appearance;bundle-version="1.1.0",
+ org.eclipse.emf.common
Bundle-Vendor: %providerName
Ant-Version: Apache Ant 1.7.0
Bundle-Version: 1.1.0.qualifier
Eclipse-BuddyPolicy: dependent
Bundle-Activator: org.eclipse.papyrus.uml.diagram.common.Activator
Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.common;singleton:=true
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.common;singleton:
+ =true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/DefferedAppliedStereotypeToDisplayCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/DefferedAppliedStereotypeToDisplayCommand.java
index fa5a9cbe242..255e3bd3ec0 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/DefferedAppliedStereotypeToDisplayCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/DefferedAppliedStereotypeToDisplayCommand.java
@@ -33,7 +33,12 @@ import com.google.common.collect.Collections2;
/**
* The Class AddAppliedStereotypeToDisplayCommand used to set the list of
* applied stereotype to display
+ *
+ * @deprecated The Display of stereotype is now treated with notation View (Bug 455311)
+ * use the command into oep.uml.diagram.common.stereotype.display.command instead
+ *
*/
+@Deprecated
public class DefferedAppliedStereotypeToDisplayCommand extends CreateEAnnotationCommand {
/** The qualified names' stereotypes list . */
@@ -63,7 +68,7 @@ public class DefferedAppliedStereotypeToDisplayCommand extends CreateEAnnotation
*/
@Override
protected void doExecute() {
- View view = (View) adapter.getAdapter(View.class);
+ View view = adapter.getAdapter(View.class);
EObject view_element = view.getElement();
Element element = (Element) view_element;
Collection<String> strStereotypes = Collections2.transform(element.getAppliedStereotypes(), new Function<Stereotype, String>() {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/UMLConnectionNodeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/UMLConnectionNodeEditPart.java
index 98964d1ad62..1454218594d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/UMLConnectionNodeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/UMLConnectionNodeEditPart.java
@@ -23,14 +23,12 @@ import org.eclipse.gef.EditPart;
import org.eclipse.gef.Request;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
-import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
-import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.ApplyStereotypeEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.edge.UMLEdgeFigure;
import org.eclipse.papyrus.uml.diagram.common.service.ApplyStereotypeRequest;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayHelper;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
import org.eclipse.papyrus.uml.tools.listeners.StereotypeElementListener.StereotypeExtensionNotification;
import org.eclipse.swt.graphics.Image;
import org.eclipse.uml2.uml.Element;
@@ -187,7 +185,7 @@ public abstract class UMLConnectionNodeEditPart extends ConnectionEditPart imple
* @return the list of stereotypes to display
*/
public String stereotypesToDisplay() {
- String stereotypesToDisplay = StereotypeDisplayHelper.getInstance().getStereotypeTextToDisplay((View) getModel());
+ String stereotypesToDisplay = StereotypeDisplayUtil.getInstance().getStereotypeTextToDisplay((View) getModel());
return stereotypesToDisplay;
@@ -199,21 +197,17 @@ public abstract class UMLConnectionNodeEditPart extends ConnectionEditPart imple
* @return the image that represents the first applied stereotype or <code>null</code> if no image has to be displayed
*/
public Image stereotypeIconToDisplay() {
- String stereotypespresentationKind = AppliedStereotypeHelper.getAppliedStereotypePresentationKind((View) getModel());
- if (stereotypespresentationKind == null) {
- return null;
- }
- if (stereotypespresentationKind.equals(UMLVisualInformationPapyrusConstant.ICON_STEREOTYPE_PRESENTATION) || stereotypespresentationKind.equals(UMLVisualInformationPapyrusConstant.TEXT_ICON_STEREOTYPE_PRESENTATION)) {
-
- // retrieve the first stereotype in the list of displayed stereotype
- String stereotypesToDisplay = AppliedStereotypeHelper.getStereotypesToDisplay((View) getModel());
- StringTokenizer tokenizer = new StringTokenizer(stereotypesToDisplay, ",");
- if (tokenizer.hasMoreTokens()) {
- String firstStereotypeName = tokenizer.nextToken();
- Stereotype stereotype = getUMLElement().getAppliedStereotype(firstStereotypeName);
- return Activator.getIconElement(getUMLElement(), stereotype, false);
- }
+
+
+ // retrieve the first stereotype in the list of displayed stereotype
+ String stereotypesToDisplay = StereotypeDisplayUtil.getInstance().getStereotypeTextToDisplay((View) getModel());
+ StringTokenizer tokenizer = new StringTokenizer(stereotypesToDisplay, ",");
+ if (tokenizer.hasMoreTokens()) {
+ String firstStereotypeName = tokenizer.nextToken();
+ Stereotype stereotype = getUMLElement().getAppliedStereotype(firstStereotypeName);
+ return Activator.getIconElement(getUMLElement(), stereotype, false);
}
+
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AbstractAppliedStereotypeDisplayEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AbstractAppliedStereotypeDisplayEditPolicy.java
index 20fd0beda5e..01d0e109d7c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AbstractAppliedStereotypeDisplayEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AbstractAppliedStereotypeDisplayEditPolicy.java
@@ -25,7 +25,6 @@ import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
@@ -37,16 +36,16 @@ import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.CreateAppliedStereotypePropertyViewCommand;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.CreateAppliedStereotypeViewCommand;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.CreateStereotypeLabelCommand;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayHelper;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.CreateAppliedStereotypeCompartmentCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.CreateAppliedStereotypePropertyViewCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.CreateStereotypeLabelCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeMigrationHelper;
+import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil;
import org.eclipse.papyrus.uml.tools.listeners.StereotypeElementListener.StereotypeExtensionNotification;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Extension;
import org.eclipse.uml2.uml.Property;
@@ -58,6 +57,8 @@ import org.eclipse.uml2.uml.Stereotype;
*/
public abstract class AbstractAppliedStereotypeDisplayEditPolicy extends GraphicalEditPolicyEx implements NotificationListener, IPapyrusListener {
+ protected String EMPTY_STRING = "";//$NON-NLS-1$
+
/** constant for this edit policy role */
public final static String STEREOTYPE_LABEL_POLICY = "AppliedStereotypeDisplayEditPolicy";//$NON-NLS-1$
@@ -65,7 +66,10 @@ public abstract class AbstractAppliedStereotypeDisplayEditPolicy extends Graphic
protected Element hostSemanticElement;
/** Helper to manipulate applied Stereotype Display model */
- protected StereotypeDisplayHelper helper = StereotypeDisplayHelper.getInstance();
+ protected StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
+ protected StereotypeMigrationHelper migrationHelper = StereotypeMigrationHelper.getInstance();
+
+
protected IGraphicalEditPart hostEditPart;
@@ -96,10 +100,13 @@ public abstract class AbstractAppliedStereotypeDisplayEditPolicy extends Graphic
// Create and Delete nodes if necessary
refreshNotationStructure();
+
}
}
+
+
/**
* Initialize Variables.
*/
@@ -219,7 +226,7 @@ public abstract class AbstractAppliedStereotypeDisplayEditPolicy extends Graphic
*/
public Image stereotypeIconToDisplay() {
Image icon = null;
- boolean displayIcon = NotationUtils.getBooleanValue(hostView, StereotypeDisplayUtils.DISPLAY_ICON, false);
+ boolean displayIcon = NotationUtils.getBooleanValue(hostView, StereotypeDisplayConstant.DISPLAY_ICON, false);
if (displayIcon) {
// retrieve the first stereotype in the list of displayed stereotype
Stereotype appliedStereotype;
@@ -341,31 +348,9 @@ public abstract class AbstractAppliedStereotypeDisplayEditPolicy extends Graphic
* the stereotype application
*/
protected void executeAppliedStereotypeBraceCompartmentCreation(final IGraphicalEditPart editPart, final Stereotype stereotype) {
- try {
- editPart.getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- Display.getCurrent().syncExec(new Runnable() {
-
- @Override
- public void run() {
- CreateAppliedStereotypeViewCommand command = new CreateAppliedStereotypeViewCommand(editPart.getEditingDomain(), editPart.getNotationView(), stereotype, StereotypeDisplayUtils.STEREOTYPE_BRACE_TYPE);
-
- // use to avoid to put it in the command stack
- try {
- GMFUnsafe.write(editPart.getEditingDomain(), command);
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
+ CreateAppliedStereotypeCompartmentCommand command = new CreateAppliedStereotypeCompartmentCommand(editPart.getEditingDomain(), editPart.getNotationView(), stereotype, StereotypeDisplayConstant.STEREOTYPE_BRACE_TYPE);
+ CommandUtil.executeUnsafeCommand(command, editPart);
- }
- });
- } catch (Exception e) {
- Activator.log.error(e);
- }
}
@@ -380,36 +365,11 @@ public abstract class AbstractAppliedStereotypeDisplayEditPolicy extends Graphic
* the stereotype associated to compartment node
*/
protected void executeAppliedStereotypeBracePropertyViewCreation(final IGraphicalEditPart editPart, final Node compartment, final Property stereotypeProperty) {
- try {
- editPart.getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- Display.getCurrent().syncExec(new Runnable() {
-
- @Override
- public void run() {
-
- // use to avoid to put it in the command stack
- CreateAppliedStereotypePropertyViewCommand command = new CreateAppliedStereotypePropertyViewCommand(editPart.getEditingDomain(), compartment, stereotypeProperty, StereotypeDisplayUtils.STEREOTYPE_PROPERTY_BRACE_TYPE);
- try {
- GMFUnsafe.write(editPart.getEditingDomain(), command);
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
- }
- });
+ CreateAppliedStereotypePropertyViewCommand command = new CreateAppliedStereotypePropertyViewCommand(editPart.getEditingDomain(), compartment, stereotypeProperty, StereotypeDisplayConstant.STEREOTYPE_PROPERTY_BRACE_TYPE);
+ CommandUtil.executeUnsafeCommand(command, editPart);
- } catch (Exception e) {
- Activator.log.error(e);
- }
}
-
-
-
/**
* The goal of this method is to execute the a command to create a notation node for a stereotype Label.
*
@@ -419,34 +379,11 @@ public abstract class AbstractAppliedStereotypeDisplayEditPolicy extends Graphic
* The stereotype related to the Label
*/
protected void executeStereotypeLabelCreation(final IGraphicalEditPart editPart, final Stereotype stereotype) {
- try {
- editPart.getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- Display.getCurrent().syncExec(new Runnable() {
-
- @Override
- public void run() {
-
- CreateStereotypeLabelCommand command = new CreateStereotypeLabelCommand(editPart.getEditingDomain(), editPart.getNotationView(), stereotype);
- // use to avoid to put it in the command stack
- try {
- GMFUnsafe.write(editPart.getEditingDomain(), command);
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
-
- }
- });
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
-
+ CreateStereotypeLabelCommand command = new CreateStereotypeLabelCommand(editPart.getEditingDomain(), editPart.getNotationView(), stereotype);
+ CommandUtil.executeUnsafeCommand(command, editPart);
+ }
/**
* Gets the diagram event broker from the editing domain.
@@ -492,24 +429,10 @@ public abstract class AbstractAppliedStereotypeDisplayEditPolicy extends Graphic
* DecorationNode of the Stereotype Label that has to be removed
*/
protected void executeStereotypeViewRemove(final IGraphicalEditPart editPart, final View view) {
- try {
- TransactionUtil.getEditingDomain(getView()).runExclusive(new Runnable() {
-
- @Override
- public void run() {
- DeleteCommand command = new DeleteCommand(view);
- // use to avoid to put it in the command stack
- try {
- GMFUnsafe.write(editPart.getEditingDomain(), command);
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
- } catch (Exception e) {
- Activator.log.error(e);
- }
+ DeleteCommand command = new DeleteCommand(view);
+ CommandUtil.executeUnsafeCommand(command, editPart);
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeExternalNodeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeExternalNodeEditPolicy.java
index 6b2cc5d4150..5e5931cc0e4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeExternalNodeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeExternalNodeEditPolicy.java
@@ -19,7 +19,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
-import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
/**
* This edit policy is used to display only applied stereotypes and properties
@@ -50,7 +50,7 @@ public class AppliedStereotypeExternalNodeEditPolicy extends AppliedStereotypeLa
getDiagramEventBroker().addNotificationListener(parentView, this);
}
- refreshDisplay();
+
}
@@ -64,11 +64,26 @@ public class AppliedStereotypeExternalNodeEditPolicy extends AppliedStereotypeLa
}
/**
- * {@inheritDoc}
+ * Refresh the text of the stereotype
*/
@Override
- public void refreshDisplay() {
- refreshStereotypeDisplay();
+ protected void refreshStereotypeDisplay() {
+ IFigure figure;
+ if (getHost() instanceof IPapyrusEditPart) {
+ figure = ((IPapyrusEditPart) getHost()).getPrimaryShape();
+ } else {
+ figure = hostEditPart.getFigure();
+ }
+
+ if (figure instanceof IPapyrusUMLElementFigure) {// calculate text
+ // and icon to display
+ final String stereotypesToDisplay = stereotypesToDisplay();
+ ((IPapyrusUMLElementFigure) figure).setStereotypeDisplay(tag + (stereotypesToDisplay), null);
+
+ }
+
+
+
}
/**
@@ -83,48 +98,38 @@ public class AppliedStereotypeExternalNodeEditPolicy extends AppliedStereotypeLa
// retrieve all stereotypes to be displayed
if (parentView == null) {
- return "";
+ return EMPTY_STRING;
}
// try to display stereotype properties
- String stereotypesToDisplay = helper.getStereotypeTextToDisplay(parentView);
- return stereotypesToDisplay;
- }
+ final String stereotypesToDisplay = helper.getStereotypeTextToDisplay(parentView);
+ final String stereotypesPropertiesToDisplay = helper.getStereotypePropertiesInBrace(parentView);
+ String display = getStereotypeAndPropertiesTextToDisplay(stereotypesToDisplay, stereotypesPropertiesToDisplay);
- /**
- * @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AbstractAppliedStereotypeDisplayEditPolicy#refreshStereotypeBraceStructure(org.eclipse.uml2.uml.Stereotype)
- *
- * @param stereotype
- * Stereotype related to the Brace to refresh
- */
- @Override
- public void refreshStereotypeBraceStructure(Stereotype stereotype) {
- // Nothing to Do
- }
-
+ return display;
+ }
/**
- * Refresh the text of the stereotype
+ * @param stereotypesToDisplay
+ * @param stereotypesPropertiesToDisplay
+ * @param display
+ * @return
*/
- @Override
- protected void refreshStereotypeDisplay() {
- IFigure figure;
- if (getHost() instanceof IPapyrusEditPart) {
- figure = ((IPapyrusEditPart) getHost()).getPrimaryShape();
- } else {
- figure = hostEditPart.getFigure();
+ private String getStereotypeAndPropertiesTextToDisplay(final String stereotypesToDisplay, final String stereotypesPropertiesToDisplay) {
+ StringBuilder display = new StringBuilder();
+ if (stereotypesToDisplay != null && !stereotypesToDisplay.isEmpty()) {
+ display.append(stereotypesToDisplay);
}
- if (figure instanceof IPapyrusUMLElementFigure) {// calculate text
- // and icon to display
- final String stereotypesToDisplay = stereotypesToDisplay();
- ((IPapyrusUMLElementFigure) figure).setStereotypeDisplay(tag + (stereotypesToDisplay), null);
-
+ if (stereotypesPropertiesToDisplay != null && !stereotypesPropertiesToDisplay.isEmpty()) {
+ if (display.length() > 0) {
+ display.append(StereotypeDisplayConstant.STEREOTYPE_PROPERTY_SEPARATOR);
+ }
+ display.append(StereotypeDisplayConstant.BRACE_LEFT + stereotypesPropertiesToDisplay + StereotypeDisplayConstant.BRACE_RIGHT);
}
-
-
-
+ return display.toString();
}
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeNodeLabelDisplayEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeNodeLabelDisplayEditPolicy.java
index ad3347eecb0..3e9589353af 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeNodeLabelDisplayEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeNodeLabelDisplayEditPolicy.java
@@ -40,6 +40,8 @@ public class AppliedStereotypeNodeLabelDisplayEditPolicy extends AppliedStereoty
super(tag);
}
+
+
/**
* @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy#refreshStereotypeDisplay()
*
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ApplyStereotypeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ApplyStereotypeEditPolicy.java
index be14809b29f..02dc2ee65cf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ApplyStereotypeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ApplyStereotypeEditPolicy.java
@@ -22,9 +22,7 @@ import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
import org.eclipse.papyrus.uml.diagram.common.commands.ApplyStereotypeCommand;
-import org.eclipse.papyrus.uml.diagram.common.commands.DefferedAppliedStereotypeToDisplayCommand;
import org.eclipse.papyrus.uml.diagram.common.service.ApplyStereotypeRequest;
import org.eclipse.uml2.uml.Element;
@@ -96,9 +94,6 @@ public class ApplyStereotypeEditPolicy extends AbstractEditPolicy {
// 1. apply stereotypes
cc.compose(new ApplyStereotypeCommand(editingDomain, request));
- // 2. display stereotypes
- cc.compose(new EMFtoGMFCommandWrapper(new DefferedAppliedStereotypeToDisplayCommand(editingDomain, getHost(), "")));
-
return new ICommandProxy(cc.reduce());
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/CommentShapeForAppliedStereotypeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/CommentShapeForAppliedStereotypeEditPolicy.java
index fc08291350a..a831e3e7dda 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/CommentShapeForAppliedStereotypeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/CommentShapeForAppliedStereotypeEditPolicy.java
@@ -36,7 +36,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.util.UMLUtil;
@@ -61,7 +61,7 @@ public class CommentShapeForAppliedStereotypeEditPolicy extends AbstractAppliedS
element = (Element) getView().getElement();
} else {
- EObject object = NotationUtils.getEObjectValue(getView(), StereotypeDisplayUtils.STEREOTYPE_COMMENT_RELATION_NAME, null);
+ EObject object = NotationUtils.getEObjectValue(getView(), StereotypeDisplayConstant.STEREOTYPE_COMMENT_RELATION_NAME, null);
if (object != null) {
if (object instanceof Element) {
element = (Element) object;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ImportedElementEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ImportedElementEditPolicy.java
index 4da1bf58927..aae33301b74 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ImportedElementEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ImportedElementEditPolicy.java
@@ -15,6 +15,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalReferenceEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.helper.SemanticElementHelper;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.Constraint;
@@ -75,6 +76,10 @@ public class ImportedElementEditPolicy extends ExternalReferenceEditPolicy {
}
+ if (StereotypeDisplayUtil.getInstance().isStereotypeView(getView())) {
+ return false;
+ }
+
// Generic case: graphical containment doesn't match the semantic containment (We only check Package containment)
Element semanticUMLElement = (Element) semanticElement;
Element parentUMLElement = (Element) parentSemanticElement;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/CornerBentFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/CornerBentFigure.java
index c29a927cae0..ee77139d3d1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/CornerBentFigure.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/CornerBentFigure.java
@@ -27,7 +27,7 @@ import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.gmf.runtime.diagram.ui.figures.NoteFigure;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
@@ -201,7 +201,7 @@ public class CornerBentFigure extends NoteFigure implements IPapyrusNodeUMLEleme
// Set stereotype text on figure
if (!"".equals(stereotypeProperties)) {
- this.stereotypePropertiesInBraceContent.setText(StereotypeDisplayUtils.BRACE_LEFT + stereotypeProperties + StereotypeDisplayUtils.BRACE_RIGHT);
+ this.stereotypePropertiesInBraceContent.setText(StereotypeDisplayConstant.BRACE_LEFT + stereotypeProperties + StereotypeDisplayConstant.BRACE_RIGHT);
} else {
this.stereotypePropertiesInBraceContent.setText("");
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/StereotypedElementLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/StereotypedElementLabelHelper.java
index 3ced407cc8a..07e3817f3a5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/StereotypedElementLabelHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/StereotypedElementLabelHelper.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.uml.diagram.common.helper;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
@@ -33,8 +34,8 @@ import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayHelper;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
import org.eclipse.papyrus.uml.tools.utils.UMLUtil;
import org.eclipse.swt.graphics.Image;
import org.eclipse.uml2.uml.Element;
@@ -46,7 +47,9 @@ import org.eclipse.uml2.uml.Stereotype;
*/
public abstract class StereotypedElementLabelHelper {
- private final static String EMPTY_STRING = "";
+ private final static String EMPTY_STRING = "";//$NON-NLS-1$
+
+ private final static String SPACE = " "; //$NON-NLS-1$
/**
* {@inheritDoc}
@@ -99,12 +102,14 @@ public abstract class StereotypedElementLabelHelper {
}
if (stereotypespresentationKind.equals(UMLVisualInformationPapyrusConstant.ICON_STEREOTYPE_PRESENTATION) || stereotypespresentationKind.equals(UMLVisualInformationPapyrusConstant.TEXT_ICON_STEREOTYPE_PRESENTATION)) {
// retrieve the first stereotype in the list of displayed stereotype
- String stereotypesToDisplay = AppliedStereotypeHelper.getStereotypesToDisplay((View) editPart.getModel());
Collection<Stereotype> stereotypes = new ArrayList<Stereotype>();
- StringTokenizer tokenizer = new StringTokenizer(stereotypesToDisplay, ",");
- while (tokenizer.hasMoreTokens()) {
- String firstStereotypeName = tokenizer.nextToken();
- stereotypes.add(getUMLElement(editPart).getAppliedStereotype(firstStereotypeName));
+ Iterator<Stereotype> appliedStereotypes = getUMLElement(editPart).getAppliedStereotypes().iterator();
+ while (appliedStereotypes.hasNext()) {
+ Stereotype appliedStereotype = appliedStereotypes.next();
+ if (editPart.getModel() instanceof View
+ && StereotypeDisplayUtil.getInstance().getStereotypeLabel(((View) editPart.getModel()), appliedStereotype).isVisible()) {
+ stereotypes.add(appliedStereotype);
+ }
}
return Activator.getIconElements(getUMLElement(editPart), stereotypes, false);
}
@@ -120,18 +125,18 @@ public abstract class StereotypedElementLabelHelper {
View view = (View) editPart.getModel();
// retrieve all stereotypes to be displayed
// try to display stereotype properties
- String stereotypesToDisplay = StereotypeDisplayHelper.getInstance().getStereotypeTextToDisplay(view);
- String stereotypesPropertiesToDisplay = StereotypeDisplayHelper.getInstance().getStereotypePropertiesInBrace(view);
+ String stereotypesToDisplay = StereotypeDisplayUtil.getInstance().getStereotypeTextToDisplay(view);
+ String stereotypesPropertiesToDisplay = StereotypeDisplayUtil.getInstance().getStereotypePropertiesInBrace(view);
String display = EMPTY_STRING;
if (stereotypesToDisplay != null && !stereotypesToDisplay.equals(EMPTY_STRING)) {
- display += stereotypesToDisplay + StereotypeDisplayUtils.STEREOTYPE_PROPERTIES_SEPARATOR;
+ display += stereotypesToDisplay + StereotypeDisplayConstant.STEREOTYPE_PROPERTIES_SEPARATOR;
}
if (stereotypesPropertiesToDisplay != null && !stereotypesPropertiesToDisplay.equals(EMPTY_STRING)) {
- display += StereotypeDisplayUtils.BRACE_LEFT + stereotypesPropertiesToDisplay + StereotypeDisplayUtils.BRACE_RIGHT;
+ display += StereotypeDisplayConstant.BRACE_LEFT + stereotypesPropertiesToDisplay + StereotypeDisplayConstant.BRACE_RIGHT + SPACE;
}
return display;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/StereotypePropertyParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/StereotypePropertyParser.java
index 96a0ae779cf..64b2a87f323 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/StereotypePropertyParser.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/StereotypePropertyParser.java
@@ -33,7 +33,7 @@ import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayHelper;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Property;
@@ -148,7 +148,7 @@ public class StereotypePropertyParser implements IParser, ISemanticParser {
@Override
public String getPrintString(IAdaptable element, int flags) {
- StereotypeDisplayHelper helper = StereotypeDisplayHelper.getInstance();
+ StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
if (element instanceof IAdaptable) {
final Property property = ((Property) (EMFHelper.getEObject(element)));
final View view = ((View) element.getAdapter(View.class));
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedStereotypeParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedStereotypeParser.java
index 75fddc56543..a0705fad10b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedStereotypeParser.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedStereotypeParser.java
@@ -13,7 +13,6 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.parser.stereotype;
-import java.text.MessageFormat;
import java.util.LinkedList;
import java.util.List;
@@ -28,14 +27,23 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.papyrus.uml.diagram.common.parser.assist.FixedSetCompletionProcessor;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Extension;
import org.eclipse.uml2.uml.Stereotype;
public class AppliedStereotypeParser implements ISemanticParser {
- private static final MessageFormat APPLIED_PROFILE = new MessageFormat("\u00AB{0}\u00BB"); //$NON-NLS-1$
+ private final String myDefaultPrintString;
+
+ public AppliedStereotypeParser() {
+ this(null);
+ }
+
+ public AppliedStereotypeParser(String defaultPrintString) {
+ myDefaultPrintString = defaultPrintString;
+ }
+
@Override
public boolean areSemanticElementsAffected(EObject listener, Object notification) {
@@ -98,9 +106,9 @@ public class AppliedStereotypeParser implements ISemanticParser {
public String getPrintString(IAdaptable element, int flags) {
String editString = getEditString(element, flags);
if (editString != null && !editString.isEmpty()) {
- return StereotypeDisplayUtils.QUOTE_LEFT + editString + StereotypeDisplayUtils.QUOTE_RIGHT;
+ return StereotypeDisplayConstant.QUOTE_LEFT + editString + StereotypeDisplayConstant.QUOTE_RIGHT;
}
- return editString;
+ return myDefaultPrintString;
}
@Override
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/ChangeStereotypeDisplayPostAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/ChangeStereotypeDisplayPostAction.java
index 937ba07dd1f..10a9f35123d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/ChangeStereotypeDisplayPostAction.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/ChangeStereotypeDisplayPostAction.java
@@ -42,7 +42,11 @@ import org.w3c.dom.Node;
/**
* Post action that manages the display of applied stereotypes.
+ *
+ * @deprecated Use the commands into oep.uml.diagram.common.stereotype.display.command
+ *
*/
+@Deprecated
public class ChangeStereotypeDisplayPostAction extends GraphicalPostAction {
/** list of stereotypes to display with their names */
@@ -139,7 +143,7 @@ public class ChangeStereotypeDisplayPostAction extends GraphicalPostAction {
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- View view = (View) viewAdapter.getAdapter(View.class);
+ View view = viewAdapter.getAdapter(View.class);
if (view != null) {
String stereotypetoDisplay = AppliedStereotypeHelper.getStereotypesToDisplay(view);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePostAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePostAction.java
index 10f43428c7b..763bb715af1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePostAction.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePostAction.java
@@ -146,7 +146,7 @@ public class DisplayAppliedStereotypePostAction extends GraphicalPostAction {
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- View view = (View) viewAdapter.getAdapter(View.class);
+ View view = viewAdapter.getAdapter(View.class);
// creates the commands to display simple stereotypes name
for (String stereotypeName : stereotypesToDisplay) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePropertiesInCompartmentPostAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePropertiesInCompartmentPostAction.java
index 03d4b3eeeae..9f1b1573d9c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePropertiesInCompartmentPostAction.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/DisplayAppliedStereotypePropertiesInCompartmentPostAction.java
@@ -58,7 +58,11 @@ import org.w3c.dom.NodeList;
* <p>
* More precisely, it is in charge of the display of properties of Stereotypes in Compartments
* </p>
+ *
+ * @deprecated Use the commands into oep.uml.diagram.common.stereotype.display.command
+ *
*/
+@Deprecated
public class DisplayAppliedStereotypePropertiesInCompartmentPostAction extends GraphicalPostAction {
/** map of stereotypes / properties to display with their qualified names */
@@ -134,7 +138,7 @@ public class DisplayAppliedStereotypePropertiesInCompartmentPostAction extends G
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- View view = (View) viewAdapter.getAdapter(View.class);
+ View view = viewAdapter.getAdapter(View.class);
String stereotypesStrList = PaletteUtil.convertToCommaSeparatedRepresentation(listOfDisplayableStereotypeProperties);
AppliedStereotypeHelper.getAddAppliedStereotypePropertiesCommand(editingDomain, view, stereotypesStrList).execute();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/StereotypePostAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/StereotypePostAction.java
index 7636719a800..af8c27b1b2d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/StereotypePostAction.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/palette/StereotypePostAction.java
@@ -54,12 +54,10 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.papyrus.uml.diagram.common.Messages;
import org.eclipse.papyrus.uml.diagram.common.commands.ApplyStereotypeCommand;
-import org.eclipse.papyrus.uml.diagram.common.commands.DefferedAppliedStereotypeToDisplayCommand;
import org.eclipse.papyrus.uml.diagram.common.part.PaletteUtil;
import org.eclipse.papyrus.uml.diagram.common.service.ApplyStereotypeRequest;
import org.eclipse.papyrus.uml.diagram.common.ui.dialogs.PropertyEditors;
@@ -220,7 +218,7 @@ public class StereotypePostAction extends ModelPostAction {
/** the column for the stereotypes */
private TreeViewerColumn stereotypeColumn = null;
- /** the column with the checkboxes for the runtime properties */
+ /** the column with the check boxes for the runtime properties */
private TreeViewerColumn runtimeColumn = null;
private ArrayList<Value> savedValues;
@@ -291,9 +289,6 @@ public class StereotypePostAction extends ModelPostAction {
cmd.add(new ApplyStereotypeCommand(editingDomain, request));
- // 2. display stereotypes
- cmd.add(new EMFtoGMFCommandWrapper(new DefferedAppliedStereotypeToDisplayCommand(editingDomain, viewAdapter, "")));
-
AbstractTransactionalCommand setPropertiesCommand = new AbstractTransactionalCommand(editingDomain, "Set stereotype values", null) {
@Override
@@ -631,7 +626,7 @@ public class StereotypePostAction extends ModelPostAction {
* <ul>
* <li>
* {@link #createConfigurationComposite(Composite, PaletteEntryProxy, List)}</li>
- * <li> {@link #performAddButtonPressed(TreeViewer)} when we add or remove stereotypes</li>
+ * <li>{@link #performAddButtonPressed(TreeViewer)} when we add or remove stereotypes</li>
* </ul>
*/
protected void updateStereotypeViewer() {
@@ -891,10 +886,10 @@ public class StereotypePostAction extends ModelPostAction {
* Set the {@link Button#setEnabled(boolean)} parameter to true or false for
* the buttons following the selected element in the {@link StereotypePostAction#stereotypeViewer}
* <ul>
- * <li> {@link StereotypePostAction#addButton}</li>
- * <li> {@link StereotypePostAction#removeButton}</li>
- * <li> {@link StereotypePostAction#upButton}</li>
- * <li> {@link StereotypePostAction#downButton}</li>
+ * <li>{@link StereotypePostAction#addButton}</li>
+ * <li>{@link StereotypePostAction#removeButton}</li>
+ * <li>{@link StereotypePostAction#upButton}</li>
+ * <li>{@link StereotypePostAction#downButton}</li>
* </ul>
*
* @param event
@@ -1085,7 +1080,8 @@ public class StereotypePostAction extends ModelPostAction {
* test if all the selected element in the selection are fron the same level
*
* @param selection
- * @return <ul>
+ * @return
+ * <ul>
* <li>{@code true} if all the element are from the same level in the tree</li>
* <li>{@code false if not}</li>
* </ul>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/StereotypeLocationEnum.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/StereotypeLocationEnum.java
index 31275816342..bbff436f6ac 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/StereotypeLocationEnum.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/StereotypeLocationEnum.java
@@ -34,13 +34,14 @@ public enum StereotypeLocationEnum {
/**
* Defines the Brace Label into a separate Comment Figure that contains the list of Stereotype Properties
+ * {@link Deprecated Not used}
*/
- IN_COMMENT_BRACE,
+ @Deprecated IN_COMMENT_BRACE,
/**
* Defines the Compartment into a separate Comment Figure dedicated to the Stereotype Properties
*/
- IN_COMMENT_COMPARTMENT
+ IN_COMMENT
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/IStereotypeViewFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/IStereotypeViewFactory.java
new file mode 100644
index 00000000000..63d53c9061e
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/IStereotypeViewFactory.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
+ *
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * This Factory creates the different Stereotype View related to the Location.
+ *
+ * @author Céline JANSSENS
+ *
+ */
+public interface IStereotypeViewFactory {
+
+ /**
+ * Create Property View according to a specific Location.
+ *
+ * @param property
+ * The UML property for the View to be created
+ * @param stereotype
+ * The UML Stereotype for which the property is required
+ * @param location
+ * The property location can be:
+ * <ul>
+ * <li>{@link StereotypeDisplayConstant#STEREOTYPE_COMMENT_LOCATION}</li>
+ * <li>{@link StereotypeDisplayConstant#STEREOTYPE_COMPARTMENT_LOCATION}</li>
+ * <li>{@link StereotypeDisplayConstant#STEREOTYPE_BRACE_LOCATION}</li>
+ * </ul>
+ * @param owner
+ * The Compartment View that should contained the Property View
+ */
+ public void createPropertyView(Property property, Stereotype stereotype, View owner, String location);
+
+ /**
+ * Create Compartment View according to a specific Location.
+ *
+ * @param stereotype
+ * The UML Stereotype for which the property is required
+ * @param location
+ * The property location can be:
+ * <ul>
+ * <li>{@link StereotypeDisplayConstant#STEREOTYPE_COMMENT_LOCATION}</li>
+ * <li>{@link StereotypeDisplayConstant#STEREOTYPE_COMPARTMENT_LOCATION}</li>
+ * <li>{@link StereotypeDisplayConstant#STEREOTYPE_BRACE_LOCATION}</li>
+ * </ul>
+ */
+ public void createCompartmentView(Stereotype stereotype, String location);
+
+
+ /**
+ * Create Label View.
+ *
+ * @param stereotype
+ * The UML Stereotype for which the property is required
+ *
+ */
+ public void createLabelView(Stereotype stereotype);
+
+
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/IStereotypeViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/IStereotypeViewProvider.java
new file mode 100644
index 00000000000..8d3e740f8c0
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/IStereotypeViewProvider.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * This interface provides the View of the Stereotype Structure
+ * If the view doesn't exist it creates the node thanks to the {@link IStereotypeViewFactory } Class.
+ * It should never return null;
+ *
+ * @author Céline JANSSENS
+ *
+ */
+public interface IStereotypeViewProvider {
+
+ /**
+ * Get the Property View for a specific location
+ *
+ * @param property
+ * The UML property for the View to be created
+ * @param stereotype
+ * The UML Stereotype for which the property is required
+ * @param location
+ * The property location can be:
+ * <ul>
+ * <li>{@link StereotypeDisplayConstant#STEREOTYPE_COMMENT_LOCATION}</li>
+ * <li>{@link StereotypeDisplayConstant#STEREOTYPE_COMPARTMENT_LOCATION}</li>
+ * <li>{@link StereotypeDisplayConstant#STEREOTYPE_BRACE_LOCATION}</li>
+ * </ul>
+ * @return The Property view (existing or newly created)
+ */
+ public View getProperty(Property property, Stereotype stereotype, Enum location);
+
+ /**
+ * Get the Compartment View for a specific location
+ *
+ *
+ * @param stereotype
+ * The UML Stereotype for which the property is required
+ * @param location
+ * The property location can be:
+ * <ul>
+ * <li>{@link StereotypeDisplayConstant#STEREOTYPE_COMMENT_LOCATION}</li>
+ * <li>{@link StereotypeDisplayConstant#STEREOTYPE_COMPARTMENT_LOCATION}</li>
+ * <li>{@link StereotypeDisplayConstant#STEREOTYPE_BRACE_LOCATION}</li>
+ * </ul>
+ * @return The Compartment view (existing or newly created)
+ */
+ public View getCompartment(Stereotype stereotype, Enum location);
+
+
+ /**
+ * Get the Label View for a specific location
+ *
+ *
+ * @param stereotype
+ * The UML Stereotype for which the property is required
+ *
+ * @return The Label view (existing or newly created)
+ */
+ public View getLabel(Stereotype stereotype);
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/StereotypeViewFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/StereotypeViewFactory.java
new file mode 100644
index 00000000000..5c6df821bca
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/StereotypeViewFactory.java
@@ -0,0 +1,207 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
+ *
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.CreateAppliedStereotypeCompartmentCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.CreateAppliedStereotypePropertyViewCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.CreateStereotypeLabelCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
+import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * This Factory implement {@link IStereotypeViewFactory} and is in charge of creating Stereotype Views.
+ *
+ * @author Céline JANSSENS
+ *
+ */
+public class StereotypeViewFactory implements IStereotypeViewFactory {
+
+ private View mainView;
+ private TransactionalEditingDomain domain;
+
+ /**
+ * Constructor.
+ *
+ * @param mainView
+ * The View on which the Stereotype is applied (i.e: A Shape, an Edge, An Operation, ...)
+ *
+ */
+ public StereotypeViewFactory(View mainView) {
+ super();
+ this.mainView = mainView;
+ this.domain = CommandUtil.resolveEditingDomain(mainView);
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.display.IStereotypeViewFactory#createPropertyView(org.eclipse.gmf.runtime.notation.View, org.eclipse.uml2.uml.Property, org.eclipse.uml2.uml.Stereotype, org.eclipse.gmf.runtime.notation.View,
+ * java.lang.String)
+ *
+ */
+ @Override
+ public void createPropertyView(Property property, Stereotype stereotype, View owner, String location) {
+
+ if (StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_LOCATION.equals(location)) {
+ createStereotypePropertyInCompartment(owner, property);
+ } else if (StereotypeDisplayConstant.STEREOTYPE_BRACE_LOCATION.equals(location)) {
+ createStereotypePropertyInBrace(owner, property);
+ } else if (StereotypeDisplayConstant.STEREOTYPE_COMMENT_LOCATION.equals(location)) {
+ createStereotypePropertyInComment(owner, property);
+ }
+
+ }
+
+
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.display.IStereotypeViewFactory#createCompartmentView(org.eclipse.gmf.runtime.notation.View, org.eclipse.uml2.uml.Stereotype, java.lang.String)
+ *
+ */
+ @Override
+ public void createCompartmentView(Stereotype stereotype, String location) {
+ if (StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_LOCATION.equals(location)) {
+ createStereotypeCompartmentInCompartment(stereotype);
+ } else if (StereotypeDisplayConstant.STEREOTYPE_BRACE_LOCATION.equals(location)) {
+ createStereotypeCompartmentInBrace(stereotype);
+ } else if (StereotypeDisplayConstant.STEREOTYPE_COMMENT_LOCATION.equals(location)) {
+ createStereotypeCompartmentInComment(stereotype);
+ }
+
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.display.IStereotypeViewFactory#createLabelView(org.eclipse.gmf.runtime.notation.View, org.eclipse.uml2.uml.Stereotype)
+ */
+ @Override
+ public void createLabelView(Stereotype stereotype) {
+ createStereotypeLabel(stereotype);
+
+ }
+
+
+ /**
+ * Execute the creation Compartment command
+ *
+ * @param stereotype
+ * Stereotype for which the View is created
+ */
+ private void createStereotypeCompartmentInComment(Stereotype stereotype) {
+ View comment = StereotypeDisplayUtil.getInstance().getStereotypeComment(mainView);
+ CreateAppliedStereotypeCompartmentCommand command = new CreateAppliedStereotypeCompartmentCommand(domain, comment, stereotype, StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_TYPE);
+ CommandUtil.executeUnsafeCommand(command, mainView);
+
+ }
+
+
+
+
+
+ /**
+ * Create the Compartment of Stereotype to be shown into the Compartment of the Shape.
+ *
+ * @param stereotype
+ * The Stereotype of the Compartment that is retrieved.
+ */
+ private void createStereotypeCompartmentInBrace(Stereotype stereotype) {
+ CreateAppliedStereotypeCompartmentCommand command = new CreateAppliedStereotypeCompartmentCommand(domain, mainView, stereotype, StereotypeDisplayConstant.STEREOTYPE_BRACE_TYPE);
+ CommandUtil.executeUnsafeCommand(command, mainView);
+
+ }
+
+ /**
+ * Create the Compartment of Stereotype to be shown into the Compartment of the Shape.
+ *
+ * @param stereotype
+ * The Stereotype of the Compartment that is retrieved.
+ */
+ private void createStereotypeCompartmentInCompartment(Stereotype stereotype) {
+ CreateAppliedStereotypeCompartmentCommand command = new CreateAppliedStereotypeCompartmentCommand(domain, mainView, stereotype, StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_TYPE);
+ CommandUtil.executeUnsafeCommand(command, mainView);
+
+ }
+
+ /**
+ * Create the Property of the Stereotype to be shown into the Compartment of the Shape.
+ *
+ *
+ * @param compartment
+ * The Compartment View that is the Owner of the new Property
+ * @param property
+ * The UML Property of the Stereotype to be retrieved.
+ *
+ */
+ private void createStereotypePropertyInCompartment(View compartment, Property property) {
+ CreateAppliedStereotypePropertyViewCommand command = new CreateAppliedStereotypePropertyViewCommand(domain, compartment, property, StereotypeDisplayConstant.STEREOTYPE_PROPERTY_TYPE);
+ CommandUtil.executeUnsafeCommand(command, mainView);
+
+ }
+
+ /**
+ * Create the Property of the Stereotype to be shown into the Brace of the Shape.
+ *
+ *
+ * @param compartment
+ * The Compartment View that is the Owner of the new Property
+ * @param property
+ * The UML Property of the Stereotype to be retrieved.
+ *
+ */
+ private void createStereotypePropertyInBrace(View compartmentView, Property property) {
+ CreateAppliedStereotypePropertyViewCommand command = new CreateAppliedStereotypePropertyViewCommand(domain, mainView, property, StereotypeDisplayConstant.STEREOTYPE_BRACE_TYPE);
+ CommandUtil.executeUnsafeCommand(command, mainView);
+
+ }
+
+ /**
+ * Create the Property of the Stereotype to be shown into the Comment of the Shape.
+ *
+ *
+ * @param compartment
+ * The Compartment View that is the Owner of the new Property
+ * @param property
+ * The UML Property of the Stereotype to be retrieved.
+ *
+ */
+ private void createStereotypePropertyInComment(View compartmentView, Property property) {
+ CreateAppliedStereotypePropertyViewCommand command = new CreateAppliedStereotypePropertyViewCommand(domain, compartmentView, property, StereotypeDisplayConstant.STEREOTYPE_PROPERTY_TYPE);
+ CommandUtil.executeUnsafeCommand(command, mainView);
+
+ }
+
+
+
+ /**
+ * Execute the {@link CreateStereotypeLabelCommand}
+ *
+ * @param view
+ * The view that required a Stereotype Label
+ */
+ private void createStereotypeLabel(final Stereotype stereotype) {
+ CreateStereotypeLabelCommand command = new CreateStereotypeLabelCommand(domain, mainView, stereotype);
+ CommandUtil.executeUnsafeCommand(command, mainView);
+ }
+
+
+
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/StereotypeViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/StereotypeViewProvider.java
new file mode 100644
index 00000000000..d374ace68dd
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/StereotypeViewProvider.java
@@ -0,0 +1,225 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
+
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeLocationEnum;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * This Class Implement the interface {@link IStereotypeViewProvider} to provide Stereotype Views.
+ *
+ * @see IStereotypeViewProvider
+ *
+ * @author Céline JANSSENS
+ *
+ */
+public class StereotypeViewProvider implements IStereotypeViewProvider {
+
+ private View mainView;
+
+ private static StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
+
+ /**
+ * Constructor.
+ *
+ * @param mainView
+ * The View on which the Stereotype is applied (i.e: A Shape, an Edge, An Operation, ...)
+ */
+ public StereotypeViewProvider(View mainView) {
+ super();
+ this.mainView = mainView;
+
+ }
+
+
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.display.IStereotypeViewProvider#getProperty(org.eclipse.uml2.uml.Property, org.eclipse.uml2.uml.Stereotype, java.lang.String)
+ *
+ */
+ @Override
+ public View getProperty(Property property, Stereotype stereotype, Enum location) {
+ View propertyView = null;
+ if (StereotypeLocationEnum.IN_COMPARTMENT.equals(location)) {
+ propertyView = getStereotypePropertyInCompartment(mainView, stereotype, property);
+ } else if (StereotypeLocationEnum.IN_BRACE.equals(location)) {
+ propertyView = getStereotypePropertyInBrace(mainView, stereotype, property);
+ } else if (StereotypeLocationEnum.IN_COMMENT.equals(location)) {
+ propertyView = getStereotypePropertyInComment(mainView, stereotype, property);
+ }
+ return propertyView;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.display.IStereotypeViewProvider#getCompartment(org.eclipse.uml2.uml.Property, org.eclipse.uml2.uml.Stereotype, java.lang.String)
+ *
+ */
+ @Override
+ public View getCompartment(Stereotype stereotype, Enum location) {
+ View compartmentView = null;
+ if (StereotypeLocationEnum.IN_COMPARTMENT.equals(location)) {
+ compartmentView = getStereotypeCompartmentInCompartment(mainView, stereotype);
+ } else if (StereotypeLocationEnum.IN_BRACE.equals(location)) {
+ compartmentView = getStereotypeCompartmentInBrace(mainView, stereotype);
+ } else if (StereotypeLocationEnum.IN_COMMENT.equals(location)) {
+ compartmentView = getStereotypeCompartmentInComment(mainView, stereotype);
+ }
+ return compartmentView;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.display.IStereotypeViewProvider#getLabel(org.eclipse.uml2.uml.Property, org.eclipse.uml2.uml.Stereotype, java.lang.String)
+ *
+ */
+ @Override
+ public View getLabel(Stereotype stereotype) {
+ return getStereotypeLabel(mainView, stereotype);
+
+ }
+
+
+ /**
+ * Retrieve the Stereotype Compartment related to a Stereotype and create it if null.
+ *
+ * @param view
+ * The view on which the Compartment is checked
+ * @param stereotype
+ * The Stereotype of the Compartment that is retrieved.
+ * @return The Compartment related to the Stereotype (existing or newly created)
+ */
+ public View getStereotypeLabel(final View view, final Stereotype stereotype) {
+ View label = helper.getStereotypeLabel(view, stereotype);
+
+ return label;
+ }
+
+
+ /**
+ * Retrieve the Stereotype Compartment View related to a Stereotype in Compartment and create it if null.
+ *
+ * @param view
+ * The view on which the Compartment is checked
+ * @param stereotype
+ * The Stereotype of the Compartment that is retrieved.
+ * @return The Compartment related to the Stereotype (existing or newly created)
+ */
+ public View getStereotypeCompartmentInCompartment(final View view, final Stereotype stereotype) {
+ View compartment = helper.getStereotypeCompartment(view, stereotype);
+
+ return compartment;
+ }
+
+
+ /**
+ * Retrieve the Stereotype Compartment View related to a Stereotype in Brace and create it if null.
+ *
+ * @param view
+ * The view on which the Compartment is checked
+ * @param stereotype
+ * The Stereotype of the Compartment that is retrieved.
+ * @return The Compartment related to the Stereotype (existing or newly created)
+ */
+ public View getStereotypeCompartmentInBrace(final View view, final Stereotype stereotype) {
+ View compartment = helper.getStereotypeBraceCompartment(view, stereotype);
+
+ return compartment;
+ }
+
+
+ /**
+ * Retrieve the Stereotype Compartment View related to a Stereotype in Comment and create it if null.
+ *
+ * @param view
+ * The view on which the Compartment is checked
+ * @param stereotype
+ * The Stereotype of the Compartment that is retrieved.
+ * @return The Compartment related to the Stereotype (existing or newly created)
+ */
+ public View getStereotypeCompartmentInComment(View view, Stereotype stereotype) {
+ View comment = helper.getStereotypeComment(view);
+ View compartment = helper.getStereotypeCompartment(comment, stereotype);
+
+ return compartment;
+ }
+
+ /**
+ * Retrieve the Stereotype Property related to a Stereotype and create it if null.
+ *
+ * @param view
+ * The view on which the Compartment is checked
+ * @param stereotype
+ * The Stereotype of the Compartment that is retrieved.
+ * @param property
+ * The UML Property of the Stereotype to be retrieved.
+ *
+ * @return The Property related with the Stereotype (existing or newly created)
+ */
+ public View getStereotypePropertyInCompartment(final View view, final Stereotype stereotype, final Property property) {
+ View propertyView = helper.getStereotypeProperty(view, stereotype, property);
+
+
+ return propertyView;
+ }
+
+
+ /**
+ * Retrieve the Stereotype Property View related to a Stereotype in Brace and create it if null.
+ *
+ * @param view
+ * The view on which the Compartment is checked
+ * @param stereotype
+ * The Stereotype of the Compartment that is retrieved.
+ * @param property
+ * The UML Property of the Stereotype to be retrieved.
+ *
+ * @return The Property related with the Stereotype (existing or newly created)
+ */
+ public View getStereotypePropertyInBrace(View view, Stereotype stereotype, Property property) {
+
+ View propertyView = helper.getStereotypePropertyInBrace(view, stereotype, property);
+
+ return propertyView;
+
+ }
+
+
+
+ /**
+ * Retrieve the Stereotype Property View related to a Stereotype in Comment and create it if null.
+ *
+ * @param view
+ * The view on which the Compartment is checked
+ * @param stereotype
+ * The Stereotype of the Compartment that is retrieved.
+ * @param property
+ * The UML Property of the Stereotype to be retrieved.
+ *
+ * @return The Property related with the Stereotype (existing or newly created)
+ */
+ public View getStereotypePropertyInComment(View view, Stereotype stereotype, Property property) {
+
+ View propertyView = helper.getStereotypePropertyInComment(view, stereotype, property);
+
+ return propertyView;
+
+ }
+
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/AddAppliedQNStereotypeToDisplayCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/AddAppliedQNStereotypeToDisplayCommand.java
new file mode 100644
index 00000000000..62fad89c3bd
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/AddAppliedQNStereotypeToDisplayCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display.command;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayCommandExecution;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * The Class AddQNAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to
+ * display with the qualifiedName.
+ */
+public class AddAppliedQNStereotypeToDisplayCommand extends RecordingCommand {
+
+
+ private Stereotype stereotype;
+
+ private View view;
+ private TransactionalEditingDomain domain;
+ private String depth;
+
+ private static StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
+ private static StereotypeDisplayCommandExecution commandHelper = StereotypeDisplayCommandExecution.getInstance();
+
+
+ /**
+ * Instantiates a new sets the applied stereotype to display command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param stereotypeList
+ * the stereotype list
+ */
+ public AddAppliedQNStereotypeToDisplayCommand(final TransactionalEditingDomain domain, final View view,
+ final Stereotype stereotype, final String depth) {
+ super(domain, "Display Stereotype with Qualified Name");
+ this.depth = depth;
+ this.domain = domain;
+ this.view = view;
+ this.stereotype = stereotype;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ View label = helper.getStereotypeLabel(view, stereotype);
+ commandHelper.setUserDepth(domain, stereotype, label, "full");
+
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/AddAppliedStereotypePropertiesToDisplayCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/AddAppliedStereotypePropertiesToDisplayCommand.java
new file mode 100644
index 00000000000..32b5f9a2788
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/AddAppliedStereotypePropertiesToDisplayCommand.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display.command;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeLocationEnum;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayCommandExecution;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * The Class AddAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to
+ * display
+ */
+public class AddAppliedStereotypePropertiesToDisplayCommand extends RecordingCommand {
+
+
+ private Property property;
+ private Stereotype stereotype;
+ private View view;
+ private TransactionalEditingDomain domain;
+ private String location;
+
+ private static StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
+ private static StereotypeDisplayCommandExecution commandHelper = StereotypeDisplayCommandExecution.getInstance();
+
+
+
+ /**
+ * add a new sets the applied stereotype properties to display command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param stereotypeList
+ * the stereotype list
+ */
+ public AddAppliedStereotypePropertiesToDisplayCommand(TransactionalEditingDomain domain, View view,
+ Property property, Stereotype stereotype, String location) {
+ super(domain, "Display a Stereotype Property");
+ this.property = property;
+ this.stereotype = stereotype;
+ this.domain = domain;
+ this.view = view;
+ this.location = location;
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ View propertyView = null;
+ if (StereotypeLocationEnum.IN_COMPARTMENT.equals(location)) {
+ propertyView = helper.getStereotypeProperty(view, stereotype, property);
+ } else if (StereotypeLocationEnum.IN_BRACE.equals(location)) {
+ propertyView = helper.getStereotypePropertyInBrace(view, stereotype, property);
+ } else if (StereotypeLocationEnum.IN_COMMENT.equals(location)) {
+ propertyView = helper.getStereotypePropertyInComment(view, stereotype, property);
+ }
+
+ commandHelper.setUserVisibility(domain, propertyView, true);
+
+
+ }
+
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/AddAppliedStereotypeToDisplayCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/AddAppliedStereotypeToDisplayCommand.java
new file mode 100644
index 00000000000..8a0ddd21b7e
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/AddAppliedStereotypeToDisplayCommand.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display.command;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayCommandExecution;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
+
+/**
+ * The Class AddAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to
+ * display
+ */
+public class AddAppliedStereotypeToDisplayCommand extends RecordingCommand {
+
+ /** The qualified name. */
+ private String stereotypeName;
+
+ private View view;
+ private TransactionalEditingDomain domain;
+
+ private static StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
+ private static StereotypeDisplayCommandExecution commandHelper = StereotypeDisplayCommandExecution.getInstance();
+
+
+
+ /**
+ * Instantiates a new sets the applied stereotype to display command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param stereotypeList
+ * the stereotype list
+ */
+ public AddAppliedStereotypeToDisplayCommand(final TransactionalEditingDomain domain, final View view,
+ final String stereotypeName) {
+ super(domain, "Display Stereotype Label");
+ this.stereotypeName = stereotypeName;
+ this.domain = domain;
+ this.view = view;
+
+
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ View label = helper.getStereotypeLabel(view, stereotypeName);
+ commandHelper.setUserVisibility(domain, label, true);
+
+
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/CreateAppliedStereotypeCommentViewCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/CreateAppliedStereotypeCommentViewCommand.java
index f39c8d7fe79..54170b04132 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/CreateAppliedStereotypeCommentViewCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/CreateAppliedStereotypeCommentViewCommand.java
@@ -12,7 +12,7 @@
* Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 460356 : Refactor Stereotype Display
*
*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.stereotype;
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display.command;
import java.util.ArrayList;
@@ -34,6 +34,7 @@ import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
import org.eclipse.gmf.runtime.notation.TitleStyle;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
/**
* the goal of this command is to create a comment in the notation that represent a compartment of stereotypes
@@ -82,13 +83,13 @@ public class CreateAppliedStereotypeCommentViewCommand extends RecordingCommand
ts.setShowTitle(true);
node.getStyles().add(ts);
node.setElement(null);
- node.setType(StereotypeDisplayUtils.STEREOTYPE_COMMENT_TYPE);
+ node.setType(StereotypeDisplayConstant.STEREOTYPE_COMMENT_TYPE);
connectCommentNode(owner, node);
EObjectValueStyle eObjectValueStyle = (EObjectValueStyle) node.createStyle(NotationPackage.eINSTANCE.getEObjectValueStyle());
eObjectValueStyle.setEObjectValue(base_element);
- eObjectValueStyle.setName(StereotypeDisplayUtils.STEREOTYPE_COMMENT_RELATION_NAME);
+ eObjectValueStyle.setName(StereotypeDisplayConstant.STEREOTYPE_COMMENT_RELATION_NAME);
// create the link
Connector edge = NotationFactory.eINSTANCE.createConnector();
@@ -100,7 +101,7 @@ public class CreateAppliedStereotypeCommentViewCommand extends RecordingCommand
bendpoints.setPoints(points);
edge.setBendpoints(bendpoints);
ViewUtil.insertChildView(owner.getDiagram(), edge, -1, true);
- edge.setType(StereotypeDisplayUtils.STEREOTYPE_COMMENT_LINK_TYPE);
+ edge.setType(StereotypeDisplayConstant.STEREOTYPE_COMMENT_LINK_TYPE);
edge.setElement(base_element);
IdentityAnchor anchor = NotationFactory.eINSTANCE.createIdentityAnchor();
edge.setSourceAnchor(anchor);
@@ -111,7 +112,7 @@ public class CreateAppliedStereotypeCommentViewCommand extends RecordingCommand
edge.setElement(null);
eObjectValueStyle = (EObjectValueStyle) edge.createStyle(NotationPackage.eINSTANCE.getEObjectValueStyle());
eObjectValueStyle.setEObjectValue(base_element);
- eObjectValueStyle.setName(StereotypeDisplayUtils.STEREOTYPE_COMMENT_RELATION_NAME);
+ eObjectValueStyle.setName(StereotypeDisplayConstant.STEREOTYPE_COMMENT_RELATION_NAME);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/CreateAppliedStereotypeViewCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/CreateAppliedStereotypeCompartmentCommand.java
index 64764162f3e..ca8c41b6947 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/CreateAppliedStereotypeViewCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/CreateAppliedStereotypeCompartmentCommand.java
@@ -11,7 +11,7 @@
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
*
*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.stereotype;
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display.command;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
@@ -21,15 +21,17 @@ import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.runtime.notation.StringValueStyle;
import org.eclipse.gmf.runtime.notation.TitleStyle;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
import org.eclipse.uml2.uml.Stereotype;
/**
* the goal of this command is to create a basic compartment in the notation that represent a compartment of stereotypes
*
*/
-public class CreateAppliedStereotypeViewCommand extends RecordingCommand {
+public class CreateAppliedStereotypeCompartmentCommand extends RecordingCommand {
- protected StereotypeDisplayHelper helper = StereotypeDisplayHelper.getInstance();
+ protected StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
protected View node;
@@ -49,7 +51,7 @@ public class CreateAppliedStereotypeViewCommand extends RecordingCommand {
* @param StereotypeApplication
* @param displayit
*/
- public CreateAppliedStereotypeViewCommand(TransactionalEditingDomain domain, View node, Stereotype stereotype, String type) {
+ public CreateAppliedStereotypeCompartmentCommand(TransactionalEditingDomain domain, View node, Stereotype stereotype, String type) {
super(domain, "CreateStereotypeCompartment");
this.node = node;
this.stereotype = stereotype;
@@ -74,14 +76,14 @@ public class CreateAppliedStereotypeViewCommand extends RecordingCommand {
// Create Stereotype Name Style
StringValueStyle stereotypeNameStyle = NotationFactory.eINSTANCE.createStringValueStyle();
- stereotypeNameStyle.setName(StereotypeDisplayUtils.STEREOTYPE_COMPARTMENT_NAME);
+ stereotypeNameStyle.setName(StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_NAME);
stereotypeNameStyle.setStringValue(stereotype.getQualifiedName());
compartment.getStyles().add(stereotypeNameStyle);
// Complete the creation
compartment.setElement(stereotype);
compartment.setType(type);
- ViewUtil.insertChildView(node, compartment, ViewUtil.APPEND, StereotypeDisplayUtils.PERSISTENT);
+ ViewUtil.insertChildView(node, compartment, ViewUtil.APPEND, StereotypeDisplayConstant.PERSISTENT);
compartment.setMutable(true);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/CreateAppliedStereotypePropertyViewCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/CreateAppliedStereotypePropertyViewCommand.java
index 6826511702f..c109a891b98 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/CreateAppliedStereotypePropertyViewCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/CreateAppliedStereotypePropertyViewCommand.java
@@ -12,7 +12,7 @@
* Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotypes Display
*
*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.stereotype;
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display.command;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.RecordingCommand;
@@ -21,6 +21,7 @@ import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
import org.eclipse.gmf.runtime.notation.DecorationNode;
import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Property;
@@ -61,7 +62,7 @@ public class CreateAppliedStereotypePropertyViewCommand extends RecordingCommand
propertyLabel.setElement(property);
// Add the new Label to it's owner Object
- ViewUtil.insertChildView(owner, propertyLabel, ViewUtil.APPEND, StereotypeDisplayUtils.PERSISTENT);
+ ViewUtil.insertChildView(owner, propertyLabel, ViewUtil.APPEND, StereotypeDisplayConstant.PERSISTENT);
propertyLabel.setMutable(true);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/CreateStereotypeLabelCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/CreateStereotypeLabelCommand.java
index 912498db127..36b35c3c3b3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/CreateStereotypeLabelCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/CreateStereotypeLabelCommand.java
@@ -12,7 +12,7 @@
*
*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.stereotype;
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display.command;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
@@ -21,6 +21,7 @@ import org.eclipse.gmf.runtime.notation.DecorationNode;
import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.runtime.notation.StringValueStyle;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Stereotype;
@@ -71,18 +72,18 @@ public class CreateStereotypeLabelCommand extends RecordingCommand {
// Create Label
DecorationNode label = NotationFactory.eINSTANCE.createDecorationNode();
- label.setType(StereotypeDisplayUtils.STEREOTYPE_LABEL_TYPE);
+ label.setType(StereotypeDisplayConstant.STEREOTYPE_LABEL_TYPE);
label.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
label.setElement(stereotype);
// Create Stereotype Name Style
StringValueStyle stereotypeNameStyle = NotationFactory.eINSTANCE.createStringValueStyle();
- stereotypeNameStyle.setName(StereotypeDisplayUtils.STEREOTYPE_LABEL_NAME);
+ stereotypeNameStyle.setName(StereotypeDisplayConstant.STEREOTYPE_LABEL_NAME);
stereotypeNameStyle.setStringValue(stereotype.getQualifiedName());
label.getStyles().add(stereotypeNameStyle);
// Add the new Label to it's owner Object
- ViewUtil.insertChildView(owner, label, ViewUtil.APPEND, StereotypeDisplayUtils.PERSISTENT);
+ ViewUtil.insertChildView(owner, label, ViewUtil.APPEND, StereotypeDisplayConstant.PERSISTENT);
label.setMutable(true);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/RemoveAppliedStereotypePropertiesToDisplayCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/RemoveAppliedStereotypePropertiesToDisplayCommand.java
new file mode 100644
index 00000000000..941dd7baf5d
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/RemoveAppliedStereotypePropertiesToDisplayCommand.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display.command;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeLocationEnum;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayCommandExecution;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * The Class RemoveAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to
+ * display
+ */
+public class RemoveAppliedStereotypePropertiesToDisplayCommand extends RecordingCommand {
+
+
+ private View view;
+ private TransactionalEditingDomain domain;
+ private Stereotype stereotype;
+ private Property property;
+ private String location;
+
+ private static StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
+ private static StereotypeDisplayCommandExecution commandHelper = StereotypeDisplayCommandExecution.getInstance();
+
+ /**
+ * Instantiates a new sets the applied stereotype to display command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param stereotypePropertyList
+ * the stereotype list
+ */
+ public RemoveAppliedStereotypePropertiesToDisplayCommand(TransactionalEditingDomain domain, View view,
+ final Property property, final Stereotype stereotype, final String location) {
+ super(domain, "Hide a Stereotype Property");
+ this.property = property;
+ this.stereotype = stereotype;
+ this.domain = domain;
+ this.view = view;
+ this.location = location;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ View propertyView = null;
+ if (StereotypeLocationEnum.IN_COMPARTMENT.equals(location)) {
+ propertyView = helper.getStereotypeProperty(view, stereotype, property);
+ } else if (StereotypeLocationEnum.IN_BRACE.equals(location)) {
+ propertyView = helper.getStereotypePropertyInBrace(view, stereotype, property);
+ } else if (StereotypeLocationEnum.IN_COMMENT.equals(location)) {
+ propertyView = helper.getStereotypePropertyInComment(view, stereotype, property);
+ }
+
+ commandHelper.setUserVisibility(domain, propertyView, false);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/RemoveAppliedStereotypeToDisplayCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/RemoveAppliedStereotypeToDisplayCommand.java
new file mode 100644
index 00000000000..1b54a707f73
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/RemoveAppliedStereotypeToDisplayCommand.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display.command;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayCommandExecution;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * The Class RemoveAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to
+ * display
+ */
+public class RemoveAppliedStereotypeToDisplayCommand extends RecordingCommand {
+
+
+ private View view;
+ private TransactionalEditingDomain domain;
+ private Stereotype stereotype;
+
+ private static StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
+ private static StereotypeDisplayCommandExecution commandHelper = StereotypeDisplayCommandExecution.getInstance();
+
+
+
+
+ /**
+ * Instantiates a new sets the applied stereotype to display command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param stereotypeList
+ * the stereotype list
+ */
+
+ public RemoveAppliedStereotypeToDisplayCommand(TransactionalEditingDomain domain, View view,
+ Stereotype stereotype) {
+ super(domain, "Hide Stereotype Label");
+ this.domain = domain;
+ this.view = view;
+ this.stereotype = stereotype;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ View label = helper.getStereotypeLabel(view, stereotype);
+ commandHelper.setUserVisibility(domain, label, false);
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/SetPersistentViewCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/SetPersistentViewCommand.java
index 54aff428314..4b0237b8262 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/SetPersistentViewCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/SetPersistentViewCommand.java
@@ -12,10 +12,11 @@
*
*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.stereotype;
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display.command;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.View;
/**
@@ -71,8 +72,12 @@ public class SetPersistentViewCommand extends RecordingCommand {
// Make the Parent Persistent
makeViewPersistant((View) view.eContainer());
// Move the view from the Transient List to the Persistent Children list
- ((View) view.eContainer()).getPersistedChildren().add(view);
- ((View) view.eContainer()).getTransientChildren().remove(view);
+ if (!(view instanceof Edge)) {
+ ((View) view.eContainer()).getPersistedChildren().add(view);
+ ((View) view.eContainer()).getTransientChildren().remove(view);
+ }
+
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/UnsetPersistentViewCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/UnsetPersistentViewCommand.java
index 4826f332a26..7648cf62cad 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/UnsetPersistentViewCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/command/UnsetPersistentViewCommand.java
@@ -12,7 +12,7 @@
*
*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.stereotype;
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display.command;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/helper/StereotypeDisplayCommandExecution.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/helper/StereotypeDisplayCommandExecution.java
new file mode 100644
index 00000000000..1150fd687ee
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/helper/StereotypeDisplayCommandExecution.java
@@ -0,0 +1,228 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.commands.SetNodeVisibilityCommand;
+import org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom.CustomStyleValueCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.SetPersistentViewCommand;
+import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * This Class regroups the Commands and their execution for the Stereotype Display
+ *
+ * @author Céline JANSSENS
+ *
+ */
+public final class StereotypeDisplayCommandExecution {
+ /**
+ * singleton instance
+ */
+ private static StereotypeDisplayCommandExecution labelHelper;
+ private StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
+
+ /** Singleton contructor */
+ private StereotypeDisplayCommandExecution() {
+ }
+
+ /**
+ * Returns the singleton instance of this class
+ *
+ * @return the singleton instance.
+ */
+ public static StereotypeDisplayCommandExecution getInstance() {
+ if (labelHelper == null) {
+ labelHelper = new StereotypeDisplayCommandExecution();
+ }
+ return labelHelper;
+ }
+
+ /**
+ * Set the visibility of a view
+ *
+ * @param view
+ * The view on which the visibility has to be set
+ * @param isVisible
+ * True to make the Compartment visible
+ */
+ public void setVisibility(final TransactionalEditingDomain domain, final View view, final boolean isVisible, final boolean inCommandStack) {
+
+
+ if (!inCommandStack) {
+ class SetVisibilityRunnable implements Runnable {
+
+ private boolean visible;
+
+ /**
+ * Constructor.
+ *
+ */
+ public SetVisibilityRunnable(boolean visible) {
+ this.visible = visible;
+ }
+
+ /**
+ * @see java.lang.Runnable#run()
+ *
+ */
+ @Override
+ public void run() {
+ if (view.isVisible() != visible) {
+ view.setVisible(visible);
+ }
+ }
+
+ }
+ CommandUtil.executeUnsafeCommand(new SetVisibilityRunnable(isVisible), domain);
+ } else {
+ SetNodeVisibilityCommand visibility = new SetNodeVisibilityCommand(domain, view, isVisible);
+ CommandUtil.executeCommandInStack(visibility, domain);
+ }
+ }
+
+
+ /**
+ * Set the visibility of a view
+ *
+ * @param view
+ * The view on which the visibility has to be set
+ * @param isVisible
+ * True to make the Compartment visible
+ */
+ public void setPersistency(final TransactionalEditingDomain domain, final View view, boolean inCommandStack) {
+
+
+ if (!inCommandStack) {
+
+ class SetPersistencyRunnable implements Runnable {
+
+ /**
+ * @see java.lang.Runnable#run()
+ *
+ */
+ @Override
+ public void run() {
+ makeViewPersistant(view);
+ }
+
+ }
+ CommandUtil.executeUnsafeCommand(new SetPersistencyRunnable(), domain);
+ } else {
+ SetPersistentViewCommand persitence = new SetPersistentViewCommand(domain, view);
+ CommandUtil.executeCommandInStack(persitence, domain);
+ }
+
+ }
+
+ /**
+ * @param eContainer
+ */
+ public void makeViewPersistant(View view) {
+ if (view != null) {
+ if (view.eContainer() != null && view.eContainer() instanceof View) {
+
+ // Make the Parent Persistent
+ makeViewPersistant((View) view.eContainer());
+ // Move the view from the Transient List to the Persistent Children list
+ if (!(view instanceof Edge)) {
+ ((View) view.eContainer()).getPersistedChildren().add(view);
+ ((View) view.eContainer()).getTransientChildren().remove(view);
+ }
+
+ }
+ }
+
+ }
+
+ /**
+ * Set the depth Name of the Stereotype Label.
+ * It uses the NamedStyle to store the depth into a View.
+ *
+ * @param stereotype
+ * The Stereotype of the Label that should be modified.
+ * @param nodeView
+ * The view of the element that needs to be updated (i.e. The Class)
+ * @param depth
+ * The Depth value as a string (Can be "none", "full" or a negative number )
+ */
+ public void setDepth(final TransactionalEditingDomain domain, final Stereotype stereotype, final View nodeView, final String depth, final boolean inCommandStack) {
+ final View label = helper.getStereotypeLabel(nodeView, stereotype);
+
+ Command command = new CustomStyleValueCommand(label, depth, NotationPackage.eINSTANCE.getStringValueStyle(), NotationPackage.eINSTANCE.getStringValueStyle_StringValue(), StereotypeDisplayConstant.STEREOTYPE_LABEL_DEPTH);
+
+ if (inCommandStack) {
+
+
+ CommandUtil.executeCommandInStack(command, domain);
+ } else {
+ CommandUtil.executeUnsafeCommand(command, domain);
+ }
+
+ }
+
+ /**
+ * This Method is called when the user ask explicitly to display a View.
+ * Then the node is first set as Persistence and the command is put in the command Stack
+ * before to set the Visibility as wanted.
+ *
+ * @param domain
+ * The Transactional Domain
+ * @param view
+ * The View to make visible
+ * @param visible
+ * True if the View has to be visible, false if the Node should be hidden
+ *
+ */
+ public void setUserVisibility(TransactionalEditingDomain domain, View view, boolean visible) {
+ if (view != null && domain != null) {
+
+ SetPersistentViewCommand persitence = new SetPersistentViewCommand(domain, view);
+ CommandUtil.executeCommandInStack(persitence, domain);
+ SetNodeVisibilityCommand visibility = new SetNodeVisibilityCommand(domain, view, visible);
+ CommandUtil.executeCommandInStack(visibility, domain);
+
+ }
+ }
+
+
+ /**
+ * This Method is called when the user ask explicitly to display a View.
+ * Then the node is first set as Persistence and the command is put in the command Stack
+ * before to set the Visibility as wanted.
+ *
+ * @param domain
+ * The Transactional Domain
+ * @param view
+ * The View to make visible
+ * @param visible
+ * True if the View has to be visible, false if the Node should be hidden
+ *
+ */
+ public void setUserDepth(TransactionalEditingDomain domain, Stereotype stereotype, View view, String depth) {
+
+ if (view != null && depth != null && !depth.isEmpty()) {
+ setPersistency(domain, view, true);
+ setDepth(domain, stereotype, view, depth, true);
+ }
+ }
+
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/StereotypeDisplayUtils.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/helper/StereotypeDisplayConstant.java
index 3e20303ecef..b03aa885035 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/StereotypeDisplayUtils.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/helper/StereotypeDisplayConstant.java
@@ -12,7 +12,7 @@
*
*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.stereotype;
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper;
import org.eclipse.papyrus.uml.diagram.common.Activator;
@@ -24,7 +24,7 @@ import org.eclipse.papyrus.uml.diagram.common.Activator;
* @author Celine JANSSENS
*
*/
-public class StereotypeDisplayUtils {
+public class StereotypeDisplayConstant {
// Depth Separator of the Stereotype Name
public static final String STEREOTYPE_LABEL_DEPTH_SEPARATOR = "::";//$NON-NLS-1$
@@ -78,6 +78,26 @@ public class StereotypeDisplayUtils {
// Icon NamedStyle Property
public static final String DISPLAY_ICON = "displayIcon";// $NON-NLS-1$
- public static final String STEREOTYPE_PROPERTY_LOCATION = "stereotypePropertyLocation";//$NON-NLS-1$
+ // NamedStyle Name for Property Location
+ public static final String STEREOTYPE_PROPERTY_LOCATION = "StereotypePropertyLocation";//$NON-NLS-1$
+
+ // NamedStyle Name for Label Alignment
+ public static final String STEREOTYPE_LABEL_ALIGNMENT = "stereotypeAlignment";//$NON-NLS-1$
+
+ /**
+ * String represent the location of stereotype properties within a comment
+ */
+ public static final String STEREOTYPE_COMMENT_LOCATION = "Comment";//$NON-NLS-1$
+
+ /**
+ * String represent the location of stereotype properties within a compartment of a graph node
+ */
+ public static final String STEREOTYPE_COMPARTMENT_LOCATION = "Compartment";//$NON-NLS-1$
+
+ /**
+ * properties of applied stereotypes are enclose in braces
+ */
+ public static final String STEREOTYPE_BRACE_LOCATION = "With brace";//$NON-NLS-1$
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/StereotypeDisplayHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/helper/StereotypeDisplayUtil.java
index fb40719a199..9e3c0af4d21 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/StereotypeDisplayHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/helper/StereotypeDisplayUtil.java
@@ -12,12 +12,11 @@
*
*****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.stereotype;
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper;
import java.util.Iterator;
import java.util.StringTokenizer;
-import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
@@ -25,14 +24,12 @@ import org.eclipse.gmf.runtime.notation.BasicCompartment;
import org.eclipse.gmf.runtime.notation.DecorationNode;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.Shape;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.commands.SetNodeVisibilityCommand;
-import org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom.CustomStyleValueCommand;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.UnsetPersistentViewCommand;
import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Element;
@@ -47,17 +44,17 @@ import org.eclipse.uml2.uml.util.UMLUtil;
* @author Celine JANSSENS
*
*/
-public class StereotypeDisplayHelper {
+public class StereotypeDisplayUtil {
private static final String EMPTY_STRING = ""; // $NON-NLS-1$
/**
* singleton instance
*/
- private static StereotypeDisplayHelper labelHelper;
+ private static StereotypeDisplayUtil labelHelper;
/** Singleton contructor */
- private StereotypeDisplayHelper() {
+ private StereotypeDisplayUtil() {
}
/**
@@ -65,9 +62,9 @@ public class StereotypeDisplayHelper {
*
* @return the singleton instance.
*/
- public static StereotypeDisplayHelper getInstance() {
+ public static StereotypeDisplayUtil getInstance() {
if (labelHelper == null) {
- labelHelper = new StereotypeDisplayHelper();
+ labelHelper = new StereotypeDisplayUtil();
}
return labelHelper;
}
@@ -101,18 +98,18 @@ public class StereotypeDisplayHelper {
/**
* Get the Semantic Element of the Comment View.
* The Comment View is not attached to its semantic element through the method {@link View#getElement()}.
- * To retrieve the semantic element, it has been added as a namedStyle with the name {@link StereotypeDisplayUtils#STEREOTYPE_COMMENT_RELATION_NAME}
+ * To retrieve the semantic element, it has been added as a namedStyle with the name {@link StereotypeDisplayConstant#STEREOTYPE_COMMENT_RELATION_NAME}
*
* @param view
* The Stereotype Comment View (of type "StereotypeComment")
* @return The Base Element of the Comment
*/
- protected Element getCommentSemanticElement(View view) {
+ public Element getCommentSemanticElement(View view) {
Element elementSemantic = null;
if (isStereotypeComment(view)) {
// Retrieve the Base Element of the Comment as the Semantic element
- EObject baseElement = NotationUtils.getEObjectValue(view, StereotypeDisplayUtils.STEREOTYPE_COMMENT_RELATION_NAME, null);
+ EObject baseElement = NotationUtils.getEObjectValue(view, StereotypeDisplayConstant.STEREOTYPE_COMMENT_RELATION_NAME, null);
if (baseElement instanceof Element) {
elementSemantic = (Element) baseElement;
@@ -183,7 +180,7 @@ public class StereotypeDisplayHelper {
if (isStereotypeLabel(object)) {
if (((View) object).isVisible()) {
if (!EMPTY_STRING.equals(textToDisplay.toString()) && (textToDisplay != null)) {
- textToDisplay.append(StereotypeDisplayUtils.STEREOTYPE_LABEL_SEPARATOR);
+ textToDisplay.append(StereotypeDisplayConstant.STEREOTYPE_LABEL_SEPARATOR);
}
textToDisplay.append(getStereotypeName((DecorationNode) object));
}
@@ -193,7 +190,7 @@ public class StereotypeDisplayHelper {
// Then add the ornament around the text.
if ((textToDisplay.toString() != null) && (!EMPTY_STRING.equals(textToDisplay.toString()))) {
- finalText.append(StereotypeDisplayUtils.QUOTE_LEFT).append(textToDisplay).append(StereotypeDisplayUtils.QUOTE_RIGHT);
+ finalText.append(StereotypeDisplayConstant.QUOTE_LEFT).append(textToDisplay).append(StereotypeDisplayConstant.QUOTE_RIGHT);
}
// Return the text or null if empty
@@ -236,7 +233,7 @@ public class StereotypeDisplayHelper {
*
* @return The String with the new StereotypeName and
*/
- protected String getStereotypeName(DecorationNode label) {
+ public String getStereotypeName(DecorationNode label) {
// Retrieve Name and Depth from CSS or NamedStyle
@@ -263,11 +260,11 @@ public class StereotypeDisplayHelper {
protected String getStereotypeNameWithDepth(String qualifiedName, String depth) {
if (depth != null && !EMPTY_STRING.equals(depth)) {
- if (StereotypeDisplayUtils.DEPTH_MIN.equals(depth)) {
+ if (StereotypeDisplayConstant.DEPTH_MIN.equals(depth)) {
return getMinimumDepthName(qualifiedName);
- } else if (StereotypeDisplayUtils.DEPTH_MAX.equals(depth)) {
+ } else if (StereotypeDisplayConstant.DEPTH_MAX.equals(depth)) {
return qualifiedName;
- } else if (StereotypeDisplayUtils.DEPTH_AUTO.equals(depth)) {
+ } else if (StereotypeDisplayConstant.DEPTH_AUTO.equals(depth)) {
// TODO to be computed
return qualifiedName;
} else {
@@ -311,8 +308,8 @@ public class StereotypeDisplayHelper {
StringBuffer name = new StringBuffer(qualifiedName);
try {
for (int i = 0; i > depthRetrieve; i--) {
- int index = name.indexOf(StereotypeDisplayUtils.STEREOTYPE_LABEL_DEPTH_SEPARATOR);
- name = name.delete(0, index + StereotypeDisplayUtils.STEREOTYPE_LABEL_DEPTH_SEPARATOR.length());
+ int index = name.indexOf(StereotypeDisplayConstant.STEREOTYPE_LABEL_DEPTH_SEPARATOR);
+ name = name.delete(0, index + StereotypeDisplayConstant.STEREOTYPE_LABEL_DEPTH_SEPARATOR.length());
}
} catch (IndexOutOfBoundsException e) {
@@ -331,8 +328,8 @@ public class StereotypeDisplayHelper {
public String getMinimumDepthName(String qualifiedName) {
String segment = EMPTY_STRING;
StringBuffer name = new StringBuffer(qualifiedName);
- int index = name.lastIndexOf(StereotypeDisplayUtils.STEREOTYPE_LABEL_DEPTH_SEPARATOR);
- segment = name.substring(index + StereotypeDisplayUtils.STEREOTYPE_LABEL_DEPTH_SEPARATOR.length());
+ int index = name.lastIndexOf(StereotypeDisplayConstant.STEREOTYPE_LABEL_DEPTH_SEPARATOR);
+ segment = name.substring(index + StereotypeDisplayConstant.STEREOTYPE_LABEL_DEPTH_SEPARATOR.length());
return segment;
}
@@ -345,7 +342,7 @@ public class StereotypeDisplayHelper {
*/
protected int getMaxDepth(String qualifiedName) {
- StringTokenizer tok = new StringTokenizer(qualifiedName, StereotypeDisplayUtils.STEREOTYPE_LABEL_DEPTH_SEPARATOR);
+ StringTokenizer tok = new StringTokenizer(qualifiedName, StereotypeDisplayConstant.STEREOTYPE_LABEL_DEPTH_SEPARATOR);
return tok.countTokens();
}
@@ -368,7 +365,7 @@ public class StereotypeDisplayHelper {
obj = iter.next();
if (obj instanceof DecorationNode) {
DecorationNode label = (DecorationNode) obj;
- if (StereotypeDisplayUtils.STEREOTYPE_LABEL_TYPE.equals(label.getType())) {
+ if (StereotypeDisplayConstant.STEREOTYPE_LABEL_TYPE.equals(label.getType())) {
if (qualifiedName.equals(getName(label))) {
return label;
}
@@ -381,7 +378,7 @@ public class StereotypeDisplayHelper {
}
/**
- * Return the associated DecorationNode of a node from it's qualified name.
+ * Return the associated Property view of a node from the property name.
*
* @param node
* Container Node of the StereotypeLabel
@@ -409,6 +406,66 @@ public class StereotypeDisplayHelper {
return propertyView;
}
+ /**
+ * Return the associated Property view of a node from the property name.
+ *
+ * @param node
+ * Container Node of the StereotypeLabel
+ * @param qualifiedName
+ * Qualified Name of the Stereotype associated to this Label
+ * @return associated StereotypeLabel
+ */
+ public DecorationNode getStereotypePropertyInBrace(View node, Stereotype stereotype, Property property) {
+ DecorationNode propertyView = null;
+ if ((stereotype != null) && (property != null)) {
+ View compartment = getStereotypeBraceCompartment(node, stereotype);
+ Object obj;
+ if (compartment != null) {
+ Iterator<?> iter = compartment.getChildren().iterator();
+ while (iter.hasNext()) {
+ obj = iter.next();
+ if (isStereotypeBraceProperty(obj) && ((DecorationNode) obj).getElement().equals(property)) {
+ propertyView = (DecorationNode) obj;
+ }
+
+ }
+ }
+ }
+
+ return propertyView;
+ }
+
+ /**
+ * Return the associated Property view of a node from the property name.
+ *
+ * @param node
+ * Container Node of the StereotypeLabel
+ * @param qualifiedName
+ * Qualified Name of the Stereotype associated to this Label
+ * @return associated StereotypeLabel
+ */
+ public DecorationNode getStereotypePropertyInComment(View mainView, Stereotype stereotype, Property property) {
+ View node = getStereotypeComment(mainView);
+ DecorationNode propertyView = null;
+
+ if ((stereotype != null) && (property != null)) {
+ View compartment = getStereotypeCompartment(node, stereotype);
+ Object obj;
+ if (compartment != null) {
+ Iterator<?> iter = compartment.getChildren().iterator();
+ while (iter.hasNext()) {
+ obj = iter.next();
+ if (isStereotypeProperty(obj) && ((DecorationNode) obj).getElement().equals(property)) {
+ propertyView = (DecorationNode) obj;
+ }
+
+ }
+ }
+ }
+
+ return propertyView;
+ }
+
/**
@@ -483,7 +540,7 @@ public class StereotypeDisplayHelper {
Edge appliedStereotypeLink = null;
while (edgeIterator.hasNext() && appliedStereotypeLink == null) {
Edge edge = edgeIterator.next();
- if (edge.getType().equals(StereotypeDisplayUtils.STEREOTYPE_COMMENT_LINK_TYPE)) {
+ if (edge.getType().equals(StereotypeDisplayConstant.STEREOTYPE_COMMENT_LINK_TYPE)) {
appliedStereotypeLink = edge;
}
}
@@ -507,7 +564,7 @@ public class StereotypeDisplayHelper {
public boolean isStereotypeLabel(Object element) {
boolean stereotypeLabel = Boolean.FALSE;
if (element instanceof DecorationNode) {
- stereotypeLabel = StereotypeDisplayUtils.STEREOTYPE_LABEL_TYPE.equals(((DecorationNode) element).getType());
+ stereotypeLabel = StereotypeDisplayConstant.STEREOTYPE_LABEL_TYPE.equals(((DecorationNode) element).getType());
}
return stereotypeLabel;
@@ -523,7 +580,7 @@ public class StereotypeDisplayHelper {
public boolean isStereotypeCompartment(Object element) {
boolean stereotypeCompartment = Boolean.FALSE;
if (element instanceof BasicCompartment) {
- stereotypeCompartment = StereotypeDisplayUtils.STEREOTYPE_COMPARTMENT_TYPE.equals(((DecorationNode) element).getType());
+ stereotypeCompartment = StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_TYPE.equals(((DecorationNode) element).getType());
}
return stereotypeCompartment;
}
@@ -538,7 +595,7 @@ public class StereotypeDisplayHelper {
public boolean isStereotypeProperty(Object element) {
boolean stereotypeProperty = Boolean.FALSE;
if (element instanceof DecorationNode) {
- stereotypeProperty = StereotypeDisplayUtils.STEREOTYPE_PROPERTY_TYPE.equals(((DecorationNode) element).getType());
+ stereotypeProperty = StereotypeDisplayConstant.STEREOTYPE_PROPERTY_TYPE.equals(((DecorationNode) element).getType());
}
return stereotypeProperty;
@@ -555,7 +612,7 @@ public class StereotypeDisplayHelper {
public boolean isStereotypeBrace(Object element) {
boolean stereotypeBraceCmpt = Boolean.FALSE;
if (element instanceof BasicCompartment) {
- stereotypeBraceCmpt = StereotypeDisplayUtils.STEREOTYPE_BRACE_TYPE.equals(((BasicCompartment) element).getType());
+ stereotypeBraceCmpt = StereotypeDisplayConstant.STEREOTYPE_BRACE_TYPE.equals(((BasicCompartment) element).getType());
}
return stereotypeBraceCmpt;
@@ -572,7 +629,7 @@ public class StereotypeDisplayHelper {
public boolean isStereotypeBraceProperty(Object element) {
boolean stereotypeProperty = Boolean.FALSE;
if (element instanceof DecorationNode) {
- stereotypeProperty = StereotypeDisplayUtils.STEREOTYPE_PROPERTY_BRACE_TYPE.equals(((DecorationNode) element).getType());
+ stereotypeProperty = StereotypeDisplayConstant.STEREOTYPE_PROPERTY_BRACE_TYPE.equals(((DecorationNode) element).getType());
}
return stereotypeProperty;
}
@@ -590,7 +647,7 @@ public class StereotypeDisplayHelper {
public boolean isStereotypeComment(Object element) {
boolean stereotypeComment = Boolean.FALSE;
if (element instanceof Shape) {
- stereotypeComment = StereotypeDisplayUtils.STEREOTYPE_COMMENT_TYPE.equals(((Shape) element).getType());
+ stereotypeComment = StereotypeDisplayConstant.STEREOTYPE_COMMENT_TYPE.equals(((Shape) element).getType());
}
return stereotypeComment;
}
@@ -612,7 +669,7 @@ public class StereotypeDisplayHelper {
}
if (isStereotypeLabel(label)) {
// Retrieve Name from CSS or NamedStyle from the Notation model.
- name = NotationUtils.getStringValue(label, StereotypeDisplayUtils.STEREOTYPE_LABEL_NAME, defaultName);
+ name = NotationUtils.getStringValue(label, StereotypeDisplayConstant.STEREOTYPE_LABEL_NAME, defaultName);
}
return name;
}
@@ -632,7 +689,7 @@ public class StereotypeDisplayHelper {
}
if (isStereotypeCompartment(compartment) || isStereotypeBrace(compartment)) {
// Retrieve Name from CSS or NamedStyle from the Notation model.
- name = NotationUtils.getStringValue(compartment, StereotypeDisplayUtils.STEREOTYPE_COMPARTMENT_NAME, defaultName);
+ name = NotationUtils.getStringValue(compartment, StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_NAME, defaultName);
}
return name;
}
@@ -647,9 +704,9 @@ public class StereotypeDisplayHelper {
*/
public String getDepth(DecorationNode label) {
String depth = EMPTY_STRING;
- if (StereotypeDisplayUtils.STEREOTYPE_LABEL_TYPE.equals(label.getType())) {
+ if (label != null && StereotypeDisplayConstant.STEREOTYPE_LABEL_TYPE.equals(label.getType())) {
// Retrieve Depth from CSS or NamedStyle from the Notation model.
- depth = NotationUtils.getStringValue(label, StereotypeDisplayUtils.STEREOTYPE_LABEL_DEPTH, StereotypeDisplayUtils.DEFAULT_DEPTH_VALUE);
+ depth = NotationUtils.getStringValue(label, StereotypeDisplayConstant.STEREOTYPE_LABEL_DEPTH, StereotypeDisplayConstant.DEFAULT_DEPTH_VALUE);
}
return depth;
@@ -675,7 +732,7 @@ public class StereotypeDisplayHelper {
DecorationNode stereo = (DecorationNode) obj;
- if (StereotypeDisplayUtils.STEREOTYPE_LABEL_TYPE.equals(stereo.getType())) {
+ if (StereotypeDisplayConstant.STEREOTYPE_LABEL_TYPE.equals(stereo.getType())) {
exist = stereo.getElement().equals(stereotype);
}
}
@@ -736,76 +793,6 @@ public class StereotypeDisplayHelper {
}
- /**
- * Set the visibility of a view
- *
- * @param view
- * The view on which the visibility has to be set
- * @param isVisible
- * True to make the Compartment visible
- */
- public void setVisibility(final TransactionalEditingDomain domain, final View view, final boolean isVisible) {
- try {
-
- domain.runExclusive(new Runnable() {
-
- @Override
- public void run() {
-
- SetNodeVisibilityCommand setCommand = new SetNodeVisibilityCommand(domain, view, isVisible);
-
- // use to avoid to put it in the command stack
- try {
- GMFUnsafe.write(domain, setCommand);
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
-
-
- /**
- * Set the visibility of a view
- *
- * @param view
- * The view on which the visibility has to be set
- * @param isVisible
- * True to make the Compartment visible
- */
- public void setPersistency(final TransactionalEditingDomain domain, final View view) {
- try {
- domain.runExclusive(new Runnable() {
-
-
- @Override
- public void run() {
- Display.getCurrent().syncExec(new Runnable() {
-
-
- @Override
- public void run() {
-
- // use to avoid to put it in the command stack
- SetPersistentViewCommand command = new SetPersistentViewCommand(domain, view);
- try {
- GMFUnsafe.write(domain, command);
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
- }
- });
-
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
-
/**
@@ -830,7 +817,7 @@ public class StereotypeDisplayHelper {
// if (node.isVisible()) {
if (stereotype != null && property != null && umlElement != null) {
- propertyAndValue = StereotypeUtil.displayPropertyValue(stereotype, property, umlElement, StereotypeDisplayUtils.STEREOTYPE_PROPERTIES_SEPARATOR);
+ propertyAndValue = StereotypeUtil.displayPropertyValue(stereotype, property, umlElement, StereotypeDisplayConstant.STEREOTYPE_PROPERTIES_SEPARATOR);
}
}
@@ -902,13 +889,13 @@ public class StereotypeDisplayHelper {
String propAndValueText = getStereotypePropertyToDisplay(propertyNode, propertyElement);
// add it to the String (i.e: "allocatedTo=[], allocatedFrom=[]")
- propertiesText = addTextWithSeparator(propertiesText, propAndValueText, StereotypeDisplayUtils.STEREOTYPE_LABEL_SEPARATOR);
+ propertiesText = addTextWithSeparator(propertiesText, propAndValueText, StereotypeDisplayConstant.STEREOTYPE_LABEL_SEPARATOR);
}
}
}
// And concatenate it to the existing text.(i.e: "isEncapsulated=false, allocatedTo=[], allocatedFrom=[]" )
- newTextToDisplay = addTextWithSeparator(newTextToDisplay, propertiesText.toString(), StereotypeDisplayUtils.STEREOTYPE_LABEL_SEPARATOR);
+ newTextToDisplay = addTextWithSeparator(newTextToDisplay, propertiesText.toString(), StereotypeDisplayConstant.STEREOTYPE_LABEL_SEPARATOR);
String finalText = newTextToDisplay.toString();
return finalText;
@@ -979,6 +966,28 @@ public class StereotypeDisplayHelper {
}
+ /**
+ * Defines if the Node has at least one Stereotype View as Child
+ *
+ * @param view
+ * The node on which we do the test
+ * @return true if at least one Stereotype Compartment, Brace or Label
+ */
+ public boolean hasStereotypeViews(View view) {
+
+ Iterator<?> iter = view.getChildren().iterator();
+ boolean compartmentExist = false;
+ while (iter.hasNext() && !compartmentExist) {
+
+ Object obj = iter.next();
+ compartmentExist = isStereotypeCompartment(obj)
+ || isStereotypeBrace(obj)
+ || isStereotypeLabel(obj);
+
+ }
+ return compartmentExist;
+ }
+
/**
* Defines if a Stereotype Comment Node has at least a brace or a compartment
@@ -1032,7 +1041,14 @@ public class StereotypeDisplayHelper {
* Defines if an object is a Stereotype View
*
* @param element
- * @return
+ * the Object on which the test is done
+ * @return true if object is one of the following:
+ * <ul>
+ * <li>Stereotype Compartment</li>
+ * <li>Stereotype Brace</li>
+ * <li>Stereotype Label</li>
+ * <li>Stereotype Property</li>
+ * </ul>
*/
public boolean isStereotypeView(Object element) {
@@ -1149,41 +1165,6 @@ public class StereotypeDisplayHelper {
return visibleProperties;
}
- /**
- * Set the depth Name of the Stereotype Label.
- * It uses the NamedStyle to store the depth into a View.
- *
- * @param stereotype
- * The Stereotype of the Label that should be modified.
- * @param nodeView
- * The view of the element that needs to be updated (i.e. The Class)
- * @param depth
- * The Depth value as a string (Can be "none", "full" or a negative number )
- */
- public void setDepth(final TransactionalEditingDomain domain, final Stereotype stereotype, final View nodeView, final String depth) {
- final View label = getStereotypeLabel(nodeView, stereotype);
- try {
-
- domain.runExclusive(new Runnable() {
-
- @Override
- public void run() {
- Command command = new CustomStyleValueCommand(label, depth, NotationPackage.eINSTANCE.getStringValueStyle(), NotationPackage.eINSTANCE.getStringValueStyle_StringValue(), StereotypeDisplayUtils.STEREOTYPE_LABEL_DEPTH);
-
- // use to avoid to put it in the command stack
- try {
- GMFUnsafe.write(domain, command);
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- });
- } catch (Exception e) {
- Activator.log.error(e);
- }
-
-
- }
/**
* @param domain
@@ -1230,11 +1211,57 @@ public class StereotypeDisplayHelper {
public boolean isStereotypeCommentLink(Object element) {
boolean stereotypeCommentLink = Boolean.FALSE;
if (element instanceof Edge) {
- stereotypeCommentLink = StereotypeDisplayUtils.STEREOTYPE_COMMENT_LINK_TYPE.equals(((Edge) element).getType());
+ stereotypeCommentLink = StereotypeDisplayConstant.STEREOTYPE_COMMENT_LINK_TYPE.equals(((Edge) element).getType());
}
return stereotypeCommentLink;
}
+ /**
+ * Get the semantic element from a view.
+ * In case of a view into a Stereotype Comment, return the semantic element of Base Element
+ *
+ * @param view
+ * The view of which the Semantic element is retrieved
+ * @return the semantic element
+ */
+ public Element getSemanticElement(View view) {
+ if (isStereotypeComment(view)) {
+ return getCommentSemanticElement(view);
+ } else {
+ if (view.getElement() instanceof Element) {
+ return (Element) view.getElement();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Concatenate Label and Property in Brace for the floating Stereotype Label.
+ *
+ * @param view
+ * The Main view of the object on which the stereotype is applied
+ * @return String with Stereotype Label and Properties in Braces
+ */
+ public String getStereotypeTextForFloatingLabel(View view) {
+ StringBuilder text = new StringBuilder();
+
+ String label = getStereotypeTextToDisplay(view);
+ String brace = getStereotypePropertiesInBrace(view);
+
+ if (label != null && !label.isEmpty()) {
+ text.append(label);
+
+ }
+
+
+ if (brace != null && !brace.isEmpty()) {
+ text.append(StereotypeDisplayConstant.STEREOTYPE_PROPERTY_SEPARATOR).append(StereotypeDisplayConstant.BRACE_LEFT + brace + StereotypeDisplayConstant.BRACE_RIGHT);
+ }
+
+
+ return text.toString();
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/helper/StereotypeUserActionHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/helper/StereotypeUserActionHelper.java
new file mode 100644
index 00000000000..96504c9bdc4
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/display/helper/StereotypeUserActionHelper.java
@@ -0,0 +1,123 @@
+/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation
+ * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.AddAppliedQNStereotypeToDisplayCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.AddAppliedStereotypePropertiesToDisplayCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.AddAppliedStereotypeToDisplayCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.RemoveAppliedStereotypePropertiesToDisplayCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.RemoveAppliedStereotypeToDisplayCommand;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * The Class AppliedStereotypeHelper.
+ * Helper used in the User interaction to display Stereotypes from the Property View.
+ * Note: this class is to be used instead of <i>AppliedStereotypeHelper</i> which is deprecated)
+ */
+public class StereotypeUserActionHelper {
+
+
+
+ /**
+ * add new applied stereotypes to display with the qualified name.
+ *
+ * @param domain
+ * the transactionnal edit domain
+ * @param view
+ * the emodel element that is the display of the uml element
+ * @param appliedStereotypeList
+ * the list of stereotype with qualified name to display
+ *
+ * @return the command to display it
+ */
+ public static RecordingCommand getAddAppliedStereotypeToDisplayWithQNCommand(TransactionalEditingDomain domain, View view, Stereotype stereotype, String depth) {
+ return new AddAppliedQNStereotypeToDisplayCommand(domain, view, stereotype, depth);
+ }
+
+ /**
+ * Gets the adds the applied stereotype command.
+ *
+ * @param domain
+ * the domain
+ * @param view
+ * the view
+ * @param appliedStereotypeListToAdd
+ * the applied stereotype list to add
+ * @param presentationKind
+ * the presentation kind
+ *
+ * @return the adds the applied stereotype command
+ */
+ public static RecordingCommand getAddAppliedStereotypeCommand(TransactionalEditingDomain domain, View view, String stereotypeName) {
+ return new AddAppliedStereotypeToDisplayCommand(domain, view, stereotypeName);
+ }
+
+ /**
+ * Gets the adds the applied stereotype propertiescommand.
+ *
+ * @param domain
+ * the domain
+ * @param view
+ * the view
+ * @param appliedStereotypeListToAdd
+ * the applied stereotype properties list to add
+ *
+ * @return the adds the applied stereotype command
+ */
+ public static RecordingCommand getAddAppliedStereotypePropertiesCommand(TransactionalEditingDomain domain, View view, Stereotype stereotype, Property property, String location) {
+ return new AddAppliedStereotypePropertiesToDisplayCommand(domain, view, property, stereotype, location);
+ }
+
+ /**
+ * Gets the removes the applied stereotype command.
+ *
+ * @param domain
+ * the domain
+ * @param view
+ * the view
+ * @param appliedStereotypeListToRemove
+ * the applied stereotype list to remove
+ * @param presentationKind
+ * the presentation kind
+ *
+ * @return the removes the applied stereotype command
+ */
+ public static RecordingCommand getRemoveAppliedStereotypeCommand(TransactionalEditingDomain domain, View view, Stereotype stereotype) {
+ return new RemoveAppliedStereotypeToDisplayCommand(domain, view, stereotype);
+ }
+
+ /**
+ * Gets the remove applied stereotype properties command.
+ *
+ * @param domain
+ * the domain
+ * @param view
+ * the view
+ * @param appliedStereotypeListToRemove
+ * the applied stereotype list to remove
+ *
+ * @return the removes the applied stereotype properties command
+ */
+ public static RecordingCommand getRemoveAppliedStereotypePropertiesCommand(TransactionalEditingDomain domain, View view, Property property, Stereotype stereotype, String location) {
+ return new RemoveAppliedStereotypePropertiesToDisplayCommand(domain, view, property, stereotype, location);
+ }
+
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/StereotypeDisplayMigrationConstant.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/StereotypeDisplayMigrationConstant.java
new file mode 100644
index 00000000000..f7c40fc46d9
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/StereotypeDisplayMigrationConstant.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.stereotype.migration;
+
+/**
+ * This class regroups all the constant required for the Migration of the Stereotype Display User Preferences.
+ *
+ * @author Céline JANSSENS
+ *
+ */
+public final class StereotypeDisplayMigrationConstant {
+ /**
+ * Stereotype EAnnotation (Old Structure to migrate to the new one)
+ */
+ public static final String STEREOTYPE_ANNOTATION = "Stereotype_Annotation";//$NON-NLS-1$
+ /**
+ * the list of stereotype to display
+ */
+ public static final String STEREOTYPE_LIST = "StereotypeList";//$NON-NLS-1$
+
+ /**
+ * the list of stereotype to display
+ */
+ public static final String STEREOTYPE_WITHQN_LIST = "StereotypeWithQualifiedNameList";//$NON-NLS-1$
+
+ /**
+ * Property location Key
+ */
+ public static final String STEREOTYPE_PROPERTY_LOCATION = "StereotypePropertyLocation";//$NON-NLS-1$
+
+ /**
+ * Property display Key
+ *
+ */
+ public static final String PROPERTY_STEREOTYPE_DISPLAY = "PropStereoDisplay";//$NON-NLS-1$
+
+ /**
+ * the kind of presentation for stereotype
+ */
+ public static final String STEREOTYPE_PRESENTATION_KIND = "Stereotype_Presentation_Kind";//$NON-NLS-1$
+
+ /**
+ * Old Type of Views
+ */
+ public static final String OLD_COMMENT_TYPE = "AppliedStereotypesComment";//$NON-NLS-1$
+ public static final Object OLD_COMMENT_LINK_TYPE = "AppliedStereotypesCommentLink";//$NON-NLS-1$
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/StereotypeMigrationHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/StereotypeMigrationHelper.java
new file mode 100644
index 00000000000..a0516ed6c64
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/StereotypeMigrationHelper.java
@@ -0,0 +1,416 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.stereotype.migration;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+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.model.NotationUtils;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayCommandExecution;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
+import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * This class regroups the methods required to create the new Stereotype Structure based on the Old Structure.
+ *
+ * @author Céline JANSSENS
+ *
+ */
+public final class StereotypeMigrationHelper {
+
+
+ public static final String EMPTY_STRING = "";//$NON-NLS-1$
+
+ /**
+ * singleton instance
+ */
+ private static StereotypeMigrationHelper migrationHelper;
+
+ /** Other Helper */
+ private static StereotypeDisplayCommandExecution commandHelper = StereotypeDisplayCommandExecution.getInstance();
+ private static StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
+
+ /** Singleton constructor */
+ private StereotypeMigrationHelper() {
+ }
+
+ /**
+ * Returns the singleton instance of this class
+ *
+ * @return the singleton instance.
+ */
+ public static StereotypeMigrationHelper getInstance() {
+ if (migrationHelper == null) {
+ migrationHelper = new StereotypeMigrationHelper();
+ }
+ return migrationHelper;
+ }
+
+
+ /**
+ * Get the Semantic Element of the Comment View.
+ * The Comment View is not attached to its semantic element through the method {@link View#getElement()}.
+ * To retrieve the semantic element, it has been added as a namedStyle with the name {@link StereotypeDisplayConstant#STEREOTYPE_COMMENT_RELATION_NAME}
+ *
+ * @param view
+ * The Stereotype Comment View (of type "StereotypeComment")
+ * @return The Base Element of the Comment
+ */
+ public Element getOldCommentSemanticElement(View view) {
+
+ Element elementSemantic = null;
+ if (isOldComment(view)) {
+ // Retrieve the Base Element of the Comment as the Semantic element
+ EObject baseElement = NotationUtils.getEObjectValue(view, StereotypeDisplayConstant.STEREOTYPE_COMMENT_RELATION_NAME, null);
+
+ if (baseElement instanceof Element) {
+ elementSemantic = (Element) baseElement;
+
+ }
+ }
+ return elementSemantic;
+ }
+
+
+
+ /**
+ * Get a Stereotype from its StereotypeName
+ *
+ * @param view
+ * View on which we try to retrieve the Stereotype
+ * @param stereotypeName
+ * Stereotype Name
+ * @return Stereotype Associated to the stereotype Name for the View.
+ */
+ public Stereotype getStereotypeFromString(View view, String stereotypeName) {
+
+ Stereotype stereotype = null;
+
+ Element element = helper.getSemanticElement(view);
+ stereotype = element.getAppliedStereotype(stereotypeName);
+
+ return stereotype;
+ }
+
+ /**
+ * Get a Property from its Name and its Stereotype
+ *
+ * @param view
+ * The View Containing the Property Compartment (i.e : ClassImpl)
+ * @param propertyName
+ * The Property Name
+ * @return The Property related to the View and to the Stereotype.
+ */
+ public Property getPropertyFromString(View view, Stereotype stereotype, String propertyName) {
+ Property property = null;
+ if (view != null && !propertyName.isEmpty()) {
+
+ Iterator<Property> propertyIterator = stereotype.getAttributes().iterator();
+ while (propertyIterator.hasNext() && property == null) {
+ Property propertyTest = propertyIterator.next();
+ if (propertyTest.getName().equals(propertyName)) {
+ property = propertyTest;
+ }
+ }
+ }
+
+ return property;
+ }
+
+
+
+ /**
+ * Check is the node is persistent and make it persistent if not
+ * Check if the visibility should be modified, and do it accordingly
+ *
+ * @param view
+ * The View to modify
+ * @param diagram
+ * The Diagram that is migrated
+ * @param visible
+ * true if the view has to be visible.
+ */
+ public void updateVisibilityAndPersistence(View view, EObject object, boolean visible) {
+ if (view != null) {
+ if (view.eContainer() instanceof View && !((View) view.eContainer()).getPersistedChildren().contains(view)) {
+ commandHelper.setPersistency(migrationHelper.getDomain(object), view, false);
+ }
+
+ if (visible != view.isVisible()) {
+ commandHelper.setVisibility(migrationHelper.getDomain(object), view, visible, false);
+ }
+ }
+
+
+ }
+
+ /**
+ * Get the Editing domain from Eobject
+ *
+ * @param object
+ * Object used to retrieve the Transactional Editing Domain
+ * @see {@link CommandUtil#resolveEditingDomain(Object)}
+ *
+ * @return Transactional Domain
+ */
+ public TransactionalEditingDomain getDomain(EObject object) {
+ return CommandUtil.resolveEditingDomain(object);
+ }
+
+ /**
+ * Get the EAnnotation, dedicated to the Stereotype Display User preferences (Old structure to be replaced by the new one)
+ *
+ * @param view
+ * The View of which the EAnnotation is necessary.
+ * @return The EAnnotation of the view . Null if does not exist.
+ */
+ public EAnnotation getStereotypeEAnnotation(EModelElement view) {
+ EAnnotation annotation = null;
+ if (view != null) {
+ annotation = view.getEAnnotation(StereotypeDisplayMigrationConstant.STEREOTYPE_ANNOTATION);
+ }
+ return annotation;
+
+ }
+
+ /**
+ *
+ * Define if a view has an Stereotype EAnnotation
+ *
+ * @param content
+ * The view
+ * @return true if the Stereotype is not null.
+ */
+ public boolean hasStereotypeEAnnotation(View content) {
+
+ return getStereotypeEAnnotation(content) != null;
+ }
+
+ /**
+ * Retrieve the list of the appliedStereotypes from a View
+ *
+ * @param view
+ * The view for which the List of Stereotypes is asked
+ * @return The appliedStereotype List. Null if no UML element related to the View.
+ */
+ public EList<Stereotype> getAppliedStereotypesFromView(View view) {
+ EList<Stereotype> list = null;
+
+ Element element = helper.getSemanticElement(view);
+ list = element.getAppliedStereotypes();
+
+ return list;
+ }
+
+
+ /* ******************* Old EAnnotation Method *************************/
+
+ /**
+ * get lhe list of stereotype to display with the qulifiedName.
+ *
+ * @param view
+ * the view of the uml element
+ *
+ * @return the list of applied stereotype to display with their qualified name
+ */
+ public String getStereotypesQNToDisplay(EModelElement view) {
+ EAnnotation eannotation = getStereotypeEAnnotation(view);
+ if (eannotation != null) {
+ EMap<String, String> entries = eannotation.getDetails();
+
+ String stereotypesToDisplay = entries.get(StereotypeDisplayMigrationConstant.STEREOTYPE_WITHQN_LIST);
+ if (stereotypesToDisplay != null) {
+ return stereotypesToDisplay;
+ }
+ }
+ return EMPTY_STRING;
+ }
+
+ /**
+ * get the list of stereotype to display from the eannotation.
+ *
+ * @param view
+ * the view
+ *
+ * @return the list of stereotypes to display separated by a comma. the applied stereotype to
+ * display is represented by the qualified name of the stereotype
+ * Empty String by default.
+ */
+ public String getStereotypesToDisplay(EModelElement view) {
+ EAnnotation eannotation = getStereotypeEAnnotation(view);
+ if (eannotation != null) {
+ EMap<String, String> entries = eannotation.getDetails();
+
+ String stereotypesToDisplay = entries.get(StereotypeDisplayMigrationConstant.STEREOTYPE_LIST);
+ if (stereotypesToDisplay != null) {
+ return stereotypesToDisplay;
+ }
+ }
+ return EMPTY_STRING;
+ }
+
+ /**
+ * Gets the applied stereotypes properties localization.
+ *
+ * @param view
+ * the view
+ *
+ * @return the applied stereotypes properties localization
+ */
+ public String getAppliedStereotypesPropertiesLocalization(EModelElement view) {
+ EAnnotation eannotation = getStereotypeEAnnotation(view);
+ if (eannotation != null) {
+ EMap<String, String> entries = eannotation.getDetails();
+
+ String displayLocalization = entries.get(StereotypeDisplayConstant.STEREOTYPE_PROPERTY_LOCATION);
+ if (displayLocalization != null && !displayLocalization.equals(StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_LOCATION)) {
+ return displayLocalization;
+ }
+ }
+
+
+ return StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_LOCATION;
+ }
+
+
+ /**
+ * Gets the applied stereotypes properties to display.
+ *
+ * @param view
+ * the view the view that displays the stereotyped element
+ *
+ * @return the applied stereotypes properties to display
+ */
+ public String getAppliedStereotypesPropertiesToDisplay(EModelElement view) {
+ EAnnotation eannotation = getStereotypeEAnnotation(view);
+ if (eannotation != null) {
+ EMap<String, String> entries = eannotation.getDetails();
+
+ String stereotypesToDisplay = entries.get(StereotypeDisplayMigrationConstant.PROPERTY_STEREOTYPE_DISPLAY);
+ if (stereotypesToDisplay != null) {
+ return stereotypesToDisplay;
+ }
+ }
+ return EMPTY_STRING;
+ }
+
+ /**
+ * Define if the passed object is the Old Comment View
+ *
+ * @param object
+ * The object to be tested
+ * @return true if the object is a view of type {@link StereotypeDisplayMigrationConstant#OLD_COMMENT_TYPE}
+ */
+ public boolean isOldComment(Object object) {
+
+ if (object instanceof View) {
+ View view = (View) object;
+ return (view.getType().equals(StereotypeDisplayMigrationConstant.OLD_COMMENT_TYPE));
+
+ }
+
+ return false;
+ }
+
+
+
+ /**
+ * Retrieve the old Comment from a hostView
+ *
+ * @param hostView
+ * The view of which the old comment is retrieve
+ * @return The OldComment View or Null if not found.
+ */
+ public View getOldStereotypeComment(View semanticView) {
+ Node node = null;
+ if (semanticView != null && semanticView.getSourceEdges() != null) {
+ // look for all links with the id AppliedStereotypesCommentLinkEditPart.ID
+ Iterator<Edge> edgeIterator = semanticView.getSourceEdges().iterator();
+ Edge appliedStereotypeLink = null;
+ while (edgeIterator.hasNext() && appliedStereotypeLink == null) {
+ Edge edge = edgeIterator.next();
+ if (edge.getType().equals(StereotypeDisplayMigrationConstant.OLD_COMMENT_LINK_TYPE)) {
+ appliedStereotypeLink = edge;
+ }
+ }
+ if (appliedStereotypeLink == null) {
+ return null;
+ }
+ node = (Node) appliedStereotypeLink.getTarget();
+ }
+ return node;
+ }
+
+ /**
+ * Retrieve the Old Link of the HostView
+ *
+ * @param hostView
+ * The view of which the old link is retrieve
+ * @return The Old Link View or Null if not found.
+ */
+ public Edge getOldStereotypeLinkComment(View semanticView) {
+ Edge appliedStereotypeLink = null;
+ if (semanticView != null && semanticView.getSourceEdges() != null) {
+ // look for all links with the id AppliedStereotypesCommentLinkEditPart.ID
+ Iterator<Edge> edgeIterator = semanticView.getSourceEdges().iterator();
+
+ while (edgeIterator.hasNext() && appliedStereotypeLink == null) {
+ Edge edge = edgeIterator.next();
+ if (edge.getType().equals(StereotypeDisplayMigrationConstant.OLD_COMMENT_LINK_TYPE)) {
+ appliedStereotypeLink = edge;
+ }
+ }
+ }
+ return appliedStereotypeLink;
+ }
+
+ /**
+ * Define if an Old Comment is Orphan
+ *
+ * @param view
+ * The View of the Old Comment
+ * @return True if the Comment is not related to another Element or if no stereotype is applied to this Element.
+ */
+ public boolean isOrphanComment(View view) {
+ boolean orphanComment = false;
+
+ if (isOldComment(view)) {
+ // if no stereotypes applied on the Base element, the comment is considered as Orphan
+ Element element = getOldCommentSemanticElement(view);
+ if (element == null || element.getAppliedStereotypes().size() == 0) {
+ orphanComment = true;
+ }
+
+ }
+ return orphanComment;
+ }
+
+
+
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypeCommentPropertiesMigrationCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypeCommentPropertiesMigrationCommand.java
new file mode 100644
index 00000000000..d2f0183e815
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypeCommentPropertiesMigrationCommand.java
@@ -0,0 +1,103 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands;
+
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+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.uml.diagram.common.stereotype.StereotypeLocationEnum;
+import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil;
+
+/**
+ *
+ * Command to Migrate the StereotypeComment from old Structure (with EAnnotation) to the Structure with NamedStyle.
+ *
+ * @author Céline JANSSENS
+ *
+ */
+public class StereotypeCommentPropertiesMigrationCommand extends StereotypePropertiesMigrationCommand {
+
+ /**
+ * Constructor.
+ *
+ * @param label
+ * Label of the Command
+ * @param content
+ * Main view on which the Stereotype is applied
+ */
+ public StereotypeCommentPropertiesMigrationCommand(String label, View content) {
+ super(label, content);
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands.StereotypePropertiesMigrationCommand#updateStereotypePropertyDisplay(org.eclipse.gmf.runtime.notation.View, java.lang.String, java.lang.Enum)
+ *
+ */
+ @Override
+ protected void updateStereotypePropertyDisplay(View view, String propertyList, Enum<?> location) {
+ // In case of the Comment, the view will be the comment itself instead of the main View.
+ if (StereotypeLocationEnum.IN_COMMENT.equals(location)) {
+
+ View newComment = helper.getStereotypeComment(view);
+ if (newComment != null) {
+ super.updateStereotypePropertyDisplay(newComment, propertyList, location);
+ setConstraint(view, newComment);
+
+ }
+ deleteOldComment(view);
+ }
+ }
+
+ /**
+ * @param view
+ * @param newComment
+ */
+ private void setConstraint(final View view, final View newComment) {
+ if (newComment instanceof Node) {
+ View oldComment = migrationHelper.getOldStereotypeComment(view);
+ if (oldComment instanceof Node) {
+ ((Node) newComment).setLayoutConstraint(((Node) oldComment).getLayoutConstraint());
+ }
+ }
+ }
+
+ /**
+ * @param view
+ */
+ private void deleteOldComment(final View hostView) {
+ // Delete Comment from the Old Structure
+
+ View oldComment = migrationHelper.getOldStereotypeComment(hostView);
+ if (oldComment != null) {
+ DeleteCommand deleteComment = new DeleteCommand(oldComment);
+ CommandUtil.executeUnsafeCommand(deleteComment, hostView);
+ }
+ Edge oldLink = migrationHelper.getOldStereotypeLinkComment(hostView);
+ if (oldLink != null) {
+ DeleteCommand deleteLink = new DeleteCommand(oldLink);
+ CommandUtil.executeUnsafeCommand(deleteLink, hostView);
+ }
+
+
+
+
+ }
+
+
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypeLabelMigrationCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypeLabelMigrationCommand.java
new file mode 100644
index 00000000000..120732819f6
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypeLabelMigrationCommand.java
@@ -0,0 +1,248 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Displays
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands;
+
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.IStereotypeViewProvider;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.StereotypeViewProvider;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayCommandExecution;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeMigrationHelper;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * This Command applies the user preferences for the Stereotype Label
+ * In charge of check the visibility, depth and persistence based on the Old EAnnotation
+ *
+ * @author Céline JANSSENS
+ *
+ */
+public class StereotypeLabelMigrationCommand implements Runnable {
+
+ // String Constant
+ private static final String EANNOTATION_LIST_SEPARATOR = ","; //$NON-NLS-1$
+ private static final String QUALIFIED_NAME_DEPTH = "full"; //$NON-NLS-1$
+
+
+ private View mainView;
+
+ // Static Instances of helpers and providers
+ private static StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
+ private static StereotypeMigrationHelper migrationHelper = StereotypeMigrationHelper.getInstance();
+ private static StereotypeDisplayCommandExecution commandHelper = StereotypeDisplayCommandExecution.getInstance();
+ protected static IStereotypeViewProvider provider;
+
+
+ /**
+ * Constructor.
+ *
+ * @param label
+ * The Label of the Command
+ * @param content
+ * The View of the element that is migrated.
+ */
+ public StereotypeLabelMigrationCommand(String label, View content) {
+
+ this.mainView = content;
+
+ }
+
+
+ /**
+ * Migrate the Stereotype Label from the old Version.
+ *
+ * @param View
+ * The element of the diagram to migrate
+ */
+ protected void migrateStereotypeLabel(View view) {
+ // Create the provider
+ setProvider(view);
+
+ if (migrationHelper.hasStereotypeEAnnotation(view)) {
+
+ // Update Visibility
+ String oldStereotype = getOldStereotypeToDisplay(view);
+ updateNewStereotypeVisibility(view, oldStereotype);
+
+ // Update Depth
+ String oldQNStereotype = getOldQNStereotypeToDisplay(view);
+ updateNewStereotypeDepth(view, oldQNStereotype);
+
+ }
+ }
+
+ /**
+ * From the Stereotype List to display with they Qualified Name, update the Depth to full
+ *
+ * @param view
+ * The view of the object to migrate
+ * @param stereotypeList
+ * List of Stereotype to display with their Qualified Name
+ */
+ protected void updateNewStereotypeDepth(View view, String stereotypeList) {
+ StringTokenizer tokenizer = new StringTokenizer(stereotypeList, EANNOTATION_LIST_SEPARATOR);
+
+ while (tokenizer.hasMoreTokens()) {
+ String stereotypeName = tokenizer.nextToken();
+ View label = helper.getStereotypeLabel(view, stereotypeName);
+ if (label != null) {
+ commandHelper.setDepth(migrationHelper.getDomain(view), migrationHelper.getStereotypeFromString(view, stereotypeName), view, QUALIFIED_NAME_DEPTH, false);
+ }
+ }
+ }
+
+
+ /**
+ * From the Stereotype List to display , update the Visibility to true
+ * And hide visible Stereotype Label that should not be shown.
+ *
+ * @param view
+ * The view of the object to migrate
+ * @param stereotypeList
+ * List of Stereotype to display
+ */
+ protected void updateNewStereotypeVisibility(View view, String stereotypeList) {
+
+ // Hide all the Label displayed but that should not to be shown
+ hideStereotypeLabelNotDisplayed(stereotypeList, view);
+
+ }
+
+
+ /**
+ * Show each Stereotype from the Stereotype to display list.
+ *
+ * @param stereotypeList
+ * The list of stereotype to display
+ * @param view
+ * The view of the object that is migrated
+ */
+ private void showStereotypeLabelToBeDisplayed(String stereotypeList, View view) {
+ StringTokenizer tokenizer = new StringTokenizer(stereotypeList, EANNOTATION_LIST_SEPARATOR);
+ while (tokenizer.hasMoreTokens()) {
+ String stereotypeName = tokenizer.nextToken();
+ showStereotypeLabel(view, stereotypeName);
+ }
+
+ }
+
+ /**
+ * Show the Label To display.
+ * Updating Visibility and Persistence
+ *
+ * @param view
+ * The view of the object to migrate
+ * @param stereotypeList
+ * List of Stereotype to display
+ */
+ protected void showStereotypeLabel(View view, String stereotypeName) {
+ View label = provider.getLabel(migrationHelper.getStereotypeFromString(view, stereotypeName));
+ if (label != null) {
+ migrationHelper.updateVisibilityAndPersistence(label, view, true);
+ }
+ }
+
+
+ /**
+ * Hide visible Stereotype Label that should not be shown.
+ * List all the applied Stereotypes, if the applied stereotype is not in the Stereotype to Display list,
+ * hide the Node.
+ *
+ * @param view
+ * The view of the object to migrate
+ * @param stereotypeList
+ * List of Stereotype to display
+ */
+ private void hideStereotypeLabelNotDisplayed(String stereotypeList, View view) {
+ EList<Stereotype> appliedStereotypes = migrationHelper.getAppliedStereotypesFromView(view);
+ Iterator<Stereotype> stereotypes = appliedStereotypes.iterator();
+ while (stereotypes.hasNext()) {
+ String stereotypeName = stereotypes.next().getQualifiedName();
+ if (stereotypeList.indexOf(stereotypeName) == -1) {
+ hideStereotypeLabel(view, stereotypeName);
+ }
+ }
+ }
+
+
+
+
+ /**
+ * Hide the Stereotype Label
+ *
+ * @param view
+ * The view of the object that is migrated
+ * @param stereotypeName
+ * Name of the Stereotype of which the Label should be hidden
+ */
+ private void hideStereotypeLabel(View view, String stereotypeName) {
+ View label = provider.getLabel(migrationHelper.getStereotypeFromString(view, stereotypeName));
+ migrationHelper.updateVisibilityAndPersistence(label, mainView, false);
+
+ }
+
+
+ /**
+ * Get List of Stereotype to display with their Qualified Name from the EAnnotation.
+ *
+ * @param view
+ * The view of the object to migrate
+ * @return The List of Stereotype to display with their Qualified Name
+ */
+ protected String getOldQNStereotypeToDisplay(View view) {
+ return migrationHelper.getStereotypesQNToDisplay(view);
+ }
+
+
+ /**
+ * Get List of Stereotype to display from the EAnnotation.
+ *
+ * @param view
+ * The view of the object to migrate
+ * @return The List of Stereotype to display
+ */
+ protected String getOldStereotypeToDisplay(View view) {
+
+ return migrationHelper.getStereotypesToDisplay(view);
+ }
+
+ /**
+ * Create the provider
+ *
+ * @param view
+ * The view on which stereotypes is applied and from which the Stereotype Views will be provided
+ */
+ private void setProvider(View view) {
+ provider = new StereotypeViewProvider(view);
+
+ }
+
+
+ /**
+ * @see java.lang.Runnable#run()
+ *
+ */
+ @Override
+ public void run() {
+ migrateStereotypeLabel(mainView);
+
+ }
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypeNestedPropertiesMigrationCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypeNestedPropertiesMigrationCommand.java
new file mode 100644
index 00000000000..6d85814a7b4
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypeNestedPropertiesMigrationCommand.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeLocationEnum;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
+
+/**
+ * Command in charge of applying user preferences of stereotype display from the old EANnotation structure to the new one.
+ * For the Properties EAnnotation details.
+ *
+ * @author Céline JANSSENS
+ *
+ */
+public class StereotypeNestedPropertiesMigrationCommand extends StereotypePropertiesMigrationCommand {
+
+ /**
+ * Constructor.
+ *
+ * @param label
+ * Command Label
+ * @param content
+ * View on which the Stereotype is applied.
+ */
+ public StereotypeNestedPropertiesMigrationCommand(String label, View content) {
+ super(label, content);
+
+ }
+
+
+ /**
+ *
+ * In this case, the Old structure return "Compartment" as in the new one the properties are stored in the "Brace" location.
+ *
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands.StereotypePropertiesMigrationCommand#getLocation(java.lang.String)
+ *
+ */
+ @Override
+ public Enum getLocation(String oldProperties) {
+ Enum location = StereotypeLocationEnum.IN_BRACE;
+ if (oldProperties.equals(StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_LOCATION)) {
+ location = StereotypeLocationEnum.IN_BRACE;
+ } else if (oldProperties.equals(StereotypeDisplayConstant.STEREOTYPE_BRACE_LOCATION)) {
+ location = StereotypeLocationEnum.IN_BRACE;
+ }
+ return location;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypePropertiesMigrationCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypePropertiesMigrationCommand.java
new file mode 100644
index 00000000000..f00e8a96f47
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/commands/StereotypePropertiesMigrationCommand.java
@@ -0,0 +1,314 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands;
+
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeLocationEnum;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.IStereotypeViewProvider;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.StereotypeViewProvider;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeMigrationHelper;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * In charge of applying user preferences from the old EAnnotation structure to the new one
+ * For Stereotypes Properties
+ * This means set visibility to the newly created views .
+ *
+ * @author Céline JANSSENS
+ *
+ */
+public class StereotypePropertiesMigrationCommand implements Runnable {
+
+ protected View mainView;
+
+ protected static IStereotypeViewProvider provider;
+
+ // Helpers
+ protected static StereotypeMigrationHelper migrationHelper = StereotypeMigrationHelper.getInstance();
+ protected static StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
+
+ // Constant
+ protected final static String EANNOTATION_LIST_SEPARATOR = ","; //$NON-NLS-1$
+ protected final static String EANNOTATION_PROPERTY_SEPARATOR = "."; //$NON-NLS-1$
+ protected final static String EMPTY_STRING = "";//$NON-NLS-1$
+
+ /**
+ * Constructor.
+ *
+ * @param label
+ * Label of the Command
+ * @param content
+ * Main view on which the Stereotype is applied
+ */
+ public StereotypePropertiesMigrationCommand(String label, View content) {
+
+ this.mainView = content;
+ }
+
+
+
+ /**
+ * Migrate the Stereotype Properties from the old Version.
+ *
+ * @param view
+ * View of the Editpart on which the STereotype is applied
+ */
+ protected void migrateStereotypeProperties(View view) {
+
+ createProvider(view);
+ if (migrationHelper.hasStereotypeEAnnotation(view)) {
+ String oldProperties = getOldPropertiesToDisplay(view);
+ String oldPropertiesLocation = getOldLocationToDisplay(view);
+ Enum<?> location = getLocation(oldPropertiesLocation);
+ updateStereotypePropertyDisplay(view, oldProperties, location);
+
+ }
+ }
+
+
+ /**
+ * Convert the EAnnotation Location to the Property Location to display.
+ * Can be extended.
+ */
+ public Enum<?> getLocation(String oldProperties) {
+ Enum<?> location = StereotypeLocationEnum.IN_BRACE;
+ if (oldProperties.equals(StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_LOCATION)) {
+ location = StereotypeLocationEnum.IN_COMPARTMENT;
+ } else if (oldProperties.equals(StereotypeDisplayConstant.STEREOTYPE_BRACE_LOCATION)) {
+ location = StereotypeLocationEnum.IN_BRACE;
+ } else if (oldProperties.equals(StereotypeDisplayConstant.STEREOTYPE_COMMENT_LOCATION)) {
+ location = StereotypeLocationEnum.IN_COMMENT;
+ }
+ return location;
+ }
+
+ /**
+ * Create the Provider with the associated View
+ *
+ * @param view
+ * The View of the object that will be taken as Reference to provide the different Stereotype to display View.
+ */
+ protected void createProvider(View view) {
+ provider = new StereotypeViewProvider(view);
+
+ }
+
+
+ /**
+ * From the Stereotype Property List to display , update the Visibility
+ * And hide visible Stereotype property that should not be shown.
+ *
+ * @param view
+ * The view of the object to migrate
+ * @param propertyList
+ * List of property to display
+ * @param location
+ * The Location of the Properties to be displayed or hidden.
+ */
+ protected void updateStereotypePropertyDisplay(View view, String propertyList, Enum<?> location) {
+
+ // Show all the properties that should be displayed
+ showStereotypePropertyToBeDisplayed(propertyList, view, location);
+
+ }
+
+ /**
+ * Show all the Properties from the Properties List and their location
+ *
+ * @param propertyList
+ * List of properties (ie: "SysML::Blocks::Block.isEncapsulated,SysML::Requirement::Requirement.id")
+ * @param view
+ * The View of the Object migrated (ie: CSSShapeImpl)
+ * @param location
+ * Place of the the property to be shown: {@link StereotypeLocationEnum}
+ */
+ private void showStereotypePropertyToBeDisplayed(String propertyList, View view, Enum<?> location) {
+ StringTokenizer tokenizer = new StringTokenizer(propertyList, EANNOTATION_LIST_SEPARATOR);
+ while (tokenizer.hasMoreTokens()) {
+
+ String propertyString = tokenizer.nextToken();
+ Stereotype stereoytpe = getStereotypeFromString(view, propertyString);
+ if (stereoytpe != null) {
+ Property property = getPropertyFromString(view, propertyString, stereoytpe);
+ showStereotypeProperty(view, stereoytpe, property, location);
+ }
+ }
+
+ }
+
+ /**
+ * Show the property and related Location Compartment to display
+ *
+ * @param view
+ * The Main View on which the stereotype is applied.
+ * @param location
+ * The location of the Property to show (Compartment, Comment, With Brace)
+ * @param stereotype
+ * The Stereotype of the Property to show
+ * @param property
+ * UML Property to show
+ */
+ private void showStereotypeProperty(View view, Stereotype stereotype, Property property, Enum<?> location) {
+ // Make The main View visible (Required for the Comment )
+ migrationHelper.updateVisibilityAndPersistence(view, view, true);
+
+ // Make The compartment owning the property visible
+ View compartment = provider.getCompartment(stereotype, location);
+ migrationHelper.updateVisibilityAndPersistence(compartment, view, true);
+
+ // Make the properties node into the Compartment visible
+ View propertyView = provider.getProperty(property, stereotype, location);
+ migrationHelper.updateVisibilityAndPersistence(propertyView, view, true);
+
+ }
+
+
+
+ /**
+ * Hide visible Properties that should not be shown.
+ * List all the applied Stereotypes and their Properties, if the property is not in the property to Display list,
+ * hide the Node.
+ *
+ * @param view
+ * The view of the object to migrate
+ * @param stereotypeList
+ * List of Stereotype to display
+ */
+ private void hideStereotypePropertyNotDisplayed(String propertyList, View view, Enum<?> location) {
+
+ // If applied Stereotype is not in the Stereotype list to display, set the visibility to false to hide the Label.
+ Iterator<Stereotype> stereotypes = migrationHelper.getAppliedStereotypesFromView(view).iterator();
+ while (stereotypes.hasNext()) {
+ Stereotype stereotype = stereotypes.next();
+ hideStereotypeProperties(stereotype, propertyList, location);
+
+ }
+ }
+
+
+ /**
+ * Hide the Properties from the properties list, location and Stereotypes
+ *
+ * @param stereotype
+ * The Stereotype of which the Properties should be hidden
+ * @param propertyList
+ * The list of all the properties to be displayed
+ * @param location
+ * The location of the Properties to be hidden
+ */
+ private void hideStereotypeProperties(Stereotype stereotype, String propertyList, Enum<?> location) {
+ for (Property property : stereotype.allAttributes()) {
+ if (propertyList.indexOf(property.getName()) == -1) {
+
+ // Create the Property view if not existing and Make the properties node into the Compartment visible
+ hideStereotypeProperty(property, stereotype, location);
+ }
+ }
+
+ }
+
+ /**
+ * Hide a single property View based on the stereotype and the location.
+ *
+ * @param property
+ * The property to hide
+ * @param stereotype
+ * The stereotype of the property to hide
+ * @param location
+ * the location of the property to hide
+ */
+ private void hideStereotypeProperty(Property property, Stereotype stereotype, Enum<?> location) {
+ View compartment = provider.getCompartment(stereotype, location);
+ if (compartment != null) {
+ View propertyView = provider.getProperty(property, stereotype, location);
+ if (propertyView != null) {
+ migrationHelper.updateVisibilityAndPersistence(propertyView, mainView, false);
+ }
+ }
+
+ }
+
+ /**
+ * Get the property from String
+ *
+ * @param view
+ * The Main View on which the stereotype is applied.
+ * @param propertyString
+ * the substring from the Old Version (I.e: "SysML::Blocks::Block.isEncapsulate")
+ * @return The corresponding UML property
+ */
+ private Property getPropertyFromString(View view, String propertyString, Stereotype stereotype) {
+ String propertyName = propertyString.substring(propertyString.indexOf(EANNOTATION_PROPERTY_SEPARATOR) + 1, propertyString.length());
+ return migrationHelper.getPropertyFromString(view, stereotype, propertyName);
+ }
+
+
+ /**
+ * Get the stereotype from String
+ *
+ * @param view
+ * The Main View on which the stereotype is applied.
+ * @param propertyString
+ * the substring from the Old Version (I.e: "SysML::Blocks::Block")
+ * @return The corresponding UML Stereotype
+ */
+ private Stereotype getStereotypeFromString(View view, String propertyString) {
+ String qualifiedName = propertyString.substring(0, propertyString.indexOf(EANNOTATION_PROPERTY_SEPARATOR));
+ return migrationHelper.getStereotypeFromString(view, qualifiedName);
+
+ }
+
+
+ /**
+ * Get the EAnnotation Detail value for the properties Location.
+ *
+ * @param view
+ * The view on which the stereotype is applied
+ * @return Location value
+ */
+ protected String getOldLocationToDisplay(View view) {
+ return migrationHelper.getAppliedStereotypesPropertiesLocalization(view);
+ }
+
+
+ /**
+ * Get the EAnnotation Detail value for the Property list to displayed
+ *
+ * @param view
+ * The view on which the stereotype is applied
+ * @return The list of the properties to be displayed
+ */
+ protected String getOldPropertiesToDisplay(View view) {
+ return migrationHelper.getAppliedStereotypesPropertiesToDisplay(view);
+ }
+
+
+ /**
+ * @see java.lang.Runnable#run()
+ *
+ */
+ @Override
+ public void run() {
+ migrateStereotypeProperties(mainView);
+
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationLabelMigrationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationLabelMigrationEditPolicy.java
new file mode 100644
index 00000000000..8c9cd48ef08
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationLabelMigrationEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.commands.RemoveEAnnotationDetailCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayMigrationConstant;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands.StereotypeLabelMigrationCommand;
+import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil;
+
+/**
+ * Edit Policy for the Stereotype Label user preferences migration.
+ * Should be applied to every graphicalEditPart on which Stereotypes can be applied.
+ *
+ * @author Céline JANSSENS
+ *
+ */
+public class StereotypeEAnnotationLabelMigrationEditPolicy extends StereotypeEAnnotationMigrationEditPolicy {
+
+ public static final String LABEL = "Migration of Stereotype Label";//$NON-NLS-1$
+
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationMigrationEditPolicy#cleanEAnnotationDetails(org.eclipse.gmf.runtime.notation.View)
+ *
+ *
+ * Clean the Key of EAnnotation related to the StereotypeLabel:
+ * <li>{@link StereotypeDisplayMigrationConstant.STEREOTYPE_LIST}</li>
+ * <li>{@link StereotypeDisplayMigrationConstant.STEREOTYPE_WITHQN_LIST}</li>
+ *
+ *
+ * @param view
+ * The view owning the EAnnotation to clean
+ *
+ */
+ @Override
+ public void cleanEAnnotationDetails(View view) {
+
+
+ TransactionalEditingDomain domain = CommandUtil.resolveEditingDomain(view);
+
+ RemoveEAnnotationDetailCommand deleteStereotype = new RemoveEAnnotationDetailCommand(domain, eAnnotation, StereotypeDisplayMigrationConstant.STEREOTYPE_LIST);
+ CommandUtil.executeUnsafeCommand(deleteStereotype, view);
+
+ RemoveEAnnotationDetailCommand deleteQNList = new RemoveEAnnotationDetailCommand(domain, eAnnotation, StereotypeDisplayMigrationConstant.STEREOTYPE_WITHQN_LIST);
+ CommandUtil.executeUnsafeCommand(deleteQNList, view);
+
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationMigrationEditPolicy#hasEAnnotationDetails(org.eclipse.gmf.runtime.notation.View)
+ *
+ */
+ @Override
+ public boolean hasEAnnotationDetails(View view) {
+
+ return migrationHelper.getStereotypesToDisplay(hostView) != null;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationMigrationEditPolicy#getStereotypeMigrationCommand(org.eclipse.gmf.runtime.notation.View)
+ *
+ */
+ @Override
+ public Runnable getStereotypeMigrationCommand(View view) {
+
+ return new StereotypeLabelMigrationCommand(LABEL, view);
+
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationMigrationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationMigrationEditPolicy.java
new file mode 100644
index 00000000000..4ff6bed855a
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationMigrationEditPolicy.java
@@ -0,0 +1,167 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.editpolicies.AbstractEditPolicy;
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.commands.RemoveEAnnotationCommand;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeMigrationHelper;
+import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil;
+
+/**
+ * This Edit Policy is in charge to migrate user preferences from old stereotype display structure
+ * (which were using EAnnotation) to the new structure using NamedStyle and additional notation Views
+ *
+ * @author Céline JANSSENS
+ *
+ */
+public abstract class StereotypeEAnnotationMigrationEditPolicy extends AbstractEditPolicy {
+
+ public static final Object STEREOTYPE_RECONCILER = "Stereotype Display Reconciler"; //$NON-NLS-1$
+
+ protected StereotypeMigrationHelper migrationHelper = StereotypeMigrationHelper.getInstance();
+ protected StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
+
+ protected View hostView = null;
+ protected EAnnotation eAnnotation = null;
+ protected IGraphicalEditPart editPart = null;
+
+
+
+ /**
+ * Set the attributes and launch the migration.
+ *
+ * @see org.eclipse.gef.editpolicies.AbstractEditPolicy#activate()
+ *
+ */
+ @Override
+ public void activate() {
+
+ // set editPart
+ if (getHost() instanceof GraphicalEditPart) {
+ this.editPart = (GraphicalEditPart) getHost();
+ }
+
+ if (getHost() instanceof ConnectionEditPart) {
+ this.editPart = (ConnectionEditPart) getHost();
+ }
+
+ // set hostView
+ if (editPart != null && editPart.getModel() instanceof View) {
+ this.hostView = (View) editPart.getModel();
+ }
+
+ // set EAnnotation and start the migration process
+ if (editPart != null && hostView != null) {
+ this.eAnnotation = migrationHelper.getStereotypeEAnnotation(hostView);
+ if (eAnnotation != null && !eAnnotation.getDetails().isEmpty()) {
+ migrateStereotype();
+ }
+ }
+
+ }
+
+ /**
+ * Migrate all the Stereotype User preferences
+ *
+ */
+ protected void migrateStereotype() {
+
+ if (eAnnotation != null) {
+ if (hasEAnnotationDetails(hostView)) {
+ // Retrieve the migration Command and execute it.
+ Runnable command = getStereotypeMigrationCommand(hostView);
+ CommandUtil.executeUnsafeCommand(command, editPart);
+
+ }
+ // Clean the details associated to each sub edit policies;
+ cleanEAnnotationDetails(hostView);
+ }
+ // Clean the EAnnotation if Empty
+ cleanEAnnotation();
+ }
+
+
+ /**
+ * Remove the EAnnotation when necessary
+ */
+ private void cleanEAnnotation() {
+
+ // If the EAnnotation is Empty Delete it
+ if (eAnnotation != null && eAnnotation.getDetails().size() == 0) {
+ RemoveEAnnotationCommand command = new RemoveEAnnotationCommand(editPart.getEditingDomain(), hostView, eAnnotation);
+ CommandUtil.executeUnsafeCommand(command, editPart);
+ }
+
+ // If No Stereotype Structure is Found on the host but EAnnotation is present, delete the EAnnotation
+ if (eAnnotation != null && !helper.hasStereotypeViews(hostView)) {
+ RemoveEAnnotationCommand command = new RemoveEAnnotationCommand(editPart.getEditingDomain(), hostView, eAnnotation);
+ CommandUtil.executeUnsafeCommand(command, editPart);
+ }
+
+ // Delete orphan Comment Node from OldStructure
+ Object container = hostView.eContainer();
+ if (container instanceof View) {
+ View containerView = (View) container;
+ Iterator<Object> sibilings = containerView.getChildren().iterator();
+ while (sibilings.hasNext()) {
+ Object sibiling = sibilings.next();
+ if (migrationHelper.isOldComment(sibiling)) {
+ if (migrationHelper.isOrphanComment((View) sibiling)) {
+ DeleteCommand deleteComment = new DeleteCommand((View) sibiling);
+ CommandUtil.executeUnsafeCommand(deleteComment, sibiling);
+ }
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Clean EAnnotation Details in the model depending of what has been treated.
+ *
+ * @param hostView
+ * The view on which the Stereotype has been applied
+ */
+ public abstract void cleanEAnnotationDetails(View view);
+
+ /**
+ * Define if the Edit Policy detail for the specific EANnotation Detail is not Empty.
+ *
+ * @param view
+ * The view on which the Stereotype has been applied
+ */
+ public abstract boolean hasEAnnotationDetails(View view);
+
+ /**
+ * Get the command to update the Node visibility related to the EAnnotation.
+ *
+ * @param hostView
+ * The view on which the Stereotype has been applied
+ */
+ public abstract Runnable getStereotypeMigrationCommand(View view);
+
+
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationNestedMigrationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationNestedMigrationEditPolicy.java
new file mode 100644
index 00000000000..044396de925
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationNestedMigrationEditPolicy.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies;
+
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.editparts.UMLCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands.StereotypeNestedPropertiesMigrationCommand;
+
+/**
+ * Edit Policy to manage the migration of the object into Compartment :
+ * <ul>
+ * <li>Operations</li>
+ * <li>Properties</li>
+ * <li>Nested Element</li>
+ * <li>Enumeration</li>
+ * <li>....</li>
+ * </ul>
+ *
+ * To be applied on all the instances of {@link UMLCompartmentEditPart}.
+ *
+ * @author Céline JANSSENS
+ *
+ */
+public class StereotypeEAnnotationNestedMigrationEditPolicy extends StereotypeEAnnotationPropertiesMigrationEditPolicy {
+
+
+ /**
+ * Constructor.
+ *
+ */
+ public StereotypeEAnnotationNestedMigrationEditPolicy() {
+ super();
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationMigrationEditPolicy#activate()
+ *
+ */
+ @Override
+ public void activate() {
+ if (getHost() instanceof GraphicalEditPart) {
+ this.editPart = (GraphicalEditPart) getHost();
+ }
+
+ if (editPart instanceof UMLCompartmentEditPart && editPart.getModel() instanceof View) {
+ this.hostView = (View) editPart.getModel();
+ }
+
+ if (editPart != null && hostView != null) {
+ this.eAnnotation = migrationHelper.getStereotypeEAnnotation(hostView);
+ migrateStereotype();
+ }
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationPropertiesMigrationEditPolicy#getStereotypeMigrationCommand(org.eclipse.gmf.runtime.notation.View)
+ *
+ */
+ @Override
+ public Runnable getStereotypeMigrationCommand(View view) {
+
+ return new StereotypeNestedPropertiesMigrationCommand(LABEL, view);
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationPropertiesMigrationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationPropertiesMigrationEditPolicy.java
new file mode 100644
index 00000000000..d00ac6a648b
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationPropertiesMigrationEditPolicy.java
@@ -0,0 +1,97 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.commands.RemoveEAnnotationDetailCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayMigrationConstant;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands.StereotypeCommentPropertiesMigrationCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands.StereotypePropertiesMigrationCommand;
+import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil;
+
+/**
+ * Edit Policy for the Stereotype Properties user preferences migration.
+ * Should be applied to every graphicalEditPart on which Stereotypes Properties can be displayed.
+ *
+ * @author Céline JANSSENS
+ *
+ */
+public class StereotypeEAnnotationPropertiesMigrationEditPolicy extends StereotypeEAnnotationMigrationEditPolicy {
+
+ public static final String LABEL = "Migration Stereotype Properties";//$NON-NLS-1$
+
+
+
+ /**
+ * Clean the Key of EAnnotation related to the StereotypeLabel:
+ * <ul>
+ * <li>{@link StereotypeDisplayMigrationConstant.STEREOTYPE_PROPERTY_LOCATION}</li>
+ * <li>{@link StereotypeDisplayMigrationConstant.PROPERTY_STEREOTYPE_DISPLAY}</li>
+ * <li>{@link StereotypeDisplayMigrationConstant.STEREOTYPE_PRESENTATION_KIND}</li>
+ * </ul>
+ *
+ * @param view
+ * The view owning the EAnnotation to clean
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationMigrationEditPolicy#cleanEAnnotationDetails(org.eclipse.gmf.runtime.notation.View)
+ *
+ */
+ @Override
+ public void cleanEAnnotationDetails(View view) {
+
+ TransactionalEditingDomain domain = CommandUtil.resolveEditingDomain(editPart);
+
+ if (domain != null) {
+ RemoveEAnnotationDetailCommand deleteLocation = new RemoveEAnnotationDetailCommand(domain, eAnnotation, StereotypeDisplayMigrationConstant.STEREOTYPE_PROPERTY_LOCATION);
+ CommandUtil.executeUnsafeCommand(deleteLocation, domain);
+ RemoveEAnnotationDetailCommand deleteProperties = new RemoveEAnnotationDetailCommand(domain, eAnnotation, StereotypeDisplayMigrationConstant.PROPERTY_STEREOTYPE_DISPLAY);
+ CommandUtil.executeUnsafeCommand(deleteProperties, domain);
+ RemoveEAnnotationDetailCommand deleteKind = new RemoveEAnnotationDetailCommand(domain, eAnnotation, StereotypeDisplayMigrationConstant.STEREOTYPE_PRESENTATION_KIND);
+ CommandUtil.executeUnsafeCommand(deleteKind, domain);
+ }
+
+ }
+
+
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationMigrationEditPolicy#hasEAnnotationDetails(org.eclipse.gmf.runtime.notation.View)
+ *
+ */
+ @Override
+ public boolean hasEAnnotationDetails(View view) {
+
+ return migrationHelper.getAppliedStereotypesPropertiesToDisplay(hostView) != null;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationMigrationEditPolicy#getStereotypeMigrationCommand(org.eclipse.gmf.runtime.notation.View)
+ *
+ */
+ @Override
+ public Runnable getStereotypeMigrationCommand(View view) {
+ Runnable migrationCommand = null;
+ if (migrationHelper.getAppliedStereotypesPropertiesLocalization(view).equals(StereotypeDisplayConstant.STEREOTYPE_COMMENT_LOCATION)) {
+ // In case of properties in Comment, a dedicated Command is required.
+ migrationCommand = new StereotypeCommentPropertiesMigrationCommand(LABEL, view);
+ } else {
+ migrationCommand = new StereotypePropertiesMigrationCommand(LABEL, view);
+ }
+
+ return migrationCommand;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/CommandUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/CommandUtil.java
index 2ce9e5c49ec..319df094508 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/CommandUtil.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/util/CommandUtil.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Enrich Execution Command
*******************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.util;
@@ -19,14 +20,20 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.Transaction;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.workspace.AbstractEMFOperation;
import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.common.core.util.StringStatics;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer;
import org.eclipse.gmf.runtime.diagram.ui.util.EditPartUtil;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.uml.diagram.common.Activator;
/**
@@ -36,6 +43,9 @@ import org.eclipse.papyrus.uml.diagram.common.Activator;
*/
public class CommandUtil {
+
+ private static final String DOMAIN_FORMAT = "The transactional Domain cannot be retrived from the object s1";
+
/**
* Executes the supplied command inside an <code>unchecked action</code>
*
@@ -45,7 +55,7 @@ public class CommandUtil {
* command that can be executed (i.e., cmd.canExecute() == true)
* @param part
*/
- public static void executeCommand(final Command cmd, IGraphicalEditPart part) {
+ public static void executeCommand(final org.eclipse.gef.commands.Command cmd, IGraphicalEditPart part) {
Map<String, Boolean> options = null;
boolean isActivating = true;
// use the viewer to determine if we are still initializing the diagram
@@ -77,4 +87,167 @@ public class CommandUtil {
}
}
+ /**
+ * Execute a command as unsafe.
+ * Consequence: the command doesn't appear in the Command Stack and does not make the diagram dirty.
+ *
+ * @param command
+ * The command to execute unsafe
+ * @param object
+ * The EObject that is required to define the Transactional domain.
+ * @param synch
+ * Define if the command should be execute synchronously or not.
+ * @see {@link #resolveEditingDomain}
+ */
+ public static void executeUnsafeCommand(final ICommand command, final Object object) {
+
+ TransactionalEditingDomain domain = resolveEditingDomain(object);
+ if (domain != null) {
+ executeCommand(command, domain);
+ }
+
+ }
+
+ /**
+ * Execute a command as unsafe.
+ * Consequence: the command doesn't appear in the Command Stack and does not make the diagram dirty.
+ *
+ * @param command
+ * The command to execute unsafe
+ * @param object
+ * The EObject that is required to define the Transactional domain.
+ * @param synch
+ * Define if the command should be execute synchronously or not.
+ * @see {@link #resolveEditingDomain}
+ */
+ public static void executeUnsafeCommand(final Command command, final Object object) {
+
+ TransactionalEditingDomain domain = resolveEditingDomain(object);
+ if (domain != null) {
+ executeCommand(command, domain);
+ }
+ }
+
+ /**
+ * Execute a command as unsafe.
+ * Consequence: the command doesn't appear in the Command Stack and does not make the diagram dirty.
+ *
+ * @param command
+ * The command to execute unsafe
+ * @param object
+ * The EObject that is required to define the Transactional domain.
+ * @param synch
+ * Define if the command should be execute synchronously or not.
+ * @see {@link #resolveEditingDomain}
+ */
+ public static void executeUnsafeCommand(final Runnable command, final Object object) {
+
+ TransactionalEditingDomain domain = resolveEditingDomain(object);
+ if (domain != null) {
+ executeCommand(command, domain);
+ }
+
+ }
+
+ /**
+ * Execute a command as unsafe.
+ * Consequence: the command doesn't appear in the Command Stack and does not make the diagram dirty.
+ *
+ * @param command
+ * The command to execute unsafe
+ * @param object
+ * The EObject that is required to define the Transactional domain.
+ *
+ * @see {@link #resolveEditingDomain}
+ */
+ public static void executeCommandInStack(final org.eclipse.emf.common.command.Command command, final Object object) {
+
+ TransactionalEditingDomain domain = resolveEditingDomain(object);
+ domain.getCommandStack().execute(command);
+
+ }
+
+ /**
+ * Retrieve Editing Domain from an object.
+ * The Object treated can be a {@link TransactionalEditingDomain}, an {@link EObject} or a {@link IGraphicalEditPart}.
+ *
+ * @param object
+ * The object used to find the Transactional Editing Domain.
+ *
+ * @return The associated Editing Domain, or null if not found.
+ */
+ public static TransactionalEditingDomain resolveEditingDomain(Object object) {
+ TransactionalEditingDomain domain = null;
+ try {
+ if (object instanceof TransactionalEditingDomain) {
+ domain = (TransactionalEditingDomain) object;
+ } else if (object instanceof IGraphicalEditPart) {
+ domain = ((IGraphicalEditPart) object).getEditingDomain();
+ } else if (object instanceof EObject) {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain((EObject) object);
+ } else {
+ Activator.log.error(String.format(DOMAIN_FORMAT, object.toString()), null);
+ }
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
+
+ return domain;
+ }
+
+ /**
+ * Run the Command Asynchronously
+ *
+ * @param command
+ * The command to execute
+ * @param domain
+ * The Transactional Editing Domain
+ *
+ */
+ public static void executeCommand(final Command command, final TransactionalEditingDomain domain) {
+
+ try {
+ GMFUnsafe.write(domain, command);
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+
+ }
+
+ /**
+ * Run the Command Asynchronously
+ *
+ * @param command
+ * The command to execute
+ * @param domain
+ * The Transactional Editing Domain
+ *
+ */
+ private static void executeCommand(final ICommand command, final TransactionalEditingDomain domain) {
+ try {
+ GMFUnsafe.write(domain, command);
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+ }
+
+ /**
+ * Run the Command Asynchronously
+ *
+ * @param command
+ * The command to execute
+ * @param domain
+ * The Transactional Editing Domain
+ *
+ */
+ private static void executeCommand(final Runnable command, final TransactionalEditingDomain domain) {
+ // use to avoid to put it in the command stack
+ try {
+ GMFUnsafe.write(domain, command);
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+ }
+
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java
index 5c048a9dc0f..248e0bcc748 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java
@@ -12,6 +12,8 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.css.dom;
+
+
import java.util.LinkedList;
import java.util.List;
@@ -24,8 +26,8 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.css.dom.GMFElementAdapter;
import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine;
import org.eclipse.papyrus.infra.tools.util.ListHelper;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayHelper;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
import org.eclipse.papyrus.uml.diagram.css.helper.CSSDOMUMLSemanticElementHelper;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.NamedElement;
@@ -43,8 +45,16 @@ import org.eclipse.uml2.uml.Stereotype;
public class GMFUMLElementAdapter extends GMFElementAdapter {
+ /**
+ * Name of the CSS Simple Selector to match on the Stereotype Compartment Shape
+ */
+ private static final String STEREOTYPE_COMMENT = "StereotypeComment"; //$NON-NLS-1$
+
+
+ // Helpers
+ public final StereotypeDisplayUtil stereotypeHelper = StereotypeDisplayUtil.getInstance();
+
- public final StereotypeDisplayHelper stereotypeHelper = StereotypeDisplayHelper.getInstance();
public static final String APPLIED_STEREOTYPES_PROPERTY = "appliedStereotypes"; //$NON-NLS-1$
@@ -165,7 +175,7 @@ public class GMFUMLElementAdapter extends GMFElementAdapter {
* @return The matching value for this Attribute
*/
protected String getStereotypeCompartmentAttribute(String attr) {
- if (StereotypeDisplayUtils.STEREOTYPE_COMPARTMENT_NAME.equals(attr)) {
+ if (StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_NAME.equals(attr)) {
BasicCompartment propertyCompartment = (BasicCompartment) semanticElement;
return stereotypeHelper.getName(propertyCompartment);
@@ -183,7 +193,7 @@ public class GMFUMLElementAdapter extends GMFElementAdapter {
*/
protected String getStereotypePropertyAttribute(String attr) {
// CSS can match property level
- if (StereotypeDisplayUtils.STEREOTYPE_PROPERTY_NAME.equals(attr)) {
+ if (StereotypeDisplayConstant.STEREOTYPE_PROPERTY_NAME.equals(attr)) {
DecorationNode propertyLabel = (DecorationNode) semanticElement;
if (propertyLabel.getElement() instanceof Property) {
@@ -192,7 +202,7 @@ public class GMFUMLElementAdapter extends GMFElementAdapter {
return propLabel;
}
// CSS can match Container Name
- } else if (StereotypeDisplayUtils.STEREOTYPE_COMPARTMENT_NAME.equals(attr)) {
+ } else if (StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_NAME.equals(attr)) {
EObject propertyCompartment = ((DecorationNode) semanticElement).eContainer();
if (stereotypeHelper.isStereotypeCompartment(propertyCompartment)) {
@@ -214,13 +224,20 @@ public class GMFUMLElementAdapter extends GMFElementAdapter {
*/
protected String getStereotypeLabelAttribute(String attr) {
- if (StereotypeDisplayUtils.STEREOTYPE_LABEL_NAME.equals(attr)) {
+ if (StereotypeDisplayConstant.STEREOTYPE_LABEL_NAME.equals(attr)) {
DecorationNode label = (DecorationNode) semanticElement;
String stereoName = stereotypeHelper.getName(label);
return stereoName;
}
+
+ if (KIND.equals(attr)) {
+ if (stereotypeHelper.isStereotypeLabel(semanticElement)) {
+ return StereotypeDisplayConstant.STEREOTYPE_LABEL_TYPE;
+ }
+
+ }
return null;
}
@@ -233,4 +250,21 @@ public class GMFUMLElementAdapter extends GMFElementAdapter {
}
return super.getCSSValue(feature, value);
}
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.css.dom.GMFElementAdapter#getLocalName()
+ *
+ * @return The Local name for the CSS matching.
+ */
+ @Override
+ public String getLocalName() {
+ if (localName == null) {
+ // In case of StereotypeComment type, the selector should match on the Stereotype Comment.
+ if (stereotypeHelper.isStereotypeComment(getNotationElement())) {
+ return STEREOTYPE_COMMENT;
+ }
+ }
+ return super.getLocalName();
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/helper/CSSDOMUMLSemanticElementHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/helper/CSSDOMUMLSemanticElementHelper.java
index d9fee117b79..b369e8ec3f8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/helper/CSSDOMUMLSemanticElementHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/helper/CSSDOMUMLSemanticElementHelper.java
@@ -18,7 +18,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.DecorationNode;
import org.eclipse.gmf.runtime.notation.Shape;
import org.eclipse.papyrus.infra.gmfdiag.css.helper.CSSDOMSemanticElementHelper;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayHelper;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
/**
* This class is a helper for retrieving view and semantic element from a compatible object related to UML.
@@ -63,7 +63,7 @@ public class CSSDOMUMLSemanticElementHelper extends CSSDOMSemanticElementHelper
public EObject findSemanticElement(EObject notationElement) {
- StereotypeDisplayHelper stereotypeHelper = StereotypeDisplayHelper.getInstance();
+ StereotypeDisplayUtil stereotypeHelper = StereotypeDisplayUtil.getInstance();
// Add Stereotype Comment
if (notationElement instanceof Shape) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/theme/umlBase.css b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/theme/umlBase.css
index 8353232f0bf..0ea01ce3843 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/theme/umlBase.css
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/theme/umlBase.css
@@ -11,11 +11,58 @@
*
*****************************************************************************/
-/* Display name in italic when isAbstract=true (bug 464129)*/
-[isAbstract=true] {
+/* Hide the name label for most links */
+
+Dependency > Label:name,
+Usage > Label:name,
+Realization > Label:name,
+InterfaceRealization > Label:name,
+Abstraction > Label:name,
+Substitution > Label:name,
+Connector > Label:name,
+InformationFlow > Label:name
+{
+ visible: false;
+}
+
+/* Display name in italic when isAbstract=true for Classifier (bug 464129)*/
+Artifact[isAbstract=true],
+DeploymentSpecification[isAbstract=true],
+Association[isAbstract=true],
+CommunicationPath[isAbstract=true],
+Extension[isAbstract=true],
+BehavioredClassifier[isAbstract=true],
+Actor[isAbstract=true],
+Usecase[isAbstract=true],
+DataType[isAbstract=true],
+Enumeration[isAbstract=true],
+PrimitiveType[isAbstract=true],
+InformationItem[isAbstract=true],
+Interface[isAbstract=true],
+Signal[isAbstract=true],
+Collaboration[isAbstract=true],
+Class[isAbstract=true],
+AssociationClass[isAbstract=true],
+Activity[isAbstract=true],
+Interaction[isAbstract=true],
+OpaqueBehavior[isAbstract=true],
+FunctionBehavior[isAbstract=true],
+StateMachine[isAbstract=true],
+ProtocolStateMachine[isAbstract=true],
+Component[isAbstract=true],
+Node[isAbstract=true],
+Device[isAbstract=true],
+ExecutionEnvironment[isAbstract=true],
+Stereotype[isAbstract=true] {
italic:true;
}
+/* Display name in italic when isAbstract=true for BehavioralFeature (bug 464129)*/
+Operation[isAbstract=true],Reception[isAbstract=true]{
+ italic:true;
+}
+
+
/*
* The Actor element icon is not useful either
*/
@@ -26,7 +73,28 @@ UseCaseDiagram Actor {
TimingDiagram * {
gradient:none;
}
+/*---------- Stereotype Display --------- */
+
+StereotypeComment{
+ visible:false;
+}
+
+
+Compartment[type=StereotypeCompartment]{
+ visible:false;
+}
+
+Compartment[type=StereotypeBrace]{
+ visible:false;
+}
+StereotypeComment Compartment[type=StereotypeBrace]{
+ visible:false;
+}
+
+Label[kind=StereotypeLabel]{
+ depth:"none";
+}
/*---------- Default SVG symbols ----------*/
@@ -121,11 +189,6 @@ ActivityDiagram AcceptEventAction
fillColor:white;
}
-ActivityDiagram MergeNode,
-ActivityDiagram DecisionNode{
- maintainSymbolRatio:false;
-}
-
ActivityDiagram InitialNode{
fillColor: black;
}
@@ -148,7 +211,8 @@ ActivityDiagram MergeNode > Label,
ActivityDiagram InitialNode > Label,
ActivityDiagram ActivityFinalNode > Label,
ActivityDiagram FlowFinalNode > Label,
-ActivityDiagram DecisionNode > Label,
+ActivityDiagram DecisionNode > Label,
+ActivityDiagram SendSignalAction > Label,
ActivityDiagram ForkNode > Label,
ActivityDiagram JoinNode > Label
{
@@ -275,7 +339,6 @@ StateMachineDiagram FinalState
fillColor:white;
}
-
StateMachineDiagram Pseudostate[kind="initial"],
StateMachineDiagram Pseudostate[kind="junction"]
{
@@ -356,11 +419,6 @@ InteractionOverviewDiagram DecisionNode
fillColor:white;
}
-InteractionOverviewDiagram MergeNode,
-InteractionOverviewDiagram DecisionNode{
- maintainSymbolRatio:false;
-}
-
InteractionOverviewDiagram InitialNode{
fillColor:black;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/SetStereotypeVisibleOnMetaclassCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/SetStereotypeVisibleOnMetaclassCommand.java
index 7e53626f2fa..f7a938bded2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/SetStereotypeVisibleOnMetaclassCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/SetStereotypeVisibleOnMetaclassCommand.java
@@ -24,12 +24,12 @@ import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
-import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeUserActionHelper;
import org.eclipse.papyrus.uml.diagram.common.util.Util;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.ElementImport;
+import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.Type;
/**
@@ -83,8 +83,8 @@ public class SetStereotypeVisibleOnMetaclassCommand extends AbstractTransactiona
Class metaclass = (Class) ((ElementImport) semanticElement).getImportedElement();
View node = (View) (this.cmdResult).getAdapter(View.class);
Element UMLelement = metaclass;
- String stereotypeName = UMLelement.getAppliedStereotypes().get(0).getQualifiedName();
- Command command = AppliedStereotypeHelper.getAddAppliedStereotypeCommand(getEditingDomain(), node, stereotypeName, UMLVisualInformationPapyrusConstant.STEREOTYPE_TEXT_HORIZONTAL_PRESENTATION);
+ Stereotype stereotype = UMLelement.getAppliedStereotypes().get(0);
+ Command command = StereotypeUserActionHelper.getAddAppliedStereotypeCommand(getEditingDomain(), node, stereotype.getQualifiedName());
if (command.canExecute()) {
command.execute();
}
@@ -92,8 +92,8 @@ public class SetStereotypeVisibleOnMetaclassCommand extends AbstractTransactiona
Class metaclass = (Class) semanticElement;
View node = (View) (this.cmdResult).getAdapter(View.class);
Element UMLelement = metaclass;
- String stereotypeName = UMLelement.getAppliedStereotypes().get(0).getQualifiedName();
- Command command = AppliedStereotypeHelper.getAddAppliedStereotypeCommand(getEditingDomain(), node, stereotypeName, UMLVisualInformationPapyrusConstant.STEREOTYPE_TEXT_HORIZONTAL_PRESENTATION);
+ Stereotype stereotype = UMLelement.getAppliedStereotypes().get(0);
+ Command command = StereotypeUserActionHelper.getAddAppliedStereotypeCommand(getEditingDomain(), node, stereotype.getQualifiedName());
if (command.canExecute()) {
command.execute();
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateAppliedStereotypeCommentViewCommandEx.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateAppliedStereotypeCommentViewCommandEx.java
index 03284319389..391abf71b67 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateAppliedStereotypeCommentViewCommandEx.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateAppliedStereotypeCommentViewCommandEx.java
@@ -31,8 +31,8 @@ import org.eclipse.gmf.runtime.notation.Shape;
import org.eclipse.gmf.runtime.notation.TitleStyle;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.CreateAppliedStereotypeCommentViewCommand;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.CreateAppliedStereotypeCommentViewCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
import org.eclipse.uml2.uml.CombinedFragment;
import org.eclipse.uml2.uml.InteractionOperand;
import org.eclipse.uml2.uml.Lifeline;
@@ -70,13 +70,13 @@ public class CreateAppliedStereotypeCommentViewCommandEx extends CreateAppliedSt
ts.setShowTitle(true);
node.getStyles().add(ts);
node.setElement(null);
- node.setType(StereotypeDisplayUtils.STEREOTYPE_COMMENT_TYPE);
+ node.setType(StereotypeDisplayConstant.STEREOTYPE_COMMENT_TYPE);
connectCommentNode(owner, node);
EObjectValueStyle eObjectValueStyle = (EObjectValueStyle) node.createStyle(NotationPackage.eINSTANCE.getEObjectValueStyle());
eObjectValueStyle.setEObjectValue(base_element);
- eObjectValueStyle.setName(StereotypeDisplayUtils.STEREOTYPE_COMMENT_RELATION_NAME);
+ eObjectValueStyle.setName(StereotypeDisplayConstant.STEREOTYPE_COMMENT_RELATION_NAME);
// create the link
Connector edge = NotationFactory.eINSTANCE.createConnector();
@@ -87,8 +87,8 @@ public class CreateAppliedStereotypeCommentViewCommandEx extends CreateAppliedSt
points.add(new RelativeBendpoint());
bendpoints.setPoints(points);
edge.setBendpoints(bendpoints);
- ViewUtil.insertChildView(owner.getDiagram(), edge, -1, StereotypeDisplayUtils.PERSISTENT);
- edge.setType(StereotypeDisplayUtils.STEREOTYPE_COMMENT_LINK_TYPE);
+ ViewUtil.insertChildView(owner.getDiagram(), edge, -1, StereotypeDisplayConstant.PERSISTENT);
+ edge.setType(StereotypeDisplayConstant.STEREOTYPE_COMMENT_LINK_TYPE);
edge.setElement(base_element);
IdentityAnchor anchor = NotationFactory.eINSTANCE.createIdentityAnchor();
edge.setSourceAnchor(anchor);
@@ -103,7 +103,7 @@ public class CreateAppliedStereotypeCommentViewCommandEx extends CreateAppliedSt
edge.setElement(null);
eObjectValueStyle = (EObjectValueStyle) edge.createStyle(NotationPackage.eINSTANCE.getEObjectValueStyle());
eObjectValueStyle.setEObjectValue(base_element);
- eObjectValueStyle.setName(StereotypeDisplayUtils.STEREOTYPE_COMMENT_RELATION_NAME);
+ eObjectValueStyle.setName(StereotypeDisplayConstant.STEREOTYPE_COMMENT_RELATION_NAME);
}
@@ -142,7 +142,7 @@ public class CreateAppliedStereotypeCommentViewCommandEx extends CreateAppliedSt
while (econtainer != null && (ViewUtil.resolveSemanticElement(econtainer) instanceof Lifeline || ViewUtil.resolveSemanticElement(econtainer) instanceof CombinedFragment || ViewUtil.resolveSemanticElement(econtainer) instanceof InteractionOperand)) {
econtainer = (View) econtainer.eContainer();
}
- ViewUtil.insertChildView(econtainer, commentNode, ViewUtil.APPEND, StereotypeDisplayUtils.PERSISTENT);
+ ViewUtil.insertChildView(econtainer, commentNode, ViewUtil.APPEND, StereotypeDisplayConstant.PERSISTENT);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/META-INF/MANIFEST.MF
index 3f1d108f907..9a19d5f9955 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/META-INF/MANIFEST.MF
@@ -30,5 +30,5 @@ Bundle-Description: The pupose of this plugin is add the fucntionality
cs directory.
Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.stereotype.editio
n;singleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Description: %pluginDescription
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/plugin.xml
index 4a838ce0dad..6ec94f1bff2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/plugin.xml
@@ -9,6 +9,12 @@
name="Low">
</Priority>
</editpolicyProvider>
+ <editpolicyProvider
+ class="org.eclipse.papyrus.uml.diagram.stereotype.edition.provider.StereotypeDisplayMigrationEditPolicyProvider">
+ <Priority
+ name="Medium">
+ </Priority>
+ </editpolicyProvider>
</extension>
<extension
id="stereotype-ep-provider"
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCommentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCommentEditPart.java
index 7fd701acc26..f16d3bd2b0d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCommentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCommentEditPart.java
@@ -15,6 +15,8 @@ package org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.StackLayout;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
@@ -31,6 +33,7 @@ import org.eclipse.papyrus.uml.diagram.common.editpolicies.CommentShapeForApplie
import org.eclipse.papyrus.uml.diagram.common.figure.node.CornerBentFigure;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypeCompartmentForCommentShapeEditPolicy;
+// TODO: Auto-generated Javadoc
/**
* The Applied StereotypeCommentEdipart and the appliedStereotypeCommentLinkEditPart are connected to the semantic element.
* Thanks to this, if the semantic element is deleted the comment will be also deleted.
@@ -43,35 +46,46 @@ import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedSt
public class AppliedStereotypeCommentEditPart extends NodeEditPart implements IGraphicalEditPart, IPrimaryEditPart {
+ /**
+ * Group Request type of deletion request.
+ */
+ private static final String DELETE = "delete";//$NON-NLS-1$
+
+ /**
+ * Instantiates a new applied stereotype comment edit part.
+ *
+ * @param view
+ * the view
+ */
public AppliedStereotypeCommentEditPart(View view) {
super(view);
}
- /**
- * @generated
- */
+ /** The content pane. */
protected IFigure contentPane;
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart#createDefaultEditPolicies()
+ *
+ */
@Override
protected void createDefaultEditPolicies() {
- // TODO Auto-generated method stub
+
super.createDefaultEditPolicies();
installEditPolicy("AppliedStereotypeCompartment", new AppliedStereotypeCompartmentForCommentShapeEditPolicy());
installEditPolicy("AutomaticDeletionIfEmpty", new CommentShapeForAppliedStereotypeEditPolicy());
}
- /**
- * @generated
- */
+ /** The Constant ID. */
public static final String ID = "AppliedStereotypesComment";
/**
* Creates figure for this edit part.
- *
+ *
* Body of this method does not depend on settings in generation model
* so you may safely remove <i>generated</i> tag and modify it.
*
- * @generated
+ * @return the node figure
*/
@Override
protected NodeFigure createMainFigure() {
@@ -83,6 +97,11 @@ public class AppliedStereotypeCommentEditPart extends NodeEditPart implements IG
return figure;
}
+ /**
+ * @see org.eclipse.gef.editparts.AbstractEditPart#toString()
+ *
+ * @return
+ */
@Override
public String toString() {
// return super.toString();
@@ -98,7 +117,9 @@ public class AppliedStereotypeCommentEditPart extends NodeEditPart implements IG
/**
- * @generated
+ * @see org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart#getContentPane()
+ *
+ * @return the Content Pane
*/
@Override
public IFigure getContentPane() {
@@ -110,7 +131,11 @@ public class AppliedStereotypeCommentEditPart extends NodeEditPart implements IG
/**
- * @generated
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart#getContentPaneFor(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)
+ *
+ * @param editPart
+ * The EditPart of which the ContentPane is retrive
+ * @returnThe content Pane
*/
@Override
protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
@@ -118,7 +143,9 @@ public class AppliedStereotypeCommentEditPart extends NodeEditPart implements IG
}
/**
- * @generated
+ * @see org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart#createNodePlate()
+ *
+ * @return the Figure created
*/
@Override
protected NodeFigure createNodePlate() {
@@ -132,7 +159,7 @@ public class AppliedStereotypeCommentEditPart extends NodeEditPart implements IG
*
* @param nodeShape
* instance of generated figure class
- * @generated
+ * @return the i figure
*/
@Override
protected IFigure setupContentPane(IFigure nodeShape) {
@@ -146,13 +173,14 @@ public class AppliedStereotypeCommentEditPart extends NodeEditPart implements IG
- /**
- * @generated
- */
+ /** The primary shape. */
protected IFigure primaryShape;
+
/**
- * @generated
+ * @see org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart#createNodeShape()
+ *
+ * @return
*/
@Override
protected IFigure createNodeShape() {
@@ -161,12 +189,35 @@ public class AppliedStereotypeCommentEditPart extends NodeEditPart implements IG
}
/**
- * @generated
+ * Gets the primary shape.
+ *
+ * @return the primary shape
+ * @see org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart#getPrimaryShape()
*/
@Override
public CornerBentFigure getPrimaryShape() {
return (CornerBentFigure) primaryShape;
}
+ /**
+ * The Comment edit Part should not be deleted because it cannot be recreated.
+ * The best solution to not show it is to hide it (through CSS or Appearance View)
+ *
+ * @param req
+ * the req
+ * @return the command
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#getCommand(org.eclipse.gef.Request)
+ */
+ @Override
+ public Command getCommand(Request req) {
+
+ Command command = null;
+ if (req.getType().equals(DELETE)) {
+ command = null;
+ } else {
+ command = super.getCommand(req);
+ }
+ return command;
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCompartmentEditPart.java
index a037a41105c..93194f9aa3e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeCompartmentEditPart.java
@@ -28,12 +28,14 @@ import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
import org.eclipse.gmf.runtime.diagram.ui.internal.figures.NestedResizableCompartmentFigure;
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.DecorationNode;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeCompartmentFigure;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
import org.eclipse.uml2.uml.Stereotype;
/**
@@ -67,18 +69,24 @@ public class AppliedStereotypeCompartmentEditPart extends ResizeableListCompartm
@Override
public String getCompartmentName() {
+ StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
+ String name = NO_STEREOTYPE_COMPARTMENT;
+ View compartment = (View) getModel();
EObject element = resolveSemanticElement();
if (element instanceof Stereotype) {
Stereotype stereotype = (Stereotype) resolveSemanticElement();
+
if (stereotype != null) {
- return (StereotypeDisplayUtils.QUOTE_LEFT + stereotype.getName() + StereotypeDisplayUtils.QUOTE_RIGHT);
+ View label = helper.getStereotypeLabel((View) compartment.eContainer(), stereotype);
+ name = StereotypeDisplayConstant.QUOTE_LEFT + helper.getStereotypeName((DecorationNode) label) + StereotypeDisplayConstant.QUOTE_RIGHT;
}
}
- return NO_STEREOTYPE_COMPARTMENT;
+ return name;
}
+
/**
* this method has be rewritten in order to add its own figure to ensure to manage it
* in Papyrus Figure.
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeMultilinePropertyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeMultilinePropertyEditPart.java
index 77ef63faf4c..d2224ccd8d2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeMultilinePropertyEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeMultilinePropertyEditPart.java
@@ -77,7 +77,7 @@ import org.eclipse.papyrus.uml.diagram.common.figure.node.EditingFlowPage;
import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure;
import org.eclipse.papyrus.uml.diagram.common.parser.StereotypePropertyParser;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayHelper;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
import org.eclipse.papyrus.uml.profile.structure.AppliedStereotypeProperty;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleEvent;
@@ -882,7 +882,7 @@ public class AppliedStereotypeMultilinePropertyEditPart extends CompartmentEditP
super.activate();
addOwnerElementListeners();
Stereotype stereotype = (Stereotype) ((View) getNotationView().eContainer()).getElement();
- stereotypeApplication = StereotypeDisplayHelper.getInstance().getStereotypeApplication(getNotationView(), stereotype);
+ stereotypeApplication = StereotypeDisplayUtil.getInstance().getStereotypeApplication(getNotationView(), stereotype);
final Element umlElement = UMLUtil.getBaseElement(stereotypeApplication);
getDiagramEventBroker().addNotificationListener(stereotypeApplication, this);
getDiagramEventBroker().addNotificationListener(umlElement, this);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentEditPolicy.java
index 4b78c10e1ca..f52aa68a508 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentEditPolicy.java
@@ -33,14 +33,14 @@ import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.LayoutConstraint;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.CreateAppliedStereotypeCommentViewCommand;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.CreateAppliedStereotypePropertyViewCommand;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.CreateAppliedStereotypeViewCommand;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.CreateAppliedStereotypeCommentViewCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.CreateAppliedStereotypeCompartmentCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.CreateAppliedStereotypePropertyViewCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Extension;
import org.eclipse.uml2.uml.Property;
@@ -111,7 +111,7 @@ public class AppliedStereotypeCommentEditPolicy extends AppliedStereotypeNodeLab
if (comment != null) {
int eventType = notification.getEventType();
- EObject object = NotationUtils.getEObjectValue(comment, StereotypeDisplayUtils.STEREOTYPE_COMMENT_RELATION_NAME, null);
+ EObject object = StereotypeDisplayUtil.getInstance().getCommentSemanticElement(comment);
// If the reference object of the comment is removed, delete the Comment node itself.
if (eventType == Notification.REMOVE && notification.getOldValue().equals(hostView) && object == null) {
executeAppliedStereotypeCommentDeletion(hostEditPart.getEditingDomain(), comment);
@@ -172,6 +172,7 @@ public class AppliedStereotypeCommentEditPolicy extends AppliedStereotypeNodeLab
* @return the number of Visible Stereotype Compartment
*/
protected int getAppliedStereotypeCompartmentNumber(View view) {
+
int nbVisibleCompartment = 0;
Iterator<View> iteratorView = view.getChildren().iterator();
while (iteratorView.hasNext()) {
@@ -228,7 +229,7 @@ public class AppliedStereotypeCommentEditPolicy extends AppliedStereotypeNodeLab
// doesn't exist already
if (!helper.isCompartmentExist(node, stereotype)) {
// Create Compartment
- executeAppliedStereotypeCompartmentCreation(hostEditPart, stereotype, StereotypeDisplayUtils.STEREOTYPE_COMPARTMENT_TYPE);
+ executeAppliedStereotypeCompartmentCreation(hostEditPart, stereotype, StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_TYPE);
}
}
@@ -256,7 +257,7 @@ public class AppliedStereotypeCommentEditPolicy extends AppliedStereotypeNodeLab
* In Charge of PropertyView Creation
*
* @param propertyType
- * Type of Property {@link StereotypeDisplayUtils#STEREOTYPE_PROPERTY_TYPE} or {@link StereotypeDisplayUtils#STEREOTYPE_PROPERTY_BRACE_TYPE}
+ * Type of Property {@link StereotypeDisplayConstant#STEREOTYPE_PROPERTY_TYPE} or {@link StereotypeDisplayConstant#STEREOTYPE_PROPERTY_BRACE_TYPE}
* @param compartment
* The Compartment owner of the Property that will be created
* @param property
@@ -286,7 +287,7 @@ public class AppliedStereotypeCommentEditPolicy extends AppliedStereotypeNodeLab
// doesn't exist already
if (!helper.isCompartmentExist(node, stereotype)) {
// Create Compartment
- executeAppliedStereotypeCompartmentCreation(hostEditPart, stereotype, StereotypeDisplayUtils.STEREOTYPE_BRACE_TYPE);
+ executeAppliedStereotypeCompartmentCreation(hostEditPart, stereotype, StereotypeDisplayConstant.STEREOTYPE_BRACE_TYPE);
}
}
@@ -349,7 +350,7 @@ public class AppliedStereotypeCommentEditPolicy extends AppliedStereotypeNodeLab
public void run() {
- CreateAppliedStereotypeViewCommand command = new CreateAppliedStereotypeViewCommand(editPart.getEditingDomain(), comment, stereotype, type);
+ CreateAppliedStereotypeCompartmentCommand command = new CreateAppliedStereotypeCompartmentCommand(editPart.getEditingDomain(), comment, stereotype, type);
// use to avoid to put it in the command stack
try {
@@ -389,7 +390,7 @@ public class AppliedStereotypeCommentEditPolicy extends AppliedStereotypeNodeLab
public void run() {
// use to avoid to put it in the command stack
- CreateAppliedStereotypePropertyViewCommand command = new CreateAppliedStereotypePropertyViewCommand(editPart.getEditingDomain(), compartment, stereotypeProperty, StereotypeDisplayUtils.STEREOTYPE_PROPERTY_TYPE);
+ CreateAppliedStereotypePropertyViewCommand command = new CreateAppliedStereotypePropertyViewCommand(editPart.getEditingDomain(), compartment, stereotypeProperty, StereotypeDisplayConstant.STEREOTYPE_PROPERTY_TYPE);
try {
GMFUnsafe.write(editPart.getEditingDomain(), command);
} catch (Exception e) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java
index bdd43a7484d..0d32efaa3c4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentEditPolicy.java
@@ -26,9 +26,9 @@ import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.CreateAppliedStereotypePropertyViewCommand;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.CreateAppliedStereotypeViewCommand;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.CreateAppliedStereotypePropertyViewCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.command.CreateAppliedStereotypeCompartmentCommand;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Extension;
import org.eclipse.uml2.uml.Property;
@@ -139,7 +139,7 @@ public class AppliedStereotypeCompartmentEditPolicy extends AppliedStereotypeNod
* In Charge of PropertyView Creation
*
* @param propertyType
- * Type of Property {@link StereotypeDisplayUtils#STEREOTYPE_PROPERTY_TYPE} or {@link StereotypeDisplayUtils#STEREOTYPE_PROPERTY_BRACE_TYPE}
+ * Type of Property {@link StereotypeDisplayConstant#STEREOTYPE_PROPERTY_TYPE} or {@link StereotypeDisplayConstant#STEREOTYPE_PROPERTY_BRACE_TYPE}
* @param compartment
* The Compartment owner of the Property that will be created
* @param property
@@ -177,7 +177,7 @@ public class AppliedStereotypeCompartmentEditPolicy extends AppliedStereotypeNod
public void run() {
- CreateAppliedStereotypeViewCommand command = new CreateAppliedStereotypeViewCommand(editPart.getEditingDomain(), editPart.getNotationView(), stereotype, StereotypeDisplayUtils.STEREOTYPE_COMPARTMENT_TYPE);
+ CreateAppliedStereotypeCompartmentCommand command = new CreateAppliedStereotypeCompartmentCommand(editPart.getEditingDomain(), editPart.getNotationView(), stereotype, StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_TYPE);
// use to avoid to put it in the command stack
try {
@@ -219,7 +219,7 @@ public class AppliedStereotypeCompartmentEditPolicy extends AppliedStereotypeNod
public void run() {
// use to avoid to put it in the command stack
- CreateAppliedStereotypePropertyViewCommand command = new CreateAppliedStereotypePropertyViewCommand(editPart.getEditingDomain(), compartment, stereotypeProperty, StereotypeDisplayUtils.STEREOTYPE_PROPERTY_TYPE);
+ CreateAppliedStereotypePropertyViewCommand command = new CreateAppliedStereotypePropertyViewCommand(editPart.getEditingDomain(), compartment, stereotypeProperty, StereotypeDisplayConstant.STEREOTYPE_PROPERTY_TYPE);
try {
GMFUnsafe.write(editPart.getEditingDomain(), command);
} catch (Exception e) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentForCommentShapeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentForCommentShapeEditPolicy.java
index 4209992f0cf..a558e71a7b6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentForCommentShapeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCompartmentForCommentShapeEditPolicy.java
@@ -17,7 +17,7 @@ package org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies;
import org.eclipse.gmf.runtime.notation.EObjectValueStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
import org.eclipse.uml2.uml.Element;
@@ -51,8 +51,8 @@ public class AppliedStereotypeCompartmentForCommentShapeEditPolicy extends Appli
if ((Element) getView().getElement() != null) {
return (Element) getView().getElement();
}
- if (getView().getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), StereotypeDisplayUtils.STEREOTYPE_COMMENT_RELATION_NAME) != null) {
- EObjectValueStyle eObjectValueStyle = (EObjectValueStyle) getView().getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), StereotypeDisplayUtils.STEREOTYPE_COMMENT_RELATION_NAME);
+ if (getView().getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), StereotypeDisplayConstant.STEREOTYPE_COMMENT_RELATION_NAME) != null) {
+ EObjectValueStyle eObjectValueStyle = (EObjectValueStyle) getView().getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), StereotypeDisplayConstant.STEREOTYPE_COMMENT_RELATION_NAME);
return (Element) eObjectValueStyle.getEObjectValue();
}
return null;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeLabelEditPolicy.java
index f34842e223e..b11aad2b605 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeLabelEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeLabelEditPolicy.java
@@ -33,6 +33,16 @@ public class AppliedStereotypeLabelEditPolicy extends AppliedStereotypeNodeLabel
}
/**
+ * @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AbstractAppliedStereotypeDisplayEditPolicy#activate()
+ *
+ */
+ @Override
+ public void activate() {
+ // CEJ Auto-generated method stub
+ super.activate();
+ }
+
+ /**
* @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy#refreshStereotypeDisplay()
*
*/
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 1fb91e42347..1c6a8d59b10 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
@@ -21,7 +21,9 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
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.core.services.ServiceException;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart.AppliedStereotypeMultilinePropertyEditPart;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypeCommentEditPolicy;
@@ -80,6 +82,14 @@ public class CustomEditPolicyProvider extends AbstractProvider implements IEditP
if (gep instanceof NamedElementEditPart) {
return true;
}
+
+ try {
+ if (ServiceUtilsForEditPart.getInstance().getServiceRegistry(gep) != null) {
+ return true;
+ }
+ } catch (ServiceException e) {
+ e.printStackTrace();
+ }
}
return false;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/DisplayedProfileElementLabelProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/DisplayedProfileElementLabelProvider.java
index 29e33ab2850..3ec957bd7b6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/DisplayedProfileElementLabelProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/DisplayedProfileElementLabelProvider.java
@@ -23,8 +23,8 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayHelper;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
import org.eclipse.papyrus.uml.profile.ImageManager;
import org.eclipse.papyrus.uml.profile.Message;
import org.eclipse.papyrus.uml.profile.tree.objects.AppliedStereotypePropertyTreeObject;
@@ -59,7 +59,7 @@ import org.eclipse.uml2.uml.util.UMLUtil;
public class DisplayedProfileElementLabelProvider extends LabelProvider {
- private StereotypeDisplayHelper helper = StereotypeDisplayHelper.getInstance();
+ private StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance();
private View mainView;
@@ -84,9 +84,9 @@ public class DisplayedProfileElementLabelProvider extends LabelProvider {
*/
public boolean isQualifiedNameDisplay(View labelView) {
- String depth = NotationUtils.getStringValue(labelView, StereotypeDisplayUtils.STEREOTYPE_LABEL_DEPTH, StereotypeDisplayUtils.DEFAULT_DEPTH_VALUE);
+ String depth = NotationUtils.getStringValue(labelView, StereotypeDisplayConstant.STEREOTYPE_LABEL_DEPTH, StereotypeDisplayConstant.DEFAULT_DEPTH_VALUE);
- return StereotypeDisplayUtils.DEPTH_MAX.equals(depth);
+ return StereotypeDisplayConstant.DEPTH_MAX.equals(depth);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypeDisplayMigrationEditPolicyProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypeDisplayMigrationEditPolicyProvider.java
new file mode 100644
index 00000000000..34aa307f48b
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypeDisplayMigrationEditPolicyProvider.java
@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotype Display
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.stereotype.edition.provider;
+
+import org.eclipse.gef.EditPart;
+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.editparts.ConnectionEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editparts.UMLCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeMigrationHelper;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationLabelMigrationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationNestedMigrationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationPropertiesMigrationEditPolicy;
+import org.eclipse.papyrus.uml.tools.utils.UMLUtil;
+
+/**
+ * @author Céline JANSSENS
+ *
+ */
+public class StereotypeDisplayMigrationEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider {
+
+
+
+ /**
+ * @see org.eclipse.gmf.runtime.common.core.service.IProvider#provides(org.eclipse.gmf.runtime.common.core.service.IOperation)
+ *
+ */
+ public boolean provides(IOperation operation) {
+ CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
+ if (!(epOperation.getEditPart() instanceof GraphicalEditPart) && !(epOperation.getEditPart() instanceof ConnectionEditPart)) {
+ return false;
+ }
+
+ EditPart gep = epOperation.getEditPart();
+
+ // Only the EditPart with an Stereotype EAnnotation into its View.
+ try {
+ if (ServiceUtilsForEditPart.getInstance().getServiceRegistry(gep) != null) {
+ if (gep.getModel() instanceof View) {
+ if (StereotypeMigrationHelper.getInstance().hasStereotypeEAnnotation((View) gep.getModel())) {
+ if (UMLUtil.resolveUMLElement(gep) != null) {
+ return true;
+ }
+ }
+ }
+ }
+ } catch (ServiceException e) {
+ e.printStackTrace();
+ }
+
+ return false;
+
+
+ }
+
+
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider#createEditPolicies(org.eclipse.gef.EditPart)
+ *
+ */
+ public void createEditPolicies(EditPart editPart) {
+
+
+ if (editPart.getModel() instanceof View) {
+ if (StereotypeMigrationHelper.getInstance().hasStereotypeEAnnotation((View) editPart.getModel())) {
+
+ // Main policy for Stereotype Label Migration
+
+ if (UMLUtil.resolveUMLElement(editPart) != null) {
+ editPart.installEditPolicy(StereotypeEAnnotationLabelMigrationEditPolicy.LABEL, new StereotypeEAnnotationLabelMigrationEditPolicy());
+ if (!(editPart instanceof UMLCompartmentEditPart)) {
+ editPart.installEditPolicy(StereotypeEAnnotationPropertiesMigrationEditPolicy.LABEL, new StereotypeEAnnotationPropertiesMigrationEditPolicy());
+ }
+ }
+
+
+ // Policy for Stereotype Property and Label Migration of Element into Compartment (Property, Operation, Nested element, Enumeration Item,...)
+ if (editPart instanceof UMLCompartmentEditPart) {
+ if (UMLUtil.resolveUMLElement(editPart) != null) {
+ editPart.installEditPolicy(StereotypeEAnnotationPropertiesMigrationEditPolicy.LABEL, new StereotypeEAnnotationNestedMigrationEditPolicy());
+ }
+ }
+
+ }
+ }
+
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypePropertiesEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypePropertiesEditPartProvider.java
index 9b3c073594e..ae926d74a78 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypePropertiesEditPartProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypePropertiesEditPartProvider.java
@@ -24,7 +24,7 @@ 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.providers.RestrictedAbstractEditPartProvider;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.StereotypeDisplayUtils;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart.AppliedStereotypeCommentEditPart;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart.AppliedStereotypeCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpart.AppliedStereotypeEmptyEditPart;
@@ -44,15 +44,15 @@ public class StereotypePropertiesEditPartProvider extends RestrictedAbstractEdit
public StereotypePropertiesEditPartProvider() {
super();
- nodeMap.put(StereotypeDisplayUtils.STEREOTYPE_COMPARTMENT_TYPE, AppliedStereotypeCompartmentEditPart.class);
- nodeMap.put(StereotypeDisplayUtils.STEREOTYPE_PROPERTY_TYPE, AppliedStereotypeMultilinePropertyEditPart.class);
- nodeMap.put(StereotypeDisplayUtils.STEREOTYPE_COMMENT_TYPE, AppliedStereotypeCommentEditPart.class);
- nodeMap.put(StereotypeDisplayUtils.STEREOTYPE_LABEL_TYPE, AppliedStereotypeEmptyEditPart.class);
- nodeMap.put(StereotypeDisplayUtils.STEREOTYPE_BRACE_TYPE, AppliedStereotypeEmptyEditPart.class);
- nodeMap.put(StereotypeDisplayUtils.STEREOTYPE_PROPERTY_BRACE_TYPE, AppliedStereotypeEmptyEditPart.class);
+ nodeMap.put(StereotypeDisplayConstant.STEREOTYPE_COMPARTMENT_TYPE, AppliedStereotypeCompartmentEditPart.class);
+ nodeMap.put(StereotypeDisplayConstant.STEREOTYPE_PROPERTY_TYPE, AppliedStereotypeMultilinePropertyEditPart.class);
+ nodeMap.put(StereotypeDisplayConstant.STEREOTYPE_COMMENT_TYPE, AppliedStereotypeCommentEditPart.class);
+ nodeMap.put(StereotypeDisplayConstant.STEREOTYPE_LABEL_TYPE, AppliedStereotypeEmptyEditPart.class);
+ nodeMap.put(StereotypeDisplayConstant.STEREOTYPE_BRACE_TYPE, AppliedStereotypeEmptyEditPart.class);
+ nodeMap.put(StereotypeDisplayConstant.STEREOTYPE_PROPERTY_BRACE_TYPE, AppliedStereotypeEmptyEditPart.class);
- edgeMap.put(StereotypeDisplayUtils.STEREOTYPE_COMMENT_LINK_TYPE, AppliedStereotypesCommentLinkEditPart.class);
+ edgeMap.put(StereotypeDisplayConstant.STEREOTYPE_COMMENT_LINK_TYPE, AppliedStereotypesCommentLinkEditPart.class);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/StereotypedElementShapeProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/StereotypedElementShapeProvider.java
index 8b632414204..f28c5b42c7f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/StereotypedElementShapeProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/StereotypedElementShapeProvider.java
@@ -15,13 +15,11 @@ package org.eclipse.papyrus.uml.diagram.symbols.provider;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
-import java.util.StringTokenizer;
import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
import org.eclipse.gmf.runtime.draw2d.ui.render.RenderedImage;
@@ -30,8 +28,7 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.service.shape.AbstractShapeProvider;
import org.eclipse.papyrus.infra.gmfdiag.common.service.shape.ProviderNotificationManager;
import org.eclipse.papyrus.infra.gmfdiag.common.service.shape.ShapeService;
-import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
-import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
import org.eclipse.papyrus.uml.diagram.symbols.Activator;
import org.eclipse.papyrus.uml.tools.utils.ElementUtil;
import org.eclipse.uml2.uml.Element;
@@ -59,21 +56,22 @@ public class StereotypedElementShapeProvider extends AbstractShapeProvider {
List<RenderedImage> images = new ArrayList<RenderedImage>();
// it has already been checked that
- String stereotypesToDisplay = AppliedStereotypeHelper.getStereotypesToDisplay((View) view);
- StringTokenizer tokenizer = new StringTokenizer(stereotypesToDisplay, ",");
- while (tokenizer.hasMoreTokens()) {
+ Iterator<Stereotype> appliedStereotypes = ((Element) element).getAppliedStereotypes().iterator();
+ while (appliedStereotypes.hasNext()) {
try {
- String stereotypeName = tokenizer.nextToken();
- Stereotype stereotype = ((Element) element).getAppliedStereotype(stereotypeName);
- org.eclipse.uml2.uml.Image icon = ElementUtil.getStereotypeImage(((Element) element), stereotype, SHAPE_CONSTANT);
- if (icon != null) {
- if (!"".equals(icon.getLocation()) && icon.getLocation() != null) {
- SVGDocument document = getSVGDocument(icon.getLocation());
- if (document != null) {
- images.add(renderSVGDocument(view, document));
- } else {
- URL url = new URL(icon.getLocation());
- images.add(RenderedImageFactory.getInstance(url));
+ Stereotype appliedStereotype = appliedStereotypes.next();
+ View stereotypeLabel = StereotypeDisplayUtil.getInstance().getStereotypeLabel(((View) view), appliedStereotype);
+ if (stereotypeLabel != null && stereotypeLabel.isVisible()) {
+ org.eclipse.uml2.uml.Image icon = ElementUtil.getStereotypeImage(((Element) element), appliedStereotype, SHAPE_CONSTANT);
+ if (icon != null) {
+ if (!"".equals(icon.getLocation()) && icon.getLocation() != null) {
+ SVGDocument document = getSVGDocument(icon.getLocation());
+ if (document != null) {
+ images.add(renderSVGDocument(view, document));
+ } else {
+ URL url = new URL(icon.getLocation());
+ images.add(RenderedImageFactory.getInstance(url));
+ }
}
}
}
@@ -101,18 +99,23 @@ public class StereotypedElementShapeProvider extends AbstractShapeProvider {
if (element instanceof Element) {
// This is an element. does it have stereotypes ? If yes, do the stereotypes have shapes associated ?
- String stereotypesToDisplay = AppliedStereotypeHelper.getStereotypesToDisplay((View) view);
- StringTokenizer tokenizer = new StringTokenizer(stereotypesToDisplay, ",");
- if (tokenizer.hasMoreTokens()) {
- String firstStereotypeName = tokenizer.nextToken();
- Stereotype stereotype = ((Element) element).getAppliedStereotype(firstStereotypeName);
- org.eclipse.uml2.uml.Image icon = ElementUtil.getStereotypeImage(((Element) element), stereotype, SHAPE_CONSTANT);
- if (icon != null) {
- if (icon.getLocation() != "" && icon.getLocation() != null) {
- return true;
+ Iterator<Stereotype> appliedStereotypes = ((Element) element).getAppliedStereotypes().iterator();
+ while (appliedStereotypes.hasNext()) {
+
+ Stereotype appliedStereotype = appliedStereotypes.next();
+ View stereotypeLabel = StereotypeDisplayUtil.getInstance().getStereotypeLabel(((View) view), appliedStereotype);
+ if (stereotypeLabel != null && stereotypeLabel.isVisible()) {
+ org.eclipse.uml2.uml.Image icon = ElementUtil.getStereotypeImage(((Element) element), appliedStereotype, SHAPE_CONSTANT);
+
+ if (icon != null) {
+ if (icon.getLocation() != "" && icon.getLocation() != null) {
+ return true;
+ }
}
}
}
+
+
}
return false;
@@ -131,17 +134,19 @@ public class StereotypedElementShapeProvider extends AbstractShapeProvider {
if (element instanceof Element) {
List<SVGDocument> images = new ArrayList<SVGDocument>();
// it has already been checked that
- String stereotypesToDisplay = AppliedStereotypeHelper.getStereotypesToDisplay((View) view);
- StringTokenizer tokenizer = new StringTokenizer(stereotypesToDisplay, ",");
- while (tokenizer.hasMoreTokens()) {
- String stereotypeName = tokenizer.nextToken();
- Stereotype stereotype = ((Element) element).getAppliedStereotype(stereotypeName);
- org.eclipse.uml2.uml.Image icon = ElementUtil.getStereotypeImage(((Element) element), stereotype, SHAPE_CONSTANT);
- if (icon != null) {
- if (icon.getLocation() != "" && icon.getLocation() != null) {
- SVGDocument document = getSVGDocument(icon.getLocation());
- if (document != null) {
- images.add(document);
+ Iterator<Stereotype> appliedStereotypes = ((Element) element).getAppliedStereotypes().iterator();
+ while (appliedStereotypes.hasNext()) {
+
+ Stereotype appliedStereotype = appliedStereotypes.next();
+ View stereotypeLabel = StereotypeDisplayUtil.getInstance().getStereotypeLabel(((View) view), appliedStereotype);
+ if (stereotypeLabel != null && stereotypeLabel.isVisible()) {
+ org.eclipse.uml2.uml.Image icon = ElementUtil.getStereotypeImage(((Element) element), appliedStereotype, SHAPE_CONSTANT);
+ if (icon != null) {
+ if (icon.getLocation() != "" && icon.getLocation() != null) {
+ SVGDocument document = getSVGDocument(icon.getLocation());
+ if (document != null) {
+ images.add(document);
+ }
}
}
}
@@ -209,23 +214,18 @@ public class StereotypedElementShapeProvider extends AbstractShapeProvider {
}
/**
- * {@inheritDoc}
+ * @see org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ *
+ * @param notification
*/
@Override
public void notifyChanged(Notification notification) {
- if (listener == null) {
- return;
- }
- if (EcorePackage.eINSTANCE.getEModelElement_EAnnotations().equals(notification.getFeature())) {
- Object newValue = notification.getNewValue();
- if (newValue instanceof EAnnotation && UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION.equals(((EAnnotation) newValue).getSource())) {
- // the stereotype annotation was modified => refresh
- listener.notifyChanged(notification);
- }
- }
+ // TODO
+
}
+
}
}

Back to the top