use of org.eclipse.ui.dialogs.SearchPattern in project tesb-studio-se by Talend.
the class XmlTableForm method addFieldsListeners.
private void addFieldsListeners() {
nameFilter.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String pattern = nameFilter.getText();
SearchPattern matcher = new SearchPattern();
matcher.setPattern(pattern);
final List<Item> newList = new ArrayList<Item>();
for (Item item : items) {
if (matcher.matches(item.getLabel())) {
newList.add(item);
}
}
reftesTableContent(newList);
completeListener.setComplete(!getSelectionItems().isEmpty());
}
});
// Event checkBox action
table.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
if (e.detail == SWT.CHECK) {
((Item) e.item.getData()).setCheck(((TableItem) e.item).getChecked());
if (null != completeListener) {
completeListener.setComplete(!getSelectionItems().isEmpty());
}
}
}
});
table.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
table.getColumns()[0].setWidth(table.getClientArea().width - 2 * table.getBorderWidth());
}
});
selectAllTablesButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
setChecked(true);
}
});
selectNoneTablesButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
setChecked(false);
}
});
}
use of org.eclipse.ui.dialogs.SearchPattern in project tdi-studio-se by Talend.
the class AbstractScdDialog method createFilter.
/**
* DOC hcw Comment method "createFilter".
*
* @param container
* @return
*/
protected ViewerFilter createFilter(Composite container) {
Composite composite = new Composite(container, SWT.NONE);
GridDataFactory.swtDefaults().grab(true, false).align(SWT.FILL, SWT.FILL).applyTo(composite);
composite.setLayout(new FormLayout());
final Button filterButton = new Button(composite, SWT.PUSH);
filterText = new Text(composite, SWT.BORDER);
filterText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
Shell dialogShell = AbstractScdDialog.this.getShell();
if (dialogShell != null) {
dialogShell.setDefaultButton(filterButton);
}
}
});
filterText.setFocus();
FormData formData = new FormData();
formData.right = new FormAttachment(100);
formData.top = new FormAttachment(0);
filterButton.setLayoutData(formData);
formData = new FormData();
formData.top = new FormAttachment(filterButton, 0, SWT.CENTER);
formData.left = new FormAttachment(0);
formData.right = new FormAttachment(filterButton, 0, SWT.LEFT);
filterText.setLayoutData(formData);
//$NON-NLS-1$
filterButton.setText(Messages.getString("AbstractScdDialog.filter"));
filterButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
filterText.setFocus();
applyFilter();
}
});
ViewerFilter filter = new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
String pattern = filterText.getText();
SearchPattern matcher = new SearchPattern();
matcher.setPattern(pattern);
return matcher.matches(element.toString());
}
};
return filter;
}
Aggregations