Do not parse if the decompiler used prints out disassembly/bytecode.
This commit is contained in:
parent
9353c968be
commit
c3841a8493
|
@ -118,9 +118,9 @@ public class BytecodeViewPanelUpdater implements Runnable
|
|||
|
||||
if (!BytecodeViewer.viewer.workPane.classFiles.containsKey(workingDecompilerName))
|
||||
{
|
||||
container.parse();
|
||||
boolean parsed = container.parse();
|
||||
BytecodeViewer.viewer.workPane.classFiles.put(workingDecompilerName, container);
|
||||
container.hasBeenParsed = true;
|
||||
container.hasBeenParsed = parsed;
|
||||
}
|
||||
|
||||
//set the swing components on the swing thread
|
||||
|
@ -449,24 +449,27 @@ public class BytecodeViewPanelUpdater implements Runnable
|
|||
@Override
|
||||
public void mouseMoved(MouseEvent e)
|
||||
{
|
||||
if (e.isControlDown())
|
||||
if (classFileContainer.hasBeenParsed)
|
||||
{
|
||||
RSyntaxTextArea textArea = (RSyntaxTextArea) e.getSource();
|
||||
Token token = textArea.viewToToken(e.getPoint());
|
||||
if (token != null)
|
||||
if (e.isControlDown())
|
||||
{
|
||||
String lexeme = token.getLexeme();
|
||||
if (classFileContainer.fieldMembers.containsKey(lexeme) || classFileContainer.methodMembers.containsKey(lexeme) || classFileContainer.methodLocalMembers.containsKey(lexeme) || classFileContainer.methodParameterMembers.containsKey(lexeme) || classFileContainer.classReferences.containsKey(lexeme))
|
||||
RSyntaxTextArea textArea = (RSyntaxTextArea) e.getSource();
|
||||
Token token = textArea.viewToToken(e.getPoint());
|
||||
if (token != null)
|
||||
{
|
||||
textArea.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
||||
String lexeme = token.getLexeme();
|
||||
if (classFileContainer.fieldMembers.containsKey(lexeme) || classFileContainer.methodMembers.containsKey(lexeme) || classFileContainer.methodLocalMembers.containsKey(lexeme) || classFileContainer.methodParameterMembers.containsKey(lexeme) || classFileContainer.classReferences.containsKey(lexeme))
|
||||
{
|
||||
textArea.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bytecodeViewPanel.textArea.getCursor().getType() != Cursor.TEXT_CURSOR)
|
||||
else
|
||||
{
|
||||
bytecodeViewPanel.textArea.setCursor(new Cursor(Cursor.TEXT_CURSOR));
|
||||
if (bytecodeViewPanel.textArea.getCursor().getType() != Cursor.TEXT_CURSOR)
|
||||
{
|
||||
bytecodeViewPanel.textArea.setCursor(new Cursor(Cursor.TEXT_CURSOR));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -477,10 +480,13 @@ public class BytecodeViewPanelUpdater implements Runnable
|
|||
@Override
|
||||
public void mouseClicked(MouseEvent e)
|
||||
{
|
||||
if (e.isControlDown())
|
||||
if (classFileContainer.hasBeenParsed)
|
||||
{
|
||||
RSyntaxTextArea textArea = (RSyntaxTextArea) e.getSource();
|
||||
textArea.getActionMap().get("goToAction").actionPerformed(new ActionEvent(textArea, ActionEvent.ACTION_PERFORMED, "goToAction"));
|
||||
if (e.isControlDown())
|
||||
{
|
||||
RSyntaxTextArea textArea = (RSyntaxTextArea) e.getSource();
|
||||
textArea.getActionMap().get("goToAction").actionPerformed(new ActionEvent(textArea, ActionEvent.ACTION_PERFORMED, "goToAction"));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.github.javaparser.symbolsolver.JavaSymbolSolver;
|
|||
import com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSolver;
|
||||
import com.github.javaparser.symbolsolver.resolution.typesolvers.JarTypeSolver;
|
||||
import com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver;
|
||||
import the.bytecode.club.bytecodeviewer.decompilers.Decompiler;
|
||||
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
|
||||
import the.bytecode.club.bytecodeviewer.resources.classcontainer.locations.*;
|
||||
import the.bytecode.club.bytecodeviewer.resources.classcontainer.parser.MyVoidVisitor;
|
||||
|
@ -51,14 +52,18 @@ public class ClassFileContainer
|
|||
/**
|
||||
* Parse the class content with JavaParser.
|
||||
*/
|
||||
public void parse()
|
||||
public boolean parse()
|
||||
{
|
||||
try
|
||||
{
|
||||
TypeSolver typeSolver = new CombinedTypeSolver(new ReflectionTypeSolver(false), new JarTypeSolver(path));
|
||||
StaticJavaParser.getParserConfiguration().setSymbolResolver(new JavaSymbolSolver(typeSolver));
|
||||
CompilationUnit compilationUnit = StaticJavaParser.parse(this.content);
|
||||
compilationUnit.accept(new MyVoidVisitor(this, compilationUnit), null);
|
||||
if (shouldParse())
|
||||
{
|
||||
TypeSolver typeSolver = new CombinedTypeSolver(new ReflectionTypeSolver(false), new JarTypeSolver(path));
|
||||
StaticJavaParser.getParserConfiguration().setSymbolResolver(new JavaSymbolSolver(typeSolver));
|
||||
CompilationUnit compilationUnit = StaticJavaParser.parse(this.content);
|
||||
compilationUnit.accept(new MyVoidVisitor(this, compilationUnit), null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
@ -69,6 +74,17 @@ public class ClassFileContainer
|
|||
System.err.println("Parsing error: " + className);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldParse()
|
||||
{
|
||||
return !getDecompiler().equals(Decompiler.BYTECODE_DISASSEMBLER.getDecompilerName())
|
||||
&& !getDecompiler().equals(Decompiler.KRAKATAU_DISASSEMBLER.getDecompilerName())
|
||||
&& !getDecompiler().equals(Decompiler.JAVAP_DISASSEMBLER.getDecompilerName())
|
||||
&& !getDecompiler().equals(Decompiler.SMALI_DISASSEMBLER.getDecompilerName())
|
||||
&& !getDecompiler().equals(Decompiler.ASM_TEXTIFY_DISASSEMBLER.getDecompilerName());
|
||||
}
|
||||
|
||||
public String getName()
|
||||
|
|
Loading…
Reference in New Issue
Block a user