style: fix code formating
This commit is contained in:
@@ -92,5 +92,4 @@ public class BackgroundWorker extends SwingWorker<Void, Void> {
|
||||
protected void done() {
|
||||
progressPane.setVisible(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,5 +24,4 @@ public class DecompileJob extends BackgroundJob {
|
||||
public String getInfoString() {
|
||||
return "Decompiling: ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public class JadxSettings extends JadxCLIArgs {
|
||||
this.showInconsistentCode = showInconsistentCode;
|
||||
}
|
||||
|
||||
public LangLocale getLangLocale(){
|
||||
public LangLocale getLangLocale() {
|
||||
return this.langLocale;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public class JadxSettingsAdapter {
|
||||
|
||||
private static <T> void populate(GsonBuilder builder, String json, Class<T> type, final T into) {
|
||||
builder.registerTypeAdapter(type, (InstanceCreator<T>) t -> into)
|
||||
.create()
|
||||
.fromJson(json, type);
|
||||
.create()
|
||||
.fromJson(json, type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import jadx.gui.utils.NLS;
|
||||
|
||||
import static jadx.gui.utils.Utils.FONT_HACK;
|
||||
|
||||
|
||||
public class JadxSettingsWindow extends JDialog {
|
||||
private static final long serialVersionUID = -1804570470377354148L;
|
||||
|
||||
@@ -72,7 +71,7 @@ public class JadxSettingsWindow extends JDialog {
|
||||
if (needReload) {
|
||||
mainWindow.reOpenFile();
|
||||
}
|
||||
if (!settings.getLangLocale().equals(prevLang)){
|
||||
if (!settings.getLangLocale().equals(prevLang)) {
|
||||
JOptionPane.showMessageDialog(
|
||||
this,
|
||||
NLS.str("msg.language_changed", settings.getLangLocale()),
|
||||
@@ -194,7 +193,7 @@ public class JadxSettingsWindow extends JDialog {
|
||||
|
||||
EditorTheme[] editorThemes = CodeArea.getAllThemes();
|
||||
JComboBox<EditorTheme> themesCbx = new JComboBox<>(editorThemes);
|
||||
for (EditorTheme theme: editorThemes) {
|
||||
for (EditorTheme theme : editorThemes) {
|
||||
if (theme.getPath().equals(settings.getEditorThemePath())) {
|
||||
themesCbx.setSelectedItem(theme);
|
||||
break;
|
||||
@@ -275,7 +274,7 @@ public class JadxSettingsWindow extends JDialog {
|
||||
|
||||
private SettingsGroup makeOtherGroup() {
|
||||
JComboBox<LangLocale> languageCbx = new JComboBox<>(NLS.getI18nLocales());
|
||||
for (LangLocale locale: NLS.getI18nLocales()) {
|
||||
for (LangLocale locale : NLS.getI18nLocales()) {
|
||||
if (locale.equals(settings.getLangLocale())) {
|
||||
languageCbx.setSelectedItem(locale);
|
||||
break;
|
||||
|
||||
@@ -205,7 +205,7 @@ public class JResource extends JLoadableNode implements Comparable<JResource> {
|
||||
if (ext.equals("html")) {
|
||||
return SyntaxConstants.SYNTAX_STYLE_HTML;
|
||||
}
|
||||
if(ext.equals("arsc")) {
|
||||
if (ext.equals("arsc")) {
|
||||
return SyntaxConstants.SYNTAX_STYLE_XML;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -38,7 +38,7 @@ public class JRoot extends JNode {
|
||||
}
|
||||
|
||||
JCertificate certificate = getCertificate(wrapper.getResources());
|
||||
if(certificate != null) {
|
||||
if (certificate != null) {
|
||||
add(certificate);
|
||||
}
|
||||
}
|
||||
@@ -84,15 +84,12 @@ public class JRoot extends JNode {
|
||||
|
||||
if (rf.getZipRef() != null) {
|
||||
String rfName = rf.getName().toUpperCase();
|
||||
if (rfName.endsWith(".DSA")||rfName.endsWith(".RSA")) {
|
||||
if (rfName.endsWith(".DSA") || rfName.endsWith(".RSA")) {
|
||||
return new JCertificate(rf);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
private JResource getResourceByName(JResource rf, String name) {
|
||||
|
||||
@@ -302,8 +302,8 @@ public abstract class CommonSearchDialog extends JDialog {
|
||||
protected static class ResultsModel extends AbstractTableModel {
|
||||
private static final long serialVersionUID = -7821286846923903208L;
|
||||
private static final String[] COLUMN_NAMES = {
|
||||
NLS.str("search_dialog.col_node"),
|
||||
NLS.str("search_dialog.col_code")
|
||||
NLS.str("search_dialog.col_node"),
|
||||
NLS.str("search_dialog.col_code")
|
||||
};
|
||||
|
||||
private final transient ArrayList<JNode> rows = new ArrayList<>();
|
||||
|
||||
@@ -293,11 +293,10 @@ public class MainWindow extends JFrame {
|
||||
if (resFile != null && JResource.isSupportedForView(resFile.getType())) {
|
||||
tabbedPane.showResource(res);
|
||||
}
|
||||
}else if (obj instanceof JCertificate) {
|
||||
} else if (obj instanceof JCertificate) {
|
||||
JCertificate cert = (JCertificate) obj;
|
||||
tabbedPane.showCertificate(cert);
|
||||
}
|
||||
else if (obj instanceof JNode) {
|
||||
} else if (obj instanceof JNode) {
|
||||
JNode node = (JNode) obj;
|
||||
JClass cls = node.getRootClass();
|
||||
if (cls != null) {
|
||||
|
||||
@@ -67,7 +67,7 @@ public class Asset {
|
||||
@Override
|
||||
public String toString() {
|
||||
return name
|
||||
+ ", size: " + String.format("%.2fMB", size / 1024. /1024.)
|
||||
+ ", size: " + String.format("%.2fMB", size / 1024. / 1024.)
|
||||
+ ", downloads count: " + downloadCount
|
||||
+ ", url: " + downloadUrl
|
||||
+ ", date: " + createdAt;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class CodeUsageInfo {
|
||||
}
|
||||
|
||||
private void addUsage(JNode jNode, JavaClass javaClass,
|
||||
CodeLinesInfo linesInfo, CodePosition codePosition, List<StringRef> lines) {
|
||||
CodeLinesInfo linesInfo, CodePosition codePosition, List<StringRef> lines) {
|
||||
UsageInfo usageInfo = usageMap.get(jNode);
|
||||
if (usageInfo == null) {
|
||||
usageInfo = new UsageInfo();
|
||||
|
||||
@@ -3,32 +3,32 @@ package jadx.gui.utils;
|
||||
import java.util.Locale;
|
||||
|
||||
public class LangLocale {
|
||||
private Locale locale;
|
||||
private Locale locale;
|
||||
|
||||
public LangLocale(Locale locale) {
|
||||
this.locale = locale;
|
||||
}
|
||||
public LangLocale(Locale locale) {
|
||||
this.locale = locale;
|
||||
}
|
||||
|
||||
public LangLocale(String l, String c) {
|
||||
this.locale = new Locale(l, c);
|
||||
}
|
||||
public LangLocale(String l, String c) {
|
||||
this.locale = new Locale(l, c);
|
||||
}
|
||||
|
||||
public Locale get() {
|
||||
return locale;
|
||||
}
|
||||
public Locale get() {
|
||||
return locale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return NLS.str("language.name", this);
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return NLS.str("language.name", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof LangLocale && locale.equals(((LangLocale) obj).get());
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof LangLocale && locale.equals(((LangLocale) obj).get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return locale.hashCode();
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return locale.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,21 +67,21 @@ public class Link extends JLabel implements MouseListener {
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
if (os.contains("win")) {
|
||||
new ProcessBuilder()
|
||||
.command(new String[] {"rundll32", "url.dll,FileProtocolHandler", url})
|
||||
.start();
|
||||
.command(new String[]{"rundll32", "url.dll,FileProtocolHandler", url})
|
||||
.start();
|
||||
return;
|
||||
}
|
||||
if (os.contains("mac")) {
|
||||
new ProcessBuilder()
|
||||
.command(new String[] {"open", url})
|
||||
.start();
|
||||
.command(new String[]{"open", url})
|
||||
.start();
|
||||
return;
|
||||
}
|
||||
Map<String, String> env = System.getenv();
|
||||
if (env.get("BROWSER") != null) {
|
||||
new ProcessBuilder()
|
||||
.command(new String[] {env.get("BROWSER"), url})
|
||||
.start();
|
||||
.command(new String[]{env.get("BROWSER"), url})
|
||||
.start();
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -7,10 +7,15 @@ import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class NLS {
|
||||
private static final Charset JAVA_CHARSET = Charset.forName("ISO-8859-1");
|
||||
private static final Charset UTF8_CHARSET = Charset.forName("UTF-8");
|
||||
|
||||
private static Vector<LangLocale> i18nLocales = new Vector<>();
|
||||
|
||||
private static Map<LangLocale, Map<String, String>> i18nMessagesMap;
|
||||
private static Map<LangLocale, Map<String, String>> i18nMessagesMap = new HashMap<>();
|
||||
|
||||
// Use these two fields to avoid invoking Map.get() method twice.
|
||||
private static Map<String, String> localizedMessagesMap;
|
||||
@@ -19,14 +24,7 @@ public class NLS {
|
||||
private static LangLocale currentLocale;
|
||||
private static LangLocale localLocale;
|
||||
|
||||
private static Charset javaCharset;
|
||||
private static Charset utf8Charset;
|
||||
|
||||
static {
|
||||
javaCharset = Charset.forName("ISO-8859-1");
|
||||
utf8Charset = Charset.forName("UTF-8");
|
||||
i18nMessagesMap = new HashMap<>();
|
||||
|
||||
localLocale = new LangLocale(Locale.getDefault());
|
||||
|
||||
i18nLocales.add(new LangLocale("en", "US")); // As default language
|
||||
@@ -35,8 +33,9 @@ public class NLS {
|
||||
|
||||
i18nLocales.forEach(NLS::load);
|
||||
|
||||
fallbackMessagesMap = i18nMessagesMap.get(i18nLocales.get(0));
|
||||
localizedMessagesMap = i18nMessagesMap.get(i18nLocales.get(0));
|
||||
LangLocale defLang = i18nLocales.get(0);
|
||||
fallbackMessagesMap = i18nMessagesMap.get(defLang);
|
||||
localizedMessagesMap = i18nMessagesMap.get(defLang);
|
||||
}
|
||||
|
||||
private NLS() {
|
||||
@@ -45,31 +44,39 @@ public class NLS {
|
||||
private static void load(LangLocale locale) {
|
||||
ResourceBundle bundle = ResourceBundle.getBundle("i18n/Messages", locale.get());
|
||||
Map<String, String> resMap = new HashMap<>();
|
||||
|
||||
for(String key : bundle.keySet()){
|
||||
resMap.put(key, new String(
|
||||
bundle.getString(key).getBytes(javaCharset),
|
||||
utf8Charset));
|
||||
for (String key : bundle.keySet()) {
|
||||
String str = bundle.getString(key);
|
||||
resMap.put(key, convertCharset(str));
|
||||
}
|
||||
i18nMessagesMap.put(locale, resMap);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String convertCharset(String str) {
|
||||
return new String(str.getBytes(JAVA_CHARSET), UTF8_CHARSET);
|
||||
}
|
||||
|
||||
public static String str(String key) {
|
||||
if(localizedMessagesMap.containsKey(key)){
|
||||
return localizedMessagesMap.get(key);
|
||||
String str = localizedMessagesMap.get(key);
|
||||
if (str != null) {
|
||||
return str;
|
||||
}
|
||||
return fallbackMessagesMap.get(key);// definitely exists
|
||||
return fallbackMessagesMap.get(key); // definitely exists
|
||||
}
|
||||
|
||||
public static String str(String key, LangLocale locale) {
|
||||
if(i18nMessagesMap.get(locale).containsKey(key)){
|
||||
return i18nMessagesMap.get(locale).get(key);
|
||||
Map<String, String> strings = i18nMessagesMap.get(locale);
|
||||
if (strings != null) {
|
||||
String str = strings.get(key);
|
||||
if (str != null) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
return fallbackMessagesMap.get(key);// definitely exists
|
||||
return fallbackMessagesMap.get(key); // definitely exists
|
||||
}
|
||||
|
||||
public static void setLocale(LangLocale locale) {
|
||||
if(i18nMessagesMap.containsKey(locale)){
|
||||
if (i18nMessagesMap.containsKey(locale)) {
|
||||
currentLocale = locale;
|
||||
} else {
|
||||
currentLocale = i18nLocales.get(0);
|
||||
@@ -77,7 +84,7 @@ public class NLS {
|
||||
localizedMessagesMap = i18nMessagesMap.get(currentLocale);
|
||||
}
|
||||
|
||||
public static Vector<LangLocale> getI18nLocales(){
|
||||
public static Vector<LangLocale> getI18nLocales() {
|
||||
return i18nLocales;
|
||||
}
|
||||
|
||||
@@ -85,12 +92,11 @@ public class NLS {
|
||||
return currentLocale;
|
||||
}
|
||||
|
||||
public static LangLocale defaultLocale(){
|
||||
if(i18nMessagesMap.containsKey(localLocale)){
|
||||
public static LangLocale defaultLocale() {
|
||||
if (i18nMessagesMap.containsKey(localLocale)) {
|
||||
return localLocale;
|
||||
} else {
|
||||
// fallback to english if unsupported
|
||||
return i18nLocales.get(0);
|
||||
}
|
||||
// fallback to english if unsupported
|
||||
return i18nLocales.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ public class LogCollector extends AppenderBase<ILoggingEvent> {
|
||||
public static final int BUFFER_SIZE = 5000;
|
||||
|
||||
private static final LogCollector INSTANCE = new LogCollector();
|
||||
|
||||
public static LogCollector getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user