use of org.talend.commons.ui.swt.colorstyledtext.ColorStyledText 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.talend.commons.ui.swt.colorstyledtext.ColorStyledText 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;
}
});
}
Aggregations