# HG changeset patch # User Tom Rodriguez # Date 1430521137 25200 # Node ID 8c04132815510bafdae9b19092deb68a8e324277 # Parent 31a1589aecdff05002d52c195c708906b3e403c7 Fixed keybinding for open and save actions in IGV diff -r 31a1589aecdf -r 8c0413281551 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java Wed Apr 29 18:09:41 2015 -0700 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java Fri May 01 15:58:57 2015 -0700 @@ -31,31 +31,45 @@ import com.sun.hotspot.igv.data.serialization.ParseMonitor; import com.sun.hotspot.igv.data.serialization.Parser; import com.sun.hotspot.igv.settings.Settings; -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; +import java.awt.event.ActionEvent; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.nio.channels.FileChannel; import java.nio.file.StandardOpenOption; -import javax.swing.Action; import javax.swing.JFileChooser; -import javax.swing.KeyStroke; import javax.swing.SwingUtilities; import javax.swing.filechooser.FileFilter; import org.netbeans.api.progress.ProgressHandle; import org.netbeans.api.progress.ProgressHandleFactory; import org.openide.util.Exceptions; +import org.openide.util.RequestProcessor; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.awt.ActionRegistration; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; -import org.openide.util.RequestProcessor; -import org.openide.util.actions.CallableSystemAction; +import org.openide.util.actions.SystemAction; /** * * @author Thomas Wuerthinger */ -public final class ImportAction extends CallableSystemAction { + +@ActionID( + category = "File", + id = "com.sun.hotspot.igv.coordinator.actions.ImportAction" +) +@ActionRegistration( + iconBase = "com/sun/hotspot/igv/coordinator/images/import.png", + displayName = "#CTL_ImportAction" +) +@ActionReferences({ + @ActionReference(path = "Menu/File", position = 0), + @ActionReference(path = "Shortcuts", name = "C-O") +}) +public final class ImportAction extends SystemAction { private static final int WORKUNITS = 10000; public static FileFilter getFileFilter() { @@ -74,8 +88,7 @@ } @Override - public void performAction() { - + public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ImportAction.getFileFilter()); fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT))); @@ -151,23 +164,13 @@ return NbBundle.getMessage(ImportAction.class, "CTL_ImportAction"); } - public ImportAction() { - putValue(Action.SHORT_DESCRIPTION, "Open XML graph document..."); - putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK)); - } - @Override protected String iconResource() { return "com/sun/hotspot/igv/coordinator/images/import.png"; } - + @Override public HelpCtx getHelpCtx() { return HelpCtx.DEFAULT_HELP; } - - @Override - protected boolean asynchronous() { - return false; - } } diff -r 31a1589aecdf -r 8c0413281551 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java Wed Apr 29 18:09:41 2015 -0700 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java Fri May 01 15:58:57 2015 -0700 @@ -29,14 +29,30 @@ import java.awt.event.KeyEvent; import javax.swing.Action; import javax.swing.KeyStroke; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.awt.ActionRegistration; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; +import org.openide.util.NbBundle.Messages; import org.openide.util.actions.CallableSystemAction; /** * * @author Thomas Wuerthinger */ +@ActionID( + category = "File", + id = "com.sun.hotspot.igv.coordinator.actions.SaveAllAction" +) +@ActionRegistration( + displayName = "#CTL_SaveAllAction" +) +@ActionReferences({ + @ActionReference(path = "Menu/File", position = 0), + @ActionReference(path = "Shortcuts", name = "C-S") +}) public final class SaveAllAction extends CallableSystemAction { @Override diff -r 31a1589aecdf -r 8c0413281551 src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/layer.xml --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/layer.xml Wed Apr 29 18:09:41 2015 -0700 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/layer.xml Fri May 01 15:58:57 2015 -0700 @@ -18,6 +18,8 @@ + + @@ -43,11 +45,11 @@ - + - +