-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a903ec
commit 713bcf3
Showing
223 changed files
with
33,709 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.fife.ui.rtextarea; | ||
|
||
import org.fife.ui.rsyntaxtextarea.DocumentRange; | ||
|
||
import java.util.List; | ||
|
||
/* | ||
* An utility class to call the restricted access methods of 'RTextArea'. | ||
* | ||
* JD-GUI uses two workarounds for RSyntaxTextArea: | ||
* - org.fife.ui.rtextarea.Marker | ||
* - org.jd.gui.view.component.RoundMarkErrorStrip | ||
*/ | ||
public class Marker { | ||
public static void markAll(RTextArea textArea, List<DocumentRange> ranges) { | ||
textArea.markAll(ranges); | ||
} | ||
|
||
public static void clearMarkAllHighlights(RTextArea textArea) { | ||
textArea.clearMarkAllHighlights(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui; | ||
|
||
public class Constants { | ||
public static final String APP_NAME = "JD-GUI"; | ||
|
||
public static final int DEFAULT_WIDTH = 600; | ||
public static final int DEFAULT_HEIGHT = 400; | ||
|
||
public static final int MINIMAL_WIDTH = 500; | ||
public static final int MINIMAL_HEIGHT = 160; | ||
|
||
public static final String CONFIG_FILENAME = "jd-gui.cfg"; | ||
|
||
public static final int MAX_RECENT_FILES = 10; | ||
public static final int RECENT_FILE_MAX_LENGTH = 200; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import javax.swing.UIManager; | ||
|
||
import org.jd.gui.controller.MainController; | ||
import org.jd.gui.model.configuration.Configuration; | ||
import org.jd.gui.service.configuration.ConfigurationPersister; | ||
import org.jd.gui.service.configuration.ConfigurationPersisterService; | ||
import org.jd.gui.util.exception.ExceptionUtil; | ||
|
||
public class JDGui { | ||
protected MainController controller; | ||
|
||
public JDGui() { | ||
// Load preferences | ||
ConfigurationPersister persister = ConfigurationPersisterService.getInstance().get(); | ||
Configuration configuration = persister.load(); | ||
Runtime.getRuntime().addShutdownHook(new Thread(() -> persister.save(configuration))); | ||
|
||
// Create SwingBuilder, set look and feel | ||
try { | ||
UIManager.setLookAndFeel(configuration.getLookAndFeel()); | ||
} catch (Exception e) { | ||
configuration.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); | ||
try { | ||
UIManager.setLookAndFeel(configuration.getLookAndFeel()); | ||
} catch (Exception ee) { | ||
assert ExceptionUtil.printStackTrace(ee); | ||
} | ||
} | ||
|
||
// Create main controller and show main frame | ||
controller = new MainController(configuration); | ||
controller.show(); | ||
} | ||
|
||
public void loadFile(File file) { | ||
controller.openFile(file); | ||
} | ||
|
||
protected static boolean checkHelpFlag(String[] args) { | ||
if (args != null) { | ||
for (String arg : args) { | ||
if ("-h".equals(arg)) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
protected static List<File> newList(String[] paths) { | ||
if (paths == null) { | ||
return Collections.emptyList(); | ||
} else { | ||
ArrayList<File> files = new ArrayList<>(paths.length); | ||
for (String path : paths) { | ||
files.add(new File(path)); | ||
} | ||
return files; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui.api; | ||
|
||
import org.jd.gui.api.feature.UriGettable; | ||
import org.jd.gui.api.model.Container; | ||
import org.jd.gui.api.model.Indexes; | ||
import org.jd.gui.spi.*; | ||
|
||
import javax.swing.*; | ||
import java.io.File; | ||
import java.net.URI; | ||
import java.nio.file.Path; | ||
import java.util.Collection; | ||
import java.util.Map; | ||
import java.util.concurrent.Future; | ||
|
||
public interface API { | ||
boolean openURI(URI uri); | ||
|
||
boolean openURI(int x, int y, Collection<Container.Entry> entries, String query, String fragment); | ||
|
||
void addURI(URI uri); | ||
|
||
<T extends JComponent & UriGettable> void addPanel(String title, Icon icon, String tip, T component); | ||
|
||
Collection<Action> getContextualActions(Container.Entry entry, String fragment); | ||
|
||
UriLoader getUriLoader(URI uri); | ||
|
||
FileLoader getFileLoader(File file); | ||
|
||
ContainerFactory getContainerFactory(Path rootPath); | ||
|
||
PanelFactory getMainPanelFactory(Container container); | ||
|
||
TreeNodeFactory getTreeNodeFactory(Container.Entry entry); | ||
|
||
TypeFactory getTypeFactory(Container.Entry entry); | ||
|
||
Indexer getIndexer(Container.Entry entry); | ||
|
||
SourceSaver getSourceSaver(Container.Entry entry); | ||
|
||
Map<String, String> getPreferences(); | ||
|
||
Collection<Future<Indexes>> getCollectionOfFutureIndexes(); | ||
|
||
interface LoadSourceListener { | ||
void sourceLoaded(String source); | ||
} | ||
|
||
String getSource(Container.Entry entry); | ||
|
||
void loadSource(Container.Entry entry, LoadSourceListener listener); | ||
|
||
File loadSourceFile(Container.Entry entry); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui.api.feature; | ||
|
||
import org.jd.gui.api.model.Container; | ||
|
||
public interface ContainerEntryGettable { | ||
Container.Entry getEntry(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui.api.feature; | ||
|
||
public interface ContentCopyable { | ||
void copy(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui.api.feature; | ||
|
||
import org.jd.gui.api.API; | ||
import org.jd.gui.api.model.Indexes; | ||
|
||
public interface ContentIndexable { | ||
Indexes index(API api); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui.api.feature; | ||
|
||
import org.jd.gui.api.API; | ||
|
||
import java.io.OutputStream; | ||
|
||
public interface ContentSavable { | ||
String getFileName(); | ||
|
||
void save(API api, OutputStream os); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui.api.feature; | ||
|
||
public interface ContentSearchable { | ||
boolean highlightText(String text, boolean caseSensitive); | ||
|
||
void findNext(String text, boolean caseSensitive); | ||
|
||
void findPrevious(String text, boolean caseSensitive); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui.api.feature; | ||
|
||
public interface ContentSelectable { | ||
void selectAll(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui.api.feature; | ||
|
||
public interface FocusedTypeGettable extends ContainerEntryGettable { | ||
String getFocusedTypeName(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui.api.feature; | ||
|
||
import org.jd.gui.api.model.Indexes; | ||
|
||
import java.util.Collection; | ||
import java.util.concurrent.Future; | ||
|
||
public interface IndexesChangeListener { | ||
void indexesChanged(Collection<Future<Indexes>> collectionOfFutureIndexes); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui.api.feature; | ||
|
||
public interface LineNumberNavigable { | ||
int getMaximumLineNumber(); | ||
|
||
void goToLineNumber(int lineNumber); | ||
|
||
boolean checkLineNumber(int lineNumber); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui.api.feature; | ||
|
||
import javax.swing.*; | ||
|
||
public interface PageChangeListener { | ||
<T extends JComponent & UriGettable> void pageChanged(T page); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui.api.feature; | ||
|
||
public interface PageChangeable { | ||
void addPageChangeListener(PageChangeListener listener); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui.api.feature; | ||
|
||
public interface PageClosable { | ||
boolean closePage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.gui.api.feature; | ||
|
||
import org.jd.gui.api.API; | ||
|
||
import javax.swing.*; | ||
|
||
public interface PageCreator { | ||
<T extends JComponent & UriGettable> T createPage(API api); | ||
} |
Oops, something went wrong.