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