Search in sources :

Example 11 with WorkflowRootEditPart

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();
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) NodeAnnotationFigure(org.knime.workbench.editor2.figures.NodeAnnotationFigure) WorkflowAnnotation(org.knime.core.node.workflow.WorkflowAnnotation) NodeAnnotation(org.knime.core.node.workflow.NodeAnnotation) Annotation(org.knime.core.node.workflow.Annotation)

Example 12 with WorkflowRootEditPart

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;
}
Also used : CreateDropRequest(org.knime.workbench.editor2.CreateDropRequest) DropNodeCommand(org.knime.workbench.editor2.commands.DropNodeCommand) ReaderNodeSettings(org.knime.workbench.editor2.ReaderNodeSettings) NodeFactory(org.knime.core.node.NodeFactory) AbstractExplorerFileStore(org.knime.workbench.explorer.filesystem.AbstractExplorerFileStore) WorkflowRootEditPart(org.knime.workbench.editor2.editparts.WorkflowRootEditPart) WorkflowManager(org.knime.core.node.workflow.WorkflowManager) WorkflowPersistor(org.knime.core.node.workflow.WorkflowPersistor) NodeCreationContext(org.knime.core.node.NodeCreationContext)

Example 13 with WorkflowRootEditPart

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());
    }
}
Also used : NodeContainerFigure(org.knime.workbench.editor2.figures.NodeContainerFigure)

Example 14 with WorkflowRootEditPart

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();
    }
}
Also used : ScrollingGraphicalViewer(org.eclipse.gef.ui.parts.ScrollingGraphicalViewer) NodeContainerEditPart(org.knime.workbench.editor2.editparts.NodeContainerEditPart) WorkflowRootEditPart(org.knime.workbench.editor2.editparts.WorkflowRootEditPart)

Example 15 with WorkflowRootEditPart

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;
}
Also used : ShowNodeIdsAction(org.knime.workbench.editor2.actions.ShowNodeIdsAction) WorkflowRootEditPart(org.knime.workbench.editor2.editparts.WorkflowRootEditPart)

Aggregations

WorkflowRootEditPart (org.knime.workbench.editor2.editparts.WorkflowRootEditPart)18 WorkflowManager (org.knime.core.node.workflow.WorkflowManager)7 NodeContainerEditPart (org.knime.workbench.editor2.editparts.NodeContainerEditPart)6 NodeContainerFigure (org.knime.workbench.editor2.figures.NodeContainerFigure)5 Point (org.eclipse.draw2d.geometry.Point)4 EditPart (org.eclipse.gef.EditPart)4 WorkflowAnnotation (org.knime.core.node.workflow.WorkflowAnnotation)4 Rectangle (org.eclipse.draw2d.geometry.Rectangle)3 EditPartViewer (org.eclipse.gef.EditPartViewer)3 IEditorPart (org.eclipse.ui.IEditorPart)3 NodeAnnotation (org.knime.core.node.workflow.NodeAnnotation)3 WorkflowManagerUI (org.knime.core.ui.node.workflow.WorkflowManagerUI)3 NodeAnnotationEditPart (org.knime.workbench.editor2.editparts.NodeAnnotationEditPart)3 IFigure (org.eclipse.draw2d.IFigure)2 PrecisionPoint (org.eclipse.draw2d.geometry.PrecisionPoint)2 ZoomManager (org.eclipse.gef.editparts.ZoomManager)2 ScrollingGraphicalViewer (org.eclipse.gef.ui.parts.ScrollingGraphicalViewer)2 ConnectionContainer (org.knime.core.node.workflow.ConnectionContainer)2 NodeContainer (org.knime.core.node.workflow.NodeContainer)2 NodeUIInformation (org.knime.core.node.workflow.NodeUIInformation)2