本文整理汇总了Java中org.eclipse.jface.viewers.StructuredViewer.addFilter方法的典型用法代码示例。如果您正苦于以下问题:Java StructuredViewer.addFilter方法的具体用法?Java StructuredViewer.addFilter怎么用?Java StructuredViewer.addFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.viewers.StructuredViewer
的用法示例。
在下文中一共展示了StructuredViewer.addFilter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SearchCellLabelProvider
import org.eclipse.jface.viewers.StructuredViewer; //导入方法依赖的package包/类
public SearchCellLabelProvider(final StructuredViewer structuredViewer) {
if (hightLight == null) {
hightLight = Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW);
}
if (builtInFont == null) {
FontData[] fontData = structuredViewer.getControl().getFont().getFontData();
fontData[0].setStyle(fontData[0].getStyle() | SWT.ITALIC);
builtInFont = new Font(Display.getCurrent(), fontData[0]);
}
structuredViewer.addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (!showBuiltIn && isBuiltIn(element)) {
return false;
}
if (filterString == null || filterString.isEmpty()) {
return true;
}
return getText(element).contains(filterString);
}
});
}
示例2: fillFilters
import org.eclipse.jface.viewers.StructuredViewer; //导入方法依赖的package包/类
public void fillFilters(StructuredViewer viewer) {
ViewerFilter workingSetFilter= fFilterActionGroup.getWorkingSetFilter();
if (fMode == SHOW_PROJECTS) {
viewer.addFilter(workingSetFilter);
} else {
viewer.removeFilter(workingSetFilter);
}
}
示例3: execute
import org.eclipse.jface.viewers.StructuredViewer; //导入方法依赖的package包/类
@Execute
public void execute(IEclipseContext context, @Active MPart activePart, @Active Shell shell,
@Named(BTSCoreConstants.OBJECTS_FILTER_BY_PARAM_ID) String param)
{
filter = null;
isContained = false;
allObjects = null;
Object o = activePart.getObject();
StructuredViewerProvider part;
// see if part has a StructuredViewer
if (o instanceof StructuredViewerProvider)
{
part = (StructuredViewerProvider) o;
}
else
{
return;
}
// get viewer
StructuredViewer viewer = part.getActiveStructuredViewer();
if (viewer == null) return;
// load param specific objects
loadSpecificObjectsAndFilter(param, viewer, context);
// make dialog
ObjectByListEntrySelectionFilterDialog dialog = new ObjectByListEntrySelectionFilterDialog(shell, allObjects, filter);
//inject projects and filter
dialog.create();
if (dialog.open() == dialog.OK)
{
filter = dialog.getFilter();
// if no projects selected, drop filter, else add to viewer
if (filter instanceof ViewerFilter) {
if (filter.getObjects().isEmpty()) {
viewer.removeFilter((ViewerFilter) filter);
} else if (!isContained) {
viewer.addFilter((ViewerFilter) filter);
} else {
}
part.reloadViewerNodes(viewer);
}
}
}