use of org.knime.workbench.ui.layout.commands.AutoLayoutCommand in project knime-core by knime.
the class AutoLayoutAction method runOnNodes.
/**
* {@inheritDoc}
*/
@Override
public synchronized void runOnNodes(final NodeContainerEditPart[] parts) {
ScrollingGraphicalViewer provider = (ScrollingGraphicalViewer) getEditor().getEditorSite().getSelectionProvider();
if (provider == null) {
return;
}
ArrayList<NodeContainerUI> nodes = null;
if (parts != null && parts.length > 0) {
nodes = new ArrayList<NodeContainerUI>(parts.length);
for (NodeContainerEditPart p : parts) {
nodes.add(p.getNodeContainer());
}
}
AutoLayoutCommand alc = new AutoLayoutCommand(getManager(), nodes);
// enables undo
getCommandStack().execute(alc);
// update the actions
getEditor().updateActions();
// Give focus to the editor again. Otherwise the actions (selection)
// is not updated correctly.
getWorkbenchPart().getSite().getPage().activate(getWorkbenchPart());
}
Aggregations