Search in sources :

Example 6 with CellEditorActionHandler

use of org.eclipse.ui.part.CellEditorActionHandler 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)

Aggregations

CellEditorActionHandler (org.eclipse.ui.part.CellEditorActionHandler)6 Font (org.eclipse.swt.graphics.Font)3 Label (org.eclipse.draw2d.Label)2 Dimension (org.eclipse.draw2d.geometry.Dimension)2 Color (org.eclipse.swt.graphics.Color)2 FontData (org.eclipse.swt.graphics.FontData)2 Text (org.eclipse.swt.widgets.Text)2 INamedEditPart (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.INamedEditPart)2 AbstractBackground (org.eclipse.draw2d.AbstractBackground)1 IFigure (org.eclipse.draw2d.IFigure)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1 ZoomManager (org.eclipse.gef.editparts.ZoomManager)1 StyledText (org.eclipse.swt.custom.StyledText)1 Annotation (org.knime.core.node.workflow.Annotation)1 AnnotationEditPart (org.knime.workbench.editor2.editparts.AnnotationEditPart)1 NodeAnnotationEditPart (org.knime.workbench.editor2.editparts.NodeAnnotationEditPart)1