use of org.eclipse.swt.graphics.FontData in project OpenGrok by OpenGrok.
the class TextUtils method makeEditable.
public static void makeEditable(Text text) {
Object isdefault = text.getData("default");
if (isdefault != null && (Boolean) isdefault == true) {
text.setForeground(new Color(null, 0x00, 0x00, 0x00));
text.setText("");
FontData fontData = text.getFont().getFontData()[0];
Font font = new Font(Display.getCurrent(), new FontData(fontData.getName(), fontData.getHeight(), SWT.NORMAL));
text.setFont(font);
text.setData("default", false);
}
}
use of org.eclipse.swt.graphics.FontData in project dbeaver by serge-rider.
the class EmptyPresentation method createPresentation.
@Override
public void createPresentation(@NotNull final IResultSetController controller, @NotNull Composite parent) {
super.createPresentation(controller, parent);
UIUtils.createHorizontalLine(parent);
placeholder = new Canvas(parent, SWT.NONE);
placeholder.setLayoutData(new GridData(GridData.FILL_BOTH));
placeholder.setBackground(controller.getDefaultBackground());
final Font normalFont = parent.getFont();
FontData[] fontData = normalFont.getFontData();
fontData[0].setStyle(fontData[0].getStyle() | SWT.BOLD);
fontData[0].setHeight(18);
final Font largeFont = new Font(normalFont.getDevice(), fontData[0]);
placeholder.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
UIUtils.dispose(largeFont);
}
});
placeholder.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
if (controller.isRefreshInProgress()) {
return;
}
e.gc.setFont(largeFont);
UIUtils.drawMessageOverControl(placeholder, e, "No Data", -10);
e.gc.setFont(normalFont);
if (controller.getDataContainer() instanceof SQLEditor.QueryResultsContainer) {
String execQuery = ActionUtils.findCommandDescription(CoreCommands.CMD_EXECUTE_STATEMENT, controller.getSite(), true);
String execScript = ActionUtils.findCommandDescription(CoreCommands.CMD_EXECUTE_SCRIPT, controller.getSite(), true);
UIUtils.drawMessageOverControl(placeholder, e, "Execute query (" + execQuery + ") or script (" + execScript + ") to see results", 20);
}
}
});
trackPresentationControl();
}
use of org.eclipse.swt.graphics.FontData in project dbeaver by serge-rider.
the class HexPreferencesPage method createContents.
/**
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
FontData fontData = getPrefFontData();
preferences = new HexPreferencesManager(fontData);
return preferences.createPreferencesPart(parent);
}
use of org.eclipse.swt.graphics.FontData in project dbeaver by serge-rider.
the class HexPreferencesPage method performOk.
/**
* @see HexPreferencesPage#performOk()
*/
@Override
public boolean performOk() {
DBPPreferenceStore store = DBeaverCore.getGlobalPreferenceStore();
FontData fontData = preferences.getFontData();
store.setValue(DBeaverPreferences.HEX_FONT_NAME, fontData.getName());
store.setValue(DBeaverPreferences.HEX_FONT_STYLE, fontData.getStyle());
store.setValue(DBeaverPreferences.HEX_FONT_SIZE, fontData.getHeight());
store.firePropertyChangeEvent(PROP_FONT_DATA, null, fontData);
PrefUtils.savePreferenceStore(store);
return true;
}
use of org.eclipse.swt.graphics.FontData in project translationstudio8 by heartsome.
the class DefaultCellStyle method setFont.
/**
* @param font The font to set.
*/
public void setFont(FontData font) {
if (isRealModification(_font, font)) {
FontData oldVal = _font;
_font = font;
firePropertyChange(FONT, oldVal, font);
}
}
Aggregations