mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-03 10:45:52 +00:00
Do not show script initializer in trait list for compound script
This commit is contained in:
@@ -263,9 +263,9 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
|
||||
return success;
|
||||
}
|
||||
|
||||
public void displayClass(int classIndex, int scriptIndex) {
|
||||
public void displayClass(int classIndex, int scriptIndex, boolean hasScriptInitializer) {
|
||||
if (abcPanel.navigator.getClassIndex() != classIndex) {
|
||||
abcPanel.navigator.setClassIndex(classIndex, scriptIndex);
|
||||
abcPanel.navigator.setClassIndex(classIndex, scriptIndex, hasScriptInitializer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -636,7 +636,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
|
||||
if (cm != null) {
|
||||
classIndex = (int) cm.getProperties().index;
|
||||
}
|
||||
displayClass(classIndex, script.scriptIndex);
|
||||
displayClass(classIndex, script.scriptIndex, script.isSimple || script.traitIndices.isEmpty());
|
||||
Highlighting tm = Highlighting.searchPos(highlightedText.getMethodHighlights(), pos);
|
||||
if (tm != null) {
|
||||
String name = "";
|
||||
@@ -666,7 +666,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
|
||||
}
|
||||
|
||||
if (classIndex == -1) {
|
||||
abcPanel.navigator.setClassIndex(-1, script.scriptIndex);
|
||||
abcPanel.navigator.setClassIndex(-1, script.scriptIndex, script.isSimple || script.traitIndices.isEmpty());
|
||||
//setNoTrait();
|
||||
//return;
|
||||
}
|
||||
|
||||
@@ -71,10 +71,10 @@ public class TraitsList extends JList<Object> implements ListSelectionListener {
|
||||
public void setAbc(ABC abc) {
|
||||
this.abc = abc;
|
||||
setModel(new DefaultListModel<>());
|
||||
setClassIndex(-1, -1);
|
||||
setClassIndex(-1, -1, false);
|
||||
}
|
||||
|
||||
public void setClassIndex(int classIndex, int scriptIndex) {
|
||||
public void setClassIndex(int classIndex, int scriptIndex, boolean hasScriptInitializer) {
|
||||
if (abc == null) {
|
||||
return;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class TraitsList extends JList<Object> implements ListSelectionListener {
|
||||
}
|
||||
|
||||
this.classIndex = classIndex;
|
||||
setModel(new TraitsListModel(abc, classIndex, scriptIndex, sorted));
|
||||
setModel(new TraitsListModel(abc, classIndex, scriptIndex, sorted, hasScriptInitializer));
|
||||
}
|
||||
|
||||
private int lastSelected = -1;
|
||||
|
||||
@@ -40,6 +40,8 @@ public final class TraitsListModel implements ListModel<Object> {
|
||||
private final int classIndex;
|
||||
|
||||
private final int scriptIndex;
|
||||
|
||||
private final boolean hasScriptInitializer;
|
||||
|
||||
public void setSorted(boolean sorted) {
|
||||
if (sorted) {
|
||||
@@ -77,15 +79,16 @@ public final class TraitsListModel implements ListModel<Object> {
|
||||
items.add(new TraitsListItem(TraitType.INITIALIZER, 0, true, abc, classIndex, scriptIndex));
|
||||
}
|
||||
|
||||
if (Configuration.enableScriptInitializerDisplay.get()) {
|
||||
if (hasScriptInitializer) {
|
||||
items.add(new TraitsListItem(TraitType.SCRIPT_INITIALIZER, 0, true, abc, classIndex, scriptIndex));
|
||||
}
|
||||
}
|
||||
|
||||
public TraitsListModel(ABC abc, int classIndex, int scriptIndex, boolean sorted) {
|
||||
public TraitsListModel(ABC abc, int classIndex, int scriptIndex, boolean sorted, boolean hasScriptInitializer) {
|
||||
this.abc = abc;
|
||||
this.classIndex = classIndex;
|
||||
this.scriptIndex = scriptIndex;
|
||||
this.hasScriptInitializer = hasScriptInitializer;
|
||||
reset();
|
||||
if (sorted) {
|
||||
setSorted(true);
|
||||
|
||||
Reference in New Issue
Block a user