#816 P-code not shown after selecting "class initializer" trait fixed

This commit is contained in:
2015-02-26 12:39:41 +01:00
parent 7e89a2c721
commit a11015e90c
9 changed files with 43 additions and 38 deletions
@@ -25,7 +25,6 @@ import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.RenameType;
import com.jpexs.decompiler.flash.abc.ScriptPack;
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.abc.types.traits.TraitClass;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.configuration.ConfigurationItem;
import com.jpexs.decompiler.flash.dumpview.DumpInfo;
@@ -2422,19 +2421,10 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
@Override
protected Void doInBackground() throws Exception {
int classIndex = -1;
for (Trait t : scriptLeaf.abc.script_info.get(scriptLeaf.scriptIndex).traits.traits) {
if (t instanceof TraitClass) {
classIndex = ((TraitClass) t).class_info;
break;
}
}
getABCPanel().detailPanel.methodTraitPanel.methodCodePanel.clear();
getABCPanel().navigator.setAbc(scriptLeaf.abc);
getABCPanel().navigator.setClassIndex(classIndex, scriptLeaf.scriptIndex);
getABCPanel().setAbc(scriptLeaf.abc);
getABCPanel().decompiledTextArea.setScript(scriptLeaf);
getABCPanel().decompiledTextArea.setClassIndex(classIndex);
getABCPanel().decompiledTextArea.setNoTrait();
return null;
}
+2 -2
View File
@@ -377,7 +377,7 @@ public class View {
return ret[0];
}
public static int showConfirmDialog(final Component parentComponent, final Object message, final String title, final int optionType) {
public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType) {
return showConfirmDialog(parentComponent, message, title, optionType, JOptionPane.PLAIN_MESSAGE);
}
@@ -392,7 +392,7 @@ public class View {
return ret[0];
}
public static int showConfirmDialog(final Component parentComponent, String message, final String title, final int optionType, ConfigurationItem<Boolean> showAgainConfig, int defaultOption) {
public static int showConfirmDialog(Component parentComponent, String message, String title, int optionType, ConfigurationItem<Boolean> showAgainConfig, int defaultOption) {
return showConfirmDialog(parentComponent, message, title, optionType, JOptionPane.PLAIN_MESSAGE, showAgainConfig, defaultOption);
}
@@ -552,6 +552,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
}
if (classIndex == -1) {
abcPanel.navigator.setClassIndex(-1, script.scriptIndex);
setNoTrait();
return;
}
@@ -599,13 +600,13 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
public void gotoTrait(int traitId) {
if (traitId == -1) {
setCaretPosition(0);
return;
}
Highlighting tc = Highlighting.searchIndex(classHighlights, classIndex);
if (tc != null) {
Highlighting th = Highlighting.searchIndex(traitHighlights, traitId, tc.startPos, tc.startPos + tc.len);
int pos;
if (th != null) {
ignoreCarret = true;
int startPos = th.startPos + th.len - 1;
@@ -613,20 +614,21 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
setCaretPosition(startPos);
}
ignoreCarret = false;
final int pos = th.startPos;
new Timer().schedule(new TimerTask() {
@Override
public void run() {
if (pos <= getDocument().getLength()) {
setCaretPosition(pos);
}
}
}, 100);
return;
pos = th.startPos;
} else {
pos = tc.startPos;
}
}
setCaretPosition(0);
final int fpos = pos;
new Timer().schedule(new TimerTask() {
@Override
public void run() {
if (fpos <= getDocument().getLength()) {
setCaretPosition(fpos);
}
}
}, 100);
}
}
public DecompiledEditorPane(ABCPanel abcPanel) {
@@ -661,14 +663,19 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
cd = SWF.getCached(scriptLeaf);
} catch (InterruptedException ex) {
}
if (cd != null) {
final String hilightedCode = cd.text;
String hilightedCode = cd.text;
highlights = cd.getInstructionHighlights();
specialHighlights = cd.getSpecialHighligths();
traitHighlights = cd.getTraitHighlights();
methodHighlights = cd.getMethodHighlights();
classHighlights = cd.getClassHighlights();
setText(hilightedCode);
if (classHighlights.size() > 0) {
setCaretPosition(classHighlights.get(0).startPos);
}
}
fireScript();
}