Skip to content
Snippets Groups Projects
Commit baec5bd7 authored by Lukas Ladenberger's avatar Lukas Ladenberger
Browse files

fixed PROBPLUGIN-47

parent ff085e5e
Branches
Tags
No related merge requests found
...@@ -16,27 +16,16 @@ import de.bmotionstudio.gef.editor.model.BControl; ...@@ -16,27 +16,16 @@ import de.bmotionstudio.gef.editor.model.BControl;
public class BMotionSelectionSynchronizer extends SelectionSynchronizer { public class BMotionSelectionSynchronizer extends SelectionSynchronizer {
private BMotionStudioEditor editor;
public BMotionSelectionSynchronizer(BMotionStudioEditor editor) {
this.editor = editor;
}
protected EditPart convert(EditPartViewer viewer, EditPart part) { protected EditPart convert(EditPartViewer viewer, EditPart part) {
EditPart p = super.convert(viewer, part); EditPart p = super.convert(viewer, part);
if (viewer instanceof ScrollingGraphicalViewer if (viewer instanceof ScrollingGraphicalViewer
|| viewer instanceof TreeViewer) { || viewer instanceof TreeViewer) {
Object model = part.getModel(); Object model = part.getModel();
if (model instanceof BControl) { if (model instanceof BControl) {
BControl control = (BControl) model; Object temp = viewer.getEditPartRegistry().get(model);
String id = control.getID();
BControl editControl = editor.getEditPage().getVisualization()
.getBControl(id);
Object temp = viewer.getEditPartRegistry().get(editControl);
EditPart newPart = null; EditPart newPart = null;
if (temp != null) { if (temp != null)
newPart = (EditPart) temp; newPart = (EditPart) temp;
}
return newPart; return newPart;
} }
} }
......
...@@ -645,8 +645,7 @@ public class BMotionStudioEditorPage extends GraphicalEditorWithFlyoutPalette { ...@@ -645,8 +645,7 @@ public class BMotionStudioEditorPage extends GraphicalEditorWithFlyoutPalette {
@Override @Override
public SelectionSynchronizer getSelectionSynchronizer() { public SelectionSynchronizer getSelectionSynchronizer() {
if (bmotionSelectionSynchronizer == null) if (bmotionSelectionSynchronizer == null)
bmotionSelectionSynchronizer = new BMotionSelectionSynchronizer( bmotionSelectionSynchronizer = new BMotionSelectionSynchronizer();
bmotionStudioEditor);
return bmotionSelectionSynchronizer; return bmotionSelectionSynchronizer;
} }
......
...@@ -231,13 +231,21 @@ public class Visualization extends BControl { ...@@ -231,13 +231,21 @@ public class Visualization extends BControl {
} }
private BControl getBControl(String ID, List<BControl> children) { private BControl getBControl(String ID, List<BControl> children) {
for (BControl bcontrol : children) { for (BControl control : children) {
if (bcontrol.getID().equals(ID)) { if (control.getID().equals(ID)) {
return bcontrol; return control;
}
for (BConnection c : control.getSourceConnections()) {
if (c.getIcon().equals(ID))
return c;
}
for (BConnection c : control.getTargetConnections()) {
if (c.getIcon().equals(ID))
return c;
} }
if (bcontrol.getChildrenArray().size() > 0) { if (control.getChildrenArray().size() > 0) {
BControl childControl = getBControl(ID, BControl childControl = getBControl(ID,
bcontrol.getChildrenArray()); control.getChildrenArray());
if (childControl != null) if (childControl != null)
return childControl; return childControl;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment