Java Code Examples for org.eclipse.jface.viewers.ViewerFilter#select()
The following examples show how to use
org.eclipse.jface.viewers.ViewerFilter#select() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TimeGraphControl.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
private void refreshExpanded(Collection<Item> expandedItemList, Item item) { // Check for filters boolean display = true; for (ViewerFilter filter : fFilters) { if (!filter.select(null, item.fEntry.getParent(), item.fEntry)) { display = false; break; } } if (display) { item.fExpandedIndex = expandedItemList.size(); expandedItemList.add(item); if (item.fHasChildren && item.fExpanded) { for (Item child : item.fChildren) { refreshExpanded(expandedItemList, child); } } } }
Example 2
Source File: PatternExpressionViewer.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private List<Expression> getFilteredExpressions() { final List<Expression> filteredExpressions = new ArrayList<>(); final Expression[] expressions = expressionNatureProvider.getExpressions(contextInput); if (expressions != null) { filteredExpressions.addAll(Arrays.asList(expressions)); if (contextInput != null) { for (final Expression exp : expressions) { for (final ViewerFilter filter : filters) { if (filter != null && !filter.select(expressionViewer, input, exp)) { filteredExpressions.remove(exp); } } } } } GroovyUtil.getBonitaConstantsFor(contextInput, filters.toArray(new ViewerFilter[] {}), false).stream() .map(ec -> ExpressionHelper.createExpression(ec.getEngineConstantName(), ec.getEngineConstantName(), ExpressionConstants.ENGINE_CONSTANT_TYPE, ec.getReturnType(), true)) .forEach(filteredExpressions::add); return filteredExpressions; }
Example 3
Source File: ExpressionViewer.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private ArrayList<String> getFilteredExpressionType() { final ArrayList<String> filteredExpressions = new ArrayList<>(); final Set<ViewerFilter> fitlers = getFilters(); final Expression exp = ExpressionFactory.eINSTANCE.createExpression(); exp.setName(""); if (filters != null && expressionNatureProvider != null && context != null && expressionEditorService != null) { final Set<IExpressionProvider> expressionProviders = expressionEditorService.getExpressionProviders(); for (final IExpressionProvider provider : expressionProviders) { for (final ViewerFilter viewerFilter : fitlers) { exp.setType(provider.getExpressionType()); if (!viewerFilter.select(this, context, exp)) { filteredExpressions.add(provider.getExpressionType()); } } } } return filteredExpressions; }
Example 4
Source File: CustomFiltersActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private boolean isSelected(Object parent, Object element, IContentProvider contentProvider, ViewerFilter filter) { if (filter instanceof EmptyLibraryContainerFilter) // workaround for https://bugs.eclipse.org/341109 return true; if (contentProvider instanceof ITreeContentProvider) { // the element and all its parents have to be selected ITreeContentProvider provider = (ITreeContentProvider) contentProvider; while (element != null && !(element instanceof IJavaModel)) { if (!filter.select(fViewer, parent, element)) return false; element= provider.getParent( element); } return true; } return filter.select(fViewer, parent, element); }
Example 5
Source File: DataExpressionEditor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void fillViewerData(final EObject context, final ViewerFilter[] filters) { final Set<Data> input = new HashSet<>(); final IExpressionProvider provider = ExpressionProviderService.getInstance() .getExpressionProvider(ExpressionConstants.VARIABLE_TYPE); final Set<Expression> expressions = provider.getExpressions(context); final Set<Expression> filteredExpressions = new HashSet<>(); if (expressions != null) { filteredExpressions.addAll(expressions); if (input != null && filters != null) { for (final Expression exp : expressions) { for (final ViewerFilter filter : filters) { if (filter != null && !filter.select(viewer, context, exp)) { filteredExpressions.remove(exp); } } } } } for (final Expression e1 : filteredExpressions) { if (editorInputExpression.isReturnTypeFixed()) { if (compatibleReturnType(editorInputExpression, e1)) { input.add((Data) e1.getReferencedElements().get(0)); } } else { input.add((Data) e1.getReferencedElements().get(0)); } } viewer.setInput(input); }
Example 6
Source File: JavaExpressionEditor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private boolean acceptExpression(final ExpressionViewer viewer, final Expression e, final EObject context, final ViewerFilter[] filters) { if (filters != null) { for (final ViewerFilter f : filters) { if (!f.select(viewer, context, e)) { return false; } } } return true; }
Example 7
Source File: EmptyCategoryFilter.java From olca-app with Mozilla Public License 2.0 | 5 votes |
private boolean passesFilters(Viewer viewer, ViewerFilter[] filters, ModelElement element) { for (ViewerFilter filter : filters) if (!filter.select(viewer, element.getParent(), element)) return false; return true; }
Example 8
Source File: ComparisonExpressionEditor.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override public void bindExpression(final EMFDataBindingContext dataBindingContext, final EObject context, final Expression inputExpression, final ViewerFilter[] viewerTypeFilters, final ExpressionViewer expressionViewer) { this.inputExpression = inputExpression; final IObservableValue contentModelObservable = EMFObservables.observeValue(inputExpression, ExpressionPackage.Literals.EXPRESSION__CONTENT); final IObservableValue nameModelObservable = EMFObservables.observeValue(inputExpression, ExpressionPackage.Literals.EXPRESSION__NAME); final IObservableValue dependenciesModelObservable = EMFObservables.observeValue(inputExpression, ExpressionPackage.Literals.EXPRESSION__REFERENCED_ELEMENTS); final IObservableValue autoDepsModelObservable = EMFObservables.observeValue(inputExpression, ExpressionPackage.Literals.EXPRESSION__AUTOMATIC_DEPENDENCIES); final IObservableValue returnTypeModelObservable = EMFObservables.observeValue(inputExpression, ExpressionPackage.Literals.EXPRESSION__RETURN_TYPE); final ISWTObservableValue observeText = WidgetProperties.text(SWT.Modify) .observe(comparisonEditor.getViewer().getControl()); dataBindingContext.bindValue(observeText, nameModelObservable); dataBindingContext.bindValue(observeText, contentModelObservable); dataBindingContext.bindValue(ViewersObservables.observeInput(dependenciesViewer), dependenciesModelObservable); final UpdateValueStrategy opposite = new UpdateValueStrategy(); opposite.setConverter(new BooleanInverserConverter()); dataBindingContext.bindValue(SWTObservables.observeSelection(automaticResolutionButton), autoDepsModelObservable); dataBindingContext.bindValue(SWTObservables.observeSelection(automaticResolutionButton), SWTObservables.observeEnabled(addDependencyButton), opposite, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER)); dependencySection.setExpanded(!automaticResolutionButton.getSelection()); addDependencyButton.setEnabled(!inputExpression.isAutomaticDependencies()); ControlDecorationSupport .create(dataBindingContext.bindValue(ViewersObservables.observeSingleSelection(typeCombo), returnTypeModelObservable), SWT.LEFT); typeCombo.getCombo().setEnabled(!inputExpression.isReturnTypeFixed()); final ExpressionContentProvider provider = ExpressionContentProvider.getInstance(); final Set<Expression> filteredExpressions = new HashSet<Expression>(); final Expression[] expressions = provider.getExpressions(context); if (expressions != null) { filteredExpressions.addAll(Arrays.asList(expressions)); if (context != null && viewerTypeFilters != null) { for (final Expression exp : expressions) { for (final ViewerFilter filter : viewerTypeFilters) { if (filter != null && !filter.select(comparisonEditor.getViewer(), context, exp)) { filteredExpressions.remove(exp); } } } } } addDependencyButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { final SelectDependencyDialog dialog = new SelectDependencyDialog(Display.getDefault().getActiveShell(), filteredExpressions, ComparisonExpressionEditor.this.inputExpression.getReferencedElements()); dialog.open(); } }); }
Example 9
Source File: GroovyUtil.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
public static List<ExpressionConstants> getBonitaConstantsFor( EObject context, final ViewerFilter[] filters, final boolean isPageFlowContext) { final List<ExpressionConstants> result = new ArrayList<>(); ViewerFilter engineFilter = filters != null ? Stream.of(filters) .filter(DisplayEngineExpressionWithName.class::isInstance) .findFirst() .orElse(NO_FILTER) : NO_FILTER; result.add(ExpressionConstants.API_ACCESSOR); result.add(ExpressionConstants.PROCESS_DEFINITION_ID); result.add(ExpressionConstants.ROOT_PROCESS_INSTANCE_ID); result.add(ExpressionConstants.PROCESS_INSTANCE_ID); result.add(ExpressionConstants.ACTIVITY_INSTANCE_ID); if (context instanceof Expression || context instanceof Operation) { context = context.eContainer(); } if (isPageFlowContext) { result.add(ExpressionConstants.LOGGED_USER_ID); } if (context instanceof Activity) { if (((Activity) context).getType() == MultiInstanceType.PARALLEL || ((Activity) context).getType() == MultiInstanceType.SEQUENTIAL) { if (engineFilter != null) { if (engineFilter.select(null, null, ExpressionConstants.NUMBER_OF_ACTIVE_INSTANCES.getEngineConstantName())) { result.add(ExpressionConstants.NUMBER_OF_ACTIVE_INSTANCES); } if (engineFilter.select(null, null, ExpressionConstants.NUMBER_OF_TERMINATED_INSTANCES.getEngineConstantName())) { result.add(ExpressionConstants.NUMBER_OF_TERMINATED_INSTANCES); } if (engineFilter.select(null, null, ExpressionConstants.NUMBER_OF_COMPLETED_INSTANCES.getEngineConstantName())) { result.add(ExpressionConstants.NUMBER_OF_COMPLETED_INSTANCES); } if (engineFilter.select(null, null, ExpressionConstants.NUMBER_OF_INSTANCES.getEngineConstantName())) { result.add(ExpressionConstants.NUMBER_OF_INSTANCES); } } } else if (((Activity) context).getType() == MultiInstanceType.STANDARD) { if (engineFilter != null && engineFilter.select(null, null, ExpressionConstants.LOOP_COUNTER.getEngineConstantName())) { result.add(ExpressionConstants.LOOP_COUNTER); } } } if (context instanceof Task) { result.add(ExpressionConstants.TASK_ASSIGNEE_ID); } return result; }
Example 10
Source File: ProblemTreeViewer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 3 votes |
/** * All element filter tests must go through this method. * Can be overridden by subclasses. * * @param object the object to filter * @param parent the parent * @param filters the filters to apply * @return true if the element is filtered */ protected boolean isFiltered(Object object, Object parent, ViewerFilter[] filters) { for (int i = 0; i < filters.length; i++) { ViewerFilter filter = filters[i]; if (!filter.select(this, parent, object)) return true; } return false; }
Example 11
Source File: ProblemTreeViewer.java From bonita-studio with GNU General Public License v2.0 | 3 votes |
/** * All element filter tests must go through this method. * Can be overridden by subclasses. * * @param object the object to filter * @param parent the parent * @param filters the filters to apply * @return true if the element is filtered */ protected boolean isFiltered(Object object, Object parent, ViewerFilter[] filters) { for (int i = 0; i < filters.length; i++) { ViewerFilter filter = filters[i]; if (!filter.select(this, parent, object)) return true; } return false; }