Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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