Refactor CodeEditor to Editor to better fit naming conventions

master
skylarmt 9 years ago
parent 882a3c469a
commit 6a071547b6

Binary file not shown.

@ -82,7 +82,7 @@ public class CodeCompleter {
for (String fileid : files) { for (String fileid : files) {
BufferedReader reader = new BufferedReader( BufferedReader reader = new BufferedReader(
new InputStreamReader( new InputStreamReader(
CodeEditor.class.getResourceAsStream("resources/" + lang + fileid + ".txt"))); CodeCompleter.class.getResourceAsStream("resources/" + lang + fileid + ".txt")));
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
switch (fileid) { switch (fileid) {

@ -70,7 +70,7 @@ import org.fife.ui.rtextarea.RTextScrollPane;
* *
* @author Skylar * @author Skylar
*/ */
public class CodeEditor extends javax.swing.JInternalFrame { public class Editor extends javax.swing.JInternalFrame {
private final JFileChooser fc = new JFileChooser(); private final JFileChooser fc = new JFileChooser();
private boolean isSaved = false; private boolean isSaved = false;
@ -88,7 +88,7 @@ public class CodeEditor extends javax.swing.JInternalFrame {
/** /**
* Creates new form CodeEditor * Creates new form CodeEditor
*/ */
public CodeEditor() { public Editor() {
initComponents(); initComponents();
FileFilter filter = new FileNameExtensionFilter("SyMAT JavaScript (.syjs)", "syjs"); FileFilter filter = new FileNameExtensionFilter("SyMAT JavaScript (.syjs)", "syjs");
@ -151,12 +151,12 @@ public class CodeEditor extends javax.swing.JInternalFrame {
}); });
} }
public CodeEditor(String text) { public Editor(String text) {
this(); this();
codeBox.setText(text); codeBox.setText(text);
} }
public CodeEditor(String text, boolean openSaveDialog) { public Editor(String text, boolean openSaveDialog) {
this(text); this(text);
if (openSaveDialog) { if (openSaveDialog) {
saveAsMenuActionPerformed(null); saveAsMenuActionPerformed(null);
@ -165,7 +165,7 @@ public class CodeEditor extends javax.swing.JInternalFrame {
private void setEditorTheme(String themeName) { private void setEditorTheme(String themeName) {
try { try {
Theme theme = Theme.load(CodeEditor.class Theme theme = Theme.load(Editor.class
.getResourceAsStream("resources/" + themeName + ".xml")); .getResourceAsStream("resources/" + themeName + ".xml"));
theme.apply(codeBox); theme.apply(codeBox);
} catch (Exception e) { } catch (Exception e) {
@ -833,7 +833,7 @@ public class CodeEditor extends javax.swing.JInternalFrame {
try { try {
BufferedReader reader = new BufferedReader( BufferedReader reader = new BufferedReader(
new InputStreamReader( new InputStreamReader(
CodeEditor.class Editor.class
.getResourceAsStream("codesamples/" + name + "." + ext))); .getResourceAsStream("codesamples/" + name + "." + ext)));
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {

@ -73,11 +73,11 @@ import javax.swing.UIManager;
/** /**
* This class is like the Force: A light theme, a dark theme, and it binds the * This class is like the Force: A light theme, a dark theme, and it binds the
* app together. Also like duct tape, but that's not as cool. * app together. Also like duct tape, but that's not as cool.
*
Contains a bunch of important variables and constants that are used all over. * Contains a bunch of important variables and constants that are used all over.
*
There should be only one Main per app instance, the important things are * There should be only one Main per app instance, the important things are
static. * static.
* *
* @author Skylar Ittner * @author Skylar Ittner
*/ */
@ -118,9 +118,9 @@ public class Main extends javax.swing.JFrame {
* Application icon, for setting frame icons. * Application icon, for setting frame icons.
*/ */
public static ArrayList<Image> symatlogo = new ArrayList<>(); public static ArrayList<Image> symatlogo = new ArrayList<>();
public static SingleInstanceServer sisrv; public static SingleInstanceServer sisrv;
public static Main maingui; public static Main maingui;
/** /**
@ -162,7 +162,7 @@ public class Main extends javax.swing.JFrame {
// Open initial windows // Open initial windows
boolean loaded = false; boolean loaded = false;
if (!argfile.equals("")) { if (!argfile.equals("")) {
CodeEditor ed = new CodeEditor(); Editor ed = new Editor();
loadFrame(ed); loadFrame(ed);
ed.openFileFromName(argfile); ed.openFileFromName(argfile);
argfile = ""; argfile = "";
@ -804,7 +804,7 @@ public class Main extends javax.swing.JFrame {
}//GEN-LAST:event_graphBtnActionPerformed }//GEN-LAST:event_graphBtnActionPerformed
private void editorBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editorBtnActionPerformed private void editorBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editorBtnActionPerformed
loadFrame(new CodeEditor()); loadFrame(new Editor());
}//GEN-LAST:event_editorBtnActionPerformed }//GEN-LAST:event_editorBtnActionPerformed
private void shellBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_shellBtnActionPerformed private void shellBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_shellBtnActionPerformed
@ -819,7 +819,7 @@ public class Main extends javax.swing.JFrame {
if (file.isEmpty()) { if (file.isEmpty()) {
return; return;
} }
CodeEditor edit = new CodeEditor(); Editor edit = new Editor();
Debug.println(file.getValue()); Debug.println(file.getValue());
edit.openFileFromName(file.getValue()); edit.openFileFromName(file.getValue());
loadFrame(edit); loadFrame(edit);
@ -1011,9 +1011,9 @@ public class Main extends javax.swing.JFrame {
break; break;
} }
} }
SingleInstanceClient sicli = new SingleInstanceClient(argfile); SingleInstanceClient sicli = new SingleInstanceClient(argfile);
try { try {
new SingleInstanceServer().start(); new SingleInstanceServer().start();
} catch (IOException ex) { } catch (IOException ex) {

@ -484,7 +484,7 @@ public class Pads extends javax.swing.JInternalFrame {
}//GEN-LAST:event_purgeBtnActionPerformed }//GEN-LAST:event_purgeBtnActionPerformed
private void saveBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveBtnActionPerformed private void saveBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveBtnActionPerformed
Main.loadFrame(new CodeEditor(getPad(getSelectedPad()), true)); Main.loadFrame(new Editor(getPad(getSelectedPad()), true));
updateList(); updateList();
}//GEN-LAST:event_saveBtnActionPerformed }//GEN-LAST:event_saveBtnActionPerformed

@ -64,7 +64,7 @@ public class SingleInstanceServer extends NanoHTTPD {
String msg = "OK"; String msg = "OK";
Map<String, String> parms = session.getParms(); Map<String, String> parms = session.getParms();
if (parms.get("arg") != null) { if (parms.get("arg") != null) {
CodeEditor ed = new CodeEditor(); Editor ed = new Editor();
Main.loadFrame(ed); Main.loadFrame(ed);
ed.openFileFromName(parms.get("arg")); ed.openFileFromName(parms.get("arg"));
java.awt.EventQueue.invokeLater(new Runnable() { java.awt.EventQueue.invokeLater(new Runnable() {

@ -167,7 +167,7 @@ public class SplashScreen extends javax.swing.JFrame {
System.out.println("Preparing editor, to skip run with argument 'skipeditor'"); System.out.println("Preparing editor, to skip run with argument 'skipeditor'");
setProgress("Preparing editor..."); setProgress("Preparing editor...");
// Get editor going too // Get editor going too
CodeEditor edit = new CodeEditor(); Editor edit = new Editor();
} }
setProgress("Checking for updates..."); setProgress("Checking for updates...");

Loading…
Cancel
Save