Exemplo n.º 1
0
 private void createSelectAllAction() {
   IActionBars actionBars = getViewSite().getActionBars();
   if (isInListState()) {
     fSelectAllAction = new SelectAllAction((TableViewer) fWrappedViewer.getViewer());
     actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), fSelectAllAction);
   } else {
     actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), null);
     fSelectAllAction = null;
   }
   actionBars.updateActionBars();
 }
Exemplo n.º 2
0
  private void switchViewer(int state) {
    // Indicate which viewer is to be used
    if (fCurrViewState == state) return;
    else {
      fCurrViewState = state;
      IPreferenceStore store = DLTKUIPlugin.getDefault().getPreferenceStore();
      store.setValue(getViewSite().getId() + TAG_VIEW_STATE, state);
    }

    // get the information from the existing viewer
    StructuredViewer viewer = fWrappedViewer.getViewer();
    Object object = viewer.getInput();
    ISelection selection = viewer.getSelection();

    // create and set up the new viewer
    Control control = createViewer(fWrappedViewer.getControl().getParent()).getControl();

    setUpViewer(fWrappedViewer);

    createSelectAllAction();

    // add the selection information from old viewer
    fWrappedViewer.setViewerInput(object);
    fWrappedViewer.getControl().setFocus();
    fWrappedViewer.setSelection(selection, true);

    // dispose old viewer
    viewer.getContentProvider().dispose();
    viewer.getControl().dispose();

    // layout the new viewer
    if (control != null && !control.isDisposed()) {
      control.setVisible(true);
      control.getParent().layout(true);
    }
  }
Exemplo n.º 3
0
 /**
  * Overrides the createContentProvider from JavaBrowsingPart Creates the content provider of this
  * part.
  */
 protected IContentProvider createContentProvider() {
   if (isInListState()) return new PackagesViewFlatContentProvider(fWrappedViewer.getViewer());
   else return new PackagesViewHierarchicalContentProvider(fWrappedViewer.getViewer());
 }