@Override
 public boolean canPaste(Clipboard clipboard) {
   Display d = getSection().getDisplay();
   Control c = d.getFocusControl();
   if (c instanceof Text) return true;
   return false;
 }
  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);
  }
Ejemplo n.º 3
0
 @Override
 public boolean canPaste(Clipboard clipboard) {
   Display d = getSection().getDisplay();
   return d.getFocusControl() instanceof Text;
 }