コード例 #1
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.ui.part.WorkbenchPart#dispose()
  */
 @Override
 public void dispose() {
   if (_listener != null) {
     TransactionManager.instance().removeTransactionManagerListener(_listener);
   }
   super.dispose();
 }
コード例 #2
0
  /**
   * Creates viewer and link it to current session via listeners.
   *
   * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
   */
  @Override
  public void createPartControl(Composite parent) {
    if (parent == null) throw new IllegalArgumentException();
    parent.setLayout(new FillLayout());

    // transaction manager
    ITransactionManager mgr = TransactionManager.instance();

    // viewer
    _viewer = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
    _viewer.setLabelProvider(new TransactionManagerViewLabelProvider());
    _viewer.setContentProvider(new TransactionManagerViewContentProvider());
    _viewer.setInput(mgr);

    // tie viewer to transaction manager
    _listener = new TransactionManagerViewListener(_viewer);
    mgr.addTransactionManagerListener(_listener);

    // apply filters
    TransactionManagerViewConfigurator config = new TransactionManagerViewConfigurator(_viewer);
    config.applyFilters();

    IAction configure = ConfigureWidgetFactory.createAction(config);

    IActionBars actionBars = getViewSite().getActionBars();
    actionBars.getToolBarManager().add(configure);
    actionBars.updateActionBars();
  }