コード例 #1
0
  private void createSectionToolbar(Section section, FormToolkit toolkit) {
    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    ToolBar toolbar = toolBarManager.createControl(section);
    final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
    toolbar.setCursor(handCursor);
    // Cursor needs to be explicitly disposed
    toolbar.addDisposeListener(
        new DisposeListener() {
          public void widgetDisposed(DisposeEvent e) {
            if (handCursor.isDisposed() == false) {
              handCursor.dispose();
            }
          }
        });
    fNewPluginAction = new NewPluginAction();
    fNewFragmentAction = new NewFragmentAction();
    toolBarManager.add(fNewPluginAction);
    toolBarManager.add(fNewFragmentAction);

    toolBarManager.update(true);
    section.setTextClient(toolbar);
  }