diff --git a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java index 91184b9b8..7ebcf4c38 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java @@ -122,7 +122,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL } public void setNoTrait() { - abcPanel.detailPanel.showCard(DetailPanel.UNSUPPORTED_TRAIT_CARD, null); + abcPanel.detailPanel.showCard(DetailPanel.UNSUPPORTED_TRAIT_CARD, null, 0); } public void hilightSpecial(HighlightSpecialType type, long index) { @@ -193,7 +193,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL this.classIndex = classIndex; } - private boolean displayMethod(int pos, int methodIndex, String name, Trait trait, boolean isStatic) { + private boolean displayMethod(int pos, int methodIndex, String name, Trait trait, int traitIndex, boolean isStatic) { ABC abc = getABC(); if (abc == null) { return false; @@ -216,7 +216,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL trait = null; } } - abcPanel.detailPanel.showCard(DetailPanel.METHOD_TRAIT_CARD, trait); + abcPanel.detailPanel.showCard(DetailPanel.METHOD_GETTER_SETTER_TRAIT_CARD, trait, traitIndex); MethodCodePanel methodCodePanel = abcPanel.detailPanel.methodTraitPanel.methodCodePanel; if (reset || (methodCodePanel.getBodyIndex() != bi)) { methodCodePanel.setBodyIndex(scriptName, bi, abc, name, trait, script.scriptIndex); @@ -552,7 +552,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL } } - displayMethod(pos, (int) tm.getProperties().index, name, currentTrait, isStatic); + displayMethod(pos, (int) tm.getProperties().index, name, currentTrait, lastTraitIndex, isStatic); currentMethodHighlight = tm; return; } @@ -572,8 +572,9 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL abcPanel.detailPanel.slotConstTraitPanel.load((TraitSlotConst) currentTrait, abc, abc.isStaticTraitId(classIndex, lastTraitIndex)); final Trait ftrait = currentTrait; + final int ftraitIndex = lastTraitIndex; View.execInEventDispatch(() -> { - abcPanel.detailPanel.showCard(DetailPanel.SLOT_CONST_TRAIT_CARD, ftrait); + abcPanel.detailPanel.showCard(DetailPanel.SLOT_CONST_TRAIT_CARD, ftrait, ftraitIndex); }); abcPanel.detailPanel.setEditMode(false); currentMethodHighlight = null; @@ -594,7 +595,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL name += ":" + currentTrait.getName(abc).getName(abc.constants, null, false); } - displayMethod(pos, abc.findMethodIdByTraitId(classIndex, lastTraitIndex), name, currentTrait, isStatic); + displayMethod(pos, abc.findMethodIdByTraitId(classIndex, lastTraitIndex), name, currentTrait, lastTraitIndex, isStatic); return; } setNoTrait(); diff --git a/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java index 7eae0d6eb..07e06c314 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.gui.HeaderLabel; import com.jpexs.decompiler.flash.gui.Main; import com.jpexs.decompiler.flash.gui.TagEditorPanel; import com.jpexs.decompiler.flash.gui.View; +import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.helpers.CancellableWorker; import java.awt.BorderLayout; import java.awt.CardLayout; @@ -52,7 +53,7 @@ public class DetailPanel extends JPanel implements TagEditorPanel { public SlotConstTraitDetailPanel slotConstTraitPanel; - public static final String METHOD_TRAIT_CARD = "abc.detail.methodtrait"; + public static final String METHOD_GETTER_SETTER_TRAIT_CARD = "abc.detail.methodtrait"; public static final String UNSUPPORTED_TRAIT_CARD = "abc.detail.unsupported"; @@ -90,7 +91,7 @@ public class DetailPanel extends JPanel implements TagEditorPanel { CardLayout layout = new CardLayout(); innerPanel.setLayout(layout); methodTraitPanel = new MethodTraitDetailPanel(abcPanel); - cardMap.put(METHOD_TRAIT_CARD, methodTraitPanel); + cardMap.put(METHOD_GETTER_SETTER_TRAIT_CARD, methodTraitPanel); unsupportedTraitPanel = new JPanel(new BorderLayout()); JLabel unsup = new JLabel("" + AppStrings.translate("info.selecttrait") + "", SwingConstants.CENTER); @@ -193,7 +194,7 @@ public class DetailPanel extends JPanel implements TagEditorPanel { selectedLabel.setIcon(val ? View.getIcon("editing16") : null); } - public void showCard(final String name, final Trait trait) { + public void showCard(final String name, final Trait trait, int traitIndex) { View.execInEventDispatch(() -> { CardLayout layout = (CardLayout) innerPanel.getLayout(); layout.show(innerPanel, name); @@ -222,7 +223,66 @@ public class DetailPanel extends JPanel implements TagEditorPanel { } selectedCard = name; - selectedLabel.setText(AppStrings.translate(name)); + String detailTitleStr = AppStrings.translate("panel.disassembled") + AppStrings.translate("abc.detail.split") + "%pcode_type%"; + String traitStr = AppStrings.translate("abc.detail.trait"); + String pcodeTypeStr = null; + + if (trait != null) { + String traitTypeLang; + switch (trait.kindType) { + case Trait.TRAIT_CLASS: + traitTypeLang = "abc.detail.trait.class"; + break; + case Trait.TRAIT_CONST: + traitTypeLang = "abc.detail.trait.const"; + break; + case Trait.TRAIT_FUNCTION: + traitTypeLang = "abc.detail.trait.function"; + break; + case Trait.TRAIT_GETTER: + traitTypeLang = "abc.detail.trait.getter"; + break; + case Trait.TRAIT_METHOD: + traitTypeLang = "abc.detail.trait.method"; + break; + case Trait.TRAIT_SETTER: + traitTypeLang = "abc.detail.trait.setter"; + break; + case Trait.TRAIT_SLOT: + traitTypeLang = "abc.detail.trait.slot"; + break; + default: + traitTypeLang = "abc.detail.unsupported"; + } + traitStr = traitStr.replace("%trait_type%", AppStrings.translate(traitTypeLang)); + pcodeTypeStr = traitStr; + } + String specialMethodTypeLang = null; + switch (traitIndex) { + case GraphTextWriter.TRAIT_SCRIPT_INITIALIZER: + specialMethodTypeLang = "abc.detail.specialmethod.scriptinitializer"; + break; + case GraphTextWriter.TRAIT_CLASS_INITIALIZER: + specialMethodTypeLang = "abc.detail.specialmethod.classinitializer"; + break; + case GraphTextWriter.TRAIT_INSTANCE_INITIALIZER: + specialMethodTypeLang = "abc.detail.specialmethod.instanceinitializer"; + break; + } + if (specialMethodTypeLang != null) { + String specialMethodStr = AppStrings.translate("abc.detail.specialmethod").replace("%specialmethod_type%", AppStrings.translate(specialMethodTypeLang)); + pcodeTypeStr = specialMethodStr; + } + if (pcodeTypeStr == null) { + if (METHOD_GETTER_SETTER_TRAIT_CARD.equals(name) && trait == null) { + pcodeTypeStr = AppStrings.translate("abc.detail.innerfunction"); + } else { + pcodeTypeStr = AppStrings.translate("abc.detail.unsupported"); + } + } + detailTitleStr = detailTitleStr.replace("%pcode_type%", pcodeTypeStr); + + selectedLabel.setText(detailTitleStr); if (trait == null) { traitNameLabel.setText("-"); } else if (abcPanel != null) { diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index 1cd00fb83..c6b192141 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -165,8 +165,10 @@ traits = Traits pleasewait = Please wait +#DEPRECATED - see abc.detail.trait.* abc.detail.methodtrait = Method/Getter/Setter Trait abc.detail.unsupported = - +#DEPRECATED - see abc.detail.trait.* abc.detail.slotconsttrait = Slot/Const Trait abc.detail.traitname = Name: @@ -736,3 +738,21 @@ generic.editor.amf3.help = AMF3 value syntax:\n\ \ * Keys in Dictionary entries can be any type\n contextmenu.showInResources = Show in Resources message.flexpath.notset = Flex SDK not found. Please configure its path in Advanced Settings / Paths (4). + + +#add after panel.disassembled string +abc.detail.split = :\u0020 +abc.detail.trait = Trait - %trait_type% +abc.detail.trait.method = Method +abc.detail.trait.getter = Getter +abc.detail.trait.setter = Setter +abc.detail.trait.slot = Slot +abc.detail.trait.const = Const +abc.detail.trait.class = Class +abc.detail.trait.function = Function + +abc.detail.specialmethod = Special method - %specialmethod_type% +abc.detail.specialmethod.scriptinitializer = Script initializer +abc.detail.specialmethod.classinitializer = Class initializer +abc.detail.specialmethod.instanceinitializer = Instance initializer +abc.detail.innerfunction = Inner function