@Override
  public Object getData(@NonNls String dataId) {
    if (DocumentationManager.SELECTED_QUICK_DOC_TEXT.getName().equals(dataId)) {
      return myEditorPane.getSelectedText();
    }

    return null;
  }
  @Override
  public Object getData(@NonNls String dataId) {
    if (DocumentationManager.SELECTED_QUICK_DOC_TEXT.getName().equals(dataId)) {
      // Javadocs often contain   symbols (non-breakable white space). We don't want to copy
      // them as is and replace
      // with raw white spaces. See IDEA-86633 for more details.
      String selectedText = myEditorPane.getSelectedText();
      return selectedText == null ? null : selectedText.replace((char) 160, ' ');
    }

    return null;
  }
Esempio n. 3
0
  public boolean canDoClipBoardAction(Action action) {
    if (action == GUIPrism.getClipboardPlugin().getPasteAction()) {
      Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
      return (clipboard.getContents(null) != null);
    } else if (action == GUIPrism.getClipboardPlugin().getCutAction()
        || action == GUIPrism.getClipboardPlugin().getCopyAction()
        || action == GUIPrism.getClipboardPlugin().getDeleteAction()) {
      return (editor.getSelectedText() != null);
    } else if (action == GUIPrism.getClipboardPlugin().getSelectAllAction()) {
      return true;
    }

    return handler.canDoClipBoardAction(action);
  }