org.eclipse.ui.dialogs.PatternFilter Java Examples

The following examples show how to use org.eclipse.ui.dialogs.PatternFilter. 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: ColumnMultiEditAction.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void run() {
   Collection<TreeItem> selectedTreeItems = Arrays.asList(xViewer.getTree().getSelection());
   Set<TreeColumn> editableColumns = getEditableTreeColumns(xViewer, selectedTreeItems);
   if (editableColumns.isEmpty()) {
      XViewerLib.popup(XViewerText.get("error"), XViewerText.get("error.no_columns.multi_editable")); //$NON-NLS-1$ //$NON-NLS-2$
      return;
   }
   String title = XViewerText.get("ColumnMultiEditAction.title"); //$NON-NLS-1$
   ListDialogSortableFiltered ld = new ListDialogSortableFiltered(title, "Select an attribute.", new PatternFilter(),
      new ArrayTreeContentProvider(), treeColumnLabelProvider, new XViewerColumnSorter());
   ld.setInput(editableColumns);
   int result = ld.open();
   if (result != 0) {
      return;
   }
   TreeColumn sel = ld.getSelectedFirst();
   xViewer.handleColumnMultiEdit(sel, selectedTreeItems);
}
 
Example #2
Source File: TimeGraphFilterDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Creates the tree viewer.
 *
 * @param parent
 *            the parent composite
 * @return the tree viewer
 */
protected CheckboxTreeViewer createTreeViewer(Composite parent) {
    PatternFilter filter = new TreePatternFilter();
    filter.setIncludeLeadingWildcard(true);
    fTree = new FilteredCheckboxTree(parent, SWT.BORDER | SWT.MULTI, filter, true, false);

    Tree tree = fTree.getViewer().getTree();
    tree.setHeaderVisible(true);
    for (String columnName : fColumnNames) {
        TreeColumn column = new TreeColumn(tree, SWT.LEFT);
        column.setText(columnName);
    }

    fTree.getViewer().setContentProvider(fContentProvider);
    fTree.getViewer().setLabelProvider(fLabelProvider);
    fTree.addCheckStateListener(new CheckStateListener());
    fTree.getViewer().setComparator(fComparator);
    if (fFilters != null) {
        for (int i = 0; i != fFilters.size(); i++) {
            fTree.getViewer().addFilter(fFilters.get(i));
        }
    }
    fTree.getViewer().setInput(fInput);
    return (CheckboxTreeViewer) fTree.getViewer();
}
 
Example #3
Source File: SelectConnectorConfigurationWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@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: ContentOutlinePageWithFilter.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createControl(Composite parent) {
    patternFilter = new PatternFilter();
    filter = PyFilteredTree.create(parent, patternFilter, false);
    treeViewer = filter.getViewer();
    treeViewer.addSelectionChangedListener(this);
}
 
Example #5
Source File: PyFilteredTree.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
public static PyFilteredTree create(Composite parent, PatternFilter filter, boolean border) {
    int treeStyle = SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL;
    if (border) {
        treeStyle |= SWT.BORDER;
    }
    return create(parent, treeStyle, filter);
}
 
Example #6
Source File: ListDialogSortableFiltered.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public ListDialogSortableFiltered(String dialogTitle, String dialogMessage, PatternFilter patternFilter, IContentProvider contentProvider, IBaseLabelProvider labelProvider, ViewerSorter viewerSorter) {
   super(Display.getCurrent().getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.NONE,
      new String[] {XViewerText.get("button.ok"), XViewerText.get("button.cancel")}, 0); //$NON-NLS-1$ //$NON-NLS-2$
   this.contentProvider = contentProvider;
   this.labelProvider = labelProvider;
   this.patternFilter = patternFilter;
   this.viewerSorter = viewerSorter;
   setShellStyle(getShellStyle() | SWT.RESIZE);
}
 
Example #7
Source File: BonitaTreeViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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 #8
Source File: MoveConnectorWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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 #9
Source File: SelectRootNodeWizardPage.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@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 #10
Source File: WorkspaceResourceSelectionDialog.java    From typescript.java with MIT License 5 votes vote down vote up
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 #11
Source File: AbstractManageDiagramWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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 #12
Source File: M2DocTypeSelectionDialog.java    From M2Doc with Eclipse Public License 1.0 5 votes vote down vote up
@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 #13
Source File: ControlView.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@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 #14
Source File: GroupsWizardPage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@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 #15
Source File: SelectProcessWizardPage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@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 #16
Source File: PyFilteredTree.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
private PyFilteredTree(Composite parent, int treeStyle, PatternFilter filter, boolean useNewLook) {
    super(parent, treeStyle, filter, useNewLook);
}
 
Example #17
Source File: MoveDataWizardPage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
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);
}
 
Example #18
Source File: PersistTargetSelectionDialog.java    From eip-designer with Apache License 2.0 4 votes vote down vote up
@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 #19
Source File: CompareTargetSelectionDialog.java    From eip-designer with Apache License 2.0 4 votes vote down vote up
@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 #20
Source File: EIPModelAndRouteSelectionDialog.java    From eip-designer with Apache License 2.0 4 votes vote down vote up
@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 #21
Source File: FilterBugsDialog.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
PatternFilteredTree(Composite parent, int treeStyle, PatternFilter filter) {
    super(parent, treeStyle, filter, true);
}
 
Example #22
Source File: ModulaQuickOutlineDialog.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
public MyFilteredTree(Composite parent, PatternFilter filter) {
    super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE, filter, true);
}
 
Example #23
Source File: ListDialogSortableFiltered.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public void setPatternFilter(PatternFilter patternFilter) {
   this.patternFilter = patternFilter;
}
 
Example #24
Source File: FilteredCheckboxTree.java    From tracecompass with Eclipse Public License 2.0 3 votes vote down vote up
/**
 * Create a new instance of the receiver.
 *
 * @param parent
 *            the parent <code>Composite</code>
 * @param treeStyle
 *            the style bits for the <code>Tree</code>
 * @param filter
 *            the filter to be used
 * @param useNewLook
 *            <code>true</code> if the new <code>FilteredTree</code> look
 *            should be used
 * @param useFastHashLookup true, if tree should use fast hash lookup, else false
 * @since 6.0
 */
public FilteredCheckboxTree(Composite parent, int treeStyle, PatternFilter filter,
        boolean useNewLook, boolean useFastHashLookup) {
    /*
     *  Keep call to deprecated super constructor until support
     *  for Eclipse 2019-06 (4.12) is dropped.
     */
    super(parent, treeStyle, filter, useNewLook);
    TreeViewer viewer = getViewer();
    if (viewer != null) {
        viewer.setUseHashlookup(useFastHashLookup);
    }
}
 
Example #25
Source File: TriStateFilteredCheckboxTree.java    From tracecompass with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Create a new instance of the receiver.
 *
 * @param parent
 *            the parent <code>Composite</code>
 * @param treeStyle
 *            the style bits for the <code>Tree</code>
 * @param filter
 *            the filter to be used
 * @param useNewLook
 *            <code>true</code> if the new <code>FilteredTree</code> look should
 *            be used
 * @param useFastHashLookup true, if tree should use fast hash lookup, else false
 * @since 6.0
 */
public TriStateFilteredCheckboxTree(Composite parent, int treeStyle, PatternFilter filter, boolean useNewLook, boolean useFastHashLookup) {
    super(parent, treeStyle, filter, useNewLook, useFastHashLookup);
}
 
Example #26
Source File: TriStateFilteredCheckboxTree.java    From tracecompass with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Create a new instance of the receiver.
 *
 * @param parent
 *            the parent <code>Composite</code>
 * @param treeStyle
 *            the style bits for the <code>Tree</code>
 * @param filter
 *            the filter to be used
 * @param useNewLook
 *            <code>true</code> if the new <code>FilteredTree</code> look should
 *            be used
 * @deprecated use {@link #TriStateFilteredCheckboxTree(Composite, int, PatternFilter, boolean, boolean)}
 * @since 3.1
 */
@Deprecated
public TriStateFilteredCheckboxTree(Composite parent, int treeStyle, PatternFilter filter, boolean useNewLook) {
    this(parent, treeStyle, filter, useNewLook, false);
}
 
Example #27
Source File: FilteredCheckboxTree.java    From tracecompass with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Create a new instance of the receiver.
 *
 * @param parent
 *            the parent <code>Composite</code>
 * @param treeStyle
 *            the style bits for the <code>Tree</code>
 * @param filter
 *            the filter to be used
 * @param useNewLook
 *            <code>true</code> if the new <code>FilteredTree</code> look
 *            should be used
 * @deprecated use {@link #FilteredCheckboxTree(Composite, int, PatternFilter, boolean, boolean)}
 *             Will only be removed after Eclipse 2019-06 (4.12) support is dropped.
 */
@Deprecated
public FilteredCheckboxTree(Composite parent, int treeStyle, PatternFilter filter,
        boolean useNewLook) {
    this(parent, treeStyle, filter, useNewLook, false);
}