Swingspector icon indicating copy to clipboard operation
Swingspector copied to clipboard

Hotkey Not Working & UI-Related Exception

Open Valkryst opened this issue 2 years ago • 9 comments

This may be due to an error on my part, but I'm unsure of what I may have done incorrectly:

  1. Installed Swingspector.
  2. Updated Run configuration to add Swingspector, and ensured its checkbox was enabled and that the hotkey was set to Ctrl+;.
  3. Ran a Swing application and tried to use the hotkey.

Results:

  • When I use the hotkey, nothing happens.
  • I can manually open the Swing Roots panel and click through the hierarchy.
    • When double-clicking on the circular element icons, the ones that appear for elements like a JRootPane, FlatTitlePane, and JLayeredPane, I get an exception (see below).
  • I can manually open the Swing Components panel, but it always says "Nothing to show".

I'm also using the new JetBrains UI, and not the original one, if that has anything to do with it

java.lang.NullPointerException: Cannot read field "stackTrace" because "placementInfo" is null
	at de.eudaemon.ideaswag.ComponentInfoPanel.getStackTraceAsText(ComponentInfoPanel.java:161)
	at de.eudaemon.ideaswag.ComponentInfoPanel.createPlacementPanel(ComponentInfoPanel.java:110)
	at de.eudaemon.ideaswag.ComponentInfoPanel.refresh(ComponentInfoPanel.java:94)
	at de.eudaemon.ideaswag.ComponentInfoPanel.<init>(ComponentInfoPanel.java:83)
	at de.eudaemon.ideaswag.Util.openComponentTab(Util.java:98)
	at de.eudaemon.ideaswag.Util.openComponentTab(Util.java:84)
	at de.eudaemon.ideaswag.TreeViewPanel.lambda$locateSelected$2(TreeViewPanel.java:124)
	at java.base/java.util.Optional.ifPresent(Optional.java:178)
	at de.eudaemon.ideaswag.TreeViewPanel.locateSelected(TreeViewPanel.java:124)
	at de.eudaemon.ideaswag.TreeViewPanel$1.mouseClicked(TreeViewPanel.java:58)
	at java.desktop/java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:278)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6659)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3385)
	at com.intellij.ui.treeStructure.Tree.processMouseEvent(Tree.java:424)
	at java.desktop/java.awt.Component.processEvent(Component.java:6421)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5026)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4584)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2804)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:790)
	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:731)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:763)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:761)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:760)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:666)
	at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.kt:614)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:569)
	at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:68)
	at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:349)
	at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:348)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
	at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:348)
	at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:343)
	at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:994)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
	at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:994)
	at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$4(IdeEventQueue.kt:343)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:385)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

Valkryst avatar Apr 05 '23 16:04 Valkryst

Regarding the hotkey; stupid question to get it out of the way: Did your make sure to press it while the keyboard focus is in your App and not in IDEA?

ohle avatar Apr 05 '23 21:04 ohle

Yup! I clicked around a few different lists, texts areas, and tabs while hitting CTRL + ; on each of them. I also tried both CTRL keys, just to be safe.

If it helps, here's a screenshot of my Run configuration:

image

Valkryst avatar Apr 05 '23 21:04 Valkryst

Have you tried it with a simpler project? Something like a single-file app showing a button in a JFrame?

ohle avatar Apr 05 '23 21:04 ohle

Just gave it a shot with this sample program, and the same configuration as above:

package com.valkryst;

import javax.swing.*;
import java.awt.*;

public class Example {
    public static void main(final String[] args) {
        final var frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setPreferredSize(new Dimension(500, 500));
        frame.setVisible(true);
        frame.pack();
        frame.setLocationRelativeTo(null);

        final var button = new JButton("Click Me!");
        button.addActionListener(e -> System.out.println("Clicked!"));

        frame.add(button);
    }
}

Seems to have the same issue as the other project, from the OP

Valkryst avatar Apr 05 '23 21:04 Valkryst

I'm sorry but I can't reproduce any of these problems (it's definitely not the UI; I use the new one, too). Do you have a logfile maybe?

The only other thing that came to mind regarding the hotkey is that it might be shadowed by your OS / Desktop Environment, in which case, you could try a different one.

ohle avatar Apr 06 '23 18:04 ohle

Yup, I can upload the log file(s). Are there any specific ones that would help?

I tried out the following combinations, chosen at random, but no dice:

  • CTRL+`
  • CTRL+ALT+1
  • CTRL+NUMPAD-1

Valkryst avatar Apr 06 '23 19:04 Valkryst

Just the latest idea.log should do it.

ohle avatar Apr 06 '23 19:04 ohle

Here's the full log file. Let me know when you have it, and I'll take it down 👍

Valkryst avatar Apr 06 '23 20:04 Valkryst

Got it, thanks. You can take it down. I'll look into it later.

ohle avatar Apr 06 '23 20:04 ohle