use of org.eclipse.swt.events.ModifyEvent in project tdi-studio-se by Talend.
the class DatabaseTypeFilter method createFilterField.
/**
* DOC bqian Comment method "createFilterField".
*
* @param container
*/
private void createFilterField(Composite container) {
if (type != ERepositoryObjectType.PROCESS && !showFilterText) {
return;
}
// create text filter
Label label = new Label(container, SWT.NONE);
//$NON-NLS-1$
label.setText(Messages.getString("RepositoryReviewDialog.jobNameFormat"));
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final Text text = new Text(container, SWT.BORDER);
text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
text.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String pattern = text.getText();
//$NON-NLS-1$ //$NON-NLS-2$
pattern = pattern.replace("*", ".*");
//$NON-NLS-1$ //$NON-NLS-2$
pattern = pattern.replace("?", ".");
//$NON-NLS-1$ //$NON-NLS-2$
pattern = "(?i)" + pattern + ".*";
textFilter.setText(pattern);
getRepositoryTreeViewer().refresh();
getRepositoryTreeViewer().expandAll();
// repositoryView.selectFirstOne();
}
});
}
use of org.eclipse.swt.events.ModifyEvent in project tdi-studio-se by Talend.
the class ReviewComponentDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
Composite container = new Composite(composite, SWT.NONE);
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
gridLayout.marginBottom = 15;
gridLayout.marginLeft = 15;
gridLayout.marginRight = 15;
gridLayout.marginTop = 15;
container.setLayout(gridLayout);
container.setLayoutData(new GridData(GridData.FILL_BOTH));
final Label titleLabel = new Label(container, SWT.NONE);
titleLabel.setText("Title:*");
titleText = new Text(container, SWT.BORDER);
titleText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
titleText.addModifyListener(new ModifyListener() {
public void modifyText(final ModifyEvent e) {
checkInput();
}
});
createRatingComp(container);
final Label reviewLabel = new Label(container, SWT.NONE);
reviewLabel.setText("Review:*");
reviewText = new Text(container, SWT.BORDER | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL);
reviewText.setLayoutData(new GridData(GridData.FILL_BOTH));
reviewText.addModifyListener(new ModifyListener() {
public void modifyText(final ModifyEvent e) {
checkInput();
}
});
checkInput();
return composite;
}
use of org.eclipse.swt.events.ModifyEvent in project tdi-studio-se by Talend.
the class ComponentsPreferencePage method createFieldEditors.
@Override
public void createFieldEditors() {
final Composite parent = getFieldEditorParent();
filePathTemp = new DirectoryFieldEditor(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER, //$NON-NLS-1$
Messages.getString("ComponentsPreferencePage.directoryFieldLabel"), parent);
addField(filePathTemp);
filePathTemp.getTextControl(parent).addModifyListener(new ModifyListener() {
String oldPath = getPreferenceStore().getString(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER);
@Override
public void modifyText(ModifyEvent e) {
String newPath = filePathTemp.getTextControl(parent).getText();
File file = new File(newPath);
if (!file.exists() && !"".equals(newPath)) {
//$NON-NLS-1$
// getPreferenceStore().setValue(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER, "");
filePathTemp.showErrorMessage();
setValid(false);
} else {
if (oldPath.equals(newPath)) {
setValid(true);
return;
}
if (!StringUtils.isEmpty(newPath)) {
if (!checkUserComponentsFolder(file)) {
filePathTemp.getTextControl(parent).setText(oldPath);
}
}
setValid(true);
}
}
});
if (PluginChecker.isPreviewPluginLoaded()) {
createForDataViewer(parent);
}
createForMapper(parent);
createFortRunJob(parent);
if (PluginChecker.isJobLetPluginLoaded()) {
createForJoblet(parent);
}
createForComponentAssist(parent);
parent.pack();
}
use of org.eclipse.swt.events.ModifyEvent in project KaiZen-OpenAPI-Editor by RepreZen.
the class QuickOutline method createTitleControl.
@Override
protected Control createTitleControl(Composite parent) {
filterText = new Text(parent, SWT.NONE);
Dialog.applyDialogFont(filterText);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.CENTER;
filterText.setLayoutData(data);
filterText.addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent e) {
if (isInvocationEvent(e)) {
e.doit = false;
handleMultiView();
} else if (e.keyCode == SWT.CR) {
handleSelection();
QuickOutline.this.close();
} else if (e.keyCode == SWT.ARROW_DOWN) {
treeViewer.getTree().setFocus();
} else if (e.keyCode == SWT.ARROW_UP) {
treeViewer.getTree().setFocus();
} else if (e.character == SWT.ESC) {
QuickOutline.this.close();
}
}
public void keyReleased(KeyEvent e) {
// do nothing
}
});
filterText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (filterTimer != null) {
filterTimer.cancel();
}
// reset the timer each time there is a
// text modification, so that only the last
// one will be executed.
filterTimer = new Timer();
filterTimer.schedule(new TimerTask() {
@Override
public void run() {
if (filterText.isDisposed()) {
return;
}
// Make sure we access the text in the correct thread.
filterText.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
// refreshing the tree will execute the filter.
if (Strings.emptyToNull(filterText.getText()) == null) {
treeViewer.refresh();
treeViewer.collapseAll();
} else {
treeViewer.refresh();
TreeItem[] items = treeViewer.getTree().getItems();
if (items != null && items.length > 0) {
treeViewer.getTree().setSelection(items[0]);
treeViewer.getTree().showItem(items[0]);
} else {
treeViewer.setSelection(StructuredSelection.EMPTY);
}
treeViewer.expandAll();
}
}
});
}
}, 500);
}
});
return filterText;
}
use of org.eclipse.swt.events.ModifyEvent in project tdi-studio-se by Talend.
the class ImportComponentDialog method createDialogArea.
/*
* (non-Javadoc) Method declared on Dialog.
*/
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
GridLayout gl = new GridLayout(5, true);
composite.setLayout(gl);
if (message != null) {
Label label = new Label(composite, SWT.WRAP);
label.setText(message);
GridData data = new GridData(GridData.GRAB_HORIZONTAL);
data.horizontalSpan = 5;
label.setLayoutData(data);
label.setFont(parent.getFont());
}
Label label1 = new Label(composite, SWT.NONE);
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
gd.horizontalSpan = 2;
label1.setLayoutData(gd);
//$NON-NLS-1$
label1.setText(Messages.getString("ImportComponentDialog.SelectDirectoryLabel"));
text = new Text(composite, SWT.BORDER);
text.setEditable(false);
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 2;
text.setLayoutData(gd);
if (paletteComponentsPath == null) {
//$NON-NLS-1$
paletteComponentsPath = "";
}
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
validateInput(true);
}
});
Button button = new Button(composite, SWT.NONE);
//$NON-NLS-1$
button.setText(Messages.getString("ImportComponentDialog.Browser"));
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalSpan = 1;
button.setLayoutData(gd);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dd = new DirectoryDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
String path = dd.open();
if (path != null) {
text.setText(path);
}
}
});
Button showPaletteComponents = new Button(composite, SWT.NONE);
gd = new GridData();
gd.horizontalSpan = 2;
showPaletteComponents.setLayoutData(gd);
//$NON-NLS-1$
showPaletteComponents.setText(Messages.getString("ImportComponentDialog.ShowPaletteComponents"));
showPaletteComponents.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
text.setText(paletteComponentsPath);
}
});
label1 = new Label(composite, SWT.LEFT);
gd = new GridData();
gd.horizontalSpan = 1;
label1.setLayoutData(gd);
//$NON-NLS-1$
label1.setText(Messages.getString("ImportComponentDialog.Filter"));
filterText = new Text(composite, SWT.BORDER);
filterText.setEditable(true);
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 2;
filterText.setLayoutData(gd);
filterText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
validateInput(false);
}
});
label1 = new Label(composite, SWT.LEFT);
gd = new GridData();
gd.horizontalSpan = 5;
label1.setLayoutData(gd);
//$NON-NLS-1$
label1.setText(Messages.getString("ImportComponentDialog.ChooseComponentsLabel"));
componentList = new List(composite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 5;
componentList.setLayoutData(gd);
componentList.addMouseListener(new MouseListener() {
public void mouseDoubleClick(MouseEvent e) {
}
public void mouseDown(MouseEvent e) {
validateSelected();
}
public void mouseUp(MouseEvent e) {
validateSelected();
}
});
errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.CENTER);
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 5;
label1.setLayoutData(gd);
errorMessageText.setLayoutData(gd);
errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
applyDialogFont(composite);
//$NON-NLS-1$
text.setText("");
return composite;
}
Aggregations