Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrschnekenbu2010-07-25 17:33:11 -0400
committerrschnekenbu2010-07-25 17:33:11 -0400
commit1ddb1fc87a21deb82d6d92a58c08accac4c4c5fb (patch)
tree05263ee395325881796bb89a9593c3c2a10050d8
parent1dc064214e632cdbd309b5df654451706340b265 (diff)
downloadorg.eclipse.papyrus-1ddb1fc87a21deb82d6d92a58c08accac4c4c5fb.tar.gz
org.eclipse.papyrus-1ddb1fc87a21deb82d6d92a58c08accac4c4c5fb.tar.xz
org.eclipse.papyrus-1ddb1fc87a21deb82d6d92a58c08accac4c4c5fb.zip
Applied Stereotype of A. Radermacher from Bug 320829 - [Property tab] Stereotype attributes cannot be modified.
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=320829#c2
-rw-r--r--plugins/others/org.eclipse.papyrus.profile/src/org/eclipse/papyrus/profile/tree/objects/AppliedStereotypePropertyTreeObject.java9
-rw-r--r--plugins/others/org.eclipse.papyrus.profile/src/org/eclipse/papyrus/profile/tree/objects/ParentTreeObject.java2
-rw-r--r--plugins/others/org.eclipse.papyrus.profile/src/org/eclipse/papyrus/profile/ui/compositesformodel/PropertyComposite.java20
3 files changed, 21 insertions, 10 deletions
diff --git a/plugins/others/org.eclipse.papyrus.profile/src/org/eclipse/papyrus/profile/tree/objects/AppliedStereotypePropertyTreeObject.java b/plugins/others/org.eclipse.papyrus.profile/src/org/eclipse/papyrus/profile/tree/objects/AppliedStereotypePropertyTreeObject.java
index d4db8187b2f..94165043921 100644
--- a/plugins/others/org.eclipse.papyrus.profile/src/org/eclipse/papyrus/profile/tree/objects/AppliedStereotypePropertyTreeObject.java
+++ b/plugins/others/org.eclipse.papyrus.profile/src/org/eclipse/papyrus/profile/tree/objects/AppliedStereotypePropertyTreeObject.java
@@ -67,6 +67,15 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
}
/**
+ * Reinitialize the children from model, useful to reflect model changes in
+ * the value tree.
+ */
+ public void reInitChilds () {
+ children.clear ();
+ createChildren ();
+ }
+
+ /**
* Creates the children.
*/
@Override
diff --git a/plugins/others/org.eclipse.papyrus.profile/src/org/eclipse/papyrus/profile/tree/objects/ParentTreeObject.java b/plugins/others/org.eclipse.papyrus.profile/src/org/eclipse/papyrus/profile/tree/objects/ParentTreeObject.java
index 2345df27880..59a24d1256a 100644
--- a/plugins/others/org.eclipse.papyrus.profile/src/org/eclipse/papyrus/profile/tree/objects/ParentTreeObject.java
+++ b/plugins/others/org.eclipse.papyrus.profile/src/org/eclipse/papyrus/profile/tree/objects/ParentTreeObject.java
@@ -28,7 +28,7 @@ public abstract class ParentTreeObject extends TreeObject {
/**
* The children.
*/
- private ArrayList children;
+ protected ArrayList children;
/**
* The Constructor.
diff --git a/plugins/others/org.eclipse.papyrus.profile/src/org/eclipse/papyrus/profile/ui/compositesformodel/PropertyComposite.java b/plugins/others/org.eclipse.papyrus.profile/src/org/eclipse/papyrus/profile/ui/compositesformodel/PropertyComposite.java
index 90aaa5c046e..ab7aa91d87b 100644
--- a/plugins/others/org.eclipse.papyrus.profile/src/org/eclipse/papyrus/profile/ui/compositesformodel/PropertyComposite.java
+++ b/plugins/others/org.eclipse.papyrus.profile/src/org/eclipse/papyrus/profile/ui/compositesformodel/PropertyComposite.java
@@ -26,6 +26,7 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.core.utils.EditorUtils;
import org.eclipse.papyrus.profile.Message;
import org.eclipse.papyrus.profile.tree.ProfileElementContentProvider;
import org.eclipse.papyrus.profile.tree.ProfileElementLabelProvider;
@@ -50,7 +51,8 @@ import org.eclipse.uml2.uml.Type;
public class PropertyComposite extends DecoratedTreeComposite {
public TransactionalEditingDomain getDomain() {
- return domain;
+ // return domain;
+ return EditorUtils.getTransactionalEditingDomain();
}
public void setDomain(TransactionalEditingDomain domain) {
@@ -211,22 +213,19 @@ public class PropertyComposite extends DecoratedTreeComposite {
// Update property value(s)
if(property.isMultivalued()) {
// If newValue was entered, add to tempValues (future values list)
- if (!currentPropertyValues.contains(newValue)) {
- currentPropertyValues.add(newValue);
- // Update tree && Refresh
- pTO.addChild(ValueTreeObject.createInstance(pTO, newValue, getDomain()));
- }
+ currentPropertyValues.add (newValue);
setPropertiesValue(selectedElt, selectedSt, property, currentPropertyValues);
}
else {
// otherwise ([0..1] case)
setPropertiesValue(selectedElt, selectedSt, property, newValue);
- pTO.addChild(ValueTreeObject.createInstance(pTO, newValue, getDomain()));
}
}
else {
Message.warning("Upper multiplicity of " + property.getName() + " is " + property.getUpper());
}
+ // Update tree && refresh
+ pTO.reInitChilds ();
}
/**
@@ -288,7 +287,7 @@ public class PropertyComposite extends DecoratedTreeComposite {
} else {
Message.warning("Lower multiplicity of " + property.getName() + " is " + lower);
}
- pTO.removeChild(vTO);
+ pTO.reInitChilds ();
}
}
@@ -355,6 +354,9 @@ public class PropertyComposite extends DecoratedTreeComposite {
*/
public void setInput(AppliedStereotypePropertyTreeObject element) {
treeViewer.setInput(element);
+ if (element != null) {
+ element.reInitChilds ();
+ }
refresh();
}
@@ -393,4 +395,4 @@ public class PropertyComposite extends DecoratedTreeComposite {
}
}
-}
+} \ No newline at end of file

Back to the top