summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTorsten Sommer2013-07-16 12:45:04 -0400
committerTorsten Sommer2013-07-16 12:45:04 -0400
commitc5e534db385afa95436ffca39789697390b674af (patch)
tree6f397eb4823f5dcb5db36bb004cdf0c2d5329478
parentac71604cff5b8bfb0124d5c63d9757c20ad0f3b2 (diff)
downloadorg.eclipse.efxclipse-c5e534db385afa95436ffca39789697390b674af.tar.gz
org.eclipse.efxclipse-c5e534db385afa95436ffca39789697390b674af.tar.xz
org.eclipse.efxclipse-c5e534db385afa95436ffca39789697390b674af.zip
Reference opening fixed.ecp
-rw-r--r--bundles/runtime/org.eclipse.fx.ecp.ui/src/org/eclipse/fx/ecp/ui/controls/multi/EmbeddedReferenceControl.java13
-rw-r--r--bundles/runtime/org.eclipse.fx.ecp.ui/src/org/eclipse/fx/ecp/ui/controls/multi/MultiControl.java12
2 files changed, 15 insertions, 10 deletions
diff --git a/bundles/runtime/org.eclipse.fx.ecp.ui/src/org/eclipse/fx/ecp/ui/controls/multi/EmbeddedReferenceControl.java b/bundles/runtime/org.eclipse.fx.ecp.ui/src/org/eclipse/fx/ecp/ui/controls/multi/EmbeddedReferenceControl.java
index f0f2305cb..d307fc9f6 100644
--- a/bundles/runtime/org.eclipse.fx.ecp.ui/src/org/eclipse/fx/ecp/ui/controls/multi/EmbeddedReferenceControl.java
+++ b/bundles/runtime/org.eclipse.fx.ecp.ui/src/org/eclipse/fx/ecp/ui/controls/multi/EmbeddedReferenceControl.java
@@ -12,6 +12,7 @@ import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.fx.ecp.ui.ECPModelElementOpener;
import org.eclipse.fx.ecp.ui.ECPUtil;
public class EmbeddedReferenceControl extends AbstractEmbeddedControl {
@@ -19,10 +20,13 @@ public class EmbeddedReferenceControl extends AbstractEmbeddedControl {
protected Hyperlink hyperlink;
protected AdapterImpl valueAdapter;
protected EObject value;
-
- public EmbeddedReferenceControl(IItemPropertyDescriptor propertyDescriptor, final EObject modelElement, final EditingDomain editingDomain, int initialIndex) {
+ protected ECPModelElementOpener modelElementOpener;
+
+ public EmbeddedReferenceControl(IItemPropertyDescriptor propertyDescriptor, final EObject modelElement, final EditingDomain editingDomain, int initialIndex, ECPModelElementOpener modelElementOpener) {
super(propertyDescriptor, modelElement, editingDomain, initialIndex);
+ this.modelElementOpener = modelElementOpener;
+
valueAdapter = new AdapterImpl() {
@Override
@@ -85,9 +89,8 @@ public class EmbeddedReferenceControl extends AbstractEmbeddedControl {
public void handle(ActionEvent arg0) {
if (eList.size() > index) {
Object item = eList.get(index);
- // TODO: change this to model element opener
- //if (item instanceof EObject)
- //context.openInNewContext((EObject) item);
+ if (item instanceof EObject)
+ modelElementOpener.openModelElement((EObject) item);
}
}
diff --git a/bundles/runtime/org.eclipse.fx.ecp.ui/src/org/eclipse/fx/ecp/ui/controls/multi/MultiControl.java b/bundles/runtime/org.eclipse.fx.ecp.ui/src/org/eclipse/fx/ecp/ui/controls/multi/MultiControl.java
index a605a43db..04b6cd51c 100644
--- a/bundles/runtime/org.eclipse.fx.ecp.ui/src/org/eclipse/fx/ecp/ui/controls/multi/MultiControl.java
+++ b/bundles/runtime/org.eclipse.fx.ecp.ui/src/org/eclipse/fx/ecp/ui/controls/multi/MultiControl.java
@@ -39,7 +39,8 @@ public class MultiControl extends ECPControlBase {
protected EList<Object> values;
protected VBox controlsBox;
protected ECPControlBase addControl;
- private Command addReferenceCommand;
+ protected Command addReferenceCommand;
+ protected ECPModelElementOpener modelElementOpener;
class Skin extends SkinBase<MultiControl> {
@@ -49,9 +50,10 @@ public class MultiControl extends ECPControlBase {
}
- public MultiControl(final IItemPropertyDescriptor propertyDescriptor, final EObject modelElement, final EditingDomain editingDomain) {
+ public MultiControl(final IItemPropertyDescriptor propertyDescriptor, final EObject modelElement, final EditingDomain editingDomain, ECPModelElementOpener modelElementOpener) {
super(propertyDescriptor, modelElement, editingDomain);
-
+ this.modelElementOpener = modelElementOpener;
+
setSkin(new Skin(this));
values = (EList<Object>) modelElement.eGet(feature);
@@ -179,7 +181,7 @@ public class MultiControl extends ECPControlBase {
final EObject modelElement, final EditingDomain editingDomain, int i) {
if (feature instanceof EReference) {
- return new EmbeddedReferenceControl(propertyDescriptor, modelElement, editingDomain, i);
+ return new EmbeddedReferenceControl(propertyDescriptor, modelElement, editingDomain, i, modelElementOpener);
} else if (feature.getEType() instanceof EEnum) {
return new EmbeddedEnumControl(propertyDescriptor, modelElement, editingDomain, i);
} else {
@@ -207,7 +209,7 @@ public class MultiControl extends ECPControlBase {
@Override
public ECPControlBase createControl(IItemPropertyDescriptor itemPropertyDescriptor, EObject modelElement, EditingDomain editingDomain, ECPModelElementOpener modelElementOpener) {
- return new MultiControl(itemPropertyDescriptor, modelElement, editingDomain);
+ return new MultiControl(itemPropertyDescriptor, modelElement, editingDomain, modelElementOpener);
}
}