Skip to content
Snippets Groups Projects
Commit 0249b63c authored by Simon Barner's avatar Simon Barner
Browse files

Auto layouter: clean up getDiagramEditPartViewer()

* Remove messy (and unneeded) loop to wait until the editor has
  opened
* Style cleanup

Issue-Ref: 3433
Issue-Url: https://af3-developer.fortiss.org/issues/3433


Signed-off-by: default avatarSimon Barner <barner@fortiss.org>
parent a72e4959
No related branches found
No related tags found
1 merge request!63433 auto layouter label size
......@@ -2,4 +2,4 @@ AutoLayoutMenu.java bca7986c209678ed937548a37db494430877d80e YELLOW
DiagramTapeMeasure.java 72454e6fe5225dab11d3d691baad93aab7a171c0 YELLOW
IAutoLayouter.java de1b11d9e202c7e23352ad85684dbf8a3fd17c7d GREEN
IAutoLayouterTapeMeasure.java df186e0ba505e0ecda211b1df76cf12f3245b47e YELLOW
KielerAutoLayouter.java 25f82e5f671b358cc6baa1327a522f9cbd762e98 YELLOW
KielerAutoLayouter.java a0f2d0cd94ffd043e6d4ddbe1589a1894412f81c YELLOW
......@@ -26,7 +26,6 @@ import static de.cau.cs.kieler.kiml.util.KimlUtil.createInitializedPort;
import static de.cau.cs.kieler.klay.layered.properties.InteractiveReferencePoint.TOP_LEFT;
import static de.cau.cs.kieler.klay.layered.properties.Properties.FEEDBACK_EDGES;
import static de.cau.cs.kieler.klay.layered.properties.Properties.INTERACTIVE_REFERENCE_POINT;
import static java.lang.Thread.sleep;
import static org.fortiss.tooling.base.layout.DefaultLayoutConstants.DEFAULT_CONNECTOR_SIZE;
import static org.fortiss.tooling.base.layout.DefaultLayoutConstants.DEFAULT_GRID_SIZE;
import static org.fortiss.tooling.base.ui.annotation.view.AnnotationViewPartBase.isUpdateEnabled;
......@@ -35,7 +34,6 @@ import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.addBendPointTo
import static org.fortiss.tooling.base.utils.LayoutDataUtils.setNodeLayoutData;
import static org.fortiss.tooling.base.utils.LayoutDataUtils.setNodePosition;
import static org.fortiss.tooling.base.utils.LayoutDataUtils.setStickyConnectorLayoutData;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
import java.util.Map.Entry;
......@@ -56,7 +54,6 @@ import org.fortiss.tooling.base.model.layout.ILayoutData;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.model.layout.Points;
import org.fortiss.tooling.base.model.layout.impl.PointsImpl;
import org.fortiss.tooling.base.ui.ToolingBaseUIActivator;
import org.fortiss.tooling.base.ui.editor.DiagramEditorBase;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.service.IPersistencyService;
......@@ -287,19 +284,10 @@ public class KielerAutoLayouter implements IAutoLayouter {
private EditPartViewer getDiagramEditPartViewer(IHierarchicElement element) {
IModelEditorBindingService es = IModelEditorBindingService.getInstance();
es.openInEditor(element);
while(!es.isOpen(element)) {
try {
sleep(100);
} catch(Exception e) {
error(ToolingBaseUIActivator.getDefault(), "Error opening editor.", e);
break;
}
}
IModelEditor<EObject> editor = es.getActiveEditor();
return editor instanceof DiagramEditorBase ? ((DiagramEditorBase<?>)editor).getViewer()
: null;
boolean isDiagramEditor = editor instanceof DiagramEditorBase;
return isDiagramEditor ? ((DiagramEditorBase<?>)editor).getViewer() : null;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment