Action () { ActionManager actionManager = ActionManager.getInstance(); if (actionManager == null) return null; AnAction action = actionManager.getAction(IdeActions.ACTION_COPY); if (action == null) return null; return new AbstractAction(action.getTemplatePresentation().getText(), action.getTemplatePresentation().getIcon()) { @Override public void actionPerformed(ActionEvent e) { StringSelection content = new StringSelection(getText()); ClipboardSynchronizer.getInstance().setContent(content, content); } @Override public boolean isEnabled() { return !getText().isEmpty(); } }; }