Skip to content

Commit

Permalink
Delete obsolete DocGen UI, update UI tool
Browse files Browse the repository at this point in the history
Update Help file in PNViewer to link to the new website.
  • Loading branch information
LadyCailin committed Jan 30, 2019
1 parent 22b465c commit 6c5b754
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 1,339 deletions.
62 changes: 61 additions & 1 deletion src/main/java/com/laytonsmith/PureUtilities/Common/OSUtils.java
Expand Up @@ -11,7 +11,67 @@ public static enum OS {
MAC,
LINUX,
SOLARIS,
UNKNOWN
UNKNOWN;

/**
* Returns true if this is {@link #WINDOWS}
* @return
*/
public boolean isWindows() {
return this == WINDOWS;
}

/**
* Returns true if this is {@link #MAC}
* @return
*/
public boolean isMac() {
return this == MAC;
}

/**
* Returns true if this is {@link #LINUX}
* @return
*/
public boolean isLinux() {
return this == LINUX;
}

/**
* Returns true if this is {@link #SOLARIS}
* @return
*/
public boolean isSolaris() {
return this == SOLARIS;
}

/**
* Returns true if this is {@link #UNKNOWN}
* @return
*/
public boolean isUnknown() {
return this == UNKNOWN;
}

/**
* Returns true if this is a strict UNIX implementation, that is, {@link #MAC} or {@link #SOLARIS}
*
* @return
*/
public boolean isUnix() {
return this == MAC || this == SOLARIS;
}

/**
* Returns true if this {@link #isUnix()} returns true, or if this is {@link #LINUX}. This is a less strict
* category than {@link #isUnix()}, because for most purposes, Linux is UNIX compatible, but this is not
* strictly the case. Depending on what you're doing, you may need to differentiate between strict UNIX OSes
* or not, so if this matters, you'll need to do a more granular check.
* @return
*/
public boolean isUnixLike() {
return isUnix() || this == LINUX;
}
}

/**
Expand Down
18 changes: 11 additions & 7 deletions src/main/java/com/laytonsmith/core/Main.java
Expand Up @@ -40,7 +40,6 @@
import com.laytonsmith.tools.UILauncher;
import com.laytonsmith.tools.docgen.DocGen;
import com.laytonsmith.tools.docgen.DocGenExportTool;
import com.laytonsmith.tools.docgen.DocGenUI;
import com.laytonsmith.tools.docgen.ExtensionDocGen;
import com.laytonsmith.tools.docgen.sitedeploy.SiteDeploy;
import com.laytonsmith.tools.pnviewer.PNViewer;
Expand Down Expand Up @@ -526,9 +525,6 @@ public static void main(String[] args) throws Exception {
} else if(mode == UNINSTALL_CMDLINE_MODE) {
Interpreter.uninstall();
System.exit(0);
} else if(mode == DOCGEN_MODE) {
DocGenUI.main(args);
System.exit(0);
} else if(mode == MSLP_MODE) {
String mslp = parsedArgs.getStringArgument();
if(mslp.isEmpty()) {
Expand Down Expand Up @@ -824,9 +820,17 @@ public static void main(String[] args) throws Exception {
} else {
// Relaunch the jar in a new process with the --run flag set,
// so that the process will be in its own subshell
CommandExecutor ce = new CommandExecutor("java -jar "
+ ClassDiscovery.GetClassContainer(Main.class).getPath() + " "
+ StringUtils.Join(args, " ") + " --in-shell");
List<String> largs = new ArrayList<>();
largs.add("java");
largs.add("-jar");
String jarPath = ClassDiscovery.GetClassContainer(Main.class).getPath();
if(OSUtils.GetOS().isWindows() && jarPath.startsWith("/")) {
jarPath = jarPath.substring(1);
}
largs.add(jarPath);
largs.addAll(Arrays.asList(args));
largs.add("--in-shell");
CommandExecutor ce = new CommandExecutor(largs.toArray(new String[largs.size()]));
ce.start();
System.exit(0);
}
Expand Down
54 changes: 15 additions & 39 deletions src/main/java/com/laytonsmith/tools/UILauncher.java
@@ -1,7 +1,6 @@
package com.laytonsmith.tools;

import com.laytonsmith.PureUtilities.Common.UIUtils;
import com.laytonsmith.tools.docgen.DocGenUI;
import com.laytonsmith.tools.pnviewer.PNViewer;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
Expand All @@ -26,48 +25,29 @@ public class UILauncher extends javax.swing.JFrame {
/**
* Creates new form UILauncher
*/
@SuppressWarnings("OverridableMethodCallInConstructor")
public UILauncher() {
final String[] args = {};
uis.add(new UI("Persistence Network Viewer", "Allows easier visualization of the Persistence Network", new Runnable() {

@Override
public void run() {
PNViewer.main(args);
}
}));

uis.add(new UI("DocGen", "Allows uploading of the built-in documentation to MediaWiki software.", new Runnable() {

@Override
public void run() {
DocGenUI.main(args);
}
uis.add(new UI("Persistence Network Viewer", "Allows easier visualization of the Persistence Network", () -> {
PNViewer.main(args);
}));

initComponents();

setTitle("MethodScript UI Tool Launcher");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

launchButton.addActionListener(new ActionListener() {

@Override
public void actionPerformed(ActionEvent e) {
if(selectedUI == null) {
JOptionPane.showMessageDialog(UILauncher.this, "Please select a tool from the list on the left.", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
selectedUI.getLauncher().run();
UILauncher.this.setVisible(false);
launchButton.addActionListener((ActionEvent e) -> {
if(selectedUI == null) {
JOptionPane.showMessageDialog(UILauncher.this, "Please select a tool from the list on the left.", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
selectedUI.getLauncher().run();
UILauncher.this.setVisible(false);
});

exitButton.addActionListener(new ActionListener() {

@Override
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
exitButton.addActionListener((ActionEvent e) -> {
System.exit(0);
});

launcherList.setModel(new AbstractListModel() {
Expand All @@ -84,14 +64,10 @@ public Object getElementAt(int index) {

});

launcherList.addListSelectionListener(new ListSelectionListener() {

@Override
public void valueChanged(ListSelectionEvent e) {
UI ui = uis.get(e.getFirstIndex());
descriptionTextArea.setText(ui.getTooltip());
selectedUI = ui;
}
launcherList.addListSelectionListener((ListSelectionEvent e) -> {
UI ui = uis.get(e.getFirstIndex());
descriptionTextArea.setText(ui.getTooltip());
selectedUI = ui;
});

launcherList.addMouseListener(new MouseAdapter() {
Expand Down

0 comments on commit 6c5b754

Please sign in to comment.