Ejemplo n.º 1
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);
    }
  }
Ejemplo n.º 2
0
 private void setViewerWrapperInput(Object input) {
   fWrappedViewer.setViewerInput(input);
 }