use of java.awt.datatransfer.StringSelection in project otapij by FellowTraveler.
the class PaymentOutboxDetailsDialog method jButton2ActionPerformed.
// </editor-fold>//GEN-END:initComponents
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_jButton2ActionPerformed
StringSelection fieldContent = new StringSelection(jTextArea1.getText());
getToolkit().getSystemClipboard().setContents(fieldContent, this);
}
use of java.awt.datatransfer.StringSelection in project intellij-community by JetBrains.
the class TestTreeView method performCopy.
@Override
public void performCopy(@NotNull DataContext dataContext) {
final PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
final String fqn;
if (element != null) {
fqn = CopyReferenceAction.elementToFqn(element);
} else {
AbstractTestProxy selectedTest = getSelectedTest();
fqn = selectedTest instanceof TestProxyRoot ? ((TestProxyRoot) selectedTest).getRootLocation() : selectedTest != null ? selectedTest.getLocationUrl() : null;
}
CopyPasteManager.getInstance().setContents(new StringSelection(fqn));
}
use of java.awt.datatransfer.StringSelection in project intellij-community by JetBrains.
the class StatusPanel method createCopyAction.
private Action createCopyAction() {
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();
}
};
}
use of java.awt.datatransfer.StringSelection in project intellij-community by JetBrains.
the class ChangesBrowserNodeCopyProvider method performCopy.
public void performCopy(@NotNull DataContext dataContext) {
List<TreePath> paths = ContainerUtil.sorted(Arrays.asList(ObjectUtils.assertNotNull(myTree.getSelectionPaths())), TreeUtil.getDisplayOrderComparator(myTree));
CopyPasteManager.getInstance().setContents(new StringSelection(StringUtil.join(paths, new Function<TreePath, String>() {
@Override
public String fun(TreePath path) {
Object node = path.getLastPathComponent();
if (node instanceof ChangesBrowserNode) {
return ((ChangesBrowserNode) node).getTextPresentation();
} else {
return node.toString();
}
}
}, "\n")));
}
use of java.awt.datatransfer.StringSelection in project intellij-community by JetBrains.
the class DetailsPanel method performCopy.
@Override
public void performCopy(@NotNull DataContext dataContext) {
String selectedText = getSelectedText();
if (selectedText == null || selectedText.isEmpty())
selectedText = StringUtil.removeHtmlTags(getText());
CopyPasteManager.getInstance().setContents(new StringSelection(selectedText));
}
Aggregations