use of org.eclipse.wst.xsd.ui.internal.adt.design.editparts.INamedEditPart in project webtools.sourceediting by eclipse.
the class LabelEditManager method initCellEditor.
protected void initCellEditor() {
Text text = (Text) getCellEditor().getControl();
Label label = ((INamedEditPart) getEditPart()).getNameLabelFigure();
if (label != null) {
scaledFont = label.getFont();
Color color = label.getBackgroundColor();
text.setBackground(color);
String initialLabelText = label.getText();
getCellEditor().setValue(initialLabelText);
} else {
scaledFont = label.getParent().getFont();
text.setBackground(label.getParent().getBackgroundColor());
}
FontData data = scaledFont.getFontData()[0];
Dimension fontSize = new Dimension(0, data.getHeight());
label.getParent().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();
}
use of org.eclipse.wst.xsd.ui.internal.adt.design.editparts.INamedEditPart in project webtools.sourceediting by eclipse.
the class TopLevelNameDirectEditManager method initCellEditor.
protected void initCellEditor() {
Text text = (Text) getCellEditor().getControl();
Label label = ((INamedEditPart) getEditPart()).getNameLabelFigure();
if (label != null) {
scaledFont = label.getFont();
Color color = label.getBackgroundColor();
text.setBackground(color);
String initialLabelText = component.getName();
getCellEditor().setValue(initialLabelText);
} else {
scaledFont = label.getParent().getFont();
text.setBackground(label.getParent().getBackgroundColor());
}
FontData data = scaledFont.getFontData()[0];
Dimension fontSize = new Dimension(0, data.getHeight());
label.getParent().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();
}
Aggregations