mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-18 16:38:08 +00:00
search: small improvement/fix
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.search;
|
||||
|
||||
import com.jpexs.decompiler.flash.AppResources;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.abc.ScriptPack;
|
||||
import com.jpexs.decompiler.flash.cache.ScriptDecompiledListener;
|
||||
@@ -50,8 +49,6 @@ public class ActionScriptSearch {
|
||||
|
||||
int pos = 0;
|
||||
List<Future<HighlightedText>> futures = new ArrayList<>();
|
||||
String workText = AppResources.translate("work.searching");
|
||||
String decAdd = ", " + AppResources.translate("work.decompiling");
|
||||
try {
|
||||
for (Map.Entry<String, ASMSource> item : asms.entrySet()) {
|
||||
pos++;
|
||||
@@ -71,14 +68,14 @@ public class ActionScriptSearch {
|
||||
@Override
|
||||
public void onStart() {
|
||||
if (listener != null) {
|
||||
listener.onWork(workText + " \"" + txt + "\"" + decAdd + " - (" + fpos + "/" + asms.size() + ") " + item.getKey() + "... ");
|
||||
listener.onDecompile(fpos, asms.size(), item.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete(HighlightedText result) {
|
||||
if (listener != null) {
|
||||
listener.onWork(workText + " \"" + txt + "\"" + decAdd + " - (" + fpos + "/" + asms.size() + ") " + item.getKey() + "... ");
|
||||
listener.onSearch(fpos, asms.size(), item.getKey());
|
||||
}
|
||||
|
||||
if (pat.matcher(result.text).find()) {
|
||||
@@ -121,8 +118,6 @@ public class ActionScriptSearch {
|
||||
|
||||
int pos = 0;
|
||||
List<Future<HighlightedText>> futures = new ArrayList<>();
|
||||
String workText = AppResources.translate("work.searching");
|
||||
String decAdd = ", " + AppResources.translate("work.decompiling");
|
||||
try {
|
||||
loop:
|
||||
for (final ScriptPack pack : allpacks) {
|
||||
@@ -147,14 +142,14 @@ public class ActionScriptSearch {
|
||||
@Override
|
||||
public void onStart() {
|
||||
if (listener != null) {
|
||||
listener.onWork(workText + " \"" + txt + "\"" + decAdd + " - (" + fpos + "/" + allpacks.size() + ") " + pack.getClassPath().toString() + "... ");
|
||||
listener.onDecompile(fpos, allpacks.size(), pack.getClassPath().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete(HighlightedText result) {
|
||||
if (listener != null) {
|
||||
listener.onWork(workText + " \"" + txt + "\" - (" + fpos + "/" + allpacks.size() + ") " + pack.getClassPath().toString() + "... ");
|
||||
listener.onSearch(fpos, allpacks.size(), pack.getClassPath().toString());
|
||||
}
|
||||
|
||||
if (pat.matcher(result.text).find()) {
|
||||
|
||||
@@ -22,5 +22,7 @@ package com.jpexs.decompiler.flash.search;
|
||||
*/
|
||||
public interface ScriptSearchListener {
|
||||
|
||||
public void onWork(String message);
|
||||
public void onDecompile(int pos, int total, String name);
|
||||
|
||||
public void onSearch(int pos, int total, String name);
|
||||
}
|
||||
|
||||
@@ -192,10 +192,18 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABC
|
||||
public List<ABCSearchResult> search(final SWF swf, final String txt, boolean ignoreCase, boolean regexp, boolean pcode, CancellableWorker<Void> worker) {
|
||||
if (txt != null && !txt.isEmpty()) {
|
||||
searchPanel.setOptions(ignoreCase, regexp);
|
||||
|
||||
String workText = AppStrings.translate("work.searching");
|
||||
String decAdd = AppStrings.translate("work.decompiling");
|
||||
return new ActionScriptSearch().searchAs3(swf, txt, ignoreCase, regexp, pcode, new ScriptSearchListener() {
|
||||
@Override
|
||||
public void onWork(String message) {
|
||||
Main.startWork(message, worker);
|
||||
public void onDecompile(int pos, int total, String name) {
|
||||
Main.startWork(workText + " \"" + txt + "\", " + decAdd + " - (" + pos + "/" + total + ") " + name + "... ", worker);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSearch(int pos, int total, String name) {
|
||||
Main.startWork(workText + " \"" + txt + "\" - (" + pos + "/" + total + ") " + name + "... ", worker);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -247,10 +247,18 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
|
||||
public List<ActionSearchResult> search(SWF swf, final String txt, boolean ignoreCase, boolean regexp, boolean pcode, CancellableWorker<Void> worker) {
|
||||
if (txt != null && !txt.isEmpty()) {
|
||||
searchPanel.setOptions(ignoreCase, regexp);
|
||||
|
||||
String workText = AppStrings.translate("work.searching");
|
||||
String decAdd = AppStrings.translate("work.decompiling");
|
||||
return new ActionScriptSearch().searchAs2(swf, txt, ignoreCase, regexp, pcode, new ScriptSearchListener() {
|
||||
@Override
|
||||
public void onWork(String message) {
|
||||
Main.startWork(message, worker);
|
||||
public void onDecompile(int pos, int total, String name) {
|
||||
Main.startWork(workText + " \"" + txt + "\", " + decAdd + " - (" + pos + "/" + total + ") " + name + "... ", worker);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSearch(int pos, int total, String name) {
|
||||
Main.startWork(workText + " \"" + txt + "\" - (" + pos + "/" + total + ") " + name + "... ", worker);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user