예제 #1
0
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
   */
  @Override
  public void createPartControl(Composite parent) {
    GridLayout gridLayout = new GridLayout(1, true);
    parent.setLayout(gridLayout);
    createTitle(parent);
    stViewer = createAbstractSTViewer(parent);

    // create the actions before the input is set on the viewer but after
    // the sorter and filter are set so the actions will be enabled correctly.
    createActions();

    final MenuManager mgr = initContextMenu();
    final Menu menu = mgr.createContextMenu(parent);
    stViewer.getViewer().getControl().setMenu(menu);

    getSite().registerContextMenu(mgr, stViewer.getViewer());

    // the selection provider registered
    getSite().setSelectionProvider(stViewer.getViewer());

    IActionBars actionBars = getViewSite().getActionBars();

    initMenu(actionBars.getMenuManager());
    initToolBar(actionBars.getToolBarManager());
  }
예제 #2
0
  /**
   * Resort the table based on field.
   *
   * @param column the column being updated
   * @param field
   */
  private void resortTable(final Item column, final ISTDataViewersField field) {
    STDataViewersComparator sorter = stViewer.getTableSorter();

    if (column.equals(sorter.getTopColumn())) {
      sorter.reverseTopPriority();
    } else {
      sorter.setTopPriority(column, field);
    }

    BusyIndicator.showWhile(
        null,
        () -> {
          stViewer.getViewer().refresh();
          stViewer.updateDirectionIndicator(column);
        });
  }
예제 #3
0
 /**
  * Fills the context menu (mouse right-click)
  *
  * <p>Subclasses may extend it. don't forget to call <code>super.fillContextMenu(...)</code>
  *
  * @param manager
  */
 private void fillContextMenu(IMenuManager manager) {
   Control control = stViewer.getViewer().getControl();
   if (control instanceof Tree) {
     Tree tree = (Tree) control;
     TreeItem[] selection = tree.getSelection();
     if (selection != null && selection.length > 0) {
       if (collapseSelectionAction != null) {
         manager.add(collapseSelectionAction);
       }
       if (expandSelectionAction != null) {
         manager.add(expandSelectionAction);
       }
       manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
       if (copyToAction != null) {
         manager.add(copyToAction);
       }
     }
   }
   manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
 }
예제 #4
0
 /**
  * Shortcut for getViewer().setInput(input) See {@link TreeViewer#setInput(Object)}
  *
  * @param input
  */
 public void setInput(Object input) {
   stViewer.getViewer().setInput(input);
 }
예제 #5
0
 /**
  * Return the input of the viewer.
  *
  * @return Object
  */
 public Object getViewerInput() {
   return stViewer.getViewer().getInput();
 }
예제 #6
0
 /**
  * Gets the selection provider.
  *
  * @return the selection provider
  */
 protected ISelectionProvider getSelectionProvider() {
   return stViewer.getViewer();
 }
예제 #7
0
 /**
  * Return the tree for the receiver.
  *
  * @return Control
  */
 public Control getControl() {
   return stViewer.getViewer().getControl();
 }