Warning panel on scripts containing §§ instructions (Tip for Settings/Automatic deobfuscation)

This commit is contained in:
Jindra Petřík
2018-05-25 19:03:20 +02:00
parent a9733926cf
commit 1dd96e6c53
7 changed files with 97 additions and 23 deletions
@@ -33,6 +33,7 @@ import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.abc.types.traits.TraitFunction;
import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter;
import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
import com.jpexs.decompiler.flash.action.deobfuscation.BrokenScriptDetector;
import com.jpexs.decompiler.flash.gui.AppStrings;
import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.View;
@@ -750,6 +751,13 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
highlightedText = decompiledText;
if (decompiledText != null) {
String hilightedCode = decompiledText.text;
BrokenScriptDetector det = new BrokenScriptDetector();
if (det.codeIsBroken(hilightedCode)) {
abcPanel.brokenHintPanel.setVisible(true);
} else {
abcPanel.brokenHintPanel.setVisible(false);
}
setText(hilightedCode);
if (highlightedText.getClassHighlights().size() > 0) {
@@ -792,21 +800,21 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
}
@Override
public String getToolTipText(MouseEvent e) {
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);
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())
{
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();
}