Commit 9189f23e authored by Skylot's avatar Skylot

refactor(gui): rename Utils class due to clash with class from core

parent 62826334
...@@ -10,7 +10,7 @@ import org.slf4j.LoggerFactory; ...@@ -10,7 +10,7 @@ import org.slf4j.LoggerFactory;
import jadx.gui.ui.ProgressPanel; import jadx.gui.ui.ProgressPanel;
import jadx.gui.utils.CacheObject; import jadx.gui.utils.CacheObject;
import jadx.gui.utils.NLS; import jadx.gui.utils.NLS;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
import jadx.gui.utils.search.TextSearchIndex; import jadx.gui.utils.search.TextSearchIndex;
public class BackgroundWorker extends SwingWorker<Void, Void> { public class BackgroundWorker extends SwingWorker<Void, Void> {
...@@ -45,20 +45,20 @@ public class BackgroundWorker extends SwingWorker<Void, Void> { ...@@ -45,20 +45,20 @@ public class BackgroundWorker extends SwingWorker<Void, Void> {
protected Void doInBackground() { protected Void doInBackground() {
try { try {
System.gc(); System.gc();
LOG.debug("Memory usage: Before decompile: {}", Utils.memoryInfo()); LOG.debug("Memory usage: Before decompile: {}", UiUtils.memoryInfo());
runJob(cache.getDecompileJob()); runJob(cache.getDecompileJob());
LOG.debug("Memory usage: Before index: {}", Utils.memoryInfo()); LOG.debug("Memory usage: Before index: {}", UiUtils.memoryInfo());
runJob(cache.getIndexJob()); runJob(cache.getIndexJob());
LOG.debug("Memory usage: After index: {}", Utils.memoryInfo()); LOG.debug("Memory usage: After index: {}", UiUtils.memoryInfo());
System.gc(); System.gc();
LOG.debug("Memory usage: After gc: {}", Utils.memoryInfo()); LOG.debug("Memory usage: After gc: {}", UiUtils.memoryInfo());
TextSearchIndex searchIndex = cache.getTextIndex(); TextSearchIndex searchIndex = cache.getTextIndex();
if (searchIndex != null && searchIndex.getSkippedCount() > 0) { if (searchIndex != null && searchIndex.getSkippedCount() > 0) {
LOG.warn("Indexing of some classes skipped, count: {}, low memory: {}", LOG.warn("Indexing of some classes skipped, count: {}, low memory: {}",
searchIndex.getSkippedCount(), Utils.memoryInfo()); searchIndex.getSkippedCount(), UiUtils.memoryInfo());
String msg = NLS.str("message.indexingClassesSkipped", searchIndex.getSkippedCount()); String msg = NLS.str("message.indexingClassesSkipped", searchIndex.getSkippedCount());
JOptionPane.showMessageDialog(null, msg); JOptionPane.showMessageDialog(null, msg);
} }
......
...@@ -13,7 +13,7 @@ import jadx.gui.utils.CacheObject; ...@@ -13,7 +13,7 @@ import jadx.gui.utils.CacheObject;
import jadx.gui.utils.CodeLinesInfo; import jadx.gui.utils.CodeLinesInfo;
import jadx.gui.utils.CodeUsageInfo; import jadx.gui.utils.CodeUsageInfo;
import jadx.gui.utils.JNodeCache; import jadx.gui.utils.JNodeCache;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
import jadx.gui.utils.search.StringRef; import jadx.gui.utils.search.StringRef;
import jadx.gui.utils.search.TextSearchIndex; import jadx.gui.utils.search.TextSearchIndex;
...@@ -42,7 +42,7 @@ public class IndexJob extends BackgroundJob { ...@@ -42,7 +42,7 @@ public class IndexJob extends BackgroundJob {
List<StringRef> lines = splitLines(cls); List<StringRef> lines = splitLines(cls);
usageInfo.processClass(cls, linesInfo, lines); usageInfo.processClass(cls, linesInfo, lines);
if (Utils.isFreeMemoryAvailable()) { if (UiUtils.isFreeMemoryAvailable()) {
index.indexCode(cls, linesInfo, lines); index.indexCode(cls, linesInfo, lines);
} else { } else {
index.classCodeIndexSkipped(cls); index.classCodeIndexSkipped(cls);
......
...@@ -17,14 +17,14 @@ import com.android.apksig.ApkVerifier; ...@@ -17,14 +17,14 @@ import com.android.apksig.ApkVerifier;
import jadx.gui.JadxWrapper; import jadx.gui.JadxWrapper;
import jadx.gui.utils.CertificateManager; import jadx.gui.utils.CertificateManager;
import jadx.gui.utils.NLS; import jadx.gui.utils.NLS;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
public class ApkSignature extends JNode { public class ApkSignature extends JNode {
private static final long serialVersionUID = -9121321926113143407L; private static final long serialVersionUID = -9121321926113143407L;
private static final Logger LOG = LoggerFactory.getLogger(ApkSignature.class); private static final Logger LOG = LoggerFactory.getLogger(ApkSignature.class);
private static final ImageIcon CERTIFICATE_ICON = Utils.openIcon("certificate_obj"); private static final ImageIcon CERTIFICATE_ICON = UiUtils.openIcon("certificate_obj");
private final transient File openFile; private final transient File openFile;
private String content; private String content;
......
...@@ -17,13 +17,13 @@ import jadx.api.ResourceFile; ...@@ -17,13 +17,13 @@ import jadx.api.ResourceFile;
import jadx.core.utils.files.ZipSecurity; import jadx.core.utils.files.ZipSecurity;
import jadx.gui.utils.CertificateManager; import jadx.gui.utils.CertificateManager;
import jadx.gui.utils.NLS; import jadx.gui.utils.NLS;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
public class JCertificate extends JNode { public class JCertificate extends JNode {
private static final long serialVersionUID = 4308696770188518731L; private static final long serialVersionUID = 4308696770188518731L;
private static final Logger LOG = LoggerFactory.getLogger(JCertificate.class); private static final Logger LOG = LoggerFactory.getLogger(JCertificate.class);
private static final ImageIcon CERTIFICATE_ICON = Utils.openIcon("certificate_obj"); private static final ImageIcon CERTIFICATE_ICON = UiUtils.openIcon("certificate_obj");
private final transient ResourceFile rf; private final transient ResourceFile rf;
......
...@@ -10,18 +10,18 @@ import jadx.api.JavaMethod; ...@@ -10,18 +10,18 @@ import jadx.api.JavaMethod;
import jadx.api.JavaNode; import jadx.api.JavaNode;
import jadx.core.dex.info.AccessInfo; import jadx.core.dex.info.AccessInfo;
import jadx.gui.utils.NLS; import jadx.gui.utils.NLS;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
public class JClass extends JLoadableNode { public class JClass extends JLoadableNode {
private static final long serialVersionUID = -1239986875244097177L; private static final long serialVersionUID = -1239986875244097177L;
private static final ImageIcon ICON_CLASS = Utils.openIcon("class_obj"); private static final ImageIcon ICON_CLASS = UiUtils.openIcon("class_obj");
private static final ImageIcon ICON_CLASS_DEFAULT = Utils.openIcon("class_default_obj"); private static final ImageIcon ICON_CLASS_DEFAULT = UiUtils.openIcon("class_default_obj");
private static final ImageIcon ICON_CLASS_PRIVATE = Utils.openIcon("innerclass_private_obj"); private static final ImageIcon ICON_CLASS_PRIVATE = UiUtils.openIcon("innerclass_private_obj");
private static final ImageIcon ICON_CLASS_PROTECTED = Utils.openIcon("innerclass_protected_obj"); private static final ImageIcon ICON_CLASS_PROTECTED = UiUtils.openIcon("innerclass_protected_obj");
private static final ImageIcon ICON_INTERFACE = Utils.openIcon("int_obj"); private static final ImageIcon ICON_INTERFACE = UiUtils.openIcon("int_obj");
private static final ImageIcon ICON_ENUM = Utils.openIcon("enum_obj"); private static final ImageIcon ICON_ENUM = UiUtils.openIcon("enum_obj");
private static final ImageIcon ICON_ANNOTATION = Utils.openIcon("annotation_obj"); private static final ImageIcon ICON_ANNOTATION = UiUtils.openIcon("annotation_obj");
private final transient JavaClass cls; private final transient JavaClass cls;
private final transient JClass jParent; private final transient JClass jParent;
......
...@@ -6,18 +6,18 @@ import jadx.api.JavaField; ...@@ -6,18 +6,18 @@ import jadx.api.JavaField;
import jadx.api.JavaNode; import jadx.api.JavaNode;
import jadx.core.dex.info.AccessInfo; import jadx.core.dex.info.AccessInfo;
import jadx.gui.utils.OverlayIcon; import jadx.gui.utils.OverlayIcon;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
public class JField extends JNode { public class JField extends JNode {
private static final long serialVersionUID = 1712572192106793359L; private static final long serialVersionUID = 1712572192106793359L;
private static final ImageIcon ICON_FLD_DEF = Utils.openIcon("field_default_obj"); private static final ImageIcon ICON_FLD_DEF = UiUtils.openIcon("field_default_obj");
private static final ImageIcon ICON_FLD_PRI = Utils.openIcon("field_private_obj"); private static final ImageIcon ICON_FLD_PRI = UiUtils.openIcon("field_private_obj");
private static final ImageIcon ICON_FLD_PRO = Utils.openIcon("field_protected_obj"); private static final ImageIcon ICON_FLD_PRO = UiUtils.openIcon("field_protected_obj");
private static final ImageIcon ICON_FLD_PUB = Utils.openIcon("field_public_obj"); private static final ImageIcon ICON_FLD_PUB = UiUtils.openIcon("field_public_obj");
private static final ImageIcon ICON_TRANSIENT = Utils.openIcon("transient_co"); private static final ImageIcon ICON_TRANSIENT = UiUtils.openIcon("transient_co");
private static final ImageIcon ICON_VOLATILE = Utils.openIcon("volatile_co"); private static final ImageIcon ICON_VOLATILE = UiUtils.openIcon("volatile_co");
private final transient JavaField field; private final transient JavaField field;
private final transient JClass jParent; private final transient JClass jParent;
...@@ -50,7 +50,7 @@ public class JField extends JNode { ...@@ -50,7 +50,7 @@ public class JField extends JNode {
@Override @Override
public Icon getIcon() { public Icon getIcon() {
AccessInfo af = field.getAccessFlags(); AccessInfo af = field.getAccessFlags();
OverlayIcon icon = Utils.makeIcon(af, ICON_FLD_PUB, ICON_FLD_PRI, ICON_FLD_PRO, ICON_FLD_DEF); OverlayIcon icon = UiUtils.makeIcon(af, ICON_FLD_PUB, ICON_FLD_PRI, ICON_FLD_PRO, ICON_FLD_DEF);
if (af.isTransient()) { if (af.isTransient()) {
icon.add(ICON_TRANSIENT); icon.add(ICON_TRANSIENT);
} }
...@@ -62,12 +62,12 @@ public class JField extends JNode { ...@@ -62,12 +62,12 @@ public class JField extends JNode {
@Override @Override
public String makeString() { public String makeString() {
return Utils.typeFormat(field.getName(), field.getType()); return UiUtils.typeFormat(field.getName(), field.getType());
} }
@Override @Override
public String makeLongString() { public String makeLongString() {
return Utils.typeFormat(field.getFullName(), field.getType()); return UiUtils.typeFormat(field.getFullName(), field.getType());
} }
@Override @Override
......
...@@ -9,18 +9,18 @@ import jadx.api.JavaNode; ...@@ -9,18 +9,18 @@ import jadx.api.JavaNode;
import jadx.core.dex.info.AccessInfo; import jadx.core.dex.info.AccessInfo;
import jadx.core.dex.instructions.args.ArgType; import jadx.core.dex.instructions.args.ArgType;
import jadx.gui.utils.OverlayIcon; import jadx.gui.utils.OverlayIcon;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
public class JMethod extends JNode { public class JMethod extends JNode {
private static final long serialVersionUID = 3834526867464663751L; private static final long serialVersionUID = 3834526867464663751L;
private static final ImageIcon ICON_MTH_DEF = Utils.openIcon("methdef_obj"); private static final ImageIcon ICON_MTH_DEF = UiUtils.openIcon("methdef_obj");
private static final ImageIcon ICON_MTH_PRI = Utils.openIcon("methpri_obj"); private static final ImageIcon ICON_MTH_PRI = UiUtils.openIcon("methpri_obj");
private static final ImageIcon ICON_MTH_PRO = Utils.openIcon("methpro_obj"); private static final ImageIcon ICON_MTH_PRO = UiUtils.openIcon("methpro_obj");
private static final ImageIcon ICON_MTH_PUB = Utils.openIcon("methpub_obj"); private static final ImageIcon ICON_MTH_PUB = UiUtils.openIcon("methpub_obj");
private static final ImageIcon ICON_CONSTRUCTOR = Utils.openIcon("constr_ovr"); private static final ImageIcon ICON_CONSTRUCTOR = UiUtils.openIcon("constr_ovr");
private static final ImageIcon ICON_SYNC = Utils.openIcon("synch_co"); private static final ImageIcon ICON_SYNC = UiUtils.openIcon("synch_co");
private final transient JavaMethod mth; private final transient JavaMethod mth;
private final transient JClass jParent; private final transient JClass jParent;
...@@ -57,7 +57,7 @@ public class JMethod extends JNode { ...@@ -57,7 +57,7 @@ public class JMethod extends JNode {
@Override @Override
public Icon getIcon() { public Icon getIcon() {
AccessInfo accessFlags = mth.getAccessFlags(); AccessInfo accessFlags = mth.getAccessFlags();
OverlayIcon icon = Utils.makeIcon(accessFlags, ICON_MTH_PUB, ICON_MTH_PRI, ICON_MTH_PRO, ICON_MTH_DEF); OverlayIcon icon = UiUtils.makeIcon(accessFlags, ICON_MTH_PUB, ICON_MTH_PRI, ICON_MTH_PRO, ICON_MTH_DEF);
if (accessFlags.isConstructor()) { if (accessFlags.isConstructor()) {
icon.add(ICON_CONSTRUCTOR); icon.add(ICON_CONSTRUCTOR);
} }
...@@ -79,7 +79,7 @@ public class JMethod extends JNode { ...@@ -79,7 +79,7 @@ public class JMethod extends JNode {
} }
base.append('('); base.append('(');
for (Iterator<ArgType> it = mth.getArguments().iterator(); it.hasNext();) { for (Iterator<ArgType> it = mth.getArguments().iterator(); it.hasNext();) {
base.append(Utils.typeStr(it.next())); base.append(UiUtils.typeStr(it.next()));
if (it.hasNext()) { if (it.hasNext()) {
base.append(", "); base.append(", ");
} }
...@@ -90,13 +90,13 @@ public class JMethod extends JNode { ...@@ -90,13 +90,13 @@ public class JMethod extends JNode {
@Override @Override
public String makeString() { public String makeString() {
return Utils.typeFormat(makeBaseString(), getReturnType()); return UiUtils.typeFormat(makeBaseString(), getReturnType());
} }
@Override @Override
public String makeLongString() { public String makeLongString() {
String name = mth.getDeclaringClass().getFullName() + '.' + makeBaseString(); String name = mth.getDeclaringClass().getFullName() + '.' + makeBaseString();
return Utils.typeFormat(name, getReturnType()); return UiUtils.typeFormat(name, getReturnType());
} }
@Override @Override
......
...@@ -10,12 +10,12 @@ import org.jetbrains.annotations.NotNull; ...@@ -10,12 +10,12 @@ import org.jetbrains.annotations.NotNull;
import jadx.api.JavaClass; import jadx.api.JavaClass;
import jadx.api.JavaPackage; import jadx.api.JavaPackage;
import jadx.gui.JadxWrapper; import jadx.gui.JadxWrapper;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
public class JPackage extends JNode implements Comparable<JPackage> { public class JPackage extends JNode implements Comparable<JPackage> {
private static final long serialVersionUID = -4120718634156839804L; private static final long serialVersionUID = -4120718634156839804L;
private static final ImageIcon PACKAGE_ICON = Utils.openIcon("package_obj"); private static final ImageIcon PACKAGE_ICON = UiUtils.openIcon("package_obj");
private final String fullName; private final String fullName;
private String name; private String name;
......
...@@ -19,17 +19,17 @@ import jadx.core.codegen.CodeWriter; ...@@ -19,17 +19,17 @@ import jadx.core.codegen.CodeWriter;
import jadx.core.xmlgen.ResContainer; import jadx.core.xmlgen.ResContainer;
import jadx.gui.utils.NLS; import jadx.gui.utils.NLS;
import jadx.gui.utils.OverlayIcon; import jadx.gui.utils.OverlayIcon;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
public class JResource extends JLoadableNode implements Comparable<JResource> { public class JResource extends JLoadableNode implements Comparable<JResource> {
private static final long serialVersionUID = -201018424302612434L; private static final long serialVersionUID = -201018424302612434L;
private static final ImageIcon ROOT_ICON = Utils.openIcon("cf_obj"); private static final ImageIcon ROOT_ICON = UiUtils.openIcon("cf_obj");
private static final ImageIcon FOLDER_ICON = Utils.openIcon("folder"); private static final ImageIcon FOLDER_ICON = UiUtils.openIcon("folder");
private static final ImageIcon FILE_ICON = Utils.openIcon("file_obj"); private static final ImageIcon FILE_ICON = UiUtils.openIcon("file_obj");
private static final ImageIcon MANIFEST_ICON = Utils.openIcon("template_obj"); private static final ImageIcon MANIFEST_ICON = UiUtils.openIcon("template_obj");
private static final ImageIcon JAVA_ICON = Utils.openIcon("java_ovr"); private static final ImageIcon JAVA_ICON = UiUtils.openIcon("java_ovr");
private static final ImageIcon ERROR_ICON = Utils.openIcon("error_co"); private static final ImageIcon ERROR_ICON = UiUtils.openIcon("error_co");
public enum JResType { public enum JResType {
ROOT, ROOT,
......
...@@ -12,12 +12,12 @@ import jadx.api.ResourceFile; ...@@ -12,12 +12,12 @@ import jadx.api.ResourceFile;
import jadx.gui.JadxWrapper; import jadx.gui.JadxWrapper;
import jadx.gui.treemodel.JResource.JResType; import jadx.gui.treemodel.JResource.JResType;
import jadx.gui.utils.NLS; import jadx.gui.utils.NLS;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
public class JRoot extends JNode { public class JRoot extends JNode {
private static final long serialVersionUID = 8888495789773527342L; private static final long serialVersionUID = 8888495789773527342L;
private static final ImageIcon ROOT_ICON = Utils.openIcon("java_model_obj"); private static final ImageIcon ROOT_ICON = UiUtils.openIcon("java_model_obj");
private final transient JadxWrapper wrapper; private final transient JadxWrapper wrapper;
......
...@@ -14,12 +14,12 @@ import javax.swing.*; ...@@ -14,12 +14,12 @@ import javax.swing.*;
import jadx.api.JavaPackage; import jadx.api.JavaPackage;
import jadx.gui.JadxWrapper; import jadx.gui.JadxWrapper;
import jadx.gui.utils.NLS; import jadx.gui.utils.NLS;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
public class JSources extends JNode { public class JSources extends JNode {
private static final long serialVersionUID = 8962924556824862801L; private static final long serialVersionUID = 8962924556824862801L;
private static final ImageIcon ROOT_ICON = Utils.openIcon("packagefolder_obj"); private static final ImageIcon ROOT_ICON = UiUtils.openIcon("packagefolder_obj");
private final transient JadxWrapper wrapper; private final transient JadxWrapper wrapper;
private final transient boolean flatPackages; private final transient boolean flatPackages;
......
...@@ -7,7 +7,7 @@ import javax.swing.*; ...@@ -7,7 +7,7 @@ import javax.swing.*;
import jadx.api.JadxDecompiler; import jadx.api.JadxDecompiler;
import jadx.gui.utils.NLS; import jadx.gui.utils.NLS;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
class AboutDialog extends JDialog { class AboutDialog extends JDialog {
private static final long serialVersionUID = 5763493590584039096L; private static final long serialVersionUID = 5763493590584039096L;
...@@ -70,7 +70,7 @@ class AboutDialog extends JDialog { ...@@ -70,7 +70,7 @@ class AboutDialog extends JDialog {
contentPane.add(textPane, BorderLayout.CENTER); contentPane.add(textPane, BorderLayout.CENTER);
contentPane.add(close, BorderLayout.PAGE_END); contentPane.add(close, BorderLayout.PAGE_END);
Utils.setWindowIcons(this); UiUtils.setWindowIcons(this);
setModalityType(ModalityType.APPLICATION_MODAL); setModalityType(ModalityType.APPLICATION_MODAL);
......
...@@ -12,7 +12,7 @@ import org.slf4j.Logger; ...@@ -12,7 +12,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import jadx.gui.utils.NLS; import jadx.gui.utils.NLS;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
public class HeapUsageBar extends JProgressBar implements ActionListener { public class HeapUsageBar extends JProgressBar implements ActionListener {
private static final Logger LOG = LoggerFactory.getLogger(HeapUsageBar.class); private static final Logger LOG = LoggerFactory.getLogger(HeapUsageBar.class);
...@@ -43,7 +43,7 @@ public class HeapUsageBar extends JProgressBar implements ActionListener { ...@@ -43,7 +43,7 @@ public class HeapUsageBar extends JProgressBar implements ActionListener {
Runtime.getRuntime().gc(); Runtime.getRuntime().gc();
update(); update();
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Memory used: {}", Utils.memoryInfo()); LOG.debug("Memory used: {}", UiUtils.memoryInfo());
} }
} }
}); });
...@@ -55,7 +55,7 @@ public class HeapUsageBar extends JProgressBar implements ActionListener { ...@@ -55,7 +55,7 @@ public class HeapUsageBar extends JProgressBar implements ActionListener {
setValue(usedKB); setValue(usedKB);
setString(NLS.str("heapUsage.text", (usedKB / TWO_TO_20), maxGB)); setString(NLS.str("heapUsage.text", (usedKB / TWO_TO_20), maxGB));
if ((used + Utils.MIN_FREE_MEMORY) > runtime.maxMemory()) { if ((used + UiUtils.MIN_FREE_MEMORY) > runtime.maxMemory()) {
setForeground(RED); setForeground(RED);
} else { } else {
setForeground(GREEN); setForeground(GREEN);
......
...@@ -92,7 +92,7 @@ import jadx.gui.utils.FontUtils; ...@@ -92,7 +92,7 @@ import jadx.gui.utils.FontUtils;
import jadx.gui.utils.JumpPosition; import jadx.gui.utils.JumpPosition;
import jadx.gui.utils.Link; import jadx.gui.utils.Link;
import jadx.gui.utils.NLS; import jadx.gui.utils.NLS;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
import static javax.swing.KeyStroke.getKeyStroke; import static javax.swing.KeyStroke.getKeyStroke;
...@@ -106,20 +106,20 @@ public class MainWindow extends JFrame { ...@@ -106,20 +106,20 @@ public class MainWindow extends JFrame {
private static final double WINDOW_RATIO = 1 - BORDER_RATIO * 2; private static final double WINDOW_RATIO = 1 - BORDER_RATIO * 2;
private static final double SPLIT_PANE_RESIZE_WEIGHT = 0.15; private static final double SPLIT_PANE_RESIZE_WEIGHT = 0.15;
private static final ImageIcon ICON_OPEN = Utils.openIcon("folder"); private static final ImageIcon ICON_OPEN = UiUtils.openIcon("folder");
private static final ImageIcon ICON_SAVE_ALL = Utils.openIcon("disk_multiple"); private static final ImageIcon ICON_SAVE_ALL = UiUtils.openIcon("disk_multiple");
private static final ImageIcon ICON_EXPORT = Utils.openIcon("database_save"); private static final ImageIcon ICON_EXPORT = UiUtils.openIcon("database_save");
private static final ImageIcon ICON_CLOSE = Utils.openIcon("cross"); private static final ImageIcon ICON_CLOSE = UiUtils.openIcon("cross");
private static final ImageIcon ICON_SYNC = Utils.openIcon("sync"); private static final ImageIcon ICON_SYNC = UiUtils.openIcon("sync");
private static final ImageIcon ICON_FLAT_PKG = Utils.openIcon("empty_logical_package_obj"); private static final ImageIcon ICON_FLAT_PKG = UiUtils.openIcon("empty_logical_package_obj");
private static final ImageIcon ICON_SEARCH = Utils.openIcon("wand"); private static final ImageIcon ICON_SEARCH = UiUtils.openIcon("wand");
private static final ImageIcon ICON_FIND = Utils.openIcon("magnifier"); private static final ImageIcon ICON_FIND = UiUtils.openIcon("magnifier");
private static final ImageIcon ICON_BACK = Utils.openIcon("icon_back"); private static final ImageIcon ICON_BACK = UiUtils.openIcon("icon_back");
private static final ImageIcon ICON_FORWARD = Utils.openIcon("icon_forward"); private static final ImageIcon ICON_FORWARD = UiUtils.openIcon("icon_forward");
private static final ImageIcon ICON_PREF = Utils.openIcon("wrench"); private static final ImageIcon ICON_PREF = UiUtils.openIcon("wrench");
private static final ImageIcon ICON_DEOBF = Utils.openIcon("lock_edit"); private static final ImageIcon ICON_DEOBF = UiUtils.openIcon("lock_edit");
private static final ImageIcon ICON_LOG = Utils.openIcon("report"); private static final ImageIcon ICON_LOG = UiUtils.openIcon("report");
private static final ImageIcon ICON_JADX = Utils.openIcon("jadx-logo"); private static final ImageIcon ICON_JADX = UiUtils.openIcon("jadx-logo");
private final transient JadxWrapper wrapper; private final transient JadxWrapper wrapper;
private final transient JadxSettings settings; private final transient JadxSettings settings;
...@@ -159,7 +159,7 @@ public class MainWindow extends JFrame { ...@@ -159,7 +159,7 @@ public class MainWindow extends JFrame {
FontUtils.registerBundledFonts(); FontUtils.registerBundledFonts();
initUI(); initUI();
initMenuAndToolbar(); initMenuAndToolbar();
Utils.setWindowIcons(this); UiUtils.setWindowIcons(this);
loadSettings(); loadSettings();
checkForUpdate(); checkForUpdate();
newProject(); newProject();
...@@ -573,7 +573,7 @@ public class MainWindow extends JFrame { ...@@ -573,7 +573,7 @@ public class MainWindow extends JFrame {
} }
}; };
openAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("file.open_action")); openAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("file.open_action"));
openAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_O, Utils.ctrlButton())); openAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_O, UiUtils.ctrlButton()));
newProjectAction = new AbstractAction(NLS.str("file.new_project")) { newProjectAction = new AbstractAction(NLS.str("file.new_project")) {
@Override @Override
...@@ -606,7 +606,7 @@ public class MainWindow extends JFrame { ...@@ -606,7 +606,7 @@ public class MainWindow extends JFrame {
} }
}; };
saveAllAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("file.save_all")); saveAllAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("file.save_all"));
saveAllAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_S, Utils.ctrlButton())); saveAllAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_S, UiUtils.ctrlButton()));
Action exportAction = new AbstractAction(NLS.str("file.export_gradle"), ICON_EXPORT) { Action exportAction = new AbstractAction(NLS.str("file.export_gradle"), ICON_EXPORT) {
@Override @Override
...@@ -615,7 +615,7 @@ public class MainWindow extends JFrame { ...@@ -615,7 +615,7 @@ public class MainWindow extends JFrame {
} }
}; };
exportAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("file.export_gradle")); exportAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("file.export_gradle"));
exportAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_E, Utils.ctrlButton())); exportAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_E, UiUtils.ctrlButton()));
JMenu recentProjects = new JMenu(NLS.str("menu.recent_projects")); JMenu recentProjects = new JMenu(NLS.str("menu.recent_projects"));
recentProjects.addMenuListener(new RecentProjectsMenuListener(recentProjects)); recentProjects.addMenuListener(new RecentProjectsMenuListener(recentProjects));
...@@ -628,7 +628,7 @@ public class MainWindow extends JFrame { ...@@ -628,7 +628,7 @@ public class MainWindow extends JFrame {
}; };
prefsAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.preferences")); prefsAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.preferences"));
prefsAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_P, prefsAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_P,
Utils.ctrlButton() | KeyEvent.SHIFT_DOWN_MASK)); UiUtils.ctrlButton() | KeyEvent.SHIFT_DOWN_MASK));
Action exitAction = new AbstractAction(NLS.str("file.exit"), ICON_CLOSE) { Action exitAction = new AbstractAction(NLS.str("file.exit"), ICON_CLOSE) {
@Override @Override
...@@ -655,7 +655,7 @@ public class MainWindow extends JFrame { ...@@ -655,7 +655,7 @@ public class MainWindow extends JFrame {
} }
}; };
syncAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.sync")); syncAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.sync"));
syncAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_T, Utils.ctrlButton())); syncAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_T, UiUtils.ctrlButton()));
Action textSearchAction = new AbstractAction(NLS.str("menu.text_search"), ICON_SEARCH) { Action textSearchAction = new AbstractAction(NLS.str("menu.text_search"), ICON_SEARCH) {
@Override @Override
...@@ -665,7 +665,7 @@ public class MainWindow extends JFrame { ...@@ -665,7 +665,7 @@ public class MainWindow extends JFrame {
}; };
textSearchAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.text_search")); textSearchAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.text_search"));
textSearchAction.putValue(Action.ACCELERATOR_KEY, textSearchAction.putValue(Action.ACCELERATOR_KEY,
getKeyStroke(KeyEvent.VK_F, Utils.ctrlButton() | KeyEvent.SHIFT_DOWN_MASK)); getKeyStroke(KeyEvent.VK_F, UiUtils.ctrlButton() | KeyEvent.SHIFT_DOWN_MASK));
Action clsSearchAction = new AbstractAction(NLS.str("menu.class_search"), ICON_FIND) { Action clsSearchAction = new AbstractAction(NLS.str("menu.class_search"), ICON_FIND) {
@Override @Override
...@@ -674,7 +674,7 @@ public class MainWindow extends JFrame { ...@@ -674,7 +674,7 @@ public class MainWindow extends JFrame {
} }
}; };
clsSearchAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.class_search")); clsSearchAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.class_search"));
clsSearchAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_N, Utils.ctrlButton())); clsSearchAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_N, UiUtils.ctrlButton()));
Action deobfAction = new AbstractAction(NLS.str("menu.deobfuscation"), ICON_DEOBF) { Action deobfAction = new AbstractAction(NLS.str("menu.deobfuscation"), ICON_DEOBF) {
@Override @Override
...@@ -684,7 +684,7 @@ public class MainWindow extends JFrame { ...@@ -684,7 +684,7 @@ public class MainWindow extends JFrame {
}; };
deobfAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("preferences.deobfuscation")); deobfAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("preferences.deobfuscation"));
deobfAction.putValue(Action.ACCELERATOR_KEY, deobfAction.putValue(Action.ACCELERATOR_KEY,
getKeyStroke(KeyEvent.VK_D, Utils.ctrlButton() | KeyEvent.ALT_DOWN_MASK)); getKeyStroke(KeyEvent.VK_D, UiUtils.ctrlButton() | KeyEvent.ALT_DOWN_MASK));
deobfToggleBtn = new JToggleButton(deobfAction); deobfToggleBtn = new JToggleButton(deobfAction);
deobfToggleBtn.setSelected(settings.isDeobfuscationOn()); deobfToggleBtn.setSelected(settings.isDeobfuscationOn());
...@@ -701,7 +701,7 @@ public class MainWindow extends JFrame { ...@@ -701,7 +701,7 @@ public class MainWindow extends JFrame {
}; };
logAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.log")); logAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.log"));
logAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_L, logAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_L,
Utils.ctrlButton() | KeyEvent.SHIFT_DOWN_MASK)); UiUtils.ctrlButton() | KeyEvent.SHIFT_DOWN_MASK));
Action aboutAction = new AbstractAction(NLS.str("menu.about"), ICON_JADX) { Action aboutAction = new AbstractAction(NLS.str("menu.about"), ICON_JADX) {
@Override @Override
...@@ -718,7 +718,7 @@ public class MainWindow extends JFrame { ...@@ -718,7 +718,7 @@ public class MainWindow extends JFrame {
}; };
backAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("nav.back")); backAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("nav.back"));
backAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_LEFT, backAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_LEFT,
Utils.ctrlButton() | KeyEvent.ALT_DOWN_MASK)); UiUtils.ctrlButton() | KeyEvent.ALT_DOWN_MASK));
Action forwardAction = new AbstractAction(NLS.str("nav.forward"), ICON_FORWARD) { Action forwardAction = new AbstractAction(NLS.str("nav.forward"), ICON_FORWARD) {
@Override @Override
...@@ -728,7 +728,7 @@ public class MainWindow extends JFrame { ...@@ -728,7 +728,7 @@ public class MainWindow extends JFrame {
}; };
forwardAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("nav.forward")); forwardAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("nav.forward"));
forwardAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_RIGHT, forwardAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_RIGHT,
Utils.ctrlButton() | KeyEvent.ALT_DOWN_MASK)); UiUtils.ctrlButton() | KeyEvent.ALT_DOWN_MASK));
JMenu file = new JMenu(NLS.str("menu.file")); JMenu file = new JMenu(NLS.str("menu.file"));
file.setMnemonic(KeyEvent.VK_F); file.setMnemonic(KeyEvent.VK_F);
......
...@@ -6,13 +6,13 @@ import java.beans.PropertyChangeListener; ...@@ -6,13 +6,13 @@ import java.beans.PropertyChangeListener;
import javax.swing.*; import javax.swing.*;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
public class ProgressPanel extends JPanel implements PropertyChangeListener { public class ProgressPanel extends JPanel implements PropertyChangeListener {
private static final long serialVersionUID = -3238438119672015733L; private static final long serialVersionUID = -3238438119672015733L;
private static final Icon ICON_CANCEL = Utils.openIcon("cross"); private static final Icon ICON_CANCEL = UiUtils.openIcon("cross");
private final JProgressBar progressBar; private final JProgressBar progressBar;
private final JLabel progressLabel; private final JLabel progressLabel;
......
...@@ -30,15 +30,15 @@ import jadx.gui.ui.codearea.CodeContentPanel; ...@@ -30,15 +30,15 @@ import jadx.gui.ui.codearea.CodeContentPanel;
import jadx.gui.utils.JumpManager; import jadx.gui.utils.JumpManager;
import jadx.gui.utils.JumpPosition; import jadx.gui.utils.JumpPosition;
import jadx.gui.utils.NLS; import jadx.gui.utils.NLS;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
public class TabbedPane extends JTabbedPane { public class TabbedPane extends JTabbedPane {
private static final Logger LOG = LoggerFactory.getLogger(TabbedPane.class); private static final Logger LOG = LoggerFactory.getLogger(TabbedPane.class);
private static final long serialVersionUID = -8833600618794570904L; private static final long serialVersionUID = -8833600618794570904L;
private static final ImageIcon ICON_CLOSE = Utils.openIcon("cross"); private static final ImageIcon ICON_CLOSE = UiUtils.openIcon("cross");
private static final ImageIcon ICON_CLOSE_INACTIVE = Utils.openIcon("cross_grayed"); private static final ImageIcon ICON_CLOSE_INACTIVE = UiUtils.openIcon("cross_grayed");
private final transient MainWindow mainWindow; private final transient MainWindow mainWindow;
private final transient Map<JNode, ContentPanel> openTabs = new LinkedHashMap<>(); private final transient Map<JNode, ContentPanel> openTabs = new LinkedHashMap<>();
...@@ -294,7 +294,7 @@ public class TabbedPane extends JTabbedPane { ...@@ -294,7 +294,7 @@ public class TabbedPane extends JTabbedPane {
public void copyRootClassName() { public void copyRootClassName() {
String name = getNodeFullName(); String name = getNodeFullName();
if (name != null) { if (name != null) {
Utils.setClipboardString(name); UiUtils.setClipboardString(name);
} }
} }
......
...@@ -11,7 +11,7 @@ import javax.swing.KeyStroke; ...@@ -11,7 +11,7 @@ import javax.swing.KeyStroke;
import jadx.gui.treemodel.JResource; import jadx.gui.treemodel.JResource;
import jadx.gui.ui.ContentPanel; import jadx.gui.ui.ContentPanel;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
/** /**
* A panel combining a {@link SearchBar and a scollable {@link CodeArea} * A panel combining a {@link SearchBar and a scollable {@link CodeArea}
...@@ -32,8 +32,8 @@ public class CodePanel extends JPanel { ...@@ -32,8 +32,8 @@ public class CodePanel extends JPanel {
add(codeScrollPane, BorderLayout.CENTER); add(codeScrollPane, BorderLayout.CENTER);
initLineNumbers(); initLineNumbers();
KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_F, Utils.ctrlButton()); KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_F, UiUtils.ctrlButton());
Utils.addKeyBinding(codeArea, key, "SearchAction", new AbstractAction() { UiUtils.addKeyBinding(codeArea, key, "SearchAction", new AbstractAction() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
searchBar.toggle(); searchBar.toggle();
......
...@@ -17,7 +17,7 @@ import org.slf4j.LoggerFactory; ...@@ -17,7 +17,7 @@ import org.slf4j.LoggerFactory;
import jadx.gui.utils.NLS; import jadx.gui.utils.NLS;
import jadx.gui.utils.TextStandardActions; import jadx.gui.utils.TextStandardActions;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
class SearchBar extends JToolBar { class SearchBar extends JToolBar {
private static final long serialVersionUID = 1836871286618633003L; private static final long serialVersionUID = 1836871286618633003L;
...@@ -28,9 +28,9 @@ class SearchBar extends JToolBar { ...@@ -28,9 +28,9 @@ class SearchBar extends JToolBar {
private static final Color COLOR_BG_WARN = new Color(0xFFFDD9); private static final Color COLOR_BG_WARN = new Color(0xFFFDD9);
private static final Color COLOR_BG_NORMAL = new Color(0xFFFFFF); private static final Color COLOR_BG_NORMAL = new Color(0xFFFFFF);
private static final Icon ICON_UP = Utils.openIcon("arrow_up"); private static final Icon ICON_UP = UiUtils.openIcon("arrow_up");
private static final Icon ICON_DOWN = Utils.openIcon("arrow_down"); private static final Icon ICON_DOWN = UiUtils.openIcon("arrow_down");
private static final Icon ICON_CLOSE = Utils.openIcon("cross"); private static final Icon ICON_CLOSE = UiUtils.openIcon("cross");
private RSyntaxTextArea rTextArea; private RSyntaxTextArea rTextArea;
......
...@@ -74,7 +74,7 @@ public class FontUtils { ...@@ -74,7 +74,7 @@ public class FontUtils {
@Nullable @Nullable
public static Font openFontTTF(String name) { public static Font openFontTTF(String name) {
String fontPath = "/fonts/" + name + ".ttf"; String fontPath = "/fonts/" + name + ".ttf";
try (InputStream is = Utils.class.getResourceAsStream(fontPath)) { try (InputStream is = UiUtils.class.getResourceAsStream(fontPath)) {
Font font = Font.createFont(Font.TRUETYPE_FONT, is); Font font = Font.createFont(Font.TRUETYPE_FONT, is);
return font.deriveFont(12f); return font.deriveFont(12f);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -100,9 +100,9 @@ public class TextStandardActions { ...@@ -100,9 +100,9 @@ public class TextStandardActions {
} }
private void addKeyActions() { private void addKeyActions() {
KeyStroke undoKey = KeyStroke.getKeyStroke(KeyEvent.VK_Z, Utils.ctrlButton()); KeyStroke undoKey = KeyStroke.getKeyStroke(KeyEvent.VK_Z, UiUtils.ctrlButton());
textComponent.getInputMap().put(undoKey, undoAction); textComponent.getInputMap().put(undoKey, undoAction);
KeyStroke redoKey = KeyStroke.getKeyStroke(KeyEvent.VK_R, Utils.ctrlButton()); KeyStroke redoKey = KeyStroke.getKeyStroke(KeyEvent.VK_R, UiUtils.ctrlButton());
textComponent.getInputMap().put(redoKey, redoAction); textComponent.getInputMap().put(redoKey, redoAction);
} }
......
...@@ -19,8 +19,8 @@ import jadx.core.dex.info.AccessInfo; ...@@ -19,8 +19,8 @@ import jadx.core.dex.info.AccessInfo;
import jadx.core.dex.instructions.args.ArgType; import jadx.core.dex.instructions.args.ArgType;
import jadx.core.utils.exceptions.JadxRuntimeException; import jadx.core.utils.exceptions.JadxRuntimeException;
public class Utils { public class UiUtils {
private static final Logger LOG = LoggerFactory.getLogger(Utils.class); private static final Logger LOG = LoggerFactory.getLogger(UiUtils.class);
private static final ImageIcon ICON_STATIC = openIcon("static_co"); private static final ImageIcon ICON_STATIC = openIcon("static_co");
private static final ImageIcon ICON_FINAL = openIcon("final_co"); private static final ImageIcon ICON_FINAL = openIcon("final_co");
...@@ -39,12 +39,12 @@ public class Utils { ...@@ -39,12 +39,12 @@ public class Utils {
*/ */
public static final long MIN_FREE_MEMORY = calculateMinFreeMemory(); public static final long MIN_FREE_MEMORY = calculateMinFreeMemory();
private Utils() { private UiUtils() {
} }
public static ImageIcon openIcon(String name) { public static ImageIcon openIcon(String name) {
String iconPath = "/icons-16/" + name + ".png"; String iconPath = "/icons-16/" + name + ".png";
URL resource = Utils.class.getResource(iconPath); URL resource = UiUtils.class.getResource(iconPath);
if (resource == null) { if (resource == null) {
throw new JadxRuntimeException("Icon not found: " + iconPath); throw new JadxRuntimeException("Icon not found: " + iconPath);
} }
...@@ -52,7 +52,7 @@ public class Utils { ...@@ -52,7 +52,7 @@ public class Utils {
} }
public static Image openImage(String path) { public static Image openImage(String path) {
URL resource = Utils.class.getResource(path); URL resource = UiUtils.class.getResource(path);
if (resource == null) { if (resource == null) {
throw new JadxRuntimeException("Image not found: " + path); throw new JadxRuntimeException("Image not found: " + path);
} }
...@@ -173,10 +173,10 @@ public class Utils { ...@@ -173,10 +173,10 @@ public class Utils {
public static void setWindowIcons(Window window) { public static void setWindowIcons(Window window) {
List<Image> icons = new ArrayList<>(); List<Image> icons = new ArrayList<>();
icons.add(Utils.openImage("/logos/jadx-logo-16px.png")); icons.add(UiUtils.openImage("/logos/jadx-logo-16px.png"));
icons.add(Utils.openImage("/logos/jadx-logo-32px.png")); icons.add(UiUtils.openImage("/logos/jadx-logo-32px.png"));
icons.add(Utils.openImage("/logos/jadx-logo-48px.png")); icons.add(UiUtils.openImage("/logos/jadx-logo-48px.png"));
icons.add(Utils.openImage("/logos/jadx-logo.png")); icons.add(UiUtils.openImage("/logos/jadx-logo.png"));
window.setIconImages(icons); window.setIconImages(icons);
} }
......
...@@ -9,7 +9,7 @@ import org.slf4j.LoggerFactory; ...@@ -9,7 +9,7 @@ import org.slf4j.LoggerFactory;
import io.reactivex.BackpressureStrategy; import io.reactivex.BackpressureStrategy;
import io.reactivex.Flowable; import io.reactivex.Flowable;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
public class CodeIndex<T> implements SearchIndex<T> { public class CodeIndex<T> implements SearchIndex<T> {
...@@ -55,7 +55,7 @@ public class CodeIndex<T> implements SearchIndex<T> { ...@@ -55,7 +55,7 @@ public class CodeIndex<T> implements SearchIndex<T> {
return; return;
} }
} }
LOG.debug("Code search complete: {}, memory usage: {}", searchStr, Utils.memoryInfo()); LOG.debug("Code search complete: {}, memory usage: {}", searchStr, UiUtils.memoryInfo());
emitter.onComplete(); emitter.onComplete();
}, BackpressureStrategy.LATEST); }, BackpressureStrategy.LATEST);
} }
......
...@@ -6,7 +6,7 @@ import java.util.List; ...@@ -6,7 +6,7 @@ import java.util.List;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import static jadx.gui.utils.Utils.caseChar; import static jadx.gui.utils.UiUtils.caseChar;
public class StringRef implements CharSequence { public class StringRef implements CharSequence {
......
...@@ -22,7 +22,7 @@ import jadx.gui.treemodel.JNode; ...@@ -22,7 +22,7 @@ import jadx.gui.treemodel.JNode;
import jadx.gui.ui.SearchDialog; import jadx.gui.ui.SearchDialog;
import jadx.gui.utils.CodeLinesInfo; import jadx.gui.utils.CodeLinesInfo;
import jadx.gui.utils.JNodeCache; import jadx.gui.utils.JNodeCache;
import jadx.gui.utils.Utils; import jadx.gui.utils.UiUtils;
import static jadx.gui.ui.SearchDialog.SearchOptions.CLASS; import static jadx.gui.ui.SearchDialog.SearchOptions.CLASS;
import static jadx.gui.ui.SearchDialog.SearchOptions.CODE; import static jadx.gui.ui.SearchDialog.SearchOptions.CODE;
...@@ -126,13 +126,13 @@ public class TextSearchIndex { ...@@ -126,13 +126,13 @@ public class TextSearchIndex {
return; return;
} }
} }
if (!Utils.isFreeMemoryAvailable()) { if (!UiUtils.isFreeMemoryAvailable()) {
LOG.warn("Skipped code search stopped due to memory limit: {}", Utils.memoryInfo()); LOG.warn("Skipped code search stopped due to memory limit: {}", UiUtils.memoryInfo());
emitter.onComplete(); emitter.onComplete();
return; return;
} }
} }
LOG.debug("Skipped code search complete: {}, memory usage: {}", searchStr, Utils.memoryInfo()); LOG.debug("Skipped code search complete: {}, memory usage: {}", searchStr, UiUtils.memoryInfo());
emitter.onComplete(); emitter.onComplete();
}, BackpressureStrategy.LATEST); }, BackpressureStrategy.LATEST);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment