org.eclipse.ui.dialogs.FilteredTree Java Examples
The following examples show how to use
org.eclipse.ui.dialogs.FilteredTree.
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: M2DocTypeSelectionDialog.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
@Override protected Control createCustomArea(Composite parent) { final Composite container = new Composite(parent, parent.getStyle()); container.setLayout(new GridLayout(1, false)); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); final FilteredTree filteredTree = new FilteredTree(container, SWT.BORDER, new PatternFilter(), true); final TreeViewer treeViewer = filteredTree.getViewer(); final Tree tree = treeViewer.getTree(); final GridData gdTable = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); gdTable.minimumWidth = TABLE_MINIMUM_WIDTH; gdTable.minimumHeight = TABLE_MINIMUM_HEIGHT; tree.setLayoutData(gdTable); treeViewer.setContentProvider(new CollectionContentProvider()); treeViewer.setLabelProvider(new LabelProvider()); treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { final Object selected = ((IStructuredSelection) event.getSelection()).getFirstElement(); selectedType = (String) selected; } }); treeViewer.setInput(getAvailableTypes(nsURIs)); if (defaultType != null) { treeViewer.setSelection(new StructuredSelection(defaultType)); } return container; }
Example #2
Source File: AbstractManageDiagramWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected Composite doCreateControl(final Composite parent, final DataBindingContext context) { final Composite mainComposite = new Composite(parent, SWT.NONE); mainComposite.setLayout(fillDefaults().numColumns(2).equalWidth(true).create()); diagramTree = new FilteredTree(mainComposite, SWT.MULTI | SWT.BORDER, new PatternFilter(), false); final TreeViewer treeViewer = diagramTree.getViewer(); treeViewer.getTree().setData(SWTBOT_WIDGET_ID_KEY, SWTBOT_ID_OPEN_DIAGRAM_TREE_ID); diagramTree .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).hint(SWT.DEFAULT, 250).create()); treeViewer.setContentProvider( new ObservableListTreeContentProvider(diagramListObservableFactory(), diagramTreeStructure())); treeViewer.setLabelProvider(new DiagramLabelProvider(new FileStoreLabelProvider())); final IObservableList selectionObservable = PojoObservables.observeList(this, "selectedDiagrams"); context.bindList(ViewersObservables.observeMultiSelection(diagramTree.getViewer()), selectionObservable); context.addValidationStatusProvider(new MultiValidator() { @Override protected IStatus validate() { return selectionObservable.isEmpty() ? ValidationStatus.error(Messages.noDiagramSelected) : ValidationStatus.ok(); } }); treeViewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(final DoubleClickEvent arg0) { final IWizard wizard = getWizard(); if (wizard.canFinish() && wizard.performFinish() && wizard.getContainer() instanceof WizardDialog) { ((WizardDialog) wizard.getContainer()).close(); } } }); treeViewer.setInput(diagramRepositoryStore); treeViewer.getTree().setFocus(); defaultSelection(selectionObservable); return mainComposite; }
Example #3
Source File: SelectConnectorConfigurationWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(10, 10, 10, 0).create()); filterTree = new FilteredTree(composite, SWT.SINGLE | SWT.BORDER, new PatternFilter(), true); filterTree.setLayoutData(GridDataFactory.fillDefaults().grab(true,true).create()) ; filterTree.getViewer().setLabelProvider(new ConnectorConfigurationLabelProvider()); filterTree.getViewer().setContentProvider(new ConnectorConfigurationContentProvider()); filterTree.getViewer().addSelectionChangedListener(this) ; filterTree.getViewer().addDoubleClickListener(this) ; filterTree.getViewer().setInput(new Object()); filterTree.getViewer().addFilter(new ViewerFilter() { @Override public boolean select(Viewer arg0, Object arg1, Object element) { ITreeContentProvider contentProvider = (ITreeContentProvider)filterTree.getViewer().getContentProvider(); if (element instanceof Category){ if(!contentProvider.hasChildren(element)){ return false; } boolean hasElements=false; for(Object c : contentProvider.getChildren(element)){ hasElements=hasElements || select(arg0,element,c); } return hasElements; }else if(element instanceof ConnectorDefinition){ return contentProvider.getChildren(element).length > 0; } return element instanceof ConnectorConfiguration; } }) ; filterTree.getViewer().expandAll(); filterTree.setFocus(); setControl(composite); }
Example #4
Source File: MoveConnectorWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createProcessTreeControl(final EMFDataBindingContext dbc, final Composite parent) { final Label label = new Label(parent, SWT.NONE); label.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create()); label.setText(Messages.chooseTargetStepOrProcess); final TreeViewer processTreeViewer = new FilteredTree(parent, SWT.BORDER | SWT.SINGLE, new PatternFilter(), true).getViewer(); processTreeViewer.getControl().getParent().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).hint(SWT.DEFAULT, 300).create()); processTreeViewer.setLabelProvider(new ElementLabelProvider(adapterFactory)); processTreeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); processTreeViewer.addFilter(new ConnectableElementViewerFilter(sourceProcess)); processTreeViewer.setInput(ModelHelper.getMainProcess(sourceProcess)); processTreeViewer.expandAll(); dbc.bindValue(ViewersObservables.observeSingleSelection(processTreeViewer), targetLocationObservable, updateValueStrategy().withValidator(selectionValidator()).create(), null); }
Example #5
Source File: BonitaTreeViewer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private TreeViewer createFilteredTree(final Composite mainComposite) { final PatternFilter filter = new SearchPatternFilter(); filter.setIncludeLeadingWildcard(true); filteredTree = new FilteredTree(mainComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, filter, true); final TreeViewer treeViewer = filteredTree.getViewer(); treeViewer.getTree().setData(SWTBOT_WIDGET_ID_KEY, BONITA_OVERVIEW_TREE_ID); filteredTree.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); filteredTree.getFilterControl().setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); filteredTree.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); return treeViewer; }
Example #6
Source File: FilteredElementTreeSelectionDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected TreeViewer doCreateTreeViewer(Composite parent, int style) { FilteredTree tree= new FilteredTreeWithFilter(parent, style, fInitialFilter, fIsDeepFiltering); tree.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(tree); TreeViewer viewer= tree.getViewer(); SWTUtil.setAccessibilityText(viewer.getControl(), Strings.removeMnemonicIndicator(getMessage())); return viewer; }
Example #7
Source File: SelectRootNodeWizardPage.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); container.setLayout(new GridLayout(2, false)); setControl(container); setTitle(Messages.SelectRootNodeWizardPage_WindowTitle); setDescription(Messages.SelectRootNodeWizardPage_Description); new FilteredTree(container, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER, new PatternFilter(), true) { @Override protected TreeViewer doCreateTreeViewer(Composite aparent, int style) { return SelectRootNodeWizardPage.this.doCreateTreeViewer(aparent); } }; }
Example #8
Source File: WorkspaceResourceSelectionDialog.java From typescript.java with MIT License | 5 votes |
protected TreeViewer doCreateTreeViewer(Composite parent, int style) { FilteredTree tree = new FilteredTree(parent, style, new PatternFilter(), true); tree.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(tree); TreeViewer viewer = tree.getViewer(); return viewer; }
Example #9
Source File: CompareTargetSelectionDialog.java From eip-designer with Apache License 2.0 | 4 votes |
@Override protected Control createDialogArea(Composite base) { Composite parent = (Composite) super.createDialogArea(base); Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); // Manage dialog tree content. FilteredTree tree = new FilteredTree(composite, SWT.SINGLE | SWT.BORDER, new PatternFilter(), true); projectTree = tree.getViewer(); projectTree.setLabelProvider(new RouteTreeLabelProvider()); projectTree.setContentProvider(new RouteTreeContentProvider()); projectTree.setInput(ResourcesPlugin.getWorkspace().getRoot()); GridDataFactory.fillDefaults().grab(true, true).hint(500, 300).applyTo(tree); // Manage dialog tree events. projectTree.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() instanceof TreeSelection) { TreeSelection tSelection = (TreeSelection)event.getSelection(); if (tSelection.getFirstElement() instanceof Route) { selectedRoute = (Route) tSelection.getFirstElement(); } } } }); setTitle("Compare '" + fileName + "' with an EIP Route model"); setMessage("Select an EIP Route to compare the resource with"); applyDialogFont(composite); return composite; }
Example #10
Source File: PersistTargetSelectionDialog.java From eip-designer with Apache License 2.0 | 4 votes |
@Override protected Control createDialogArea(Composite base) { Composite parent = (Composite) super.createDialogArea(base); Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); // Manage dialog tree content. FilteredTree tree = new FilteredTree(composite, SWT.SINGLE | SWT.BORDER, new PatternFilter(), true); projectTree = tree.getViewer(); projectTree.setLabelProvider(new EIPModelTreeLabelProvider()); projectTree.setContentProvider(new EIPModelTreeContentProvider()); projectTree.setInput(ResourcesPlugin.getWorkspace().getRoot()); GridDataFactory.fillDefaults().grab(true, true).hint(500, 300).applyTo(tree); // Manage dialog tree events. projectTree.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() instanceof TreeSelection) { TreeSelection tSelection = (TreeSelection)event.getSelection(); if (tSelection.getFirstElement() instanceof IResource) { selectedEIPModel = (IResource) tSelection.getFirstElement(); } } } }); setTitle("Parse and merge '" + fileName + "' with an EIP Model"); setMessage("Select an EIP Model to persist the parsed resource within"); applyDialogFont(composite); return composite; }
Example #11
Source File: EIPModelAndRouteSelectionDialog.java From eip-designer with Apache License 2.0 | 4 votes |
@Override protected Control createDialogArea(Composite base) { Composite parent = (Composite) super.createDialogArea(base); Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); // Manage dialog tree content. FilteredTree tree = new FilteredTree(composite, SWT.SINGLE | SWT.BORDER, new PatternFilter(), true); projectTree = tree.getViewer(); projectTree.setLabelProvider(new EIPModelTreeLabelProvider()); projectTree.setContentProvider(new EIPModelTreeContentProvider()); projectTree.setInput(ResourcesPlugin.getWorkspace().getRoot()); GridDataFactory.fillDefaults().grab(true, true).hint(500, 300).applyTo(tree); // Manage dialog tree events. projectTree.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() instanceof TreeSelection) { TreeSelection tSelection = (TreeSelection)event.getSelection(); if (tSelection.getFirstElement() instanceof IResource) { eipModel = (IResource) tSelection.getFirstElement(); } } } }); setTitle("Choose a target EIP model"); setMessage("Select the EIP model for designing a new Route from Service"); applyDialogFont(composite); return composite; }
Example #12
Source File: ControlView.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
@Override public void createPartControl(Composite parent) { // Filter that shows all children of a match node PatternFilter filter = new PatternFilter() { @Override protected boolean isLeafMatch(Viewer viewer, Object element) { ITraceControlComponent parentElement = (ITraceControlComponent) element; while (parentElement != null) { if (super.isLeafMatch(viewer, parentElement)) { return true; } parentElement = parentElement.getParent(); } return false; } }; // Create filtered tree FilteredTree filteredTree = new FilteredTree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, filter, true) { @Override protected void updateToolbar(boolean visible) { super.updateToolbar(visible); treeViewer.expandToLevel(DEFAULT_EXPAND_LEVEL); } }; fTreeViewer = filteredTree.getViewer(); ColumnViewerToolTipSupport.enableFor(fTreeViewer); fTreeViewer.setContentProvider(new TraceControlContentProvider()); fTreeViewer.setLabelProvider(new TraceControlLabelProvider()); // Create model root fRoot = new TraceControlRoot(); fRoot.addComponentListener(this); if (fInitialConnections != null) { for (IRemoteConnection rc : fInitialConnections) { TargetNodeComponent node = new TargetNodeComponent(rc.getName(), fRoot, rc); fRoot.addChild(node); } fInitialConnections = null; } fTreeViewer.setInput(fRoot); // Create context menu for the tree viewer createContextMenu(); getSite().setSelectionProvider(fTreeViewer); }
Example #13
Source File: GroupsWizardPage.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override protected StructuredViewer createViewer(final Composite parent) { final FilteredTree fileredTree = new FilteredTree(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION, new PatternFilter(), true); ((Text) ((Composite) fileredTree.getChildren()[0]).getChildren()[0]).setMessage(Messages.search); fileredTree.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).minSize(200, 200).create()); fileredTree.getViewer().setContentProvider(new GroupContentProvider()); fileredTree.forceFocus(); groupSingleSelectionObservable = ViewersObservables.observeSingleSelection(fileredTree.getViewer()); groupSingleSelectionObservable.addValueChangeListener(new IValueChangeListener() { private final Adapter groupAdapter = new AdapterImpl() { /* * (non-Javadoc) * @see org.eclipse.emf.common.notify.impl.AdapterImpl#notifyChanged(org.eclipse.emf.common.notify.Notification) */ @Override public void notifyChanged(Notification notification) { switch (notification.getFeatureID(org.bonitasoft.studio.actors.model.organization.Group.class)) { case OrganizationPackage.GROUP__NAME: handleGroupNameChange(notification); break; default: break; } super.notifyChanged(notification); } }; @Override public void handleValueChange(final ValueChangeEvent event) { final org.bonitasoft.studio.actors.model.organization.Group previousGroup = (org.bonitasoft.studio.actors.model.organization.Group) event.diff .getOldValue(); if (previousGroup != null) { previousGroup.eAdapters().remove(groupAdapter); } final org.bonitasoft.studio.actors.model.organization.Group selectedGroup = (org.bonitasoft.studio.actors.model.organization.Group) event.diff .getNewValue(); if (selectedGroup != null) { setControlEnabled(getInfoGroup(), true); selectedGroup.eAdapters().add(groupAdapter); addSubGroupButton.setEnabled(true); } else { addSubGroupButton.setEnabled(false); setControlEnabled(getInfoGroup(), false); } } }); return fileredTree.getViewer(); }
Example #14
Source File: SelectProcessWizardPage.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override public void createControl(Composite parent) { Composite mainComposite = new Composite(parent, SWT.NONE) ; mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()) ; mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create()) ; databindingContext = new DataBindingContext() ; final FilteredTree tree = new FilteredTree(mainComposite, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE,new PatternFilter(), false) ; tree.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()) ; TreeViewer viewer = tree.getViewer() ; viewer.setContentProvider(new ProcessContentProvider()) ; viewer.setLabelProvider(new ProcessTreeLabelProvider()) ; UpdateValueStrategy startegy = new UpdateValueStrategy() ; startegy.setBeforeSetValidator(new IValidator() { @Override public IStatus validate(Object value) { if(value instanceof AbstractProcess && !(value instanceof MainProcess)){ return Status.OK_STATUS ; } return ValidationStatus.error(Messages.mustSelectProcessError); } }) ; if(diagram == null){ viewer.setInput(new Object[]{ProcessContentProvider.OTHER_PROCESSES}) ; }else{ viewer.setInput(new Object[]{diagram,ProcessContentProvider.OTHER_PROCESSES}) ; } if(diagram != null){ if(((ITreeContentProvider) viewer.getContentProvider()).hasChildren(diagram)){ viewer.expandToLevel(diagram, 1) ; } }else{ if(((ITreeContentProvider) viewer.getContentProvider()).hasChildren(ProcessContentProvider.OTHER_PROCESSES)){ viewer.expandToLevel(ProcessContentProvider.OTHER_PROCESSES, 1) ; } } WizardPageSupport.create(this,databindingContext) ; databindingContext.bindValue(ViewersObservables.observeSingleSelection(viewer), PojoObservables.observeValue(this, "selection"),startegy,null) ; setControl(mainComposite) ; }
Example #15
Source File: ListDialogSortableFiltered.java From nebula with Eclipse Public License 2.0 | 4 votes |
public FilteredTree getTreeViewer() { return treeViewer; }
Example #16
Source File: AbstractManageDiagramWizardPage.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
/** * @return the diagramTree */ public FilteredTree getDiagramTree() { return diagramTree; }
Example #17
Source File: MoveDataWizardPage.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
public void createControl(Composite parent) { context = new DataBindingContext(); Composite mainComposite = new Composite(parent, SWT.NONE); GridLayout gl = new GridLayout(1, false); mainComposite.setLayout(gl); new Label(mainComposite, SWT.NONE).setText(Messages.chooseTargetStepOrProcess); modelTree = new FilteredTree(mainComposite, SWT.BORDER | SWT.SINGLE, new PatternFilter(), true); modelTree.getViewer().setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); modelTree.getViewer().setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); DataAwareElementViewerFilter filter = new DataAwareElementViewerFilter(sourceContainer) ; modelTree.getViewer().setFilters(new ViewerFilter[]{filter,modelTree.getViewer().getFilters()[0]}); modelTree.getViewer().setInput(sourceProcess); modelTree.getViewer().expandAll() ; UpdateValueStrategy selectionStrategy = new UpdateValueStrategy(); selectionStrategy.setAfterGetValidator(new IValidator() { @Override public IStatus validate(Object value) { if(value==null){ return ValidationStatus.error(Messages.dataMoveErrorTargetSelected); } if(!(value instanceof DataAware)){ return ValidationStatus.error(Messages.datamoveErrorWrongTarget); } if(value.equals(sourceContainer)){ return ValidationStatus.error(Messages.dataMoveErrorTargetCantBeSource); } return ValidationStatus.ok(); } }); context.bindValue(ViewersObservables.observeSingleSelection(modelTree.getViewer()), PojoProperties.value(MoveDataWizardPage.class, "selectedDataAwareElement").observe(this),selectionStrategy,null); WizardPageSupport.create(this, context); setControl(mainComposite); }