8297032: IGV: shortcut to center selected nodes

Reviewed-by: chagedorn, rcastanedalo
This commit is contained in:
Tobias Holenstein 2022-11-17 13:04:07 +00:00
parent 35acb89166
commit d02bfdf9d7
3 changed files with 271 additions and 2 deletions
src/utils/IdealGraphVisualizer/View/src/main
java/com/sun/hotspot/igv/view/actions
resources/com/sun/hotspot/igv/view/images

@ -0,0 +1,73 @@
/*
* 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.view.DiagramViewModel;
import com.sun.hotspot.igv.view.EditorTopComponent;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionRegistration;
import org.openide.util.NbBundle;
@ActionID(category = "View", id = "com.sun.hotspot.igv.view.actions.CenterSelectedNodesAction")
@ActionRegistration(displayName = "#CTL_CenterSelectedNodesAction")
@ActionReferences({
@ActionReference(path = "Menu/View", position = 600),
@ActionReference(path = "Shortcuts", name = "D-9")
})
@NbBundle.Messages({
"CTL_CenterSelectedNodesAction=Center selected nodes",
"HINT_CenterSelectedNodesAction=Center the selected nodes"
})
public final class CenterSelectedNodesAction extends ModelAwareAction {
@Override
protected String iconResource() {
return "com/sun/hotspot/igv/view/images/centerSelectedNodes.svg"; // NOI18N
}
@Override
public String getName() {
return NbBundle.getMessage(NextDiagramAction.class, "CTL_CenterSelectedNodesAction");
}
@Override
protected String getDescription() {
return NbBundle.getMessage(NextDiagramAction.class, "HINT_CenterSelectedNodesAction");
}
@Override
public void performAction(DiagramViewModel model) {
EditorTopComponent editor = EditorTopComponent.findEditorForGraph(model.getGraph());
if (editor != null) {
editor.centerSelectedNodes();
}
}
@Override
public boolean isEnabled(DiagramViewModel model) {
return !model.getSelectedNodes().isEmpty();
}
}

@ -41,8 +41,8 @@ import org.openide.util.actions.CallableSystemAction;
@ActionReference(path = "Shortcuts", name = "D-0")
})
@NbBundle.Messages({
"CTL_ZoomResetAction=Reset zoom (100%",
"HINT_ZoomResetAction=Rest the zoom level to 100%"
"CTL_ZoomResetAction=Reset zoom (100%)",
"HINT_ZoomResetAction=Reset the zoom level to 100%"
})
public final class ZoomResetAction extends CallableSystemAction {

@ -0,0 +1,196 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
version="1.1"
id="Vector_Icons"
x="0px"
y="0px"
width="16px"
height="16px"
viewBox="0 0 16 16"
style="enable-background:new 0 0 16 16;"
xml:space="preserve"
sodipodi:docname="zoomIn copy.svg"
inkscape:version="1.2.1 (9c6d41e, 2022-07-14)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs30" /><sodipodi:namedview
id="namedview28"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
inkscape:zoom="64.1875"
inkscape:cx="3.5598832"
inkscape:cy="9.4956183"
inkscape:window-width="2452"
inkscape:window-height="1205"
inkscape:window-x="2204"
inkscape:window-y="257"
inkscape:window-maximized="0"
inkscape:current-layer="Vector_Icons" />
<style
type="text/css"
id="style9">
.st0{fill:#FFFFFF;}
.st1{opacity:0.25;}
.st2{fill:#FAFAFA;}
.st3{opacity:0.33;}
.st4{fill:none;stroke:#474747;stroke-miterlimit:10;}
.st5{opacity:0.42;}
.st6{fill:#CAE3FF;}
.st7{opacity:0.2;}
.st8{opacity:0.03;}
.st9{opacity:0.1;}
.st10{opacity:0.15;}
.st11{opacity:0.45;}
.st12{fill:#FFE1B0;}
.st13{fill:#B3DBFF;}
.st14{fill:#FBDC7C;}
.st15{fill:#FFDB43;}
.st16{fill:#E79B00;}
.st17{fill:#3883CE;}
.st18{fill:none;stroke:#003399;stroke-width:1.375;stroke-miterlimit:10;}
.st19{fill:#E8513D;}
.st20{fill:#1E1E1E;}
.st21{fill:#FFC36D;}
.st22{fill:#9FCBFF;}
.st23{fill:#E9F7FF;}
.st24{fill:#62707C;}
.st25{fill:#7A8896;}
.st26{fill:#57BFFF;}
.st27{fill:#E69D35;}
.st28{fill:#9CFF73;}
.st29{fill:#4891CC;}
.st30{fill:#474747;}
.st31{fill:#CCA05E;}
.st32{opacity:0.67;}
.st33{opacity:0.3;}
.st34{fill:#EAEAEA;}
.st35{fill:#FFE945;}
.st36{fill:#FFCF8C;}
.st37{fill:#FF5252;}
.st38{opacity:0.12;}
.st39{fill:#45A5F4;}
.st40{fill:url(#SVGID_1_);}
.st41{fill:url(#SVGID_2_);}
.st42{opacity:0.05;}
.st43{fill:#3D81F5;}
.st44{fill:#CECECE;}
.st45{fill:#B5B5B5;}
.st46{opacity:0.4;}
.st47{fill:#595959;}
.st48{fill:#80FF80;}
.st49{fill:#C8FF80;}
.st50{fill:#FFEE80;}
.st51{fill:#FFA680;}
.st52{fill:#FF8080;}
.st53{fill:none;}
.st54{fill:#007AFF;}
.st55{fill:#EFFF78;}
.st56{fill:#FFDA00;}
.st57{fill:#3EADFF;}
.st58{opacity:0.67;fill:#FFFFFF;}
.st59{fill:#2E92FF;}
.st60{fill:#3AEA00;}
.st61{fill:#303030;}
</style>
<g
id="g976"><g
id="g936"><line
class="st18"
x1="1.4835176"
y1="1.5341178"
x2="6.5766888"
y2="1.5341178"
id="line25"
style="fill:#000000;stroke:#000000;stroke-linecap:round;stroke-opacity:1" /><line
class="st18"
x1="1.4800391"
y1="6.6342201"
x2="1.4800391"
y2="1.5410478"
id="line25-9"
style="fill:#000000;stroke:#000000;stroke-width:1.375;stroke-linecap:round;stroke-miterlimit:10;stroke-opacity:1" /></g><g
id="g936-9"
transform="rotate(90,8.0582129,8.1116407)"><line
class="st18"
x1="1.4835176"
y1="1.5341178"
x2="6.5766888"
y2="1.5341178"
id="line25-7"
style="fill:#000000;stroke:#000000;stroke-width:1.375;stroke-linecap:round;stroke-miterlimit:10;stroke-opacity:1" /><line
class="st18"
x1="1.4800391"
y1="6.6342201"
x2="1.4800391"
y2="1.5410478"
id="line25-9-0"
style="fill:#000000;stroke:#000000;stroke-width:1.375;stroke-linecap:round;stroke-miterlimit:10;stroke-opacity:1" /></g></g><g
id="g976-9"
transform="rotate(180,8.0562076,8.1003438)"><g
id="g936-8"><line
class="st18"
x1="1.4835176"
y1="1.5341178"
x2="6.5766888"
y2="1.5341178"
id="line25-2"
style="fill:#000000;stroke:#000000;stroke-width:1.375;stroke-linecap:round;stroke-miterlimit:10;stroke-opacity:1" /><line
class="st18"
x1="1.4800391"
y1="6.6342201"
x2="1.4800391"
y2="1.5410478"
id="line25-9-07"
style="fill:#000000;stroke:#000000;stroke-width:1.375;stroke-linecap:round;stroke-miterlimit:10;stroke-opacity:1" /></g><g
id="g936-9-4"
transform="rotate(90,8.0582129,8.1116407)"><line
class="st18"
x1="1.4835176"
y1="1.5341178"
x2="6.5766888"
y2="1.5341178"
id="line25-7-8"
style="fill:#000000;stroke:#000000;stroke-width:1.375;stroke-linecap:round;stroke-miterlimit:10;stroke-opacity:1" /><line
class="st18"
x1="1.4800391"
y1="6.6342201"
x2="1.4800391"
y2="1.5410478"
id="line25-9-0-5"
style="fill:#000000;stroke:#000000;stroke-width:1.375;stroke-linecap:round;stroke-miterlimit:10;stroke-opacity:1" /></g></g>
</svg>

After

(image error) Size: 5.7 KiB