use of org.knime.workbench.editor2.editparts.WorkflowRootEditPart in project knime-core by knime.
the class AnnotationEditPart method nodeUIInformationChanged.
/**
* {@inheritDoc}
*/
@Override
public void nodeUIInformationChanged(final NodeUIInformationEvent evt) {
Annotation anno = getModel();
NodeAnnotationFigure annoFig = (NodeAnnotationFigure) getFigure();
annoFig.newContent(anno);
WorkflowRootEditPart parent = (WorkflowRootEditPart) getParent();
parent.setLayoutConstraint(this, getFigure(), new Rectangle(anno.getX(), anno.getY(), anno.getWidth(), anno.getHeight()));
refreshVisuals();
parent.refresh();
}
use of org.knime.workbench.editor2.editparts.WorkflowRootEditPart in project knime-core by knime.
the class NewWorkflowContainerEditPolicy method getCreateCommand.
/**
* {@inheritDoc}
*/
@Override
protected Command getCreateCommand(final CreateRequest request) {
// point where the command occurred
// The node/description should be initially located here
boolean snapToGrid = WorkflowEditor.getActiveEditorSnapToGrid();
WorkflowRootEditPart workflowPart = (WorkflowRootEditPart) this.getHost();
if (!Wrapper.wraps(workflowPart.getWorkflowManager(), WorkflowManager.class)) {
// adding new nodes not supported yet by UI-interfaces and implemenations
LOGGER.error("Adding new nodes not supported by '" + workflowPart.getWorkflowManager().getClass().getSimpleName() + "'.");
return null;
}
WorkflowManager manager = Wrapper.unwrapWFM(workflowPart.getWorkflowManager());
if (request instanceof CreateDropRequest) {
Object obj = request.getNewObject();
CreateDropRequest cdr = (CreateDropRequest) request;
if (obj instanceof NodeFactory) {
return handleNodeDrop(manager, (NodeFactory<? extends NodeModel>) obj, cdr);
} else if (obj instanceof AbstractExplorerFileStore) {
AbstractExplorerFileStore fs = (AbstractExplorerFileStore) obj;
if (AbstractExplorerFileStore.isWorkflowTemplate(fs)) {
return handleMetaNodeTemplateDrop(manager, cdr, fs);
}
} else if (obj instanceof WorkflowPersistor) {
return handleMetaNodeDrop(manager, (WorkflowPersistor) obj, cdr);
} else if (obj instanceof ReaderNodeSettings) {
ReaderNodeSettings settings = (ReaderNodeSettings) obj;
return new DropNodeCommand(manager, settings.getFactory(), new NodeCreationContext(settings.getUrl()), request.getLocation(), snapToGrid);
} else {
LOGGER.error("Illegal drop object: " + obj);
}
}
return null;
}
use of org.knime.workbench.editor2.editparts.WorkflowRootEditPart in project knime-core by knime.
the class NodeContainerEditPart method callHideNodeName.
/**
* Change hide/show node label status.
*/
public void callHideNodeName() {
WorkflowRootEditPart root = getRootEditPart();
if (root != null) {
NodeContainerFigure ncFigure = (NodeContainerFigure) getFigure();
ncFigure.hideNodeName(root.hideNodeNames());
}
}
use of org.knime.workbench.editor2.editparts.WorkflowRootEditPart in project knime-core by knime.
the class ShowNodeIdsAction method runOnNodes.
/**
* {@inheritDoc}
*/
@Override
public synchronized void runOnNodes(final NodeContainerEditPart[] parts) {
ScrollingGraphicalViewer provider = (ScrollingGraphicalViewer) getEditor().getEditorSite().getSelectionProvider();
if (provider == null) {
return;
}
// get parent of the node parts
WorkflowRootEditPart editorPart = (WorkflowRootEditPart) provider.getRootEditPart().getChildren().get(0);
editorPart.changeShowNodeID();
for (NodeContainerEditPart edit : getAllParts(NodeContainerEditPart.class)) {
edit.updateHeaderField();
}
}
use of org.knime.workbench.editor2.editparts.WorkflowRootEditPart in project knime-core by knime.
the class ShowNodeIdsEditorAction method createAction.
/**
* {@inheritDoc}
*/
@Override
protected AbstractNodeAction createAction(final WorkflowEditor editor) {
WorkflowRootEditPart part = (WorkflowRootEditPart) ((editor).getViewer().getRootEditPart().getChildren().get(0));
ShowNodeIdsAction showNodeIdsAction = new ShowNodeIdsAction(editor);
showNodeIdsAction.setChecked(part.showNodeId());
return showNodeIdsAction;
}
Aggregations