Code cleaned (unused imports, formatting, IDE warnings, etc)

master
skylarmt 9 years ago
parent 629a8d0bc2
commit 9ccf1e3e7e

@ -32,14 +32,8 @@ import java.awt.Component;
import java.awt.Font;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
@ -63,8 +57,7 @@ public class CodeEditor extends javax.swing.JInternalFrame {
private final JFileChooser fc = new JFileChooser();
private boolean isSaved = false;
private RSyntaxTextArea codeBox = new RSyntaxTextArea();
private RTextScrollPane sp;
private String lastSaved = "";
private final RTextScrollPane sp;
private boolean fileChanged = false;
private CompletionProvider jscomp = new CodeCompleter("js").getProvider();
@ -462,7 +455,6 @@ public class CodeEditor extends javax.swing.JInternalFrame {
codeBox.setText(FileUtils.readFile(f.toString()));
isSaved = true;
filedata = f;
lastSaved = FileUtils.MD5(codeBox.getText());
setTitle("Editor - " + f.getName());
} catch (IOException ex) {
JOptionPane.showInternalMessageDialog(this,

@ -49,6 +49,7 @@ public class Debug {
}
}
@SuppressWarnings(value = {"CallToPrintStackTrace"})
public static void stacktrace(Exception e) {
if (DEBUG) {
e.printStackTrace();

@ -211,7 +211,7 @@ public class FirstRun extends javax.swing.JInternalFrame {
private void contBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_contBtnActionPerformed
if (noLicSel.isSelected()) {
if (PrefStorage.getSetting("licensetype").equals("demo")
if (PrefStorage.getSetting("licensetype").equals("demo")
&& PrefStorage.getSetting("licensedemo").equals("used")) {
int ans = JOptionPane.showInternalConfirmDialog(this,
"You have already used a trial license."
@ -219,7 +219,7 @@ public class FirstRun extends javax.swing.JInternalFrame {
"Expired",
JOptionPane.YES_NO_OPTION);
if (ans == JOptionPane.NO_OPTION) {
} else {
openShop();
}
@ -292,7 +292,7 @@ public class FirstRun extends javax.swing.JInternalFrame {
*/
private class CheckThread extends Thread {
private String email;
private final String email;
public CheckThread(String useremail) {
email = useremail;
@ -303,12 +303,12 @@ public class FirstRun extends javax.swing.JInternalFrame {
try {
Debug.println("Checking license...");
URL url = new URL(API_URL + "liccheck.php?email=" + email);
InputStream is = url.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = br.readLine();
br.close();
is.close();
String line;
try (InputStream is = url.openStream();
BufferedReader br
= new BufferedReader(new InputStreamReader(is))) {
line = br.readLine();
}
switch (line) {
case "ok:single":
@ -356,12 +356,13 @@ public class FirstRun extends javax.swing.JInternalFrame {
JOptionPane.QUESTION_MESSAGE);
Debug.println("Checking license code (" + code + ")...");
URL url = new URL(API_URL + "emailverify.php?code=" + code + "&email=" + email);
InputStream is = url.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = br.readLine();
br.close();
is.close();
String line;
try (InputStream is = url.openStream()) {
BufferedReader br
= new BufferedReader(new InputStreamReader(is));
line = br.readLine();
br.close();
}
if (code.equals(line)) {
success("domain");
} else {

@ -1,7 +1,7 @@
/*
* Apocalypse Laboratories
* Open Source License
*
*
* Source code can be used for any purpose, as long as:
* - Compiled binaries are rebranded and trademarks are not
* visible by the end user at any time, except to give
@ -14,7 +14,7 @@
* - and you provide your modified source code for download,
* under the terms of the GNU LGPL v3 or a comparable
* license.
*
*
* Compiled binaries cannot be redistributed or mirrored,
* unless:
* - You have written permission from Apocalypse Laboratories;
@ -22,7 +22,7 @@
* not even behind a paywall or other blocking mechanism;
* - or you have received a multi-computer license, in which
* case you should take measures to prevent unauthorized
* downloads, such as preventing download access from the
* downloads, such as preventing download access from the
* Internet.
*/
package net.apocalypselabs.symat;
@ -40,7 +40,7 @@ public class FontOptions extends javax.swing.JPanel {
public FontOptions() {
initComponents();
}
public FontOptions(int size) {
this();
jSpinner1.setValue(size);
@ -104,7 +104,7 @@ public class FontOptions extends javax.swing.JPanel {
public int getResult() {
return (int) jSpinner1.getValue();
}
public boolean isModified() {
return modified;
}

@ -1,7 +1,7 @@
/*
/*
* Apocalypse Laboratories
* Open Source License
*
*
* Source code can be used for any purpose, as long as:
* - Compiled binaries are rebranded and trademarks are not
* visible by the end user at any time, except to give
@ -14,7 +14,7 @@
* - and you provide your modified source code for download,
* under the terms of the GNU LGPL v3 or a comparable
* license.
*
*
* Compiled binaries cannot be redistributed or mirrored,
* unless:
* - You have written permission from Apocalypse Laboratories;
@ -22,7 +22,7 @@
* not even behind a paywall or other blocking mechanism;
* - or you have received a multi-computer license, in which
* case you should take measures to prevent unauthorized
* downloads, such as preventing download access from the
* downloads, such as preventing download access from the
* Internet.
*/
package net.apocalypselabs.symat;
@ -118,7 +118,7 @@ public class Functions {
}
}
/*
/*
Graphing interfaces
*/
public void plotrange(double xmin, double xmax) {

@ -1,7 +1,7 @@
/*
/*
* Apocalypse Laboratories
* Open Source License
*
*
* Source code can be used for any purpose, as long as:
* - Compiled binaries are rebranded and trademarks are not
* visible by the end user at any time, except to give
@ -14,7 +14,7 @@
* - and you provide your modified source code for download,
* under the terms of the GNU LGPL v3 or a comparable
* license.
*
*
* Compiled binaries cannot be redistributed or mirrored,
* unless:
* - You have written permission from Apocalypse Laboratories;
@ -22,7 +22,7 @@
* not even behind a paywall or other blocking mechanism;
* - or you have received a multi-computer license, in which
* case you should take measures to prevent unauthorized
* downloads, such as preventing download access from the
* downloads, such as preventing download access from the
* Internet.
*/
package net.apocalypselabs.symat;
@ -248,7 +248,7 @@ public class Help extends javax.swing.JInternalFrame {
}
setText(text, "Manual (" + topicList.getSelectedValue().toString() + ")");
} catch (Exception e) {
//JOptionPane.showInternalMessageDialog(MainGUI.mainPane,
//JOptionPane.showInternalMessageDialog(MainGUI.mainPane,
//"Error: Cannot load help topic "+name+".\n\n"+e.getMessage());
setText("<html><head></head><body><p><b>Error:</b><br>Cannot get help topic \""
+ name + "\".<br>(" + e.getMessage() + ")</p></body></html>", "Manual");

@ -31,8 +31,6 @@ import java.awt.Color;
import java.awt.Font;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
@ -412,7 +410,7 @@ public class Interpreter extends javax.swing.JInternalFrame {
false);
} catch (IOException ex) {
JOptionPane.showInternalMessageDialog(this,
"Error saving: "+ex.getMessage(),
"Error saving: " + ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE);
}
@ -452,7 +450,7 @@ public class Interpreter extends javax.swing.JInternalFrame {
}
// Implement ans command
String ansfill = "";
String ansfill;
try {
ansfill = String.valueOf(Double.parseDouble(ans.toString()));
} catch (NumberFormatException ex) {
@ -463,6 +461,7 @@ public class Interpreter extends javax.swing.JInternalFrame {
}
@Override
@SuppressWarnings("null")
public void run() {
try {
if (doSpecialCommands()) {

@ -29,12 +29,15 @@ package net.apocalypselabs.symat;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontFormatException;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.PropertyVetoException;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Calendar;
import java.util.Date;
import javax.swing.ImageIcon;
@ -758,7 +761,7 @@ public class MainGUI extends javax.swing.JFrame {
ubuntuRegular = Font.createFont(Font.TRUETYPE_FONT,
new File(MainGUI.class.
getResource("resources/Ubuntu-R.ttf").toURI()));
} catch (Exception ex) {
} catch (URISyntaxException | FontFormatException | IOException ex) {
ubuntuRegular = Font.getFont(Font.SANS_SERIF);
}

@ -1,7 +1,7 @@
/*
/*
* Apocalypse Laboratories
* Open Source License
*
*
* Source code can be used for any purpose, as long as:
* - Compiled binaries are rebranded and trademarks are not
* visible by the end user at any time, except to give
@ -14,7 +14,7 @@
* - and you provide your modified source code for download,
* under the terms of the GNU LGPL v3 or a comparable
* license.
*
*
* Compiled binaries cannot be redistributed or mirrored,
* unless:
* - You have written permission from Apocalypse Laboratories;
@ -22,7 +22,7 @@
* not even behind a paywall or other blocking mechanism;
* - or you have received a multi-computer license, in which
* case you should take measures to prevent unauthorized
* downloads, such as preventing download access from the
* downloads, such as preventing download access from the
* Internet.
*/
package net.apocalypselabs.symat;
@ -45,7 +45,7 @@ public class PrefStorage {
public static boolean isset(String key) {
return !getSetting(key, "NULL").equals("NULL");
}
public static void unset(String key) {
prefs.remove(key);
}
@ -57,7 +57,7 @@ public class PrefStorage {
public static String getSetting(String key, String emptyResponse) {
return prefs.get(key, emptyResponse);
}
public static boolean save() {
try {
prefs.flush();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B

Loading…
Cancel
Save