Java 类org.eclipse.ui.part.CellEditorActionHandler 实例源码

项目:Hydrograph    文件:CommentBoxLabelEditManager.java   
/**
 * Initializes the cell editor. Subclasses should implement this to set the
 * initial text and add things such as {@link VerifyListener
 * VerifyListeners}, if needed.
 */
protected void initCellEditor() {
    CommentBoxFigure comment = (CommentBoxFigure)getEditPart().getFigure();
    getCellEditor().setValue(comment.getText());
    ZoomManager zoomMgr = (ZoomManager)getEditPart().getViewer()
            .getProperty(ZoomManager.class.toString());
    if (zoomMgr != null) {
        cachedZoom = -1.0;
        updateScaledFont(zoomMgr.getZoom());
        zoomMgr.addZoomListener(zoomListener);
    } else
        getCellEditor().getControl().setFont(comment.getFont());

    actionBars = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
            .getActiveEditor().getEditorSite().getActionBars();
    saveCurrentActions(actionBars);
    actionHandler = new CellEditorActionHandler(actionBars);
    actionHandler.addCellEditor(getCellEditor());
    actionBars.updateActionBars();
}
项目:statecharts    文件:XtextDirectEditManager.java   
protected void initCellEditor() {
    committed = false;

    // Get the Text Compartments Edit Part

    setEditText(getEditPart().getEditText());

    IFigure label = getEditPart().getFigure();
    Assert.isNotNull(label);
    StyledText text = (StyledText) getCellEditor().getControl();
    // scale the font accordingly to the zoom level
    text.setFont(getScaledFont(label));

    // Hook the cell editor's copy/paste actions to the actionBars so that
    // they can
    // be invoked via keyboard shortcuts.
    actionBars = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()
            .getEditorSite().getActionBars();
    saveCurrentActions(actionBars);
    actionHandler = new CellEditorActionHandler(actionBars);
    actionHandler.addCellEditor(getCellEditor());
    actionBars.updateActionBars();
}
项目:Archie-Smart-IDE    文件:ShapeEditManager.java   
@Override
protected void initCellEditor() {
    // update text
    ShapeFigure figure = (ShapeFigure)getEditPart().getFigure();
    getCellEditor().setValue(figure.getName());

    // TODO update font if diagram is scaled

    // Hook the cell editor's copy/paste actions to the actionBars so that
    // they can
    // be invoked via keyboard shortcuts.
    actionBars = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
            .getActivePage().getActiveEditor().getEditorSite().getActionBars();
    saveCurrentActions(actionBars);
    actionHandler = new CellEditorActionHandler(actionBars);
    actionHandler.addCellEditor(getCellEditor());
    actionBars.updateActionBars();
}
项目:Archie-Smart-IDE    文件:ConnectionEditManager.java   
@Override
protected void initCellEditor() {
    // update text
    ConnectionFigure figure = (ConnectionFigure)getEditPart().getFigure();
    getCellEditor().setValue(figure.getText());

    // update font

    // Hook the cell editor's copy/paste actions to the actionBars so that
    // they can
    // be invoked via keyboard shortcuts.
    actionBars = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
            .getActivePage().getActiveEditor().getEditorSite().getActionBars();
    saveCurrentActions(actionBars);
    actionHandler = new CellEditorActionHandler(actionBars);
    actionHandler.addCellEditor(getCellEditor());
    actionBars.updateActionBars();
}
项目:PDFReporter-Studio    文件:CalloutEditManager.java   
protected void initCellEditor() {
    // update text

    try {
        MCallout model = ((CalloutEditPart) getEditPart()).getModel();
        getCellEditor().setValue(model.getPropertyValue(MCallout.PROP_TEXT));
        getCellEditor().getControl().setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

        // update font
        ZoomManager zoomMgr = (ZoomManager) getEditPart().getViewer().getProperty(ZoomManager.class.toString());
        if (zoomMgr != null) { // this will force the font to be set cachedZoom = -1.0;
            updateScaledFont(zoomMgr.getZoom(), model);
            zoomMgr.addZoomListener(zoomListener);
        } // else
            // getCellEditor().getControl().setFont(stickyNote.getFont());
        // Hook the cell editor's copy/paste actions to the actionBars so that they can
        // be invoked via keyboard
        // shortcuts.
        actionBars = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()
                .getEditorSite().getActionBars();
        saveCurrentActions(actionBars);
        actionHandler = new CellEditorActionHandler(actionBars);
        actionHandler.addCellEditor(getCellEditor());
        actionBars.updateActionBars();

    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
项目:PDFReporter-Studio    文件:TextEditManager.java   
protected void initCellEditor() {
    // update text

    try {
        MStaticText model = (MStaticText) ((FigureEditPart) getEditPart()).getModel();
        getCellEditor().setValue(model.getPropertyValue(JRBaseStaticText.PROPERTY_TEXT));
        getCellEditor().getControl().setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

        // update font
        ZoomManager zoomMgr = (ZoomManager) getEditPart().getViewer().getProperty(ZoomManager.class.toString());
        if (zoomMgr != null) { // this will force the font to be set cachedZoom = -1.0;
            updateScaledFont(zoomMgr.getZoom(), model);
            zoomMgr.addZoomListener(zoomListener);
        } // else
            // getCellEditor().getControl().setFont(stickyNote.getFont());
        // Hook the cell editor's copy/paste actions to the actionBars so that they can
        // be invoked via keyboard
        // shortcuts.
        actionBars = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()
                .getEditorSite().getActionBars();
        saveCurrentActions(actionBars);
        actionHandler = new CellEditorActionHandler(actionBars);
        actionHandler.addCellEditor(getCellEditor());
        actionBars.updateActionBars();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
项目:birt    文件:LabelEditManager.java   
protected void initCellEditor( )
    {
        Text text = (Text) getCellEditor( ).getControl( );

        LabelFigure labelFigure = (LabelFigure) getEditPart( ).getFigure( );
        String initialLabelText = ( (LabelHandle) getModel()).getText( );
        if ( initialLabelText == null )
        {
            initialLabelText = ""; //$NON-NLS-1$
        }
        getCellEditor( ).setValue( initialLabelText );
        IFigure figure = getEditPart( ).getFigure( );
        scaledFont = figure.getFont( );
        FontData data = scaledFont.getFontData( )[0];
        Dimension fontSize = new Dimension( 0, data.getHeight( ) );
        labelFigure.translateToAbsolute( fontSize );
        data.setHeight( fontSize.height );
        scaledFont = new Font( null, data );

        text.setFont( scaledFont );
        text.selectAll( );

//       Hook the cell editor's copy/paste actions to the actionBars so that they can
        // be invoked via keyboard shortcuts.
        actionBars = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
                .getActiveEditor().getEditorSite().getActionBars();
        saveCurrentActions(actionBars);
        actionHandler = new CellEditorActionHandler(actionBars);
        actionHandler.addCellEditor(getCellEditor());
        actionBars.updateActionBars();
    }