Debug tooltips on hover

When in Debug mode and stopped at a breakpoint, hovering over dientifiers will show up their name and value in a tooltip. All matching locals will be shown, one on each line.
This commit is contained in:
AL
2017-11-30 11:06:36 +00:00
parent cdf72b6798
commit 0a0ecf8112
5 changed files with 85 additions and 5 deletions
@@ -46,6 +46,7 @@ import com.jpexs.decompiler.flash.tags.ABCContainerTag;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.helpers.CancellableWorker;
import java.awt.Point;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
@@ -789,4 +790,24 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
super.setText(t);
setCaretPosition(0);
}
@Override
public String getToolTipText(MouseEvent e) {
// not debugging: so return existing text
if (abcPanel.getDebugPanel().localsTable == null)
return super.getToolTipText();
final Point point = new Point(e.getX(), e.getY());
final int pos = abcPanel.decompiledTextArea.viewToModel(point);
final String identifier = abcPanel.getMainPanel().getActionPanel().getStringUnderPosition(pos, abcPanel.decompiledTextArea);
if (identifier != null && !identifier.isEmpty())
{
String tooltipText = abcPanel.getDebugPanel().localsTable.TryGetDebugHoverToolTipText(identifier);
return (tooltipText == null ? super.getToolTipText() : tooltipText);
}
// not found: so return existing text
return super.getToolTipText();
}
}