mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-19 15:38:17 +00:00
do not copy big byte arrays, store only references (ByteArrayRange) e.g in image tags
This commit is contained in:
@@ -360,10 +360,10 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
Helper.emptyObject(this);
|
||||
}
|
||||
|
||||
public ABCPanel(MainPanel mainPanel) {
|
||||
public ABCPanel(MainPanel mainPanel) {
|
||||
|
||||
DefaultSyntaxKit.initKit();
|
||||
|
||||
|
||||
this.mainPanel = mainPanel;
|
||||
setLayout(new BorderLayout());
|
||||
|
||||
@@ -373,12 +373,12 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
|
||||
@Override
|
||||
public boolean isLink(Token token) {
|
||||
return hasDeclaration(token.length==1?token.start:token.start+1);
|
||||
return hasDeclaration(token.length == 1 ? token.start : token.start + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleLink(Token token) {
|
||||
gotoDeclaration(token.length==1?token.start:token.start+1);
|
||||
gotoDeclaration(token.length == 1 ? token.start : token.start + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -543,25 +543,24 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
}
|
||||
|
||||
private boolean hasDeclaration(int pos) {
|
||||
|
||||
SyntaxDocument sd = (SyntaxDocument)decompiledTextArea.getDocument();
|
||||
|
||||
SyntaxDocument sd = (SyntaxDocument) decompiledTextArea.getDocument();
|
||||
Token t = sd.getTokenAt(pos);
|
||||
if(t==null || (t.type != TokenType.IDENTIFIER && t.type!=TokenType.KEYWORD && t.type!=TokenType.REGEX)){
|
||||
if (t == null || (t.type != TokenType.IDENTIFIER && t.type != TokenType.KEYWORD && t.type != TokenType.REGEX)) {
|
||||
return false;
|
||||
}
|
||||
Reference<Integer> abcIndex=new Reference<>(0);
|
||||
Reference<Integer> classIndex=new Reference<>(0);
|
||||
Reference<Integer> traitIndex=new Reference<>(0);
|
||||
Reference<Integer> multinameIndexRef=new Reference<>(0);
|
||||
Reference<Boolean> classTrait=new Reference<>(false);
|
||||
|
||||
|
||||
if(decompiledTextArea.getPropertyTypeAtPos(pos, abcIndex, classIndex, traitIndex, classTrait,multinameIndexRef)){
|
||||
Reference<Integer> abcIndex = new Reference<>(0);
|
||||
Reference<Integer> classIndex = new Reference<>(0);
|
||||
Reference<Integer> traitIndex = new Reference<>(0);
|
||||
Reference<Integer> multinameIndexRef = new Reference<>(0);
|
||||
Reference<Boolean> classTrait = new Reference<>(false);
|
||||
|
||||
if (decompiledTextArea.getPropertyTypeAtPos(pos, abcIndex, classIndex, traitIndex, classTrait, multinameIndexRef)) {
|
||||
return true;
|
||||
}
|
||||
int multinameIndex = decompiledTextArea.getMultinameAtPos(pos);
|
||||
if (multinameIndex > -1) {
|
||||
if(multinameIndex == 0){
|
||||
if (multinameIndex == 0) {
|
||||
return false;
|
||||
}
|
||||
List<MultinameUsage> usages = abc.findMultinameDefinition(swf.abcList, multinameIndex);
|
||||
@@ -585,21 +584,20 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
if (!usages.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return decompiledTextArea.getLocalDeclarationOfPos(pos,new Reference<>("")) != -1;
|
||||
return decompiledTextArea.getLocalDeclarationOfPos(pos, new Reference<>("")) != -1;
|
||||
}
|
||||
|
||||
private void gotoDeclaration(int pos) {
|
||||
Reference<Integer> abcIndex=new Reference<>(0);
|
||||
Reference<Integer> classIndex=new Reference<>(0);
|
||||
Reference<Integer> traitIndex=new Reference<>(0);
|
||||
Reference<Boolean> classTrait=new Reference<>(false);
|
||||
Reference<Integer> multinameIndexRef=new Reference<>(0);
|
||||
|
||||
|
||||
if(decompiledTextArea.getPropertyTypeAtPos(pos, abcIndex, classIndex, traitIndex, classTrait,multinameIndexRef)){
|
||||
UsageFrame.gotoUsage(ABCPanel.this, new TraitMultinameUsage(swf.abcList, swf.abcList.get(abcIndex.getVal()).getABC(), multinameIndexRef.getVal(),classIndex.getVal(), traitIndex.getVal(), classTrait.getVal(), null, -1) {
|
||||
Reference<Integer> abcIndex = new Reference<>(0);
|
||||
Reference<Integer> classIndex = new Reference<>(0);
|
||||
Reference<Integer> traitIndex = new Reference<>(0);
|
||||
Reference<Boolean> classTrait = new Reference<>(false);
|
||||
Reference<Integer> multinameIndexRef = new Reference<>(0);
|
||||
|
||||
if (decompiledTextArea.getPropertyTypeAtPos(pos, abcIndex, classIndex, traitIndex, classTrait, multinameIndexRef)) {
|
||||
UsageFrame.gotoUsage(ABCPanel.this, new TraitMultinameUsage(swf.abcList, swf.abcList.get(abcIndex.getVal()).getABC(), multinameIndexRef.getVal(), classIndex.getVal(), traitIndex.getVal(), classTrait.getVal(), null, -1) {
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -632,12 +630,12 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int dpos = decompiledTextArea.getLocalDeclarationOfPos(pos,new Reference<>(""));
|
||||
|
||||
int dpos = decompiledTextArea.getLocalDeclarationOfPos(pos, new Reference<>(""));
|
||||
if (dpos > -1) {
|
||||
decompiledTextArea.setCaretPosition(dpos);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private class CtrlClickHandler extends KeyAdapter implements MouseListener, MouseMotionListener {
|
||||
@@ -860,7 +858,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
}
|
||||
setDecompiledEditMode(false);
|
||||
reload();
|
||||
View.showMessageDialog(this, AppStrings.translate("message.action.saved"));
|
||||
View.showMessageDialog(this, AppStrings.translate("message.action.saved"));
|
||||
} catch (AVM2ParseException ex) {
|
||||
abc.script_info.get(oldIndex).delete(abc, false);
|
||||
decompiledTextArea.gotoLine((int) ex.line);
|
||||
|
||||
Reference in New Issue
Block a user