Codebase list jd-gui / a82460b
Merge branch 'master' of https://github.com/java-decompiler/jd-gui roswalt 4 years ago
14 changed file(s) with 302 addition(s) and 158 deletion(s). Raw diff Collapse all Expand all
11
22 JD-GUI, a standalone graphical utility that displays Java sources from CLASS files.
33
4 ![](http://java-decompiler.github.io/img/screenshot17.png)
4 ![](https://raw.githubusercontent.com/java-decompiler/jd-gui/master/src/website/img/jd-gui.png)
55
66 - Java Decompiler projects home page: [http://java-decompiler.github.io](http://java-decompiler.github.io)
77 - JD-GUI source code: [https://github.com/java-decompiler/jd-gui](https://github.com/java-decompiler/jd-gui)
290290 if (matchedEntries == null) {
291291 Map<String, Collection> index = indexes.getIndex(indexName);
292292
293 if (patternLength == 1) {
294 matchedEntries = matchWithCharFunction.apply(pattern.charAt(0), index);
295 } else {
296 String lastKey = key.substring(0, key.length() - 1);
297 Map<String, Collection> lastMatchedTypes = cache.get(lastKey);
298 if (lastMatchedTypes != null) {
299 matchedEntries = matchWithStringFunction.apply(pattern, lastMatchedTypes);
293 if (index != null) {
294 if (patternLength == 1) {
295 matchedEntries = matchWithCharFunction.apply(pattern.charAt(0), index);
300296 } else {
301 matchedEntries = matchWithStringFunction.apply(pattern, index);
297 String lastKey = key.substring(0, key.length() - 1);
298 Map<String, Collection> lastMatchedTypes = cache.get(lastKey);
299 if (lastMatchedTypes != null) {
300 matchedEntries = matchWithStringFunction.apply(pattern, lastMatchedTypes);
301 } else {
302 matchedEntries = matchWithStringFunction.apply(pattern, index);
303 }
302304 }
303305 }
304306
1414 import javax.swing.*;
1515 import javax.xml.stream.*;
1616 import java.awt.*;
17 import java.io.File;
18 import java.io.FileInputStream;
19 import java.io.FileOutputStream;
20 import java.util.ArrayList;
17 import java.io.*;
18 import java.net.URL;
19 import java.util.*;
2120 import java.util.List;
22 import java.util.Map;
23 import java.util.Stack;
21 import java.util.jar.Manifest;
2422
2523 public class ConfigurationXmlPersisterProvider implements ConfigurationPersister {
2624 protected static final String ERROR_BACKGROUND_COLOR = "JdGuiPreferences.errorBackgroundColor";
25 protected static final String JD_CORE_VERSION = "JdGuiPreferences.jdCoreVersion";
2726
2827 protected static final File FILE = getConfigFile();
2928
5655 return new File(Constants.CONFIG_FILENAME);
5756 }
5857
58 @Override
5959 public Configuration load() {
6060 // Default values
6161 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
169169 config.getPreferences().put(ERROR_BACKGROUND_COLOR, "0xFF6666");
170170 }
171171
172 config.getPreferences().put(JD_CORE_VERSION, getJdCoreVersion());
173
172174 return config;
173175 }
174176
177 protected String getJdCoreVersion() {
178 try {
179 Enumeration<URL> enumeration = ConfigurationXmlPersisterProvider.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
180
181 while (enumeration.hasMoreElements()) {
182 try (InputStream is = enumeration.nextElement().openStream()) {
183 String attribute = new Manifest(is).getMainAttributes().getValue("JD-Core-Version");
184 if (attribute != null) {
185 return attribute;
186 }
187 }
188 }
189 } catch (IOException e) {
190 assert ExceptionUtil.printStackTrace(e);
191 }
192
193 return "SNAPSHOT";
194 }
195
196 @Override
175197 public void save(Configuration configuration) {
176198 Point l = configuration.getMainWindowLocation();
177199 Dimension s = configuration.getMainWindowSize();
9696 hbox.add(Box.createHorizontalGlue());
9797
9898 hbox = Box.createHorizontalBox();
99 hbox.add(new JLabel("Copyright © 2008-2019 Emmanuel Dupuy"));
99 hbox.add(new JLabel("Copyright © 2008, 2019 Emmanuel Dupuy"));
100100 hbox.add(Box.createHorizontalGlue());
101101 subvbox.add(hbox);
102102
249249 if (selectedTreeNode != null) {
250250 selectedTypeCallback.accept(selectedTreeNode.getUri(), searchInConstantPoolsEnterTextField.getText(), getFlags());
251251 }
252 searchInConstantPoolsDialog.setVisible(false);
253252 }
254253 };
255254 searchInConstantPoolsOpenButton.addActionListener(searchInConstantPoolsOpenActionListener);
1414 apply plugin: 'nebula.ospackage'
1515
1616 // Common configuration //
17 rootProject.version='1.5.2'
18 rootProject.ext.set('jdCoreVersion', '1.0.3')
17 rootProject.version='1.6.3'
18 rootProject.ext.set('jdCoreVersion', '1.0.7')
1919 targetCompatibility = '1.8'
2020
2121 allprojects {
3030 }
3131
3232 repositories {
33 mavenCentral()
34 maven {
35 url 'https://raw.github.com/java-decompiler/mvn-repo/master'
36 }
33 jcenter()
3734 }
3835
3936 configurations {
3131 }
3232 }
3333
34 @SuppressWarnings("unchecked")
3435 protected static void index(API api, Container.Entry entry, Indexes indexes, Map<String, Collection> packageDeclarationIndex) {
3536 for (Container.Entry e : entry.getChildren()) {
3637 if (e.isDirectory()) {
1515 import org.jd.gui.util.io.NewlineOutputStream;
1616
1717 import java.io.*;
18 import java.net.URL;
1918 import java.nio.charset.Charset;
2019 import java.nio.file.Files;
2120 import java.nio.file.Path;
22 import java.util.Enumeration;
2321 import java.util.HashMap;
2422 import java.util.Map;
25 import java.util.jar.Manifest;
2623
2724 public class ClassFileSourceSaverProvider extends AbstractSourceSaverProvider {
2825 protected static final String ESCAPE_UNICODE_CHARACTERS = "ClassFileDecompilerPreferences.escapeUnicodeCharacters";
29 protected static final String REALIGN_LINE_NUMBERS = "ClassFileDecompilerPreferences.realignLineNumbers";
30 protected static final String WRITE_LINE_NUMBERS = "ClassFileSaverPreferences.writeLineNumbers";
31 protected static final String WRITE_METADATA = "ClassFileSaverPreferences.writeMetadata";
26 protected static final String REALIGN_LINE_NUMBERS = "ClassFileDecompilerPreferences.realignLineNumbers";
27 protected static final String WRITE_LINE_NUMBERS = "ClassFileSaverPreferences.writeLineNumbers";
28 protected static final String WRITE_METADATA = "ClassFileSaverPreferences.writeMetadata";
29 protected static final String JD_CORE_VERSION = "JdGuiPreferences.jdCoreVersion";
3230
3331 protected static final ClassFileToJavaSourceDecompiler DECOMPILER = new ClassFileToJavaSourceDecompiler();
3432
3533 protected ContainerLoader loader = new ContainerLoader();
3634 protected LineNumberStringBuilderPrinter printer = new LineNumberStringBuilderPrinter();
37 protected String jdCoreVersion = "SNAPSHOT";
38
39 public ClassFileSourceSaverProvider() {
40 try {
41 Enumeration<URL> enumeration = ClassFileSourceSaverProvider.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
42
43 while (enumeration.hasMoreElements()) {
44 try (InputStream is = enumeration.nextElement().openStream()) {
45 String attribute = new Manifest(is).getMainAttributes().getValue("JD-Core-Version");
46 if (attribute != null) {
47 jdCoreVersion = attribute;
48 }
49 }
50 }
51 } catch (IOException e) {
52 assert ExceptionUtil.printStackTrace(e);
53 }
54 }
5535
5636 @Override public String[] getSelectors() { return appendSelectors("*:file:*.class"); }
5737
143123 }
144124 // Add JD-Core version
145125 stringBuffer.append("\n * JD-Core Version: ");
146 stringBuffer.append(jdCoreVersion);
126 stringBuffer.append(preferences.get(JD_CORE_VERSION));
147127 stringBuffer.append("\n */");
148128 }
149129
77 package org.jd.gui.util.decompiler;
88
99 public class LineNumberStringBuilderPrinter extends StringBuilderPrinter {
10 protected boolean showLineNumbers = false;
10 protected boolean showLineNumbers = false;
1111
12 protected int maxLineNumber = 0;
13 protected int digitCount = 0;
12 protected int maxLineNumber = 0;
13 protected int digitCount = 0;
1414
15 protected String lineNumberBeginPrefix;
16 protected String lineNumberEndPrefix;
17 protected String unknownLineNumberPrefix;
15 protected String lineNumberBeginPrefix;
16 protected String lineNumberEndPrefix;
17 protected String unknownLineNumberPrefix;
1818
19 public void setShowLineNumbers(boolean showLineNumbers) { this.showLineNumbers = showLineNumbers; }
19 public void setShowLineNumbers(boolean showLineNumbers) { this.showLineNumbers = showLineNumbers; }
2020
21 protected int printDigit(int dcv, int lineNumber, int divisor, int left) {
22 if (digitCount >= dcv) {
23 if (lineNumber < divisor) {
24 append(' ');
25 } else {
26 int e = (lineNumber-left) / divisor;
27 append((char)('0' + e));
28 left += e*divisor;
29 }
30 }
21 protected int printDigit(int dcv, int lineNumber, int divisor, int left) {
22 if (digitCount >= dcv) {
23 if (lineNumber < divisor) {
24 stringBuffer.append(' ');
25 } else {
26 int e = (lineNumber-left) / divisor;
27 stringBuffer.append((char)('0' + e));
28 left += e*divisor;
29 }
30 }
3131
32 return left;
33 }
32 return left;
33 }
3434
35 // --- Printer --- //
36 @Override
37 public void start(int maxLineNumber, int majorVersion, int minorVersion) {
38 super.start(maxLineNumber, majorVersion, minorVersion);
35 // --- Printer --- //
36 @Override
37 public void start(int maxLineNumber, int majorVersion, int minorVersion) {
38 super.start(maxLineNumber, majorVersion, minorVersion);
3939
40 if (showLineNumbers) {
41 this.maxLineNumber = maxLineNumber;
40 if (showLineNumbers) {
41 this.maxLineNumber = maxLineNumber;
4242
43 if (maxLineNumber > 0) {
44 digitCount = 1;
45 unknownLineNumberPrefix = " ";
46 int maximum = 9;
43 if (maxLineNumber > 0) {
44 digitCount = 1;
45 unknownLineNumberPrefix = " ";
46 int maximum = 9;
4747
48 while (maximum < maxLineNumber) {
49 digitCount++;
50 unknownLineNumberPrefix += ' ';
51 maximum = maximum*10 + 9;
52 }
48 while (maximum < maxLineNumber) {
49 digitCount++;
50 unknownLineNumberPrefix += ' ';
51 maximum = maximum*10 + 9;
52 }
5353
54 lineNumberBeginPrefix = "/* ";
55 lineNumberEndPrefix = " */ ";
56 } else {
57 unknownLineNumberPrefix = "";
58 lineNumberBeginPrefix = "";
59 lineNumberEndPrefix = "";
60 }
61 } else {
62 this.maxLineNumber = 0;
63 unknownLineNumberPrefix = "";
64 lineNumberBeginPrefix = "";
65 lineNumberEndPrefix = "";
66 }
67 }
54 lineNumberBeginPrefix = "/* ";
55 lineNumberEndPrefix = " */ ";
56 } else {
57 unknownLineNumberPrefix = "";
58 lineNumberBeginPrefix = "";
59 lineNumberEndPrefix = "";
60 }
61 } else {
62 this.maxLineNumber = 0;
63 unknownLineNumberPrefix = "";
64 lineNumberBeginPrefix = "";
65 lineNumberEndPrefix = "";
66 }
67 }
6868
69 @Override public void startLine(int lineNumber) {
70 if (maxLineNumber > 0) {
71 append(lineNumberBeginPrefix);
69 @Override public void startLine(int lineNumber) {
70 if (maxLineNumber > 0) {
71 stringBuffer.append(lineNumberBeginPrefix);
7272
73 if (lineNumber == UNKNOWN_LINE_NUMBER) {
74 append(unknownLineNumberPrefix);
75 } else {
76 int left = 0;
73 if (lineNumber == UNKNOWN_LINE_NUMBER) {
74 stringBuffer.append(unknownLineNumberPrefix);
75 } else {
76 int left = 0;
7777
78 left = printDigit(5, lineNumber, 10000, left);
79 left = printDigit(4, lineNumber, 1000, left);
80 left = printDigit(3, lineNumber, 100, left);
81 left = printDigit(2, lineNumber, 10, left);
82 append((char)('0' + (lineNumber-left)));
83 }
78 left = printDigit(5, lineNumber, 10000, left);
79 left = printDigit(4, lineNumber, 1000, left);
80 left = printDigit(3, lineNumber, 100, left);
81 left = printDigit(2, lineNumber, 10, left);
82 stringBuffer.append((char)('0' + (lineNumber-left)));
83 }
8484
85 append(lineNumberEndPrefix);
86 }
85 stringBuffer.append(lineNumberEndPrefix);
86 }
8787
88 for (int i=0; i<indentationCount; i++) {
89 append(TAB);
90 }
91 }
92 @Override public void extraLine(int count) {
93 if (realignmentLineNumber) {
94 while (count-- > 0) {
95 if (maxLineNumber > 0) {
96 append(lineNumberBeginPrefix);
97 append(unknownLineNumberPrefix);
98 append(lineNumberEndPrefix);
99 }
88 for (int i=0; i<indentationCount; i++) {
89 stringBuffer.append(TAB);
90 }
91 }
92 @Override public void extraLine(int count) {
93 if (realignmentLineNumber) {
94 while (count-- > 0) {
95 if (maxLineNumber > 0) {
96 stringBuffer.append(lineNumberBeginPrefix);
97 stringBuffer.append(unknownLineNumberPrefix);
98 stringBuffer.append(lineNumberEndPrefix);
99 }
100100
101 append(NEWLINE);
102 }
103 }
104 }
101 stringBuffer.append(NEWLINE);
102 }
103 }
104 }
105105 }
2828 public int getMinorVersion() { return minorVersion; }
2929 public StringBuilder getStringBuffer() { return stringBuffer; }
3030
31 public void append(char c) { stringBuffer.append(c); }
32 public void append(String s) { stringBuffer.append(s); }
33
34 protected void printEscape(String s) {
31 protected void escape(String s) {
3532 if (unicodeEscape && (s != null)) {
3633 int length = s.length();
3734
3936 char c = s.charAt(i);
4037
4138 if (c == '\t') {
42 append(c);
39 stringBuffer.append(c);
4340 } else if (c < 32) {
4441 // Write octal format
45 append("\\0");
46 append((char) ('0' + (c >> 3)));
47 append((char) ('0' + (c & 0x7)));
42 stringBuffer.append("\\0");
43 stringBuffer.append((char) ('0' + (c >> 3)));
44 stringBuffer.append((char) ('0' + (c & 0x7)));
4845 } else if (c > 127) {
4946 // Write octal format
50 append("\\u");
47 stringBuffer.append("\\u");
5148
5249 int z = (c >> 12);
53 append((char) ((z <= 9) ? ('0' + z) : (('A' - 10) + z)));
50 stringBuffer.append((char) ((z <= 9) ? ('0' + z) : (('A' - 10) + z)));
5451 z = ((c >> 8) & 0xF);
55 append((char) ((z <= 9) ? ('0' + z) : (('A' - 10) + z)));
52 stringBuffer.append((char) ((z <= 9) ? ('0' + z) : (('A' - 10) + z)));
5653 z = ((c >> 4) & 0xF);
57 append((char) ((z <= 9) ? ('0' + z) : (('A' - 10) + z)));
54 stringBuffer.append((char) ((z <= 9) ? ('0' + z) : (('A' - 10) + z)));
5855 z = (c & 0xF);
59 append((char) ((z <= 9) ? ('0' + z) : (('A' - 10) + z)));
56 stringBuffer.append((char) ((z <= 9) ? ('0' + z) : (('A' - 10) + z)));
6057 } else {
61 append(c);
58 stringBuffer.append(c);
6259 }
6360 }
6461 } else {
65 append(s);
62 stringBuffer.append(s);
6663 }
6764 }
6865
7774
7875 @Override public void end() {}
7976
80 @Override public void printText(String text) { printEscape(text); }
81 @Override public void printNumericConstant(String constant) { append(constant); }
82 @Override public void printStringConstant(String constant, String ownerInternalName) { append(constant); }
83 @Override public void printKeyword(String keyword) { append(keyword); }
77 @Override public void printText(String text) { escape(text); }
78 @Override public void printNumericConstant(String constant) { escape(constant); }
79 @Override public void printStringConstant(String constant, String ownerInternalName) { escape(constant); }
80 @Override public void printKeyword(String keyword) { stringBuffer.append(keyword); }
8481
85 @Override public void printDeclaration(int type, String internalTypeName, String name, String descriptor) { append(name); }
86 @Override public void printReference(int type, String internalTypeName, String name, String descriptor, String ownerInternalName) { append(name); }
82 @Override public void printDeclaration(int type, String internalTypeName, String name, String descriptor) { escape(name); }
83 @Override public void printReference(int type, String internalTypeName, String name, String descriptor, String ownerInternalName) { escape(name); }
8784
8885 @Override public void indent() { indentationCount++; }
8986 @Override public void unindent() { if (indentationCount > 0) indentationCount--; }
9087
91 @Override public void startLine(int lineNumber) { for (int i=0; i<indentationCount; i++) append(TAB); }
92 @Override public void endLine() { append(NEWLINE); }
93 @Override public void extraLine(int count) { if (realignmentLineNumber) while (count-- > 0) append(NEWLINE); }
88 @Override public void startLine(int lineNumber) { for (int i=0; i<indentationCount; i++) stringBuffer.append(TAB); }
89 @Override public void endLine() { stringBuffer.append(NEWLINE); }
90 @Override public void extraLine(int count) { if (realignmentLineNumber) while (count-- > 0) stringBuffer.append(NEWLINE); }
9491
9592 @Override public void startMarker(int type) {}
9693 @Override public void endMarker(int type) {}
1111 import org.jd.core.v1.ClassFileToJavaSourceDecompiler;
1212 import org.jd.gui.api.API;
1313 import org.jd.gui.api.model.Container;
14 import org.jd.gui.util.decompiler.ClassPathLoader;
15 import org.jd.gui.util.decompiler.ContainerLoader;
16 import org.jd.gui.util.decompiler.NopPrinter;
17 import org.jd.gui.util.decompiler.StringBuilderPrinter;
14 import org.jd.gui.util.decompiler.*;
1815 import org.jd.gui.util.exception.ExceptionUtil;
16 import org.jd.gui.util.io.NewlineOutputStream;
1917
2018 import javax.swing.text.BadLocationException;
2119 import javax.swing.text.DefaultCaret;
2220 import java.awt.*;
21 import java.io.*;
22 import java.nio.charset.Charset;
2323 import java.util.HashMap;
2424 import java.util.Map;
2525
2626 public class ClassFilePage extends TypePage {
2727 protected static final String ESCAPE_UNICODE_CHARACTERS = "ClassFileDecompilerPreferences.escapeUnicodeCharacters";
2828 protected static final String REALIGN_LINE_NUMBERS = "ClassFileDecompilerPreferences.realignLineNumbers";
29 protected static final String WRITE_LINE_NUMBERS = "ClassFileSaverPreferences.writeLineNumbers";
30 protected static final String WRITE_METADATA = "ClassFileSaverPreferences.writeMetadata";
31 protected static final String JD_CORE_VERSION = "JdGuiPreferences.jdCoreVersion";
2932
3033 protected static final ClassFileToJavaSourceDecompiler DECOMPILER = new ClassFileToJavaSourceDecompiler();
3134
9699 return (v == null) ? defaultValue : Boolean.valueOf(v);
97100 }
98101
102 @Override
99103 public String getSyntaxStyle() { return SyntaxConstants.SYNTAX_STYLE_JAVA; }
100104
101105 // --- ContentSavable --- //
106 @Override
102107 public String getFileName() {
103108 String path = entry.getPath();
104109 int index = path.lastIndexOf('.');
105110 return path.substring(0, index) + ".java";
106111 }
107112
113 @Override
114 public void save(API api, OutputStream os) {
115 try {
116 // Init preferences
117 Map<String, String> preferences = api.getPreferences();
118 boolean realignmentLineNumbers = getPreferenceValue(preferences, REALIGN_LINE_NUMBERS, true);
119 boolean unicodeEscape = getPreferenceValue(preferences, ESCAPE_UNICODE_CHARACTERS, false);
120 boolean showLineNumbers = getPreferenceValue(preferences, WRITE_LINE_NUMBERS, true);
121
122 Map<String, Object> configuration = new HashMap<>();
123 configuration.put("realignLineNumbers", realignmentLineNumbers);
124
125 // Init loader
126 ContainerLoader loader = new ContainerLoader(entry);
127
128 // Init printer
129 LineNumberStringBuilderPrinter printer = new LineNumberStringBuilderPrinter();
130 printer.setRealignmentLineNumber(realignmentLineNumbers);
131 printer.setUnicodeEscape(unicodeEscape);
132 printer.setShowLineNumbers(showLineNumbers);
133
134 // Format internal name
135 String entryPath = entry.getPath();
136 assert entryPath.endsWith(".class");
137 String entryInternalName = entryPath.substring(0, entryPath.length() - 6); // 6 = ".class".length()
138
139 // Decompile class file
140 DECOMPILER.decompile(loader, printer, entryInternalName, configuration);
141
142 StringBuilder stringBuffer = printer.getStringBuffer();
143
144 // Metadata
145 if (getPreferenceValue(preferences, WRITE_METADATA, true)) {
146 // Add location
147 String location =
148 new File(entry.getUri()).getPath()
149 // Escape "\ u" sequence to prevent "Invalid unicode" errors
150 .replaceAll("(^|[^\\\\])\\\\u", "\\\\\\\\u");
151 stringBuffer.append("\n\n/* Location: ");
152 stringBuffer.append(location);
153 // Add Java compiler version
154 int majorVersion = printer.getMajorVersion();
155
156 if (majorVersion >= 45) {
157 stringBuffer.append("\n * Java compiler version: ");
158
159 if (majorVersion >= 49) {
160 stringBuffer.append(majorVersion - (49 - 5));
161 } else {
162 stringBuffer.append(majorVersion - (45 - 1));
163 }
164
165 stringBuffer.append(" (");
166 stringBuffer.append(majorVersion);
167 stringBuffer.append('.');
168 stringBuffer.append(printer.getMinorVersion());
169 stringBuffer.append(')');
170 }
171 // Add JD-Core version
172 stringBuffer.append("\n * JD-Core Version: ");
173 stringBuffer.append(preferences.get(JD_CORE_VERSION));
174 stringBuffer.append("\n */");
175 }
176
177 try (PrintStream ps = new PrintStream(new NewlineOutputStream(os), true, "UTF-8")) {
178 ps.print(stringBuffer.toString());
179 } catch (IOException e) {
180 assert ExceptionUtil.printStackTrace(e);
181 }
182 } catch (Throwable t) {
183 assert ExceptionUtil.printStackTrace(t);
184
185 try (OutputStreamWriter writer = new OutputStreamWriter(os, Charset.defaultCharset())) {
186 writer.write("// INTERNAL ERROR //");
187 } catch (IOException ee) {
188 assert ExceptionUtil.printStackTrace(ee);
189 }
190 }
191 }
192
108193 // --- LineNumberNavigable --- //
194 @Override
109195 public int getMaximumLineNumber() { return maximumLineNumber; }
110196
197 @Override
111198 public void goToLineNumber(int lineNumber) {
112199 int textAreaLineNumber = getTextAreaLineNumber(lineNumber);
113200 if (textAreaLineNumber > 0) {
121208 }
122209 }
123210
211 @Override
124212 public boolean checkLineNumber(int lineNumber) { return lineNumber <= maximumLineNumber; }
125213
126214 // --- PreferencesChangeListener --- //
215 @Override
127216 public void preferencesChanged(Map<String, String> preferences) {
128217 DefaultCaret caret = (DefaultCaret)textArea.getCaret();
129218 int updatePolicy = caret.getUpdatePolicy();
219308 super.endLine();
220309 textAreaLineNumber++;
221310 }
311 @Override
222312 public void extraLine(int count) {
223313 super.extraLine(count);
224314 if (realignmentLineNumber) {
2121 public class TextPage extends AbstractTextPage implements ContentCopyable, ContentSelectable, ContentSavable {
2222
2323 // --- ContentCopyable --- //
24 @Override
2425 public void copy() {
2526 if (textArea.getSelectionStart() == textArea.getSelectionEnd()) {
2627 getToolkit().getSystemClipboard().setContents(new StringSelection(""), null);
3031 }
3132
3233 // --- ContentSelectable --- //
34 @Override
3335 public void selectAll() {
3436 textArea.selectAll();
3537 }
3638
3739 // --- ContentSavable --- //
40 @Override
3841 public String getFileName() { return "file.txt"; }
3942
43 @Override
4044 public void save(API api, OutputStream os) {
4145 try (OutputStreamWriter writer = new OutputStreamWriter(new NewlineOutputStream(os), "UTF-8")) {
4246 writer.write(textArea.getText());
44 <key>CFBundleDevelopmentRegion</key> <string>English</string>
55 <key>CFBundleExecutable</key> <string>universalJavaApplicationStub.sh</string>
66 <key>CFBundleName</key> <string>JD-GUI</string>
7 <key>CFBundleGetInfoString</key> <string>JD-GUI version ${VERSION}, Copyright 2008-2019 Emmanuel Dupuy</string>
7 <key>CFBundleGetInfoString</key> <string>JD-GUI version ${VERSION}, Copyright 2008, 2019 Emmanuel Dupuy</string>
88 <key>CFBundleIconFile</key> <string>jd-gui.icns</string>
99 <key>CFBundleIdentifier</key> <string>jd.jd-gui</string>
1010 <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
1111 <key>CFBundlePackageType</key> <string>APPL</string>
12 <key>CFBundleLongVersionString</key> <string>${VERSION}, Copyright 2008-2019 Emmanuel Dupuy</string>
12 <key>CFBundleLongVersionString</key> <string>${VERSION}, Copyright 2008, 2019 Emmanuel Dupuy</string>
1313 <key>CFBundleShortVersionString</key> <string>${VERSION}</string>
1414 <key>CSResourcesFileMapped</key> <true/>
1515 <key>LSRequiresCarbon</key> <true/>
16 <key>NSHumanReadableCopyright</key> <string>Copyright 2008-2019 Emmanuel Dupuy</string>
16 <key>NSHumanReadableCopyright</key> <string>Copyright 2008, 2019 Emmanuel Dupuy</string>
1717 <key>NSPrincipalClass</key> <string>NSApplication</string>
1818 <key>NSHighResolutionCapable</key> <true/>
1919 <key>CFBundleDocumentTypes</key>
2222 <key>CFBundleTypeExtensions</key>
2323 <array>
2424 <string>class</string>
25 </array>
26 <key>CFBundleTypeMIMETypes</key>
27 <array>
28 <string>application/java</string>
2529 </array>
2630 <key>CFBundleTypeRole</key> <string>Viewer</string>
2731 <key>CFBundleTypeName</key> <string>Class File</string>
3337 <array>
3438 <string>java</string>
3539 </array>
40 <key>CFBundleTypeMIMETypes</key>
41 <array>
42 <string>text/plain</string>
43 </array>
3644 <key>CFBundleTypeRole</key> <string>Viewer</string>
3745 <key>CFBundleTypeName</key> <string>Java File</string>
3846 <key>LSIsAppleDefaultForType</key> <false/>
4250 <key>CFBundleTypeExtensions</key>
4351 <array>
4452 <string>jar</string>
53 </array>
54 <key>CFBundleTypeMIMETypes</key>
55 <array>
56 <string>application/java-archive</string>
4557 </array>
4658 <key>CFBundleTypeName</key> <string>Jar File</string>
4759 <key>CFBundleTypeRole</key> <string>Viewer</string>
5365 <array>
5466 <string>war</string>
5567 </array>
68 <key>CFBundleTypeMIMETypes</key>
69 <array>
70 <string>application/java-archive</string>
71 </array>
5672 <key>CFBundleTypeName</key> <string>War File</string>
5773 <key>CFBundleTypeRole</key> <string>Viewer</string>
5874 <key>LSIsAppleDefaultForType</key> <false/>
6379 <array>
6480 <string>ear</string>
6581 </array>
82 <key>CFBundleTypeMIMETypes</key>
83 <array>
84 <string>application/java-archive</string>
85 </array>
6686 <key>CFBundleTypeName</key> <string>Ear File</string>
6787 <key>CFBundleTypeRole</key> <string>Viewer</string>
6888 <key>LSIsAppleDefaultForType</key> <false/>
7191 <dict>
7292 <key>CFBundleTypeExtensions</key>
7393 <array>
94 <string>aar</string>
95 </array>
96 <key>CFBundleTypeName</key> <string>Android archive File</string>
97 <key>CFBundleTypeRole</key> <string>Viewer</string>
98 <key>LSIsAppleDefaultForType</key> <false/>
99 <key>LSTypeIsPackage</key> <false/>
100 </dict>
101 <dict>
102 <key>CFBundleTypeExtensions</key>
103 <array>
104 <string>jmod</string>
105 </array>
106 <key>CFBundleTypeMIMETypes</key>
107 <array>
108 <string>application/java-archive</string>
109 </array>
110 <key>CFBundleTypeName</key> <string>Java module File</string>
111 <key>CFBundleTypeRole</key> <string>Viewer</string>
112 <key>LSIsAppleDefaultForType</key> <false/>
113 <key>LSTypeIsPackage</key> <false/>
114 </dict>
115 <dict>
116 <key>CFBundleTypeExtensions</key>
117 <array>
74118 <string>zip</string>
119 </array>
120 <key>CFBundleTypeMIMETypes</key>
121 <array>
122 <string>application/zip</string>
75123 </array>
76124 <key>CFBundleTypeName</key> <string>Zip File</string>
77125 <key>CFBundleTypeRole</key> <string>Viewer</string>
83131 <array>
84132 <string>log</string>
85133 <string>txt</string>
134 </array>
135 <key>CFBundleTypeMIMETypes</key>
136 <array>
137 <string>text/plain</string>
86138 </array>
87139 <key>CFBundleTypeName</key> <string>Log File</string>
88140 <key>CFBundleTypeRole</key> <string>Viewer</string>
Binary diff not shown