@@ -0,0 +1,2546 @@
+package editor.gui.ccp;%0A%0Aimport static java.awt.event.ActionEvent.ACTION_PERFORMED;%0A%0Aimport java.awt.Component;%0Aimport java.awt.event.ActionEvent;%0Aimport java.awt.event.KeyEvent;%0Aimport java.util.function.Supplier;%0A%0Aimport javax.swing.JMenuItem;%0Aimport javax.swing.KeyStroke;%0Aimport javax.swing.TransferHandler;%0A%0A/**%0A * This is a convenience class for creating a set of cut, copy, and paste menu items%0A * with commonly-used keyboard accelerators (Ctrl+X, Ctrl+C, Ctrl+V, respectively)%0A * optionally already installed. The menu text and keyboard accelerators are not%0A * customizable.%0A * %0A * @author Alec Roelke%0A */%0Apublic class CCPItems%0A%7B%0A    /** Cut menu item. */%0A    public final JMenuItem cut;%0A    /** Copy menu item. */%0A    public final JMenuItem copy;%0A    /** Paste menu item. */%0A    public final JMenuItem paste;%0A    %0A    /**%0A     * Create a new set of cut, copy, and paste menu items that allow the reference to the source%0A     * component performing the action to change what it points to over time.%0A     * %0A     * @param source function for getting the component performing the actions%0A     * @param accelerate add keyboard accelerators%0A     */%0A    public CCPItems(Supplier%3C? extends Component%3E source, boolean accelerate)%0A    %7B%0A        cut = new JMenuItem(%22Cut%22);%0A        copy = new JMenuItem(%22Copy%22);%0A        paste = new JMenuItem(%22Paste%22);%0A%0A        cut.addActionListener((e) -%3E TransferHandler.getCutAction().actionPerformed(new ActionEvent(source.get(), ACTION_PERFORMED, null)));%0A        copy.addActionListener((e) -%3E TransferHandler.getCopyAction().actionPerformed(new ActionEvent(source.get(), ACTION_PERFORMED, null)));%0A        paste.addActionListener((e) -%3E TransferHandler.getPasteAction().actionPerformed(new ActionEvent(source.get(), ACTION_PERFORMED, null)));%0A%0A        if (accelerate)%0A        %7B%0A            cut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.CTRL_DOWN_MASK));%0A            copy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK));%0A            paste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK));%0A        %7D%0A    %7D%0A%0A    /**%0A     * Create a new set of cut, copy, and paste menu items with a static source reference%0A     * (i.e. if the reference passed here changes later, these items won't see the change).%0A     * %0A     * @param source component performing the actions%0A     * @param accelerate add keyboard accelerators%0A     */%0A    public CCPItems(Component source, boolean accelerate)%0A    %7B%0A        this(() -%3E source, accelerate);%0A    %7D%0A%7D

Add convenience class for CCP menu items