Search in sources :

Example 56 with Clipboard

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);
}
Also used : Clipboard(java.awt.datatransfer.Clipboard) ExClipboard(org.openide.util.datatransfer.ExClipboard) ExClipboard(org.openide.util.datatransfer.ExClipboard)

Example 57 with 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();
    }
}
Also used : Clipboard(java.awt.datatransfer.Clipboard) ExClipboard(org.openide.util.datatransfer.ExClipboard) ExClipboard(org.openide.util.datatransfer.ExClipboard)

Example 58 with Clipboard

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);
}
Also used : Clipboard(java.awt.datatransfer.Clipboard) StringSelection(java.awt.datatransfer.StringSelection)

Example 59 with Clipboard

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;
}
Also used : Clipboard(java.awt.datatransfer.Clipboard) StringSelection(java.awt.datatransfer.StringSelection)

Example 60 with Clipboard

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;
}
Also used : Clipboard(java.awt.datatransfer.Clipboard) StringSelection(java.awt.datatransfer.StringSelection)

Aggregations

Clipboard (java.awt.datatransfer.Clipboard)181 StringSelection (java.awt.datatransfer.StringSelection)117 Transferable (java.awt.datatransfer.Transferable)44 IOException (java.io.IOException)30 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)16 JDialog (javax.swing.JDialog)12 JOptionPane (javax.swing.JOptionPane)12 ActionEvent (java.awt.event.ActionEvent)11 Flame (org.jwildfire.create.tina.base.Flame)10 ActionListener (java.awt.event.ActionListener)8 JButton (javax.swing.JButton)8 JScrollPane (javax.swing.JScrollPane)8 JMenuItem (javax.swing.JMenuItem)7 JPanel (javax.swing.JPanel)7 JTextArea (javax.swing.JTextArea)7 Foundation (org.concord.energy3d.model.Foundation)7 HousePart (org.concord.energy3d.model.HousePart)7 FlameReader (org.jwildfire.create.tina.io.FlameReader)7 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)7 Point (java.awt.Point)6