Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions agent/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.

DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

Expand Down Expand Up @@ -49,7 +49,7 @@
<name>Universal Permissive License Version 1.0</name>
<url>https://oss.oracle.com/licenses/upl</url>
<distribution>repo</distribution>
<comments>Copyright (c) 2018, 2025, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.</comments>
<comments>Copyright (c) 2018, 2026, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.</comments>
</license>
</licenses>
<organization>
Expand Down Expand Up @@ -91,7 +91,7 @@
<nexus.staging.plugin.version>1.6.13</nexus.staging.plugin.version>
<maven.gpg.version>3.1.0</maven.gpg.version>
<!-- Dependency Versions -->
<asm.version>9.8</asm.version>
<asm.version>9.9.1</asm.version>
<junit.version>4.13.2</junit.version>
</properties>
<scm>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -34,9 +34,14 @@

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.KeyboardFocusManager;
import java.awt.event.InputEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -45,13 +50,19 @@
import java.util.TimerTask;
import java.util.logging.Level;

import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingConstants;
import javax.swing.SwingWorker;

import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.openjdk.jmc.console.jconsole.Activator;
import org.openjdk.jmc.console.jconsole.JConsolePluginLoader;
import org.openjdk.jmc.console.jconsole.MissionControlContext;
Expand All @@ -71,6 +82,7 @@ public class JConsolePluginTabbedPane extends JTabbedPane {
private final Map<JConsolePlugin, SwingWorker<?, ?>> swingWorkers = new HashMap<>();
private volatile boolean disposeTimerTask;
private final MissionControlContext ctx;
private static final String STACKTRACE_VIEW_ID = "org.openjdk.jmc.flightrecorder.ui.StacktraceView";

public JConsolePluginTabbedPane(IConnectionHandle connectionHandle) {
// FIXME: Make placement configurable in settings
Expand Down Expand Up @@ -142,6 +154,78 @@ private void addErrorTab(String title, String message) {
Activator.getLogger().log(Level.WARNING,
NLS.bind(Messages.JConsolePluginTabbedPane_ERROR_MESSAGE_COULD_NOT_CREATE_PLUGIN_TAB, message));
this.add(title, p);
setFocusTraversalProperties(p);
addKeyListener(p);
addKeyListenerForFwdFocusToSWT(p);
}

/**
* Adding key listener to transfer focus forward or backward based on 'TAB' or 'Shift + TAB'
*/
private void addKeyListener(JComponent comp) {
comp.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_TAB) {
if ((e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0) {
e.getComponent().transferFocusBackward();
} else {
e.getComponent().transferFocus();
}
e.consume();
}
}
});
}

/**
* Setting the focus traversal properties.
*/
private void setFocusTraversalProperties(JComponent comp) {
comp.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.emptySet());
comp.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, Collections.emptySet());
comp.setFocusable(true);
comp.setFocusTraversalKeysEnabled(true);
}

/**
* Adding key listener and checking if all the swing components are already cycled (Fwd) once.
* On completion of swing component cycle transferring focus back to SWT.
*/
private void addKeyListenerForFwdFocusToSWT(JComponent comp) {
comp.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_TAB) {
if ((e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0) {
e.getComponent().transferFocusBackward();
} else {
setFocusBackToSWT();
}
e.consume();
}
}
});
}

/**
* This method sets the focus from swing to SWT. If outline page is active focus will be set to
* outline view else to JVM Browser
*/
private void setFocusBackToSWT() {
Display.getDefault().syncExec(new Runnable() {
public void run() {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
IViewPart outlineView = activePage.showView(STACKTRACE_VIEW_ID);
if (activePage.getActiveEditor() != null) {
outlineView.setFocus();
}
} catch (PartInitException e) {
Activator.getLogger().log(Level.INFO, "Failed to set focus", e); //$NON-NLS-1$
}
}
});
}

private void startUpdateThread() {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2023, 2025, Datadog, Inc. All rights reserved.
# Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2023, 2026, Datadog, Inc. All rights reserved.
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
Expand Down Expand Up @@ -32,3 +32,4 @@
# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
FLAME_GRAPH_VIEW_NAME=Flame Graph
BUTTERFLY_VIEW_NAME=Butterfly
17 changes: 15 additions & 2 deletions application/org.openjdk.jmc.flightrecorder.flamegraph/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2023, Datadog, Inc. All rights reserved.
Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2023, 2026, Datadog, Inc. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -42,6 +42,13 @@
icon="icons/flame.png"
id="org.openjdk.jmc.flightrecorder.flamegraph"
name="%FLAME_GRAPH_VIEW_NAME"/>
<view
allowMultiple="false"
category="org.openjdk.jmc.ui.main"
class="org.openjdk.jmc.flightrecorder.flamegraph.views.ButterflyView"
icon="icons/butterfly.png"
id="org.openjdk.jmc.flightrecorder.flamegraph.butterfly"
name="%BUTTERFLY_VIEW_NAME"/>
</extension>
<extension point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension targetID="org.openjdk.jmc.ui.idesupport.StandardPerspective">
Expand All @@ -51,6 +58,12 @@
relative="org.openjdk.jmc.flightrecorder.ui.StacktraceView"
showTitle="true"
visible="true"/>
<view
id="org.openjdk.jmc.flightrecorder.flamegraph.butterfly"
relationship="stack"
relative="org.openjdk.jmc.flightrecorder.flamegraph"
showTitle="true"
visible="true"/>
</perspectiveExtension>
</extension>
</plugin>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2025, Datadog, Inc. All rights reserved.
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2026, Datadog, Inc. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -50,6 +50,11 @@ public class Messages {
public static final String FLAMEVIEW_PNG_IMAGE = "FLAMEVIEW_PNG_IMAGE"; //$NON-NLS-1$
public static final String FLAMEVIEW_TOGGLE_MINIMAP = "FLAMEVIEW_TOGGLE_MINIMAP"; //$NON-NLS-1$
public static final String FLAMEVIEW_RESET_ZOOM = "FLAMEVIEW_RESET_ZOOM"; //$NON-NLS-1$
public static final String BUTTERFLYVIEW_CALLERS = "BUTTERFLYVIEW_CALLERS"; //$NON-NLS-1$
public static final String BUTTERFLYVIEW_CALLEES = "BUTTERFLYVIEW_CALLEES"; //$NON-NLS-1$
public static final String BUTTERFLYVIEW_SEARCH = "BUTTERFLYVIEW_SEARCH"; //$NON-NLS-1$
public static final String BUTTERFLYVIEW_SELECT_METHOD = "BUTTERFLYVIEW_SELECT_METHOD"; //$NON-NLS-1$
public static final String BUTTERFLYVIEW_NO_METHOD_SELECTED = "BUTTERFLYVIEW_NO_METHOD_SELECTED"; //$NON-NLS-1$

private Messages() {
}
Expand Down
Loading
Loading