/*
   * Implementation of method defined on <code>IAction</code>.
   */
  @Override
  public void run() {
    IResourceNavigator navigator = getNavigator();
    ResourcePatternFilter filter = navigator.getPatternFilter();
    FiltersContentProvider contentProvider = new FiltersContentProvider(filter);

    ListSelectionDialog dialog =
        new ListSelectionDialog(
            getShell(),
            getViewer(),
            contentProvider,
            new LabelProvider(),
            FILTER_SELECTION_MESSAGE);

    dialog.setTitle(FILTER_TITLE_MESSAGE);
    dialog.setInitialSelections(contentProvider.getInitialSelections());
    dialog.open();
    if (dialog.getReturnCode() == Window.OK) {
      Object[] results = dialog.getResult();
      String[] selectedPatterns = new String[results.length];
      System.arraycopy(results, 0, selectedPatterns, 0, results.length);
      filter.setPatterns(selectedPatterns);
      navigator.setFiltersPreference(selectedPatterns);
      Viewer viewer = getViewer();
      viewer.getControl().setRedraw(false);
      viewer.refresh();
      viewer.getControl().setRedraw(true);
    }
  }
예제 #2
0
  /*
   * Implementation of method defined on <code>IAction</code>.
   */
  public void run() {
    FiltersContentProvider contentProvider = new FiltersContentProvider();

    ListSelectionDialog dialog =
        new ListSelectionDialog(
            explorer.getSite().getShell(),
            explorer.getTreeViewer(),
            contentProvider,
            new LabelProvider(),
            FILTER_SELECTION_MESSAGE);
    dialog.setTitle(FILTER_TITLE_MESSAGE);
    dialog.setInitialSelections(contentProvider.getInitialSelections());
    dialog.open();
    if (dialog.getReturnCode() == Dialog.OK) {
      Object[] results = dialog.getResult();
      String[] selectedPatterns = new String[results.length];
      System.arraycopy(results, 0, selectedPatterns, 0, results.length);
      contentProvider.setSelections(selectedPatterns);
      Viewer viewer = explorer.getTreeViewer();
      viewer.getControl().setRedraw(false);
      explorer.updateFilters(selectedPatterns);
      viewer.refresh();
      viewer.getControl().setRedraw(true);
    }
  }