use of org.eclipse.swt.graphics.FontData in project tdi-studio-se by Talend.
the class ProcessComposite method setConsoleFont.
/**
* DOC chuang Comment method "setConsoleFont".
*/
private void setConsoleFont() {
IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
FontData fontData = PreferenceConverter.getFontData(preferenceStore, TalendDesignerPrefConstants.CONSOLT_TEXT_FONT);
if (fontData != null) {
if (consoleText.getFont() != null) {
FontData oldFont = consoleText.getFont().getFontData()[0];
// font is same
if (!oldFont.equals(fontData)) {
Font font = new Font(this.getDisplay(), fontData);
consoleText.setFont(font);
}
// else no need to change the font it is the same
} else {
Font font = new Font(this.getDisplay(), fontData);
consoleText.setFont(font);
}
} else {
// should never happend
//$NON-NLS-1$
log.info("Could not find default font for the console");
}
}
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 SqlEditDialog method createDialogArea.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite control = (Composite) super.createDialogArea(parent);
// create text viewer
GridData gid = new GridData();
gid.grabExcessHorizontalSpace = true;
gid.grabExcessVerticalSpace = true;
gid.horizontalAlignment = GridData.FILL;
gid.verticalAlignment = GridData.FILL;
control.setLayoutData(gid);
GridLayout gridLayout = new GridLayout();
gridLayout.marginBottom = 0;
gridLayout.marginHeight = 0;
gridLayout.marginLeft = 0;
gridLayout.marginRight = 0;
gridLayout.marginTop = 0;
gridLayout.marginWidth = 0;
control.setLayout(gridLayout);
colorText = new ColorStyledText(control, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, CorePlugin.getDefault().getPreferenceStore(), language);
IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
String fontType = preferenceStore.getString(TalendDesignerPrefConstants.MEMO_TEXT_FONT);
FontData fontData = new FontData(fontType);
Font font = new Font(null, fontData);
addResourceDisposeListener(colorText, font);
colorText.setFont(font);
GridData gd = new GridData(GridData.FILL_BOTH);
colorText.setLayoutData(gd);
colorText.setText(sql);
colorText.addModifyListener(new ModifyListener() {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
*/
@Override
public void modifyText(ModifyEvent e) {
sql = colorText.getText();
}
});
createEditorProposal();
return control;
}
use of org.eclipse.swt.graphics.FontData in project tdi-studio-se by Talend.
the class SQLBuilderEditorComposite method createEditorArea.
/**
* Creates UI for editor.
*
* @param parent
*/
private void createEditorArea(Composite parent) {
// create divider line
Composite div1 = new Composite(parent, SWT.NONE);
GridData lgid = new GridData();
lgid.grabExcessHorizontalSpace = true;
lgid.horizontalAlignment = GridData.FILL;
lgid.heightHint = 1;
lgid.verticalIndent = 1;
div1.setLayoutData(lgid);
div1.setBackground(parent.getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
// create text viewer
GridData gid = new GridData();
gid.grabExcessHorizontalSpace = true;
gid.grabExcessVerticalSpace = true;
gid.horizontalAlignment = GridData.FILL;
gid.verticalAlignment = GridData.FILL;
colorText = new ColorStyledText(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, CorePlugin.getDefault().getPreferenceStore(), language);
IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
String fontType = preferenceStore.getString(TalendDesignerPrefConstants.MEMO_TEXT_FONT);
FontData fontData = new FontData(fontType);
Font font = new Font(null, fontData);
addResourceDisposeListener(colorText, font);
colorText.setFont(font);
GridData gd = new GridData(GridData.FILL_BOTH);
colorText.setLayoutData(gd);
colorText.setText(this.connParam.getQuery());
colorText.addVerifyKeyListener(new VerifyKeyListener() {
@Override
public void verifyKey(VerifyEvent event) {
if (event.stateMask == SWT.CTRL && event.keyCode == 13) {
event.doit = false;
execSQLAction.run();
}
}
});
colorText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
isModified = true;
}
});
}
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));
}
}
}
Aggregations