mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-16 02:43:20 +00:00
8288750: IGV: Improve Shortcuts
Reviewed-by: chagedorn, thartmann
This commit is contained in:
parent
210a06a287
commit
be6be15efa
@ -28,6 +28,7 @@ import java.awt.event.MouseEvent;
|
||||
import org.netbeans.api.visual.action.SelectProvider;
|
||||
import org.netbeans.api.visual.action.WidgetAction;
|
||||
import org.netbeans.api.visual.widget.Widget;
|
||||
import org.openide.util.Utilities;
|
||||
|
||||
/**
|
||||
* Selection action that acts on double-click only. Does not support aiming.
|
||||
@ -42,6 +43,10 @@ public class DoubleClickSelectAction extends WidgetAction.LockedAdapter {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
protected int getModifierMask () {
|
||||
return Utilities.isMac() ? MouseEvent.META_DOWN_MASK : MouseEvent.CTRL_DOWN_MASK;
|
||||
}
|
||||
|
||||
protected boolean isLocked() {
|
||||
return false;
|
||||
}
|
||||
@ -49,7 +54,7 @@ public class DoubleClickSelectAction extends WidgetAction.LockedAdapter {
|
||||
@Override
|
||||
public State mousePressed(Widget widget, WidgetMouseEvent event) {
|
||||
if (event.getClickCount() >= 2 && (event.getButton() == MouseEvent.BUTTON1 || event.getButton() == MouseEvent.BUTTON2)) {
|
||||
boolean invert = (event.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) != 0;
|
||||
boolean invert = (event.getModifiersEx() & getModifierMask()) != 0;
|
||||
Point point = event.getPoint();
|
||||
if (provider.isSelectionAllowed(widget, point, invert)) {
|
||||
provider.select(widget, point, invert);
|
||||
|
||||
@ -42,36 +42,22 @@ import java.util.logging.Logger;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import javax.swing.Action;
|
||||
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.actions.SystemAction;
|
||||
import org.openide.util.actions.CallableSystemAction;
|
||||
import org.openide.util.Utilities;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Thomas Wuerthinger
|
||||
*/
|
||||
|
||||
@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 {
|
||||
public final class ImportAction extends CallableSystemAction {
|
||||
private static final int WORKUNITS = 10000;
|
||||
|
||||
public static FileFilter getFileFilter() {
|
||||
@ -90,7 +76,7 @@ public final class ImportAction extends SystemAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
public void performAction() {
|
||||
JFileChooser fc = new JFileChooser();
|
||||
fc.setFileFilter(ImportAction.getFileFilter());
|
||||
fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT)));
|
||||
@ -170,13 +156,24 @@ public final class ImportAction extends SystemAction {
|
||||
return NbBundle.getMessage(ImportAction.class, "CTL_ImportAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String iconResource() {
|
||||
return "com/sun/hotspot/igv/coordinator/images/import.png";
|
||||
public ImportAction() {
|
||||
putValue(Action.SHORT_DESCRIPTION, "Open");
|
||||
// D is the Control key on most platforms, the Command (meta) key on Macintosh
|
||||
putValue(Action.ACCELERATOR_KEY, Utilities.stringToKey("D-O"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpCtx getHelpCtx() {
|
||||
return HelpCtx.DEFAULT_HELP;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean asynchronous() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String iconResource() {
|
||||
return "com/sun/hotspot/igv/coordinator/images/import.png";
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ public final class RemoveAction extends NodeAction {
|
||||
}
|
||||
|
||||
public RemoveAction() {
|
||||
putValue(Action.SHORT_DESCRIPTION, "Remove selected graphs and groups");
|
||||
putValue(Action.SHORT_DESCRIPTION, getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -39,7 +39,6 @@ import org.openide.util.actions.CallableSystemAction;
|
||||
*/
|
||||
public final class RemoveAllAction extends CallableSystemAction {
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return NbBundle.getMessage(RemoveAllAction.class, "CTL_RemoveAllAction");
|
||||
@ -47,7 +46,6 @@ public final class RemoveAllAction extends CallableSystemAction {
|
||||
|
||||
public RemoveAllAction() {
|
||||
putValue(Action.SHORT_DESCRIPTION, "Remove all graphs and groups");
|
||||
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_SHIFT, InputEvent.CTRL_MASK));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -29,30 +29,17 @@ import java.awt.event.InputEvent;
|
||||
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;
|
||||
import org.openide.util.Utilities;
|
||||
|
||||
/**
|
||||
*
|
||||
* @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
|
||||
@ -68,7 +55,8 @@ public final class SaveAllAction extends CallableSystemAction {
|
||||
|
||||
public SaveAllAction() {
|
||||
putValue(Action.SHORT_DESCRIPTION, "Save all groups to XML file...");
|
||||
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));
|
||||
// D is the Control key on most platforms, the Command (meta) key on Macintosh
|
||||
putValue(Action.ACCELERATOR_KEY, Utilities.stringToKey("D-S"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,16 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
|
||||
<filesystem>
|
||||
<folder name="Shortcuts">
|
||||
<file name="D-Z.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-UndoAction.instance"/>
|
||||
</file>
|
||||
<file name="DS-Z.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-RedoAction.instance"/>
|
||||
</file>
|
||||
<file name="D-Y.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-RedoAction.instance"/>
|
||||
</file>
|
||||
<file name="D-BACK_SPACE.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/File/com-sun-hotspot-igv-coordinator-actions-RemoveAction.instance"/>
|
||||
</file>
|
||||
<file name="D-DELETE.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/File/com-sun-hotspot-igv-coordinator-actions-RemoveAction.instance"/>
|
||||
</file>
|
||||
<file name="DS-W.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/File/com-sun-hotspot-igv-coordinator-actions-RemoveAllAction.instance"/>
|
||||
</file>
|
||||
</folder>
|
||||
<folder name="Actions">
|
||||
<folder name="File">
|
||||
<file name="com-sun-hotspot-igv-coordinator-actions-SaveAsAction.instance"/>
|
||||
<file name="com-sun-hotspot-igv-coordinator-actions-SaveAllAction.instance"/>
|
||||
<file name="com-sun-hotspot-igv-coordinator-actions-ImportAction.instance"/>
|
||||
</folder>
|
||||
<folder name="Edit">
|
||||
<file name="com-sun-hotspot-igv-coordinator-actions-RemoveAction.instance"/>
|
||||
<file name="com-sun-hotspot-igv-coordinator-actions-RemoveAllAction.instance"/>
|
||||
</folder>
|
||||
<folder name="Edit">
|
||||
<file name="org-openide-actions-UndoAction.instance">
|
||||
<attr name="instanceCreate" methodvalue="org.openide.actions.UndoRedoAction.create"/>
|
||||
<attr name="undo" boolvalue="true"/>
|
||||
</file>
|
||||
<file name="org-openide-actions-RedoAction.instance">
|
||||
<attr name="instanceCreate" methodvalue="org.openide.actions.UndoRedoAction.create"/>
|
||||
<attr name="redo" boolvalue="true"/>
|
||||
</file>
|
||||
</folder>
|
||||
<folder name="Window">
|
||||
<file name="com-sun-hotspot-igv-coordinator-actions-OutlineAction.instance"/>
|
||||
</folder>
|
||||
@ -44,14 +72,13 @@
|
||||
<attr name="position" intvalue="350"/>
|
||||
</file>
|
||||
<file name="com-sun-hotspot-igv-coordinator-actions-RemoveAction.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/Edit/com-sun-hotspot-igv-coordinator-actions-RemoveAction.instance"/>
|
||||
<attr name="originalFile" stringvalue="Actions/File/com-sun-hotspot-igv-coordinator-actions-RemoveAction.instance"/>
|
||||
<attr name="position" intvalue="400"/>
|
||||
</file>
|
||||
<file name="com-sun-hotspot-igv-coordinator-actions-RemoveAllAction.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/Edit/com-sun-hotspot-igv-coordinator-actions-RemoveAllAction.instance"/>
|
||||
<attr name="originalFile" stringvalue="Actions/File/com-sun-hotspot-igv-coordinator-actions-RemoveAllAction.instance"/>
|
||||
<attr name="position" intvalue="500"/>
|
||||
</file>
|
||||
|
||||
<!-- Hidden menu entries from other modules -->
|
||||
<file name="org-netbeans-modules-editor-ExportHtmlAction.shadow_hidden"/>
|
||||
<file name="org-netbeans-modules-openfile-OpenFileAction.shadow_hidden"/>
|
||||
@ -71,6 +98,14 @@
|
||||
</folder>
|
||||
|
||||
<folder name="Edit">
|
||||
<file name="org-openide-actions-UndoAction.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-UndoAction.instance"/>
|
||||
<attr name="position" intvalue="100"/>
|
||||
</file>
|
||||
<file name="org-openide-actions-RedoAction.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-RedoAction.instance"/>
|
||||
<attr name="position" intvalue="150"/>
|
||||
</file>
|
||||
<!-- Hidden menu entries from other modules -->
|
||||
<file name="Separator1.instance_hidden"/>
|
||||
<file name="Separator2.instance_hidden"/>
|
||||
@ -104,6 +139,7 @@
|
||||
<file name="org-netbeans-core-actions-LogAction.shadow_hidden"/>
|
||||
<file name="org-netbeans-core-multiview-EditorsAction.instance_hidden"/>
|
||||
<file name="org-netbeans-core-windows-actions-ToolbarsListAction.instance_hidden"/>
|
||||
<file name="org-netbeans-core-windows-actions-ToolbarsListAction.shadow_hidden"/>
|
||||
<file name="org-netbeans-modules-editor-NbCodeFoldingAction.instance_hidden"/>
|
||||
<file name="org-netbeans-modules-project-ui-SyncEditorWithViewsAction.shadow_hidden"/>
|
||||
<file name="org-netbeans-modules-versioning-ShowTextAnnotationsAction.shadow_hidden"/>
|
||||
@ -114,34 +150,21 @@
|
||||
</folder>
|
||||
|
||||
<!-- Hidden menus -->
|
||||
<folder name="Tools_hidden"/>
|
||||
<folder name="GoTo_hidden"/>
|
||||
<folder name="Source_hidden"/>
|
||||
<folder name="Refactoring_hidden"/>
|
||||
<folder name="BuildProject_hidden"/>
|
||||
<folder name="RunProject_hidden"/>
|
||||
<folder name="Versioning_hidden"/>
|
||||
|
||||
<folder name="Tools">
|
||||
<!-- Hidden menu entries from other modules -->
|
||||
<file name="LibrariesCustomizerAction.shadow_hidden"/>
|
||||
<file name="PaletteManager_hidden"/>
|
||||
<file name="Separator1.instance_hidden"/>
|
||||
<file name="Separator2.instance_hidden"/>
|
||||
<file name="ServerManagerAction3.shadow_hidden"/>
|
||||
<file name="VariablesCustomizerAction.shadow_hidden"/>
|
||||
<file name="org-netbeans-modules-autoupdate-ui-actions-PluginManagerAction.shadow_hidden"/>
|
||||
<file name="org-netbeans-modules-templates-actions-TemplatesAction.shadow_hidden"/>
|
||||
<file name="org-netbeans-modules-options-OptionsWindowAction-separatorBefore.instance_hidden"/>
|
||||
<file name="org-netbeans-modules-xml-catalog-CatalogAction.shadow_hidden"/>
|
||||
<file name="org-openide-actions-ToolsAction.shadow_hidden"/>
|
||||
</folder>
|
||||
|
||||
|
||||
<folder name="Window">
|
||||
<file name="OutlineAction.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/Window/com-sun-hotspot-igv-coordinator-actions-OutlineAction.instance"/>
|
||||
</file>
|
||||
|
||||
<!-- Hidden menu entries from other modules -->
|
||||
<file name="Web_hidden"/>
|
||||
<file name="org-netbeans-modules-tasks-ui-DashboardTopComponent.shadow_hidden"/>
|
||||
<file name="Debug_hidden"/>
|
||||
<file name="Navigator_hidden"/>
|
||||
<file name="Other_hidden"/>
|
||||
|
||||
@ -49,11 +49,6 @@ public final class NewFilterAction extends CallableSystemAction {
|
||||
return NbBundle.getMessage(SaveFilterSettingsAction.class, "CTL_NewFilterAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
super.initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpCtx getHelpCtx() {
|
||||
return HelpCtx.DEFAULT_HELP;
|
||||
|
||||
@ -49,11 +49,6 @@ public final class RemoveFilterSettingsAction extends CallableSystemAction {
|
||||
putValue(Action.SHORT_DESCRIPTION, "Delete current filter profile");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
super.initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpCtx getHelpCtx() {
|
||||
return HelpCtx.DEFAULT_HELP;
|
||||
|
||||
@ -45,11 +45,6 @@ public final class SaveFilterSettingsAction extends CallableSystemAction {
|
||||
return NbBundle.getMessage(SaveFilterSettingsAction.class, "CTL_SaveFilterSettingsAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
super.initialize();
|
||||
}
|
||||
|
||||
public SaveFilterSettingsAction() {
|
||||
putValue(Action.SHORT_DESCRIPTION, "Save filter configuration as profile...");
|
||||
}
|
||||
|
||||
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
package com.sun.hotspot.igv.util;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.JPanel;
|
||||
import org.netbeans.api.visual.action.ActionFactory;
|
||||
import org.netbeans.api.visual.action.SelectProvider;
|
||||
import org.netbeans.api.visual.action.WidgetAction;
|
||||
import org.netbeans.api.visual.action.WidgetAction.State;
|
||||
import org.netbeans.api.visual.action.WidgetAction.WidgetKeyEvent;
|
||||
import org.netbeans.api.visual.action.WidgetAction.WidgetMouseEvent;
|
||||
import org.netbeans.api.visual.widget.Widget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Thomas Wuerthinger
|
||||
*/
|
||||
public class ExtendedSelectAction extends WidgetAction.Adapter {
|
||||
|
||||
private WidgetAction innerAction;
|
||||
private JPanel panel;
|
||||
|
||||
public ExtendedSelectAction(SelectProvider provider) {
|
||||
innerAction = ActionFactory.createSelectAction(provider);
|
||||
panel = new JPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public State mousePressed(Widget widget, WidgetMouseEvent event) {
|
||||
// TODO: Solve this differently?
|
||||
if (event.getButton() != MouseEvent.BUTTON2) {
|
||||
return innerAction.mousePressed(widget, new WidgetMouseEvent(event.getEventID(), new MouseEvent(panel, (int) event.getEventID(), event.getWhen(), event.getModifiersEx(), event.getPoint().x, event.getPoint().y, event.getClickCount(), event.isPopupTrigger(), MouseEvent.BUTTON1)));
|
||||
} else {
|
||||
return super.mousePressed(widget, event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public State mouseReleased(Widget widget, WidgetMouseEvent event) {
|
||||
return innerAction.mouseReleased(widget, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public State keyTyped(Widget widget, WidgetKeyEvent event) {
|
||||
return innerAction.keyTyped(widget, event);
|
||||
}
|
||||
}
|
||||
@ -37,11 +37,13 @@ import com.sun.hotspot.igv.hierarchicallayout.LinearLayoutManager;
|
||||
import com.sun.hotspot.igv.hierarchicallayout.HierarchicalLayoutManager;
|
||||
import com.sun.hotspot.igv.layout.LayoutGraph;
|
||||
import com.sun.hotspot.igv.layout.Link;
|
||||
import com.sun.hotspot.igv.selectioncoordinator.SelectionCoordinator;
|
||||
import com.sun.hotspot.igv.selectioncoordinator.*;
|
||||
import com.sun.hotspot.igv.util.ColorIcon;
|
||||
import com.sun.hotspot.igv.util.CustomSelectAction;
|
||||
import com.sun.hotspot.igv.util.DoubleClickAction;
|
||||
import com.sun.hotspot.igv.util.PropertiesSheet;
|
||||
import com.sun.hotspot.igv.view.actions.CustomizablePanAction;
|
||||
import com.sun.hotspot.igv.view.EditorTopComponent;
|
||||
import com.sun.hotspot.igv.view.widgets.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
@ -65,6 +67,7 @@ import org.openide.nodes.Sheet;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.util.lookup.AbstractLookup;
|
||||
import org.openide.util.lookup.InstanceContent;
|
||||
import org.openide.util.Utilities;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -406,7 +409,33 @@ public class DiagramScene extends ObjectScene implements DiagramViewer {
|
||||
panAction = new CustomizablePanAction(~0, MouseEvent.BUTTON1_DOWN_MASK);
|
||||
this.getActions().addAction(panAction);
|
||||
|
||||
selectAction = createSelectAction();
|
||||
selectAction = new CustomSelectAction(new SelectProvider() {
|
||||
public boolean isAimingAllowed(Widget widget, Point localLocation, boolean invertSelection) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSelectionAllowed(Widget widget, Point localLocation, boolean invertSelection) {
|
||||
return findObject(widget) != null;
|
||||
}
|
||||
|
||||
public void select(Widget widget, Point localLocation, boolean invertSelection) {
|
||||
EditorTopComponent editor = EditorTopComponent.getActive();
|
||||
if (editor != null) {
|
||||
editor.requestActive();
|
||||
}
|
||||
Object object = findObject(widget);
|
||||
setFocusedObject(object);
|
||||
if (object != null) {
|
||||
if (!invertSelection && getSelectedObjects().contains(object)) {
|
||||
return;
|
||||
}
|
||||
userSelectionSuggested(Collections.singleton(object), invertSelection);
|
||||
} else {
|
||||
userSelectionSuggested(Collections.emptySet(), invertSelection);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.getActions().addAction(selectAction);
|
||||
|
||||
blockLayer = new LayerWidget(this);
|
||||
@ -431,7 +460,7 @@ public class DiagramScene extends ObjectScene implements DiagramViewer {
|
||||
|
||||
this.setLayout(LayoutFactory.createAbsoluteLayout());
|
||||
|
||||
this.getInputBindings().setZoomActionModifiers(KeyEvent.CTRL_MASK);
|
||||
this.getInputBindings().setZoomActionModifiers(Utilities.isMac() ? KeyEvent.META_MASK : KeyEvent.CTRL_MASK);
|
||||
zoomAction = ActionFactory.createMouseCenteredZoomAction(1.2);
|
||||
this.getActions().addAction(zoomAction);
|
||||
this.getView().addMouseWheelListener(mouseWheelListener);
|
||||
|
||||
@ -42,6 +42,7 @@ import com.sun.hotspot.igv.util.RangeSlider;
|
||||
import com.sun.hotspot.igv.settings.Settings;
|
||||
import com.sun.hotspot.igv.view.actions.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.HierarchyBoundsListener;
|
||||
import java.awt.event.HierarchyEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
@ -91,6 +92,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
public final class EditorTopComponent extends TopComponent implements PropertyChangeListener {
|
||||
|
||||
private DiagramViewer scene;
|
||||
private Toolbar toolBar;
|
||||
private InstanceContent content;
|
||||
private InstanceContent graphContent;
|
||||
private EnableSeaLayoutAction seaLayoutAction;
|
||||
@ -109,6 +111,16 @@ public final class EditorTopComponent extends TopComponent implements PropertyCh
|
||||
private RangeSlider rangeSlider;
|
||||
private JToggleButton overviewButton;
|
||||
private JToggleButton hideDuplicatesButton;
|
||||
|
||||
private static final Component quicksearch;
|
||||
static {
|
||||
Action searchAction = Utilities.actionsForPath("Actions/Search").get(0);
|
||||
quicksearch = ((Presenter.Toolbar) searchAction).getToolbarPresenter();
|
||||
Dimension preferredSize = quicksearch.getPreferredSize();
|
||||
preferredSize = new Dimension((int) preferredSize.getWidth() * 2, (int) preferredSize.getHeight());
|
||||
quicksearch.setMinimumSize(preferredSize); // necessary for GTK LAF
|
||||
quicksearch.setPreferredSize(preferredSize);
|
||||
}
|
||||
private static final String PREFERRED_ID = "EditorTopComponent";
|
||||
private static final String SATELLITE_STRING = "satellite";
|
||||
private static final String SCENE_STRING = "scene";
|
||||
@ -171,30 +183,33 @@ public final class EditorTopComponent extends TopComponent implements PropertyCh
|
||||
setToolTipText(NbBundle.getMessage(EditorTopComponent.class, "HINT_EditorTopComponent"));
|
||||
|
||||
Action[] actions = new Action[]{
|
||||
PrevDiagramAction.get(PrevDiagramAction.class),
|
||||
NextDiagramAction.get(NextDiagramAction.class),
|
||||
null,
|
||||
ExtractAction.get(ExtractAction.class),
|
||||
ShowAllAction.get(HideAction.class),
|
||||
ShowAllAction.get(ShowAllAction.class),
|
||||
null,
|
||||
ZoomInAction.get(ZoomInAction.class),
|
||||
ZoomOutAction.get(ZoomOutAction.class),
|
||||
PrevDiagramAction.get(PrevDiagramAction.class),
|
||||
NextDiagramAction.get(NextDiagramAction.class),
|
||||
null,
|
||||
ShrinkDiffAction.get(ShrinkDiffAction.class),
|
||||
ExpandDiffAction.get(ExpandDiffAction.class),
|
||||
null,
|
||||
ExtractAction.get(ExtractAction.class),
|
||||
ShowAllAction.get(HideAction.class),
|
||||
ShowAllAction.get(ShowAllAction.class),
|
||||
null,
|
||||
ZoomOutAction.get(ZoomOutAction.class),
|
||||
ZoomInAction.get(ZoomInAction.class),
|
||||
};
|
||||
|
||||
|
||||
Action[] actionsWithSelection = new Action[]{
|
||||
ExtractAction.get(ExtractAction.class),
|
||||
ShowAllAction.get(HideAction.class),
|
||||
null,
|
||||
ExpandPredecessorsAction.get(ExpandPredecessorsAction.class),
|
||||
ExpandSuccessorsAction.get(ExpandSuccessorsAction.class)
|
||||
ExtractAction.get(ExtractAction.class),
|
||||
ShowAllAction.get(HideAction.class),
|
||||
null,
|
||||
ExpandPredecessorsAction.get(ExpandPredecessorsAction.class),
|
||||
ExpandSuccessorsAction.get(ExpandSuccessorsAction.class)
|
||||
};
|
||||
|
||||
initComponents();
|
||||
|
||||
ToolbarPool.getDefault().setPreferredIconSize(16);
|
||||
Toolbar toolBar = new Toolbar();
|
||||
toolBar = new Toolbar();
|
||||
Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
|
||||
toolBar.setBorder(b);
|
||||
JPanel container = new JPanel();
|
||||
@ -233,15 +248,18 @@ public final class EditorTopComponent extends TopComponent implements PropertyCh
|
||||
doc.getChangedEvent().addListener(d -> closeOnRemovedOrEmptyGroup());
|
||||
}
|
||||
|
||||
toolBar.add(NextDiagramAction.get(NextDiagramAction.class));
|
||||
toolBar.add(PrevDiagramAction.get(PrevDiagramAction.class));
|
||||
toolBar.add(NextDiagramAction.get(NextDiagramAction.class));
|
||||
toolBar.addSeparator();
|
||||
toolBar.add(ShrinkDiffAction.get(ShrinkDiffAction.class));
|
||||
toolBar.add(ExpandDiffAction.get(ExpandDiffAction.class));
|
||||
toolBar.addSeparator();
|
||||
toolBar.add(ExtractAction.get(ExtractAction.class));
|
||||
toolBar.add(ShowAllAction.get(HideAction.class));
|
||||
toolBar.add(ShowAllAction.get(ShowAllAction.class));
|
||||
toolBar.addSeparator();
|
||||
toolBar.add(ShowAllAction.get(ZoomInAction.class));
|
||||
toolBar.add(ShowAllAction.get(ZoomOutAction.class));
|
||||
toolBar.add(ShowAllAction.get(ZoomInAction.class));
|
||||
|
||||
toolBar.addSeparator();
|
||||
ButtonGroup layoutButtons = new ButtonGroup();
|
||||
@ -294,8 +312,12 @@ public final class EditorTopComponent extends TopComponent implements PropertyCh
|
||||
hideDuplicatesAction.addPropertyChangeListener(this);
|
||||
|
||||
toolBar.addSeparator();
|
||||
toolBar.add(UndoAction.get(UndoAction.class));
|
||||
toolBar.add(RedoAction.get(RedoAction.class));
|
||||
UndoAction undoAction = UndoAction.get(UndoAction.class);
|
||||
undoAction.putValue(Action.SHORT_DESCRIPTION, "Undo");
|
||||
toolBar.add(undoAction);
|
||||
RedoAction redoAction = RedoAction.get(RedoAction.class);
|
||||
redoAction.putValue(Action.SHORT_DESCRIPTION, "Redo");
|
||||
toolBar.add(redoAction);
|
||||
|
||||
toolBar.addSeparator();
|
||||
ButtonGroup interactionButtons = new ButtonGroup();
|
||||
@ -315,20 +337,30 @@ public final class EditorTopComponent extends TopComponent implements PropertyCh
|
||||
selectionModeAction.addPropertyChangeListener(this);
|
||||
|
||||
toolBar.add(Box.createHorizontalGlue());
|
||||
Action action = Utilities.actionsForPath("QuickSearchShadow").get(0);
|
||||
Component quicksearch = ((Presenter.Toolbar) action).getToolbarPresenter();
|
||||
try {
|
||||
// (aw) workaround for disappearing search bar due to reparenting one shared component instance.
|
||||
quicksearch = (Component) quicksearch.getClass().getConstructor(KeyStroke.class).newInstance(new Object[]{null});
|
||||
} catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) {
|
||||
}
|
||||
Dimension preferredSize = quicksearch.getPreferredSize();
|
||||
preferredSize = new Dimension((int) preferredSize.getWidth() * 2, (int) preferredSize.getHeight());
|
||||
quicksearch.setMinimumSize(preferredSize); // necessary for GTK LAF
|
||||
quicksearch.setPreferredSize(preferredSize);
|
||||
toolBar.add(quicksearch);
|
||||
|
||||
centerPanel = new JPanel();
|
||||
centerPanel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_S, 0, false), "showSatellite");
|
||||
centerPanel.getActionMap().put("showSatellite",
|
||||
new AbstractAction("showSatellite") {
|
||||
@Override public void actionPerformed(ActionEvent e) {
|
||||
EditorTopComponent.this.overviewButton.setSelected(true);
|
||||
EditorTopComponent.this.overviewAction.setState(true);
|
||||
}
|
||||
});
|
||||
centerPanel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_S, 0, true), "showScene");
|
||||
centerPanel.getActionMap().put("showScene",
|
||||
new AbstractAction("showScene") {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
EditorTopComponent.this.overviewButton.setSelected(false);
|
||||
EditorTopComponent.this.overviewAction.setState(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.add(centerPanel, BorderLayout.CENTER);
|
||||
cardLayout = new CardLayout();
|
||||
centerPanel.setLayout(cardLayout);
|
||||
@ -338,9 +370,6 @@ public final class EditorTopComponent extends TopComponent implements PropertyCh
|
||||
satelliteComponent.setSize(200, 200);
|
||||
centerPanel.add(SATELLITE_STRING, satelliteComponent);
|
||||
|
||||
// TODO: Fix the hot key for entering the satellite view
|
||||
this.addKeyListener(keyListener);
|
||||
|
||||
scene.getComponent().addHierarchyBoundsListener(new HierarchyBoundsListener() {
|
||||
|
||||
@Override
|
||||
@ -368,28 +397,6 @@ public final class EditorTopComponent extends TopComponent implements PropertyCh
|
||||
|
||||
updateDisplayName();
|
||||
}
|
||||
private KeyListener keyListener = new KeyListener() {
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_S) {
|
||||
EditorTopComponent.this.overviewButton.setSelected(true);
|
||||
EditorTopComponent.this.overviewAction.setState(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_S) {
|
||||
EditorTopComponent.this.overviewButton.setSelected(false);
|
||||
EditorTopComponent.this.overviewAction.setState(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public DiagramViewModel getDiagramModel() {
|
||||
return rangeSliderModel;
|
||||
@ -661,6 +668,7 @@ public final class EditorTopComponent extends TopComponent implements PropertyCh
|
||||
|
||||
@Override
|
||||
protected void componentShowing() {
|
||||
toolBar.add(quicksearch);
|
||||
super.componentShowing();
|
||||
scene.componentShowing();
|
||||
}
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
package com.sun.hotspot.igv.util;
|
||||
|
||||
import org.netbeans.api.visual.widget.Widget;
|
||||
import org.netbeans.api.visual.action.WidgetAction;
|
||||
import org.netbeans.api.visual.action.SelectProvider;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Tobias Holenstein
|
||||
*/
|
||||
public class CustomSelectAction extends WidgetAction.LockedAdapter {
|
||||
|
||||
private final SelectProvider provider;
|
||||
|
||||
public CustomSelectAction(SelectProvider provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
protected boolean isLocked() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected int getModifierMask() {
|
||||
return org.openide.util.Utilities.isMac() ? MouseEvent.META_DOWN_MASK : MouseEvent.CTRL_DOWN_MASK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public State mousePressed(Widget widget, WidgetMouseEvent event) {
|
||||
Point localLocation = event.getPoint();
|
||||
if (event.getButton() == MouseEvent.BUTTON1 || event.getButton() == MouseEvent.BUTTON2) {
|
||||
boolean invertSelection = (event.getModifiersEx() & getModifierMask()) != 0;
|
||||
if (provider.isSelectionAllowed(widget, localLocation, invertSelection)) {
|
||||
provider.select(widget, localLocation, invertSelection);
|
||||
return State.CHAIN_ONLY;
|
||||
}
|
||||
}
|
||||
return State.REJECTED;
|
||||
}
|
||||
|
||||
}
|
||||
@ -43,6 +43,7 @@
|
||||
*/
|
||||
package com.sun.hotspot.igv.view.actions;
|
||||
|
||||
import com.sun.hotspot.igv.view.EditorTopComponent;
|
||||
import java.awt.Container;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
@ -90,6 +91,10 @@ public class CustomizablePanAction extends WidgetAction.LockedAdapter {
|
||||
|
||||
@Override
|
||||
public State mousePressed (Widget widget, WidgetMouseEvent event) {
|
||||
EditorTopComponent editor = EditorTopComponent.getActive();
|
||||
if (editor != null) {
|
||||
editor.requestActive();
|
||||
}
|
||||
if (isLocked ())
|
||||
return State.createLocked (widget, this);
|
||||
if (enabled && (event.getModifiersEx() & modifiersExMask) == modifiersEx) {
|
||||
|
||||
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
package com.sun.hotspot.igv.view.actions;
|
||||
|
||||
import com.sun.hotspot.igv.data.ChangedListener;
|
||||
import com.sun.hotspot.igv.util.ContextAction;
|
||||
import com.sun.hotspot.igv.view.DiagramViewModel;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.ImageIcon;
|
||||
import org.openide.util.*;
|
||||
|
||||
public final class ExpandDiffAction extends ContextAction<DiagramViewModel> implements ChangedListener<DiagramViewModel> {
|
||||
|
||||
private DiagramViewModel model;
|
||||
|
||||
public ExpandDiffAction() {
|
||||
putValue(Action.SHORT_DESCRIPTION, "Expand the difference selection");
|
||||
putValue(Action.SMALL_ICON, new ImageIcon(ImageUtilities.loadImage("com/sun/hotspot/igv/view/images/expand_right.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return NbBundle.getMessage(ExpandDiffAction.class, "CTL_ExpandDiffAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpCtx getHelpCtx() {
|
||||
return HelpCtx.DEFAULT_HELP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<DiagramViewModel> contextClass() {
|
||||
return DiagramViewModel.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performAction(DiagramViewModel model) {
|
||||
if (model.getSecondPosition() != model.getPositions().size() - 1) {
|
||||
model.setPositions(model.getFirstPosition(), model.getSecondPosition() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DiagramViewModel model) {
|
||||
super.update(model);
|
||||
|
||||
if (this.model != model) {
|
||||
if (this.model != null) {
|
||||
this.model.getDiagramChangedEvent().removeListener(this);
|
||||
}
|
||||
|
||||
this.model = model;
|
||||
if (this.model != null) {
|
||||
this.model.getDiagramChangedEvent().addListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(DiagramViewModel model) {
|
||||
return model.getSecondPosition() != model.getPositions().size() - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Action createContextAwareInstance(Lookup arg0) {
|
||||
return new ExpandDiffAction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changed(DiagramViewModel source) {
|
||||
update(source);
|
||||
}
|
||||
}
|
||||
@ -46,11 +46,6 @@ public final class ExpandPredecessorsAction extends CallableSystemAction {
|
||||
return "Expand Above";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
super.initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpCtx getHelpCtx() {
|
||||
return HelpCtx.DEFAULT_HELP;
|
||||
|
||||
@ -46,11 +46,6 @@ public final class ExpandSuccessorsAction extends CallableSystemAction {
|
||||
return "Expand Below";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
super.initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpCtx getHelpCtx() {
|
||||
return HelpCtx.DEFAULT_HELP;
|
||||
|
||||
@ -34,6 +34,7 @@ import javax.swing.KeyStroke;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import org.openide.util.*;
|
||||
import org.openide.util.actions.CallableSystemAction;
|
||||
import org.openide.util.Utilities;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -46,7 +47,8 @@ public final class ExportAction extends CallableSystemAction implements LookupLi
|
||||
|
||||
public ExportAction() {
|
||||
putValue(Action.SHORT_DESCRIPTION, "Export current graph as image file");
|
||||
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK));
|
||||
// D is the Control key on most platforms, the Command (meta) key on Macintosh
|
||||
putValue(Action.ACCELERATOR_KEY, Utilities.stringToKey("D-E"));
|
||||
lookup = Utilities.actionsGlobalContext();
|
||||
result = lookup.lookup(new Lookup.Template<>(ExportCookie.class));
|
||||
result.addLookupListener(this);
|
||||
|
||||
@ -30,6 +30,7 @@ import javax.swing.Action;
|
||||
import javax.swing.KeyStroke;
|
||||
import org.openide.util.HelpCtx;
|
||||
import org.openide.util.actions.CallableSystemAction;
|
||||
import org.openide.util.Utilities;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -47,7 +48,8 @@ public final class ExtractAction extends CallableSystemAction {
|
||||
|
||||
public ExtractAction() {
|
||||
putValue(Action.SHORT_DESCRIPTION, "Extract current set of selected nodes");
|
||||
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.CTRL_MASK, false));
|
||||
// D is the Control key on most platforms, the Command (meta) key on Macintosh
|
||||
putValue(Action.ACCELERATOR_KEY, Utilities.stringToKey("D-X"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -55,11 +57,6 @@ public final class ExtractAction extends CallableSystemAction {
|
||||
return "Extract action";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
super.initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpCtx getHelpCtx() {
|
||||
return HelpCtx.DEFAULT_HELP;
|
||||
|
||||
@ -30,6 +30,7 @@ import javax.swing.Action;
|
||||
import javax.swing.KeyStroke;
|
||||
import org.openide.util.HelpCtx;
|
||||
import org.openide.util.actions.CallableSystemAction;
|
||||
import org.openide.util.Utilities;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -47,7 +48,8 @@ public final class HideAction extends CallableSystemAction {
|
||||
|
||||
public HideAction() {
|
||||
putValue(Action.SHORT_DESCRIPTION, "Hide selected nodes");
|
||||
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_H, Event.CTRL_MASK, false));
|
||||
// D is the Control key on most platforms, the Command (meta) key on Macintosh
|
||||
putValue(Action.ACCELERATOR_KEY, Utilities.stringToKey("D-H"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -55,11 +57,6 @@ public final class HideAction extends CallableSystemAction {
|
||||
return "Hide";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
super.initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpCtx getHelpCtx() {
|
||||
return HelpCtx.DEFAULT_HELP;
|
||||
|
||||
@ -39,10 +39,6 @@ public final class NextDiagramAction extends ContextAction<DiagramViewModel> imp
|
||||
private DiagramViewModel model;
|
||||
|
||||
public NextDiagramAction() {
|
||||
this(Utilities.actionsGlobalContext());
|
||||
}
|
||||
|
||||
public NextDiagramAction(Lookup lookup) {
|
||||
putValue(Action.SHORT_DESCRIPTION, "Show next graph of current group");
|
||||
putValue(Action.SMALL_ICON, new ImageIcon(ImageUtilities.loadImage("com/sun/hotspot/igv/view/images/next_diagram.png")));
|
||||
}
|
||||
@ -64,12 +60,8 @@ public final class NextDiagramAction extends ContextAction<DiagramViewModel> imp
|
||||
|
||||
@Override
|
||||
public void performAction(DiagramViewModel model) {
|
||||
int fp = model.getFirstPosition();
|
||||
int sp = model.getSecondPosition();
|
||||
if (sp != model.getPositions().size() - 1) {
|
||||
int nfp = fp + 1;
|
||||
int nsp = sp + 1;
|
||||
model.setPositions(nfp, nsp);
|
||||
if (model.getSecondPosition() != model.getPositions().size() - 1) {
|
||||
model.setPositions(model.getFirstPosition() + 1, model.getSecondPosition() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,7 +88,7 @@ public final class NextDiagramAction extends ContextAction<DiagramViewModel> imp
|
||||
|
||||
@Override
|
||||
public Action createContextAwareInstance(Lookup arg0) {
|
||||
return new NextDiagramAction(arg0);
|
||||
return new NextDiagramAction();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -40,7 +40,7 @@ public class OverviewAction extends AbstractAction {
|
||||
|
||||
public OverviewAction() {
|
||||
putValue(AbstractAction.SMALL_ICON, new ImageIcon(ImageUtilities.loadImage(iconResource())));
|
||||
putValue(Action.SHORT_DESCRIPTION, "Show satellite view of whole graph");
|
||||
putValue(Action.SHORT_DESCRIPTION, "Show satellite view of whole graph (hold S-KEY)");
|
||||
setState(false);
|
||||
}
|
||||
|
||||
|
||||
@ -39,10 +39,6 @@ public final class PrevDiagramAction extends ContextAction<DiagramViewModel> imp
|
||||
private DiagramViewModel model;
|
||||
|
||||
public PrevDiagramAction() {
|
||||
this(Utilities.actionsGlobalContext());
|
||||
}
|
||||
|
||||
public PrevDiagramAction(Lookup lookup) {
|
||||
putValue(Action.SHORT_DESCRIPTION, "Show previous graph of current group");
|
||||
putValue(Action.SMALL_ICON, new ImageIcon(ImageUtilities.loadImage("com/sun/hotspot/igv/view/images/prev_diagram.png")));
|
||||
}
|
||||
@ -64,12 +60,8 @@ public final class PrevDiagramAction extends ContextAction<DiagramViewModel> imp
|
||||
|
||||
@Override
|
||||
public void performAction(DiagramViewModel model) {
|
||||
int fp = model.getFirstPosition();
|
||||
int sp = model.getSecondPosition();
|
||||
if (fp != 0) {
|
||||
int nfp = fp - 1;
|
||||
int nsp = sp - 1;
|
||||
model.setPositions(nfp, nsp);
|
||||
if (model.getFirstPosition() != 0) {
|
||||
model.setPositions(model.getFirstPosition() - 1, model.getSecondPosition() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,7 +88,7 @@ public final class PrevDiagramAction extends ContextAction<DiagramViewModel> imp
|
||||
|
||||
@Override
|
||||
public Action createContextAwareInstance(Lookup arg0) {
|
||||
return new PrevDiagramAction(arg0);
|
||||
return new PrevDiagramAction();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -30,6 +30,7 @@ import javax.swing.Action;
|
||||
import javax.swing.KeyStroke;
|
||||
import org.openide.util.HelpCtx;
|
||||
import org.openide.util.actions.CallableSystemAction;
|
||||
import org.openide.util.Utilities;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -47,7 +48,8 @@ public final class ShowAllAction extends CallableSystemAction {
|
||||
|
||||
public ShowAllAction() {
|
||||
putValue(Action.SHORT_DESCRIPTION, "Show all nodes");
|
||||
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK));
|
||||
// D is the Control key on most platforms, the Command (meta) key on Macintosh
|
||||
putValue(Action.ACCELERATOR_KEY, Utilities.stringToKey("D-A"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -55,11 +57,6 @@ public final class ShowAllAction extends CallableSystemAction {
|
||||
return "Show all";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
super.initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpCtx getHelpCtx() {
|
||||
return HelpCtx.DEFAULT_HELP;
|
||||
|
||||
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
package com.sun.hotspot.igv.view.actions;
|
||||
|
||||
import com.sun.hotspot.igv.data.ChangedListener;
|
||||
import com.sun.hotspot.igv.util.ContextAction;
|
||||
import com.sun.hotspot.igv.view.DiagramViewModel;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.ImageIcon;
|
||||
import org.openide.util.*;
|
||||
|
||||
public final class ShrinkDiffAction extends ContextAction<DiagramViewModel> implements ChangedListener<DiagramViewModel> {
|
||||
private DiagramViewModel model;
|
||||
|
||||
public ShrinkDiffAction() {
|
||||
putValue(Action.SHORT_DESCRIPTION, "Reduce the difference selection");
|
||||
putValue(Action.SMALL_ICON, new ImageIcon(ImageUtilities.loadImage("com/sun/hotspot/igv/view/images/shrink_right.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return NbBundle.getMessage(ShrinkDiffAction.class, "CTL_ShrinkDiffAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpCtx getHelpCtx() {
|
||||
return HelpCtx.DEFAULT_HELP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<DiagramViewModel> contextClass() {
|
||||
return DiagramViewModel.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performAction(DiagramViewModel model) {
|
||||
int firstPos = model.getFirstPosition();
|
||||
int secondPos = model.getSecondPosition();
|
||||
if (secondPos != model.getPositions().size() - 1) {
|
||||
model.setPositions(firstPos, (firstPos < secondPos) ? secondPos - 1 : secondPos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DiagramViewModel model) {
|
||||
super.update(model);
|
||||
|
||||
if (this.model != model) {
|
||||
if (this.model != null) {
|
||||
this.model.getDiagramChangedEvent().removeListener(this);
|
||||
}
|
||||
|
||||
this.model = model;
|
||||
if (this.model != null) {
|
||||
this.model.getDiagramChangedEvent().addListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(DiagramViewModel model) {
|
||||
return model.getSecondPosition() != model.getPositions().size() - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Action createContextAwareInstance(Lookup arg0) {
|
||||
return new ShrinkDiffAction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changed(DiagramViewModel source) {
|
||||
update(source);
|
||||
}
|
||||
}
|
||||
@ -30,6 +30,7 @@ import javax.swing.Action;
|
||||
import javax.swing.KeyStroke;
|
||||
import org.openide.util.HelpCtx;
|
||||
import org.openide.util.actions.CallableSystemAction;
|
||||
import org.openide.util.Utilities;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -51,7 +52,8 @@ public final class ZoomInAction extends CallableSystemAction {
|
||||
}
|
||||
|
||||
public ZoomInAction() {
|
||||
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, Event.CTRL_MASK, false));
|
||||
// D is the Control key on most platforms, the Command (meta) key on Macintosh
|
||||
putValue(Action.ACCELERATOR_KEY, Utilities.stringToKey("D-EQUALS"));
|
||||
putValue(Action.SHORT_DESCRIPTION, "Zoom in");
|
||||
}
|
||||
|
||||
|
||||
@ -30,6 +30,7 @@ import javax.swing.Action;
|
||||
import javax.swing.KeyStroke;
|
||||
import org.openide.util.HelpCtx;
|
||||
import org.openide.util.actions.CallableSystemAction;
|
||||
import org.openide.util.Utilities;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -46,9 +47,9 @@ public final class ZoomOutAction extends CallableSystemAction {
|
||||
}
|
||||
|
||||
public ZoomOutAction() {
|
||||
|
||||
putValue(Action.SHORT_DESCRIPTION, "Zoom out");
|
||||
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, Event.CTRL_MASK, false));
|
||||
// D is the Control key on most platforms, the Command (meta) key on Macintosh
|
||||
putValue(Action.ACCELERATOR_KEY, Utilities.stringToKey("D-MINUS"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -56,11 +57,6 @@ public final class ZoomOutAction extends CallableSystemAction {
|
||||
return "Zoom out";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
super.initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpCtx getHelpCtx() {
|
||||
return HelpCtx.DEFAULT_HELP;
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
CTL_EditorAction=Open Editor Window
|
||||
CTL_NextDiagramAction=Show next graph
|
||||
CTL_ExpandDiffAction=Expand difference selection
|
||||
CTL_ShrinkDiffAction=Reduce difference selection
|
||||
CTL_EnableSeaLayoutAction=Enable sea-of-nodes layout
|
||||
CTL_EnableBlockLayoutAction=Enable block layout
|
||||
CTL_EnableCFGLayoutAction=Enable control-flow graph layout
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 409 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@ -1,20 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
|
||||
<filesystem>
|
||||
<folder name="Shortcuts">
|
||||
<file name="D-F.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/Edit/org-netbeans-modules-quicksearch-QuickSearchAction.instance"/>
|
||||
</file>
|
||||
<file name="D-LEFT.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/View/com-sun-hotspot-igv-view-actions-PrevDiagramAction.instance"/>
|
||||
</file>
|
||||
<file name="D-RIGHT.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/View/com-sun-hotspot-igv-view-actions-NextDiagramAction.instance"/>
|
||||
</file>
|
||||
<file name="DS-RIGHT.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/View/com-sun-hotspot-igv-view-actions-ExpandDiffAction.instance"/>
|
||||
</file>
|
||||
<file name="D-UP.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/View/com-sun-hotspot-igv-view-actions-ExpandDiffAction.instance"/>
|
||||
</file>
|
||||
<file name="DS-LEFT.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/View/com-sun-hotspot-igv-view-actions-ShrinkDiffAction.instance"/>
|
||||
</file>
|
||||
<file name="D-DOWN.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/View/com-sun-hotspot-igv-view-actions-ShrinkDiffAction.instance"/>
|
||||
</file>
|
||||
</folder>
|
||||
<folder name="Actions">
|
||||
<folder name="File">
|
||||
<file name="com-sun-hotspot-igv-view-actions-ExportAction.instance">
|
||||
<attr name="position" intvalue="1100"/>
|
||||
</file>
|
||||
</folder>
|
||||
<folder name="Search">
|
||||
<file name="org-netbeans-modules-quicksearch-QuickSearchAction.instance"><attr name="position" intvalue="2001"/></file>
|
||||
</folder>
|
||||
<folder name="View">
|
||||
<file name="com-sun-hotspot-igv-view-actions-NextDiagramAction.instance"><attr name="position" intvalue="2000"/></file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-PrevDiagramAction.instance"><attr name="position" intvalue="2001"/></file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-NextDiagramAction.instance"><attr name="position" intvalue="2001"/></file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-ShrinkDiffAction.instance"><attr name="position" intvalue="2001"/></file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-ExpandDiffAction.instance"><attr name="position" intvalue="2001"/></file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-ShowAllAction.instance"><attr name="position" intvalue="2001"/></file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-ExtractAction.instance"><attr name="position" intvalue="2001"/></file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-HideAction.instance"><attr name="position" intvalue="2001"/></file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-ZoomInAction.instance"><attr name="position" intvalue="2001"/></file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-ZoomOutAction.instance"><attr name="position" intvalue="2001"/></file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-ZoomInAction.instance"><attr name="position" intvalue="2001"/></file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-OverviewAction.instance"><attr name="position" intvalue="2001"/></file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-PredSuccAction.instance"><attr name="position" intvalue="2001"/></file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-ShowEmptyBlocksAction.instance"><attr name="position" intvalue="2001"/></file>
|
||||
@ -33,25 +61,33 @@
|
||||
<attr name="originalFile" stringvalue="Actions/View/com-sun-hotspot-igv-view-actions-NextDiagramAction.instance"/>
|
||||
<attr name="position" intvalue="150"/>
|
||||
</file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-ShrinkDiffAction.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/View/com-sun-hotspot-igv-view-actions-ShrinkDiffAction.instance"/>
|
||||
<attr name="position" intvalue="250"/>
|
||||
</file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-ExpandDiffAction.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/View/com-sun-hotspot-igv-view-actions-ExpandDiffAction.instance"/>
|
||||
<attr name="position" intvalue="200"/>
|
||||
</file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-ShowAllAction.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/View/com-sun-hotspot-igv-view-actions-ShowAllAction.instance"/>
|
||||
<attr name="position" intvalue="200"/>
|
||||
<attr name="position" intvalue="300"/>
|
||||
</file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-ExtractAction.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/View/com-sun-hotspot-igv-view-actions-ExtractAction.instance"/>
|
||||
<attr name="position" intvalue="300"/>
|
||||
<attr name="position" intvalue="350"/>
|
||||
</file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-HideAction.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/View/com-sun-hotspot-igv-view-actions-HideAction.instance"/>
|
||||
<attr name="position" intvalue="400"/>
|
||||
</file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-ZoomInAction.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/View/com-sun-hotspot-igv-view-actions-ZoomInAction.instance"/>
|
||||
<attr name="position" intvalue="500"/>
|
||||
</file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-ZoomOutAction.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/View/com-sun-hotspot-igv-view-actions-ZoomOutAction.instance"/>
|
||||
<attr name="position" intvalue="550"/>
|
||||
<attr name="position" intvalue="500"/>
|
||||
</file>
|
||||
<file name="com-sun-hotspot-igv-view-actions-ZoomInAction.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/View/com-sun-hotspot-igv-view-actions-ZoomInAction.instance"/>
|
||||
<attr name="position" intvalue="450"/>
|
||||
</file>
|
||||
</folder>
|
||||
<folder name="File">
|
||||
@ -64,11 +100,6 @@
|
||||
<attr name="position" intvalue="710"/>
|
||||
</file>
|
||||
</folder>
|
||||
<folder name="Window">
|
||||
<file name="Tools_hidden"/>
|
||||
<file name="Web_hidden"/>
|
||||
<file name="org-netbeans-modules-tasks-ui-DashboardTopComponent.shadow_hidden"/>
|
||||
</folder>
|
||||
</folder>
|
||||
|
||||
<folder name="QuickSearch">
|
||||
@ -84,19 +115,12 @@
|
||||
<file name="com-sun-hotspot-igv-view-NodeQuickSearch.instance"/>
|
||||
</folder>
|
||||
<folder name="Blocks">
|
||||
<attr name="command" stringvalue="n"/>
|
||||
<attr name="command" stringvalue="b"/>
|
||||
<attr name="position" intvalue="1"/>
|
||||
<file name="com-sun-hotspot-igv-view-BlockQuickSearch.instance"/>
|
||||
</folder>
|
||||
<file name="Projects_hidden"/>
|
||||
</folder>
|
||||
|
||||
<folder name="QuickSearchShadow">
|
||||
<file name="org-netbeans-modules-quicksearch-QuickSearchAction.shadow">
|
||||
<attr name="originalFile" stringvalue="Actions/Edit/org-netbeans-modules-quicksearch-QuickSearchAction.instance"/>
|
||||
|
||||
</file>
|
||||
</folder>
|
||||
<folder name="Windows2">
|
||||
<folder name="Modes">
|
||||
<folder name="properties">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user