Search in sources :

Example 11 with Annotation

use of org.knime.core.node.workflow.Annotation in project knime-core by knime.

the class AnnotationEditPart method createFigure.

/**
 * {@inheritDoc}
 */
@Override
protected IFigure createFigure() {
    Annotation anno = getModel();
    NodeAnnotationFigure f = new WorkflowAnnotationFigure(anno);
    if (anno instanceof WorkflowAnnotation) {
        f.setBounds(new Rectangle(anno.getX(), anno.getY(), anno.getWidth(), anno.getHeight()));
    }
    return f;
}
Also used : WorkflowAnnotationFigure(org.knime.workbench.editor2.figures.WorkflowAnnotationFigure) 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) WorkflowAnnotation(org.knime.core.node.workflow.WorkflowAnnotation)

Example 12 with Annotation

use of org.knime.core.node.workflow.Annotation in project knime-core by knime.

the class AnnotationEditPart method activate.

/**
 * {@inheritDoc}
 */
@Override
public void activate() {
    super.activate();
    IPreferenceStore store = KNIMEUIPlugin.getDefault().getPreferenceStore();
    store.addPropertyChangeListener(this);
    Annotation anno = getModel();
    anno.addUIInformationListener(this);
    // update the ui info now
    nodeUIInformationChanged(null);
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) WorkflowAnnotation(org.knime.core.node.workflow.WorkflowAnnotation) NodeAnnotation(org.knime.core.node.workflow.NodeAnnotation) Annotation(org.knime.core.node.workflow.Annotation)

Example 13 with Annotation

use of org.knime.core.node.workflow.Annotation in project knime-core by knime.

the class AnnotationEditManager method initCellEditor.

/**
 * Initializes the cell editor.
 *
 * @see org.eclipse.gef.tools.DirectEditManager#initCellEditor()
 */
@Override
protected void initCellEditor() {
    // de-select the underlying annotation to remove the selection handles
    final GraphicalEditPart editPart = getEditPart();
    editPart.getRoot().getViewer().deselectAll();
    editPart.getFigure().setVisible(false);
    StyledTextEditor stw = (StyledTextEditor) getCellEditor();
    Annotation anno = ((AnnotationEditPart) editPart).getModel();
    Font defaultFont;
    if (editPart instanceof NodeAnnotationEditPart) {
        defaultFont = AnnotationEditPart.getNodeAnnotationDefaultFont();
    } else if (anno.getVersion() < AnnotationData.VERSION_20151012) {
        defaultFont = FontStore.INSTANCE.getSystemDefaultFont();
    } else {
        defaultFont = AnnotationEditPart.getWorkflowAnnotationDefaultFont();
    }
    stw.setDefaultFont(defaultFont);
    stw.setValue(anno);
    // Hook the cell editor's copy/paste actions to the actionBars so that
    // they can
    // be invoked via keyboard shortcuts.
    m_actionBars = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorSite().getActionBars();
    saveCurrentActions(m_actionBars);
    m_actionHandler = new CellEditorActionHandler(m_actionBars);
    m_actionHandler.addCellEditor(getCellEditor());
    m_actionBars.updateActionBars();
}
Also used : AnnotationEditPart(org.knime.workbench.editor2.editparts.AnnotationEditPart) NodeAnnotationEditPart(org.knime.workbench.editor2.editparts.NodeAnnotationEditPart) CellEditorActionHandler(org.eclipse.ui.part.CellEditorActionHandler) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) Annotation(org.knime.core.node.workflow.Annotation) Font(org.eclipse.swt.graphics.Font) NodeAnnotationEditPart(org.knime.workbench.editor2.editparts.NodeAnnotationEditPart)

Example 14 with Annotation

use of org.knime.core.node.workflow.Annotation in project knime-core by knime.

the class NodeAnnotationEditPart method createFigure.

/**
 * {@inheritDoc}
 */
@Override
protected IFigure createFigure() {
    Annotation anno = getModel();
    NodeAnnotationFigure f = new NodeAnnotationFigure(anno);
    return f;
}
Also used : NodeAnnotationFigure(org.knime.workbench.editor2.figures.NodeAnnotationFigure) Annotation(org.knime.core.node.workflow.Annotation) NodeAnnotation(org.knime.core.node.workflow.NodeAnnotation)

Aggregations

Annotation (org.knime.core.node.workflow.Annotation)14 NodeAnnotation (org.knime.core.node.workflow.NodeAnnotation)9 WorkflowAnnotation (org.knime.core.node.workflow.WorkflowAnnotation)7 Rectangle (org.eclipse.draw2d.geometry.Rectangle)3 AnnotationEditPart (org.knime.workbench.editor2.editparts.AnnotationEditPart)3 NodeAnnotationEditPart (org.knime.workbench.editor2.editparts.NodeAnnotationEditPart)3 NodeAnnotationFigure (org.knime.workbench.editor2.figures.NodeAnnotationFigure)3 EditPart (org.eclipse.gef.EditPart)2 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)2 Font (org.eclipse.swt.graphics.Font)2 NodeID (org.knime.core.node.workflow.NodeID)2 WorkflowManagerUI (org.knime.core.ui.node.workflow.WorkflowManagerUI)2 WorkflowPortBar (org.knime.workbench.editor2.model.WorkflowPortBar)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1 Composite (org.eclipse.swt.widgets.Composite)1 CellEditorActionHandler (org.eclipse.ui.part.CellEditorActionHandler)1 AnnotationData (org.knime.core.node.workflow.AnnotationData)1 NodeUIInformation (org.knime.core.node.workflow.NodeUIInformation)1