diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/ZoomLevelAction.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/ZoomLevelAction.java index 865a727c3de..7edfdca1e56 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/ZoomLevelAction.java +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/ZoomLevelAction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -40,6 +40,8 @@ public final class ZoomLevelAction extends JComboBox implements ChangedL private final DiagramViewer diagramScene; + boolean updateZoomInScene = true; + @Override public void actionPerformed(ActionEvent e) { EditorTopComponent editor = EditorTopComponent.getActive(); @@ -58,6 +60,9 @@ public final class ZoomLevelAction extends JComboBox implements ChangedL level = Math.max(level, minLevel); level = Math.min(level, maxLevel); setZoomLevel(level); + if (updateZoomInScene) { + diagramScene.setZoomPercentage(level); + } } catch(NumberFormatException exception) { changed(diagramScene); } @@ -84,11 +89,12 @@ public final class ZoomLevelAction extends JComboBox implements ChangedL private void setZoomLevel(int zoomLevel) { setSelectedItem(zoomLevel + "%"); - diagramScene.setZoomPercentage(zoomLevel); } @Override public void changed(DiagramViewer diagramViewer) { - setSelectedItem(diagramViewer.getZoomPercentage() + "%"); + updateZoomInScene = false; + setZoomLevel(diagramViewer.getZoomPercentage()); + updateZoomInScene = true; } }