Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java
index 2914f240d7b..39d51b4fb27 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpolicies/AppliedStereotypeCommentCreationEditPolicy.java
@@ -57,6 +57,9 @@ public class AppliedStereotypeCommentCreationEditPolicy extends AppliedStereotyp
public final static String APPLIED_STEREOTYPE_COMMENT = "Applied_Stereotype_Comment";
+ /**
+ * This method has in charge to refresh the presence of the view that represent the comment
+ */
protected void updateAppliedStereotypeCommentShape() {
String stereotypeLocalizationToDisplay = AppliedStereotypeHelper.getAppliedStereotypesPropertiesLocalization((View)getHost().getModel());
String stereotypePropertiesToDisplay = AppliedStereotypeHelper.getAppliedStereotypesPropertiesToDisplay((View)getHost().getModel());
@@ -79,13 +82,20 @@ public class AppliedStereotypeCommentCreationEditPolicy extends AppliedStereotyp
if(!stereotypeLocalizationToDisplay.equals(UMLVisualInformationPapyrusConstant.STEREOTYPE_COMMENT_LOCATION) || getvisisbleAppliedStereotypeCompartment(commentNode, getUMLElement()) == 0) {
final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(commentNode);
executeAppliedStereotypeCommentDeletion(domain, commentNode);
-
}
}
+
}
+ /**
+ * return the number of visible compartment that represent a stereotype
+ * @param view the container view
+ * @param eobject the eobject that represent the container
+ * @return the number of visible stereotype compartment
+ */
protected int getvisisbleAppliedStereotypeCompartment(View view, EObject eobject) {
int nbVisibleCompartment = 0;
+ @SuppressWarnings("unchecked")
Iterator<View> iteratorView = view.getChildren().iterator();
while(iteratorView.hasNext()) {
View subview = (View)iteratorView.next();
@@ -95,7 +105,9 @@ public class AppliedStereotypeCommentCreationEditPolicy extends AppliedStereotyp
}
return nbVisibleCompartment;
}
-
+/**
+ * this method is use to copy all eAnnotation from the view to the comment in order to display properties of stereotype
+ */
protected void delegateEAnnotationInCommentShape() {
final Node appliedStereotypeComment = getAppliedStereotypeCommentNode();
@@ -119,7 +131,7 @@ public class AppliedStereotypeCommentCreationEditPolicy extends AppliedStereotyp
}
};
- Display.getCurrent().asyncExec(new Runnable() {
+ Display.getCurrent().syncExec(new Runnable() {
public void run() {
//use to avoid to put it in the command stack
@@ -169,7 +181,7 @@ public class AppliedStereotypeCommentCreationEditPolicy extends AppliedStereotyp
* the stereotype application
*/
protected void executeAppliedStereotypeCommentCreation(final EditPart editPart, final TransactionalEditingDomain domain, final EObject semanticElement) {
- Display.getCurrent().asyncExec(new Runnable() {
+ Display.getCurrent().syncExec(new Runnable() {
public void run() {
int x = 200;
@@ -208,9 +220,14 @@ public class AppliedStereotypeCommentCreationEditPolicy extends AppliedStereotyp
});
}
+ /**
+ * method in oder to delete the comment
+ * @param domain the transactional editing domain
+ * @param commentNode the view that represent the comment of stereotype
+ */
protected void executeAppliedStereotypeCommentDeletion(final TransactionalEditingDomain domain, final View commentNode) {
- Display.getCurrent().asyncExec(new Runnable() {
+ Display.getCurrent().syncExec(new Runnable() {
public void run() {
//because it is asynchrone the comment node maybe become s null

Back to the top