Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #222 add hover info to entries in the Liberty Tool window #528

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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
28 changes: 28 additions & 0 deletions src/main/java/io/openliberty/tools/intellij/LibertyExplorer.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -220,6 +221,33 @@ public static Tree buildTree(Project project, Color backgroundColor) {
}
});

tree.addMouseMotionListener(new MouseMotionAdapter() {
private String currentTooltipText = null;

@Override
public void mouseMoved(MouseEvent e) {
super.mouseMoved(e);

TreePath path = tree.getPathForLocation(e.getX(), e.getY());
if (path == null ) {
if (currentTooltipText != null) {
tree.setToolTipText(null);
currentTooltipText = null;
}
} else {
Object node = path.getLastPathComponent();
if (node instanceof LibertyModuleNode) {
LibertyModuleNode libertyNode = (LibertyModuleNode) node;
String tooltipText = libertyNode.getFilePath().getPath();
if (!tooltipText.equals(currentTooltipText)) {
tree.setToolTipText(tooltipText);
currentTooltipText = tooltipText;
}
}
}
}
});

tree.addMouseListener(new PopupHandler() {
@Override
public void invokePopup(Component comp, int x, int y) {
Expand Down
Loading