diff --git a/plugins/org.eclipse.fordiac.ide.elk/plugin.xml b/plugins/org.eclipse.fordiac.ide.elk/plugin.xml index 7853c5dc32..c4c0384e76 100644 --- a/plugins/org.eclipse.fordiac.ide.elk/plugin.xml +++ b/plugins/org.eclipse.fordiac.ide.elk/plugin.xml @@ -1,264 +1,140 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + diff --git a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/FordiacLayoutConnector.java b/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/FordiacLayoutConnector.java index bbc5fb22cb..8cc4ef0595 100644 --- a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/FordiacLayoutConnector.java +++ b/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/FordiacLayoutConnector.java @@ -18,10 +18,6 @@ import java.util.List; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.NotEnabledException; -import org.eclipse.core.commands.NotHandledException; -import org.eclipse.core.commands.common.NotDefinedException; import org.eclipse.core.runtime.IStatus; import org.eclipse.elk.core.service.DiagramLayoutEngine; import org.eclipse.elk.core.service.IDiagramLayoutConnector; @@ -33,13 +29,12 @@ import org.eclipse.fordiac.ide.application.editparts.SubAppForFBNetworkEditPart; import org.eclipse.fordiac.ide.application.editparts.UnfoldedSubappContentEditPart; import org.eclipse.fordiac.ide.elk.commands.LayoutCommand; +import org.eclipse.fordiac.ide.elk.handlers.ConnectionLayoutHandler; import org.eclipse.fordiac.ide.elk.helpers.FordiacGraphBuilder; import org.eclipse.fordiac.ide.elk.helpers.FordiacGraphDataHelper; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.handlers.IHandlerService; import com.google.inject.Injector; @@ -64,29 +59,14 @@ public void applyLayout(final LayoutMapping mapping, final IPropertyHolder setti // schedule as async to ensure the changes from the layout command have been // processed - Display.getDefault().asyncExec(() -> { - final var handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class); - final var networkEditPart = fordiacMapping.getNetworkEditPart(); - - try { - if (networkEditPart instanceof UnfoldedSubappContentEditPart) { - final var event = new Event(); - event.data = networkEditPart.getParent(); // pass to the handler - handlerService.executeCommand("org.eclipse.fordiac.ide.elk.expandedSubappConnectionLayout", event); //$NON-NLS-1$ - } else { - handlerService.executeCommand("org.eclipse.fordiac.ide.elk.connectionLayout", null); //$NON-NLS-1$ - } - } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) { - e.printStackTrace(); - } - }); + Display.getDefault().asyncExec(() -> ConnectionLayoutHandler + .getLayoutCommandNonHierarchical(fordiacMapping.getWorkbenchPart()).execute()); } public static void executeManually(final List editParts) { final var workbenchPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart(); final Injector injector = LayoutConnectorsService.getInstance().getInjector(workbenchPart, null); final DiagramLayoutEngine engine = injector.getInstance(DiagramLayoutEngine.class); - final var handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class); for (final var ep : editParts) { final FordiacLayoutMapping mapping = new FordiacLayoutMapping(workbenchPart, true, @@ -101,16 +81,8 @@ public static void executeManually(final List editPa mapping.getCommandStack().execute(new LayoutCommand(mapping.getLayoutData())); } - Display.getDefault().asyncExec(() -> { - final var event = new Event(); - event.data = ep; // pass to the handler - try { - handlerService.executeCommand("org.eclipse.fordiac.ide.elk.expandedSubappConnectionLayout", event); //$NON-NLS-1$ - } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) { - e.printStackTrace(); - } - }); - + Display.getDefault().asyncExec(() -> ConnectionLayoutHandler + .getLayoutCommand((UnfoldedSubappContentEditPart) ep.getContentEP()).execute()); } } diff --git a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/AbstractConnectionLayoutHandler.java b/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/AbstractConnectionLayoutHandler.java index 87e407ee2c..5c82f220cd 100644 --- a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/AbstractConnectionLayoutHandler.java +++ b/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/AbstractConnectionLayoutHandler.java @@ -18,19 +18,17 @@ import org.eclipse.elk.core.util.BasicProgressMonitor; import org.eclipse.fordiac.ide.application.editparts.UnfoldedSubappContentEditPart; import org.eclipse.fordiac.ide.elk.FordiacLayoutData; -import org.eclipse.fordiac.ide.elk.commands.ConnectionLayoutCommand; import org.eclipse.fordiac.ide.elk.connection.ConnectionLayoutMapping; import org.eclipse.fordiac.ide.elk.connection.ConnectionRoutingHelper; import org.eclipse.fordiac.ide.ui.FordiacLogHelper; +import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.CommandStack; import org.eclipse.swt.widgets.Event; import org.eclipse.ui.IWorkbenchPart; public abstract class AbstractConnectionLayoutHandler extends AbstractLayoutHandler { - protected static void executeCommand(final ExecutionEvent event, final IWorkbenchPart part, - final FordiacLayoutData data) { - final ConnectionLayoutCommand cmd = new ConnectionLayoutCommand(data); + protected static void executeCommand(final ExecutionEvent event, final IWorkbenchPart part, final Command cmd) { if (isAutomaticLayout(event)) { // passes the cmd back to the editor to be handled there ((Event) event.getTrigger()).data = cmd; diff --git a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/AbstractLayoutHandler.java b/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/AbstractLayoutHandler.java index bd24a86fa9..f0826c6d7c 100644 --- a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/AbstractLayoutHandler.java +++ b/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/AbstractLayoutHandler.java @@ -13,7 +13,9 @@ package org.eclipse.fordiac.ide.elk.handlers; import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.fordiac.ide.application.editparts.UnfoldedSubappContentEditPart; import org.eclipse.gef.GraphicalViewer; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.ui.ISources; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.handlers.HandlerUtil; @@ -32,4 +34,8 @@ public void setEnabled(final Object evaluationContext) { } } + protected static boolean isSubappLayout(final StructuredSelection selection) { + return selection != null && selection.getFirstElement() instanceof UnfoldedSubappContentEditPart; + } + } \ No newline at end of file diff --git a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/ConnectionLayoutHandler.java b/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/ConnectionLayoutHandler.java index 52a4132abd..8cc987be5e 100644 --- a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/ConnectionLayoutHandler.java +++ b/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/ConnectionLayoutHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2022, 2023 Primetals Technologies Austria GmbH + * Copyright (c) 2022 - 2024 Primetals Technologies Austria GmbH * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -19,40 +19,65 @@ import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.Status; import org.eclipse.elk.alg.libavoid.server.LibavoidServerException; -import org.eclipse.fordiac.ide.elk.FordiacLayoutData; +import org.eclipse.fordiac.ide.application.editparts.UnfoldedSubappContentEditPart; import org.eclipse.fordiac.ide.elk.Messages; import org.eclipse.fordiac.ide.elk.commands.ConnectionLayoutCommand; -import org.eclipse.fordiac.ide.elk.connection.ConnectionLayoutMapping; import org.eclipse.fordiac.ide.elk.connection.ConnectionRoutingHelper; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.ui.IEditorPart; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.handlers.HandlerUtil; public class ConnectionLayoutHandler extends AbstractConnectionLayoutHandler { @Override public Object execute(final ExecutionEvent event) throws ExecutionException { - final IWorkbenchPart part = HandlerUtil.getActiveEditor(event); - if (null != part) { - try { - final ConnectionLayoutMapping mapping = run(part); - final FordiacLayoutData data = ConnectionRoutingHelper.calculateConnections(mapping); - runSubapps(mapping, data); - executeCommand(event, part, data); - } catch (final LibavoidServerException e) { - MessageDialog.openWarning(HandlerUtil.getActiveShell(event), Messages.ConnectionLayout_TimeoutTitle, - MessageFormat.format(Messages.ConnectionLayout_TimeoutMessage, e.getMessage())); - } + final var selection = (StructuredSelection) HandlerUtil.getCurrentSelection(event); + final var part = HandlerUtil.getActiveEditor(event); + + if (isSubappLayout(selection)) { + final var content = (UnfoldedSubappContentEditPart) selection.getFirstElement(); + executeCommand(event, part, getLayoutCommand(content)); + } else if (null != part) { + executeCommand(event, part, getLayoutCommandNonHierarchical(part)); } + return Status.OK_STATUS; } - public static void executeManually(final IEditorPart part) { - final ConnectionLayoutMapping mapping = run(part); - final FordiacLayoutData data = ConnectionRoutingHelper.calculateConnections(mapping); - runSubapps(mapping, data); - new ConnectionLayoutCommand(data).execute(); + public static Command getLayoutCommand(final IWorkbenchPart part) { + return getLayoutCommand(part, true); + } + + public static Command getLayoutCommand(final UnfoldedSubappContentEditPart content) { + return getLayoutCommand(content, true); + } + + public static Command getLayoutCommandNonHierarchical(final IWorkbenchPart part) { + return getLayoutCommand(part, false); + } + + public static Command getLayoutCommandNonHierarchical(final UnfoldedSubappContentEditPart content) { + return getLayoutCommand(content, false); + } + + private static Command getLayoutCommand(final Object obj, final boolean isHierarchical) { + try { + final var mapping = run(obj); + final var data = ConnectionRoutingHelper.calculateConnections(mapping); + if (isHierarchical) { + runSubapps(mapping, data); + } + return new ConnectionLayoutCommand(data); + } catch (final LibavoidServerException e) { + MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), + Messages.ConnectionLayout_TimeoutTitle, + MessageFormat.format(Messages.ConnectionLayout_TimeoutMessage, e.getMessage())); + } + return UnexecutableCommand.INSTANCE; } } diff --git a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/NestedExpandedSubappHandler.java b/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/ConnectionLayoutHandlerMule.java similarity index 50% rename from plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/NestedExpandedSubappHandler.java rename to plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/ConnectionLayoutHandlerMule.java index 48accdb5c5..0b1747ae6c 100644 --- a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/NestedExpandedSubappHandler.java +++ b/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/ConnectionLayoutHandlerMule.java @@ -8,34 +8,26 @@ * SPDX-License-Identifier: EPL-2.0 * * Contributors: - * Daniel Lindhuber - * - initial API and implementation and/or initial documentation + * Daniel Lindhuber - initial implementation and/or documentation *******************************************************************************/ package org.eclipse.fordiac.ide.elk.handlers; -import java.util.stream.Collectors; - +import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.Status; -import org.eclipse.fordiac.ide.application.editparts.SubAppForFBNetworkEditPart; -import org.eclipse.fordiac.ide.elk.FordiacLayoutConnector; -import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.swt.widgets.Event; import org.eclipse.ui.handlers.HandlerUtil; -public class NestedExpandedSubappHandler extends AbstractLayoutHandler { +public class ConnectionLayoutHandlerMule extends AbstractHandler { @Override public Object execute(final ExecutionEvent event) throws ExecutionException { - final var selection = (StructuredSelection) HandlerUtil.getCurrentSelection(event); - // @formatter:off - final var subapps = selection.stream() - .filter(SubAppForFBNetworkEditPart.class::isInstance) - .map(SubAppForFBNetworkEditPart.class::cast) - .filter(subapp -> subapp.getModel().isUnfolded()) - .collect(Collectors.toList()); - // @formatter:on - FordiacLayoutConnector.executeManually(subapps); + final var part = HandlerUtil.getActiveEditor(event); + final var mule = (Event) event.getTrigger(); + mule.data = (part != null) ? ConnectionLayoutHandler.getLayoutCommandNonHierarchical(part) + : UnexecutableCommand.INSTANCE; return Status.OK_STATUS; } diff --git a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/ExpandedSubappConnectionLayoutHandler.java b/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/ExpandedSubappConnectionLayoutHandler.java deleted file mode 100644 index 86f66cdb3c..0000000000 --- a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/ExpandedSubappConnectionLayoutHandler.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2024 Primetals Technologies Austria GmbH - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Daniel Lindhuber - * - initial API and implementation and/or initial documentation - *******************************************************************************/ -package org.eclipse.fordiac.ide.elk.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.Status; -import org.eclipse.fordiac.ide.application.editparts.SubAppForFBNetworkEditPart; -import org.eclipse.fordiac.ide.elk.commands.ConnectionLayoutCommand; -import org.eclipse.fordiac.ide.elk.connection.ConnectionRoutingHelper; -import org.eclipse.gef.GraphicalViewer; -import org.eclipse.swt.widgets.Event; -import org.eclipse.ui.handlers.HandlerUtil; - -public class ExpandedSubappConnectionLayoutHandler extends AbstractConnectionLayoutHandler { - - @Override - public Object execute(final ExecutionEvent event) throws ExecutionException { - if (event.getTrigger() instanceof final Event ev && ev.widget == null) { - // programmatic trigger - final var subappEp = (SubAppForFBNetworkEditPart) ((Event) event.getTrigger()).data; - final var mapping = run(subappEp.getContentEP()); - final var data = ConnectionRoutingHelper.calculateConnections(mapping); - runSubapps(mapping, data); - new ConnectionLayoutCommand(data).execute(); - } else { - // menu trigger - final var part = HandlerUtil.getActiveEditor(event); - assert part != null; - final var viewer = part.getAdapter(GraphicalViewer.class); - - // property tester ensures type and size == 1 - final var subappEp = (SubAppForFBNetworkEditPart) viewer.getSelectedEditParts().get(0); - - final var mapping = run(subappEp.getContentEP()); - final var data = ConnectionRoutingHelper.calculateConnections(mapping); - runSubapps(mapping, data); - executeCommand(event, part, data); - } - - return Status.OK_STATUS; - } - - @Override - public boolean isEnabled() { - return true; - } - -} diff --git a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/LayoutHandler.java b/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/LayoutHandler.java index 65c615722d..bfa7f033bc 100644 --- a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/LayoutHandler.java +++ b/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/LayoutHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2023 Primetals Technologies Austria GmbH + * Copyright (c) 2021 - 2024 Primetals Technologies Austria GmbH * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -13,23 +13,32 @@ *******************************************************************************/ package org.eclipse.fordiac.ide.elk.handlers; +import java.util.List; + import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.Status; import org.eclipse.elk.core.service.DiagramLayoutEngine; +import org.eclipse.fordiac.ide.application.editparts.UnfoldedSubappContentEditPart; +import org.eclipse.fordiac.ide.elk.FordiacLayoutConnector; import org.eclipse.fordiac.ide.elk.helpers.FordiacLayoutFactory; -import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.ui.handlers.HandlerUtil; public class LayoutHandler extends AbstractLayoutHandler { @Override public Object execute(final ExecutionEvent event) throws ExecutionException { - final IWorkbenchPart part = HandlerUtil.getActiveEditor(event); + final var part = HandlerUtil.getActiveEditor(event); + final var selection = (StructuredSelection) HandlerUtil.getCurrentSelection(event); - if (null != part) { + if (isSubappLayout(selection)) { + final var content = (UnfoldedSubappContentEditPart) selection.getFirstElement(); + FordiacLayoutConnector.executeManually(List.of(content.getParent())); + } else if (null != part) { DiagramLayoutEngine.invokeLayout(part, null, FordiacLayoutFactory.createLayoutParams()); } + return Status.OK_STATUS; } diff --git a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/SystemLayoutHandler.java b/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/SystemLayoutHandler.java index 4a9fc7436e..7c635175f6 100644 --- a/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/SystemLayoutHandler.java +++ b/plugins/org.eclipse.fordiac.ide.elk/src/org/eclipse/fordiac/ide/elk/handlers/SystemLayoutHandler.java @@ -285,7 +285,7 @@ private static void handleSubappType(final FormEditor multiPageEditor, final Lib final var breadcrumbEditor = multiPageEditor.getAdapter(AbstractBreadCrumbEditor.class); multiPageEditor.setActiveEditor(breadcrumbEditor); multiPageEditor.getAdapter(GraphicalViewer.class).flush(); - ConnectionLayoutHandler.executeManually(multiPageEditor); + ConnectionLayoutHandler.getLayoutCommand(multiPageEditor).execute(); final List elements = new ArrayList<>(); collectSubapps(elements, subappType.getFBNetwork()); @@ -300,7 +300,7 @@ private static void handleCompositeType(final FormEditor multiPageEditor, final final var networkEditor = multiPageEditor.getAdapter(FBNetworkEditor.class); multiPageEditor.setActiveEditor(networkEditor); multiPageEditor.getAdapter(GraphicalViewer.class).flush(); - ConnectionLayoutHandler.executeManually(multiPageEditor); + ConnectionLayoutHandler.getLayoutCommand(multiPageEditor).execute(); saveTypeEditor(multiPageEditor, typeEditable); } @@ -342,7 +342,7 @@ private static void collectSubapps(final List saveList, final FBNetwork private static void layoutBreadcrumbEditor(final EObject refElement, final AbstractBreadCrumbEditor editor) { editor.getBreadcrumb().setInput(refElement); editor.getAdapter(GraphicalViewer.class).flush(); - ConnectionLayoutHandler.executeManually(editor); + ConnectionLayoutHandler.getLayoutCommand(editor).execute(); } private static EObject getBreadCrumbRefElement(final EObject sel) { diff --git a/plugins/org.eclipse.fordiac.ide.model.ui/src/org/eclipse/fordiac/ide/model/ui/editors/AbstractBreadCrumbEditor.java b/plugins/org.eclipse.fordiac.ide.model.ui/src/org/eclipse/fordiac/ide/model/ui/editors/AbstractBreadCrumbEditor.java index 32c447953c..d1a7c27ae0 100644 --- a/plugins/org.eclipse.fordiac.ide.model.ui/src/org/eclipse/fordiac/ide/model/ui/editors/AbstractBreadCrumbEditor.java +++ b/plugins/org.eclipse.fordiac.ide.model.ui/src/org/eclipse/fordiac/ide/model/ui/editors/AbstractBreadCrumbEditor.java @@ -240,7 +240,7 @@ public void stackChanged(final CommandStackEvent event) { if (isConnectionLayoutPreferenceTicked() && isTagged(event)) { if (event.isPostChangeEvent()) { if (event.getDetail() == CommandStack.POST_EXECUTE) { - final GraphicalViewer viewer = getActiveEditor().getAdapter(GraphicalViewer.class); + final var viewer = getActiveEditor().getAdapter(GraphicalViewer.class); // running the layout without flushing the viewer results in a bad state of the // libavoid process // -> do not allow auto layout if that is the case @@ -394,7 +394,7 @@ private static Command createConnectionLayoutCommand() { final IHandlerService handlerService = getHandlerService(); try { final Event mule = new Event(); - handlerService.executeCommand("org.eclipse.fordiac.ide.elk.connectionLayout", mule); //$NON-NLS-1$ + handlerService.executeCommand("org.eclipse.fordiac.ide.elk.connectionLayoutMule", mule); //$NON-NLS-1$ return (Command) mule.data; } catch (final Exception ex) { throw new IllegalStateException("Could not execute layout command", ex); //$NON-NLS-1$