|
|
@@ -12,6 +12,9 @@ package org.yakindu.sct.refactoring.handlers.impl;
|
|
|
|
|
|
import org.eclipse.core.commands.ExecutionEvent;
|
|
|
import org.eclipse.core.commands.ExecutionException;
|
|
|
+import org.eclipse.gef.commands.Command;
|
|
|
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
|
|
|
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
|
|
|
import org.eclipse.gmf.runtime.notation.View;
|
|
|
import org.eclipse.ui.handlers.HandlerUtil;
|
|
|
import org.yakindu.sct.refactoring.handlers.AbstractViewRefactoringHandler;
|
|
|
@@ -19,6 +22,7 @@ import org.yakindu.sct.refactoring.refactor.AbstractRefactoring;
|
|
|
import org.yakindu.sct.refactoring.refactor.impl.InlineSubdiagramRefactoring;
|
|
|
import org.yakindu.sct.ui.editor.editparts.StateEditPart;
|
|
|
import org.yakindu.sct.ui.editor.partitioning.DiagramPartitioningUtil;
|
|
|
+import org.yakindu.sct.ui.editor.policies.SetPreferredSizeRequest;
|
|
|
|
|
|
/**
|
|
|
* Handler for {@link InlineSubdiagramRefactoring}.
|
|
|
@@ -36,7 +40,15 @@ public class InlineSubdiagramHandler extends AbstractViewRefactoringHandler {
|
|
|
@Override
|
|
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
|
|
if (allEditorsAreClosed(event))
|
|
|
- return super.execute(event);
|
|
|
+ super.execute(event);
|
|
|
+ setPreferredSize(event);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Object setPreferredSize(ExecutionEvent event) {
|
|
|
+ IGraphicalEditPart editPart = (IGraphicalEditPart) getFirstElement(HandlerUtil.getCurrentSelection(event));
|
|
|
+ Command cmd = editPart.getCommand(new SetPreferredSizeRequest(editPart));
|
|
|
+ AbstractRefactoring.executeCommand(new CommandProxy(cmd), editPart.resolveSemanticElement().eResource());
|
|
|
return null;
|
|
|
}
|
|
|
|