Package org.eclipse.ui.dialogs

Examples of org.eclipse.ui.dialogs.PatternFilter


          label.setText(Messages.LocationControl_CHOOSE_BINS_MSG);
          break;
      }

      /* Filter for Filtered Tree */
      final PatternFilter filter = new PatternFilter() {
        @Override
        protected boolean isLeafMatch(Viewer viewer, Object element) {
          if (fMode == Mode.SELECT_BIN && !(element instanceof INewsBin))
            return false;

          String labelText = ((IFolderChild) element).getName();
          if (labelText == null)
            return false;

          return wordMatches(labelText);
        }
      };

      /* Filtered Tree to make it easier to chose an element */
      fFilteredTree = new FilteredTree(composite, SWT.BORDER, filter) {
        @Override
        protected TreeViewer doCreateTreeViewer(Composite parent, int style) {
          fViewer = new CheckboxTreeViewer(parent, SWT.BORDER) {
            @Override
            public void refresh(boolean updateLabels) {
              super.refresh(updateLabels);

              /* Avoid collapsed Tree */
              expandToLevel(fMode == Mode.SELECT_BIN ? AbstractTreeViewer.ALL_LEVELS : 2);

              /* Restore Checked Elements */
              for (IFolderChild child : fCheckedElementsCache) {
                setParentsExpanded(child);
                fViewer.setChecked(child, true);
                setChildsChecked(child, true, true, false);
              }
            }
          };
          fViewer.setAutoExpandLevel(fMode == Mode.SELECT_BIN ? AbstractTreeViewer.ALL_LEVELS : 2);
          fViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
          fViewer.getTree().setData(ApplicationWorkbenchWindowAdvisor.FOCUSLESS_SCROLL_HOOK, new Object());
          return fViewer;
        }

        @Override
        protected void updateToolbar(boolean visible) {
          if (filterToolBar != null)
            filterToolBar.getControl().setEnabled(visible);
        }

        @Override
        protected Composite createFilterControls(Composite parent) {
          Composite filterControls = super.createFilterControls(parent);
          if (filterToolBar != null) {
            filterToolBar.getControl().setVisible(true);
            filterToolBar.getControl().setEnabled(false);
          }
          return filterControls;
        }
      };

      fFilteredTree.setInitialText(""); //$NON-NLS-1$
      if (fMode == Mode.SEARCH_LOCATION) {
        fFilteredTree.getFilterControl().setMessage(Messages.LocationControl_FILTER_LOCATIONS);
        OwlUI.makeAccessible(fFilteredTree.getFilterControl(), Messages.LocationControl_FILTER_LOCATIONS);
      } else {
        fFilteredTree.getFilterControl().setMessage(Messages.LocationControl_FILTER_BINS);
        OwlUI.makeAccessible(fFilteredTree.getFilterControl(), Messages.LocationControl_FILTER_BINS);
      }
      fFilteredTree.getViewer().getControl().setFocus();

      /* Filter when Typing into Tree */
      fFilteredTree.getViewer().getControl().addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
          if (e.character > 0x20) {
            String character = String.valueOf(e.character);
            Text text = fFilteredTree.getFilterControl();
            text.setFocus();
            text.setText(character);
            text.setSelection(1);
            filter.setPattern(character);

            /* Consume the Event */
            e.doit = false;
          }
        }
View Full Code Here


        gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
        gridData.grabExcessVerticalSpace = true;
        setLayoutData(gridData);

        // Create the tree viewer to display the file tree
        PatternFilter patternFilter = new PatternFilter();
        final FilteredTree filter = new FilteredTree(this, selectionStyle, patternFilter);
        final TreeViewer tv = filter.getViewer();
        tv.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
        tv.setContentProvider(new ContentProvider());
        labelProvider = new LabelProvider();
View Full Code Here

        gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
        gridData.grabExcessVerticalSpace = true;
        setLayoutData(gridData);

        // Create the tree viewer to display the file tree
        PatternFilter patternFilter = new PatternFilter();
        final FilteredTree filter = new FilteredTree(this, selectionStyle, patternFilter);
        final TreeViewer tv = filter.getViewer();
        tv.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
        tv.setContentProvider(new ContentProvider());
        labelProvider = new LabelProvider();
View Full Code Here

        gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
        gridData.grabExcessVerticalSpace = true;
        setLayoutData(gridData);

        // Create the tree viewer to display the file tree
        PatternFilter patternFilter = new PatternFilter();
        final FilteredTree filter = new FilteredTree(this, selectionStyle, patternFilter);
        final TreeViewer tv = filter.getViewer();
        tv.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
        tv.setContentProvider(new ContentProvider());
        labelProvider = new LabelProvider();
View Full Code Here

        } catch (IOException e) {
            e.printStackTrace();
        }

        // Create the tree viewer to display the file tree
        PatternFilter patternFilter = new PatternFilter();
        final FilteredTree filter = new FilteredTree(this, selectionStyle, patternFilter, true);
        final TreeViewer tv = filter.getViewer();
        tv.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
        tv.setContentProvider(new MyContentProvider());
        MyLabelProvider labelProvider = new MyLabelProvider();
View Full Code Here

        gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
        gridData.grabExcessVerticalSpace = true;
        setLayoutData(gridData);

        // Create the tree viewer to display the file tree
        PatternFilter patternFilter = new PatternFilter();
        final FilteredTree filter = new FilteredTree(this, selectionStyle, patternFilter);
        final TreeViewer tv = filter.getViewer();
        tv.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
        tv.setContentProvider(new ContentProvider());
        labelProvider = new LabelProvider();
View Full Code Here

        gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
        gridData.grabExcessVerticalSpace = true;
        setLayoutData(gridData);

        // Create the tree viewer to display the file tree
        PatternFilter patternFilter = new PatternFilter();
        final FilteredTree filter = new FilteredTree(this, selectionStyle, patternFilter);
        final TreeViewer tv = filter.getViewer();
        tv.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
        tv.setContentProvider(new ContentProvider());
        labelProvider = new LabelProvider();
View Full Code Here

    }

    private TreeViewer createTreeViewer( Composite modulesComposite ) {

        PatternFilter patternFilter = new PatternFilter();
        final FilteredTree filter = new FilteredTree(modulesComposite, SWT.SINGLE | SWT.BORDER, patternFilter, true);
        final TreeViewer modulesViewer = filter.getViewer();

        Control control = modulesViewer.getControl();
        GridData controlGD = new GridData(SWT.FILL, SWT.FILL, true, true);
View Full Code Here

        } catch (IOException e) {
            e.printStackTrace();
        }

        // Create the tree viewer to display the file tree
        PatternFilter patternFilter = new PatternFilter();
        final FilteredTree filter = new FilteredTree(this, selectionStyle, patternFilter, true);
        final TreeViewer tv = filter.getViewer();
        tv.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
        tv.setContentProvider(new MyContentProvider());
        MyLabelProvider labelProvider = new MyLabelProvider();
View Full Code Here

        Group treeAndButtons = createGroup(sash, "Available pattern types and patterns");
        treeAndButtons.setLayout(new GridLayout());
        treeAndButtons.setLayoutData(new GridData(GridData.FILL_BOTH));

        final PatternFilteredTree tree = new PatternFilteredTree(treeAndButtons, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL
                | SWT.H_SCROLL | SWT.RESIZE, new PatternFilter());
        tree.setLayoutData(new GridData(GridData.FILL_BOTH));

        Composite buttons = new Composite(treeAndButtons, SWT.NONE);
        buttons.setLayout(new GridLayout(3, true));
        buttons.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
View Full Code Here

TOP

Related Classes of org.eclipse.ui.dialogs.PatternFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.