本文整理汇总了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);
}