Skip to content

Commit

Permalink
Uploaded files for JD Gui
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacocococo committed Dec 13, 2020
1 parent 3a903ec commit 713bcf3
Show file tree
Hide file tree
Showing 223 changed files with 33,709 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/org/fife/ui/rtextarea/Marker.java
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();
}
}
23 changes: 23 additions & 0 deletions src/org/jd/gui/Constants.java
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;
}
75 changes: 75 additions & 0 deletions src/org/jd/gui/JDGui.java
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;
}
}
}
63 changes: 63 additions & 0 deletions src/org/jd/gui/api/API.java
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);
}
14 changes: 14 additions & 0 deletions src/org/jd/gui/api/feature/ContainerEntryGettable.java
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();
}
12 changes: 12 additions & 0 deletions src/org/jd/gui/api/feature/ContentCopyable.java
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();
}
15 changes: 15 additions & 0 deletions src/org/jd/gui/api/feature/ContentIndexable.java
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);
}
18 changes: 18 additions & 0 deletions src/org/jd/gui/api/feature/ContentSavable.java
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);
}
16 changes: 16 additions & 0 deletions src/org/jd/gui/api/feature/ContentSearchable.java
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);
}
12 changes: 12 additions & 0 deletions src/org/jd/gui/api/feature/ContentSelectable.java
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();
}
12 changes: 12 additions & 0 deletions src/org/jd/gui/api/feature/FocusedTypeGettable.java
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();
}
17 changes: 17 additions & 0 deletions src/org/jd/gui/api/feature/IndexesChangeListener.java
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);
}
16 changes: 16 additions & 0 deletions src/org/jd/gui/api/feature/LineNumberNavigable.java
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);
}
14 changes: 14 additions & 0 deletions src/org/jd/gui/api/feature/PageChangeListener.java
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);
}
12 changes: 12 additions & 0 deletions src/org/jd/gui/api/feature/PageChangeable.java
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);
}
12 changes: 12 additions & 0 deletions src/org/jd/gui/api/feature/PageClosable.java
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();
}
16 changes: 16 additions & 0 deletions src/org/jd/gui/api/feature/PageCreator.java
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);
}
Loading

0 comments on commit 713bcf3

Please sign in to comment.