use of java.awt.datatransfer.Clipboard in project netbeans-mmd-plugin by raydac.
the class MMDGraphEditor method registerAsClipboardListener.
private void registerAsClipboardListener() {
final Clipboard clipboard = NbUtils.findClipboard();
if (clipboard instanceof ExClipboard) {
((ExClipboard) clipboard).addClipboardListener(this);
} else {
clipboard.addFlavorListener(this);
}
processClipboardChange(clipboard);
}
use of java.awt.datatransfer.Clipboard in project netbeans-mmd-plugin by raydac.
the class MMDGraphEditor method componentClosed.
@Override
public void componentClosed() {
try {
this.mindMapPanel.dispose();
LOGGER.info("MMD Editor is disposed : " + this.mindMapPanel.toString());
} finally {
final Clipboard clipboard = NbUtils.findClipboard();
if (clipboard instanceof ExClipboard) {
((ExClipboard) clipboard).removeClipboardListener(this);
} else {
clipboard.removeFlavorListener(this);
}
super.componentClosed();
}
}
use of java.awt.datatransfer.Clipboard in project netbeans-mmd-plugin by raydac.
the class NoteEditor method buttonCopyActionPerformed.
// GEN-LAST:event_buttonExportActionPerformed
private void buttonCopyActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_buttonCopyActionPerformed
StringSelection stringSelection = new StringSelection(this.editorPane.getSelectedText());
final Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();
clpbrd.setContents(stringSelection, null);
}
use of java.awt.datatransfer.Clipboard in project netbeans-mmd-plugin by raydac.
the class SourceTextEditor method doCut.
@Override
public boolean doCut() {
boolean result = false;
final String selected = this.editor.getSelectedText();
if (selected != null && !selected.isEmpty()) {
final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(new StringSelection(selected), null);
// NOI18N
this.editor.replaceSelection("");
}
return result;
}
use of java.awt.datatransfer.Clipboard in project netbeans-mmd-plugin by raydac.
the class SourceTextEditor method doCopy.
@Override
public boolean doCopy() {
boolean result = false;
final String selected = this.editor.getSelectedText();
if (selected != null && !selected.isEmpty()) {
final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(new StringSelection(selected), null);
}
return result;
}
Aggregations