use of org.eclipse.swt.graphics.FontData in project tdi-studio-se by Talend.
the class TraceDebugProcessComposite method setConsoleFont.
private boolean setConsoleFont() {
IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
String fontType = preferenceStore.getString(RunProcessPrefsConstants.CONSOLE_FONT);
if (StringUtils.isNotEmpty(fontType)) {
FontData fontData = new FontData(fontType);
if (consoleText.getFont() != null) {
FontData oldFont = consoleText.getFont().getFontData()[0];
// font is same
if (oldFont.equals(fontData)) {
return false;
}
}
Font font = new Font(this.getDisplay(), fontData);
consoleText.setFont(font);
return true;
}
return false;
}
use of org.eclipse.swt.graphics.FontData in project tdi-studio-se by Talend.
the class SQLTextViewer method adaptToPreferenceChange.
void adaptToPreferenceChange(PropertyChangeEvent event) {
if (event.getProperty().equals(IConstants.FONT)) {
FontData[] fData = PreferenceConverter.getFontDataArray(store, IConstants.FONT);
String des = store.getString(IConstants.FONT);
JFaceResources.getFontRegistry().put(des, fData);
Control ctrl = this.getControl();
if (ctrl != null) {
ctrl.setFont(JFaceResources.getFontRegistry().get(des));
}
}
}
use of org.eclipse.swt.graphics.FontData in project tdi-studio-se by Talend.
the class DatabaseBusinessItemNameEditPart method refreshFont.
/**
* @generated
*/
protected void refreshFont() {
FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
if (style != null) {
FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
use of org.eclipse.swt.graphics.FontData in project tdi-studio-se by Talend.
the class BusinessItemRelationshipNameEditPart method refreshFont.
/**
* @generated
*/
protected void refreshFont() {
FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
if (style != null) {
FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
use of org.eclipse.swt.graphics.FontData in project tdi-studio-se by Talend.
the class NodeLabelEditManager method initCellEditor.
@Override
protected void initCellEditor() {
Connection connection = ((ConnectionLabel) this.getEditPart().getModel()).getConnection();
if (getCellEditor() instanceof NodeLabelCellEditor) {
((NodeLabelCellEditor) getCellEditor()).setCurrentConnection(connection);
}
Label label = (Label) (getEditPart()).getFigure();
String initialLabelText = label.getText();
getCellEditor().setValue(initialLabelText);
text = (Text) getCellEditor().getControl();
IFigure figure = (getEditPart()).getFigure();
scaledFont = figure.getFont();
FontData data = scaledFont.getFontData()[0];
Dimension fontSize = new Dimension(0, data.getHeight());
label.translateToAbsolute(fontSize);
data.setHeight(fontSize.height);
scaledFont = new Font(null, data);
text.setFont(scaledFont);
text.selectAll();
}
Aggregations