use of org.csstudio.swt.widgets.figures.ITextFigure in project yamcs-studio by yamcs.
the class TextEditManager method initCellEditor.
@Override
protected void initCellEditor() {
// update text
ITextFigure textFigure = getEditPart().getAdapter(ITextFigure.class);
// AbstractWidgetModel labelModel = (AbstractWidgetModel) getEditPart().getModel();
getCellEditor().setValue(textFigure.getText());
if (textFigure.isOpaque() || textFigure.getBorder() instanceof AbstractBackground) {
getCellEditor().getControl().setBackground(textFigure.getBackgroundColor());
} else {
getCellEditor().getControl().setBackground(textFigure.getParent().getBackgroundColor());
}
getCellEditor().getControl().setForeground(textFigure.getForegroundColor());
// 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());
zoomMgr.addZoomListener(zoomListener);
} else
getCellEditor().getControl().setFont(textFigure.getFont());
// Hook the cell editor's copy/paste actions to the actionBars so that they can
// be invoked via keyboard shortcuts.
IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (activeEditor != null) {
actionBars = activeEditor.getEditorSite().getActionBars();
saveCurrentActions(actionBars);
actionHandler = new CellEditorActionHandler(actionBars);
actionHandler.addCellEditor(getCellEditor());
actionBars.updateActionBars();
}
}
Aggregations