本文整理匯總了Java中org.eclipse.jface.viewers.TreeViewer.addFilter方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeViewer.addFilter方法的具體用法?Java TreeViewer.addFilter怎麽用?Java TreeViewer.addFilter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.viewers.TreeViewer
的用法示例。
在下文中一共展示了TreeViewer.addFilter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDialogArea
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
CustomElementSelectionForm form = new CustomElementSelectionForm(parent, SWT.FILL);
form.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
TreeViewer v = form.getTreeViewer();
for (ViewerFilter filter : filters) {
v.addFilter(filter);
}
this.treeViewer = v;
WorkbenchContentProvider contentProvider = new WorkbenchContentProvider();
ILabelProvider labelProvider = new WorkbenchLabelProvider();
this.treeViewer.setContentProvider(contentProvider);
this.treeViewer.setLabelProvider(labelProvider);
this.treeViewer.setComparator(new ViewerComparator());
this.treeViewer.setAutoExpandLevel(this.getAutoExpandLevel());
form.setElementLabel(this.elementLabel);
this.elementNameInput = form.getElementInput();
form.getElementInput().addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals(SuffixText.TEXT_PROPERTY) ||
evt.getPropertyName().equals(SuffixText.SUFFIX_PROPERTY)) {
validateElementInput();
elementInputChanged();
}
}
});
return form;
}
示例2: createViewer
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
protected void createViewer() {
FormLayout formLayout = new FormLayout();
setLayout(formLayout);
Composite con = new Composite(this, SWT.NONE);
FormData topData = new FormData();
topData.left = new FormAttachment(0,0);
topData.right = new FormAttachment(100,0);
topData.top = new FormAttachment(0,0);
con.setLayoutData(topData);
con.setLayout(new GridLayout(3,false));
createTopArea(con);
viewer = new TreeViewer(this, SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
contentProvider = new PrefsContentProvider();
viewer.setContentProvider(contentProvider);
viewer.getTree().setHeaderVisible(true);
viewer.getTree().setLinesVisible(true);
FormData viewerData = new FormData();
viewerData.top = new FormAttachment(con, 5);
viewerData.bottom = new FormAttachment(100,0);
viewerData.left = new FormAttachment(0,0);
viewerData.right = new FormAttachment(100,0);
viewer.getTree().setLayoutData(viewerData);
viewerFilter = new PreferenceFilter();
viewer.addFilter(viewerFilter);
filterJob = new SetFilterJob(viewer, viewerFilter);
}