Add Java scripting engine (BeanShell)
This commit is contained in:
parent
1a7958ad39
commit
8c2532728a
BIN
lib/bsh-2.0b5.jar
Normal file
BIN
lib/bsh-2.0b5.jar
Normal file
Binary file not shown.
@ -35,6 +35,7 @@ endorsed.classpath=
|
||||
excludes=
|
||||
file.reference.autocomplete-2.5.4.jar=lib/autocomplete-2.5.4.jar
|
||||
file.reference.beautyeye_lnf.jar=lib/beautyeye_lnf.jar
|
||||
file.reference.bsh-2.0b5.jar=lib\\bsh-2.0b5.jar
|
||||
file.reference.commons-codec-1.9.jar=lib/commons-codec-1.9.jar
|
||||
file.reference.commons-logging-1.2.jar=lib/commons-logging-1.2.jar
|
||||
file.reference.flamingo-6.3.jar=lib/flamingo-6.3.jar
|
||||
@ -90,7 +91,8 @@ javac.classpath=\
|
||||
${file.reference.httpmime-4.5.jar}:\
|
||||
${file.reference.jna-4.1.0.jar}:\
|
||||
${file.reference.jna-platform-4.1.0.jar}:\
|
||||
${file.reference.jython-standalone-2.7.0.jar}
|
||||
${file.reference.jython-standalone-2.7.0.jar}:\
|
||||
${file.reference.bsh-2.0b5.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
|
@ -92,7 +92,7 @@ public class CodeRunner {
|
||||
}
|
||||
|
||||
public CodeRunner(int lang) {
|
||||
this(lang == 0 ? "js" : "py");
|
||||
this(lang == 0 ? "js" : (lang == 2 ? "ja" : "py"));
|
||||
}
|
||||
|
||||
public CodeRunner(String lang) {
|
||||
@ -137,6 +137,26 @@ public class CodeRunner {
|
||||
initError(ex);
|
||||
}
|
||||
break;
|
||||
case "java":
|
||||
case "ja":
|
||||
case "beanshell":
|
||||
case "bsh":
|
||||
scriptLang = "java";
|
||||
se = new ScriptEngineManager().getEngineByName("java");
|
||||
try {
|
||||
// Add custom functions.
|
||||
/*se.eval("importClass(net.apocalypselabs.symat.Functions);"
|
||||
+ "SyMAT_Functions = new net.apocalypselabs.symat.Functions();"
|
||||
+ "SyMAT_Functions.setLang('js');\n"
|
||||
+ getFunctions("js")
|
||||
+ loadToolkits());*/
|
||||
// Allow engine access from scripts.
|
||||
se.put("engine", se);
|
||||
attachWriters();
|
||||
} catch (Exception ex) {
|
||||
initError(ex);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException("Script language " + lang + " not supported.");
|
||||
}
|
||||
@ -298,17 +318,20 @@ public class CodeRunner {
|
||||
|
||||
private String getFunctions(String lang) {
|
||||
String text = "";
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(
|
||||
CodeRunner.class
|
||||
.getResourceAsStream("functions." + lang)));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
text += line + "\n";
|
||||
if (!lang.equals("java")) {
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(
|
||||
CodeRunner.class
|
||||
.getResourceAsStream("functions." + lang)));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
text += line + "\n";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return text;
|
||||
}
|
||||
return text;
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
@ -274,6 +274,17 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="pythonOptionActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JRadioButtonMenuItem" name="javaOption">
|
||||
<Properties>
|
||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||
<ComponentRef name="langBtnGroup"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Java"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaOptionActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
</SubComponents>
|
||||
</Menu>
|
||||
</SubComponents>
|
||||
|
@ -96,6 +96,10 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
private AutoCompletion jsac = new AutoCompletion(jscomp);
|
||||
private AutoCompletion pyac = new AutoCompletion(pycomp);
|
||||
|
||||
public static final int JAVASCRIPT = 1;
|
||||
public static final int PYTHON = 2;
|
||||
public static final int JAVA = 3;
|
||||
|
||||
private File filedata;
|
||||
|
||||
private int font_size = 12;
|
||||
@ -103,14 +107,26 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
/**
|
||||
* @param python If true sets to Python
|
||||
*/
|
||||
@Deprecated
|
||||
public Editor(boolean python) {
|
||||
this((python ? PYTHON : JAVASCRIPT));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lang Script language: 1 = javascript, 2 = python, 3 = java
|
||||
*/
|
||||
public Editor(int lang) {
|
||||
initComponents();
|
||||
|
||||
FileFilter filter = new FileNameExtensionFilter("JavaScript (syjs, js)", "syjs", "js");
|
||||
FileFilter filter = new FileNameExtensionFilter("All SyMAT Files", "syjs", "js", "sypy", "py", "syjava", "java");
|
||||
fc.setFileFilter(filter);
|
||||
fc.addChoosableFileFilter(filter);
|
||||
fc.addChoosableFileFilter(new FileNameExtensionFilter(
|
||||
"JavaScript (syjs, js)", "syjs", "js"));
|
||||
fc.addChoosableFileFilter(new FileNameExtensionFilter(
|
||||
"Python (sypy, py)", "sypy", "py"));
|
||||
fc.addChoosableFileFilter(new FileNameExtensionFilter(
|
||||
"Java (syjava, java)", "syjava", "java"));
|
||||
fc.addChoosableFileFilter(new FileNameExtensionFilter(
|
||||
"Plain Text (txt, text)", "txt", "text"));
|
||||
|
||||
@ -136,39 +152,49 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
}
|
||||
});
|
||||
|
||||
if (python) {
|
||||
if (lang == PYTHON) {
|
||||
pyac.install(codeBox);
|
||||
javascriptOption.setSelected(false);
|
||||
pythonOption.setSelected(true);
|
||||
codeBox.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PYTHON);
|
||||
} else if (lang == JAVA) {
|
||||
codeBox.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
||||
} else {
|
||||
jsac.install(codeBox);
|
||||
codeBox.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
|
||||
}
|
||||
sp.setVisible(true);
|
||||
codeBox.setVisible(true);
|
||||
|
||||
sp.setVisible(
|
||||
true);
|
||||
codeBox.setVisible(
|
||||
true);
|
||||
codeBox.requestFocus();
|
||||
|
||||
codeBox.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
changed();
|
||||
}
|
||||
codeBox.getDocument()
|
||||
.addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e
|
||||
) {
|
||||
changed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
changed();
|
||||
}
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e
|
||||
) {
|
||||
changed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
changed();
|
||||
}
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e
|
||||
) {
|
||||
changed();
|
||||
}
|
||||
|
||||
public void changed() {
|
||||
fileChanged = true;
|
||||
}
|
||||
});
|
||||
public void changed() {
|
||||
fileChanged = true;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -200,16 +226,18 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
*
|
||||
* @param openfile Nothing to see here, move along.
|
||||
*/
|
||||
public Editor(int openfile) {
|
||||
public Editor(long openfile) {
|
||||
this("");
|
||||
openMenuActionPerformed(null);
|
||||
|
||||
}
|
||||
|
||||
private void setEditorTheme(String themeName) {
|
||||
try {
|
||||
Theme theme
|
||||
= Theme.load(
|
||||
Editor.class.
|
||||
Editor.class
|
||||
.
|
||||
getResourceAsStream(
|
||||
"resources/" + themeName + ".xml"),
|
||||
new Font(Font.MONOSPACED, Font.PLAIN, font_size));
|
||||
@ -273,6 +301,7 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
codeLangMenu = new javax.swing.JMenu();
|
||||
javascriptOption = new javax.swing.JRadioButtonMenuItem();
|
||||
pythonOption = new javax.swing.JRadioButtonMenuItem();
|
||||
javaOption = new javax.swing.JRadioButtonMenuItem();
|
||||
|
||||
jMenuItem4.setText("jMenuItem4");
|
||||
|
||||
@ -546,6 +575,15 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
});
|
||||
codeLangMenu.add(pythonOption);
|
||||
|
||||
langBtnGroup.add(javaOption);
|
||||
javaOption.setText("Java");
|
||||
javaOption.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
javaOptionActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
codeLangMenu.add(javaOption);
|
||||
|
||||
runMenu.add(codeLangMenu);
|
||||
|
||||
jMenuBar1.add(runMenu);
|
||||
@ -571,10 +609,11 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
if (r == JFileChooser.APPROVE_OPTION) {
|
||||
try {
|
||||
File f = fc.getSelectedFile();
|
||||
codeBox.setText(FileUtils.readFile(f.toString()));
|
||||
isSaved = true;
|
||||
filedata = f;
|
||||
setTitle(f.getName());
|
||||
/*codeBox.setText(FileUtils.readFile(f.toString()));
|
||||
isSaved = true;
|
||||
filedata = f;*/
|
||||
openString(FileUtils.readFile(f.getAbsolutePath()),
|
||||
f.getAbsolutePath(), true);
|
||||
} catch (IOException ex) {
|
||||
JOptionPane.showInternalMessageDialog(this,
|
||||
"Error: Cannot load file: " + ex.getMessage());
|
||||
@ -612,15 +651,24 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
isSaved = saved;
|
||||
fileChanged = false;
|
||||
setTitle((new File(file)).getName());
|
||||
if (file.matches(".*\\.(js|mls|symt|syjs)")) {
|
||||
if (file.matches(".*\\.(js|mls|symt|syjs)")) { // JavaScript
|
||||
javascriptOption.setSelected(true);
|
||||
pythonOption.setSelected(false);
|
||||
javaOption.setSelected(false);
|
||||
codeBox.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
|
||||
pyac.uninstall();
|
||||
jsac.install(codeBox);
|
||||
} else if (file.matches(".*\\.(sypy|py)")) {
|
||||
} else if (file.matches(".*\\.(syjava|java)")) { // Java
|
||||
javascriptOption.setSelected(false);
|
||||
pythonOption.setSelected(false);
|
||||
javaOption.setSelected(true);
|
||||
codeBox.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
||||
//pyac.uninstall();
|
||||
//jsac.install(codeBox);
|
||||
} else if (file.matches(".*\\.(sypy|py)")) { // Python
|
||||
javascriptOption.setSelected(false);
|
||||
pythonOption.setSelected(true);
|
||||
javaOption.setSelected(false);
|
||||
codeBox.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PYTHON);
|
||||
jsac.uninstall();
|
||||
pyac.install(codeBox);
|
||||
@ -673,6 +721,9 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
} else if (pythonOption.isSelected()) {
|
||||
rt = new RunThread("python");
|
||||
rt.start();
|
||||
} else if (javaOption.isSelected()) {
|
||||
rt = new RunThread("java");
|
||||
rt.start();
|
||||
}
|
||||
}//GEN-LAST:event_runCodeBtnActionPerformed
|
||||
|
||||
@ -743,6 +794,7 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
uo.start();
|
||||
cr.evalCode(script);
|
||||
uo.kill();
|
||||
|
||||
}
|
||||
|
||||
private class UpdateOutput extends Thread {
|
||||
@ -855,7 +907,7 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
}
|
||||
|
||||
private void exportMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportMenuActionPerformed
|
||||
String lang = pythonOption.isSelected() ? "python" : "js";
|
||||
String lang = pythonOption.isSelected() ? "python" : (javaOption.isSelected() ? "java" : "js");
|
||||
Main.loadFrame(new CodeExport(codeBox.getText(), lang, outputBox.getText()));
|
||||
}//GEN-LAST:event_exportMenuActionPerformed
|
||||
|
||||
@ -928,7 +980,7 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
|
||||
private void packPluginMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_packPluginMenuActionPerformed
|
||||
Main.loadFrame(new PackagePlugin(codeBox.getText(),
|
||||
javascriptOption.isSelected() ? 0 : 1
|
||||
javascriptOption.isSelected() ? 0 : pythonOption.isSelected() ? 1 : 2
|
||||
));
|
||||
}//GEN-LAST:event_packPluginMenuActionPerformed
|
||||
|
||||
@ -942,6 +994,12 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
+ "\n=============\n");
|
||||
}//GEN-LAST:event_killButtonActionPerformed
|
||||
|
||||
private void javaOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaOptionActionPerformed
|
||||
codeBox.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
||||
//pyac.uninstall();
|
||||
//jsac.install(codeBox);
|
||||
}//GEN-LAST:event_javaOptionActionPerformed
|
||||
|
||||
private void createShared(String id) {
|
||||
try {
|
||||
String padid = Pads.genPad(id, codeBox.getText());
|
||||
@ -972,6 +1030,7 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
ext = "py";
|
||||
}
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(
|
||||
@ -1030,6 +1089,7 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JPopupMenu.Separator jSeparator1;
|
||||
private javax.swing.JSplitPane jSplitPane1;
|
||||
private javax.swing.JRadioButtonMenuItem javaOption;
|
||||
private javax.swing.JRadioButtonMenuItem javascriptOption;
|
||||
private javax.swing.JMenuItem killButton;
|
||||
private javax.swing.ButtonGroup langBtnGroup;
|
||||
|
@ -62,6 +62,7 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import net.apocalypselabs.symat.plugin.LoadPlugin;
|
||||
import net.apocalypselabs.symat.plugin.Plugin;
|
||||
import net.apocalypselabs.symat.plugin.PluginParent;
|
||||
import org.python.google.common.io.Files;
|
||||
|
||||
/**
|
||||
|
@ -72,6 +72,17 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="pythonMenuActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JRadioButtonMenuItem" name="javaMenu">
|
||||
<Properties>
|
||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||
<ComponentRef name="langGroup"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Java"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaMenuActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
</SubComponents>
|
||||
</Menu>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="setDefaultLang">
|
||||
|
@ -115,8 +115,14 @@ public class Interpreter extends javax.swing.JInternalFrame {
|
||||
if (lang.equals("python")) {
|
||||
javascriptMenu.setSelected(false);
|
||||
pythonMenu.setSelected(true);
|
||||
javaMenu.setSelected(false);
|
||||
pyac.install(inputBox);
|
||||
setTitle("Shell [python]");
|
||||
} else if (lang.equals("java")) {
|
||||
setTitle("Shell [java]");
|
||||
javascriptMenu.setSelected(false);
|
||||
pythonMenu.setSelected(false);
|
||||
javaMenu.setSelected(true);
|
||||
} else {
|
||||
jsac.install(inputBox);
|
||||
setTitle("Shell [javascript]");
|
||||
@ -167,6 +173,7 @@ public class Interpreter extends javax.swing.JInternalFrame {
|
||||
jMenu1 = new javax.swing.JMenu();
|
||||
javascriptMenu = new javax.swing.JRadioButtonMenuItem();
|
||||
pythonMenu = new javax.swing.JRadioButtonMenuItem();
|
||||
javaMenu = new javax.swing.JRadioButtonMenuItem();
|
||||
setDefaultLang = new javax.swing.JMenuItem();
|
||||
|
||||
setClosable(true);
|
||||
@ -279,6 +286,15 @@ public class Interpreter extends javax.swing.JInternalFrame {
|
||||
});
|
||||
jMenu1.add(pythonMenu);
|
||||
|
||||
langGroup.add(javaMenu);
|
||||
javaMenu.setText("Java");
|
||||
javaMenu.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
javaMenuActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jMenu1.add(javaMenu);
|
||||
|
||||
langMenu.add(jMenu1);
|
||||
|
||||
setDefaultLang.setText("Set as default");
|
||||
@ -407,6 +423,8 @@ public class Interpreter extends javax.swing.JInternalFrame {
|
||||
FileFilter filter;
|
||||
if (javascriptMenu.isSelected()) {
|
||||
filter = new FileNameExtensionFilter("SyMAT JavaScript (.syjs)", "syjs");
|
||||
} else if (javaMenu.isSelected()) {
|
||||
filter = new FileNameExtensionFilter("SyMAT Java (.syjava)", "syjava");
|
||||
} else {
|
||||
filter = new FileNameExtensionFilter("SyMAT Python (.sypy)", "sypy");
|
||||
}
|
||||
@ -436,6 +454,13 @@ public class Interpreter extends javax.swing.JInternalFrame {
|
||||
inputBox.requestFocusInWindow();
|
||||
}//GEN-LAST:event_formFocusGained
|
||||
|
||||
private void javaMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaMenuActionPerformed
|
||||
if (!lang.equals("java")) {
|
||||
Main.loadFrame(new Interpreter("java"));
|
||||
dispose();
|
||||
}
|
||||
}//GEN-LAST:event_javaMenuActionPerformed
|
||||
|
||||
private void doRunCode() {
|
||||
String code = inputBox.getText();
|
||||
commandsForExport += code + "\n";
|
||||
@ -551,6 +576,7 @@ public class Interpreter extends javax.swing.JInternalFrame {
|
||||
private javax.swing.JMenu jMenu4;
|
||||
private javax.swing.JMenuBar jMenuBar1;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JRadioButtonMenuItem javaMenu;
|
||||
private javax.swing.JRadioButtonMenuItem javascriptMenu;
|
||||
private javax.swing.ButtonGroup langGroup;
|
||||
private javax.swing.JMenu langMenu;
|
||||
|
@ -55,7 +55,6 @@
|
||||
*/
|
||||
package net.apocalypselabs.symat;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontFormatException;
|
||||
@ -64,7 +63,6 @@ import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
@ -108,7 +106,7 @@ public class Main extends JRibbonFrame {
|
||||
/**
|
||||
* Version name, as it should be displayed.
|
||||
*/
|
||||
public static final String VERSION_NAME = "2.0.2";
|
||||
public static final String VERSION_NAME = "2.1";
|
||||
|
||||
/**
|
||||
* The word "SyMAT".
|
||||
@ -121,7 +119,7 @@ public class Main extends JRibbonFrame {
|
||||
/**
|
||||
* Version number, for updates and //needs in scripts
|
||||
*/
|
||||
public static final double APP_CODE = 23;
|
||||
public static final double APP_CODE = 24;
|
||||
/**
|
||||
* Base URL for building API calls
|
||||
*/
|
||||
@ -133,7 +131,7 @@ public class Main extends JRibbonFrame {
|
||||
|
||||
/**
|
||||
* Ubuntu font. Loaded from Ubuntu-R.ttf in the default package at runtime.
|
||||
* May become default sans-serif if something bad happens.
|
||||
* Becomes default sans-serif if something bad happens.
|
||||
*/
|
||||
public static Font ubuntuRegular;
|
||||
public static boolean skipPython = false; // Skip python init on start?
|
||||
|
@ -338,9 +338,10 @@
|
||||
<Component class="javax.swing.JComboBox" name="langSelect">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="2">
|
||||
<StringArray count="3">
|
||||
<StringItem index="0" value="JavaScript"/>
|
||||
<StringItem index="1" value="Python"/>
|
||||
<StringItem index="2" value="Java"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
@ -293,7 +293,7 @@ public class PackagePlugin extends javax.swing.JInternalFrame {
|
||||
|
||||
jLabel8.setText("Language:");
|
||||
|
||||
langSelect.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "JavaScript", "Python" }));
|
||||
langSelect.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "JavaScript", "Python", "Java" }));
|
||||
|
||||
codeBox.setColumns(20);
|
||||
codeBox.setRows(5);
|
||||
|
@ -55,7 +55,6 @@
|
||||
*/
|
||||
package net.apocalypselabs.symat;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
@ -774,7 +774,7 @@ The code released under the CDDL shall be governed by the laws of the State of C
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.<br>
|
||||
</p><br>
|
||||
<br>
|
||||
<p><b>iTextPDF, Symja (core):</b></p>
|
||||
<p><b>iTextPDF, Symja (core), BeanShell:</b></p>
|
||||
<p> GNU LESSER GENERAL PUBLIC LICENSE<br>
|
||||
Version 3, 29 June 2007<br>
|
||||
<br>
|
||||
|
@ -62,9 +62,9 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InvalidClassException;
|
||||
import java.io.ObjectInputStream;
|
||||
import net.apocalypselabs.symat.CodeRunner;
|
||||
import net.apocalypselabs.symat.Debug;
|
||||
import net.apocalypselabs.symat.Main;
|
||||
import org.pushingpixels.flamingo.api.common.JCommandButton;
|
||||
import org.pushingpixels.flamingo.api.common.JCommandToggleButton;
|
||||
@ -79,9 +79,9 @@ import org.pushingpixels.flamingo.api.common.icon.ResizableIcon;
|
||||
*/
|
||||
public class LoadPlugin {
|
||||
|
||||
private Plugin p = new Plugin();
|
||||
private Plugin p;
|
||||
|
||||
public LoadPlugin(File f) throws FileNotFoundException, IOException, ClassNotFoundException {
|
||||
public LoadPlugin(File f) throws FileNotFoundException, IOException, ClassNotFoundException, InvalidClassException {
|
||||
FileInputStream fin = new FileInputStream(f);
|
||||
ObjectInputStream ois = new ObjectInputStream(fin);
|
||||
p = (Plugin) ois.readObject();
|
||||
|
@ -61,12 +61,13 @@ import javax.swing.ImageIcon;
|
||||
/**
|
||||
* Plugin container class.
|
||||
*/
|
||||
public class Plugin implements Serializable {
|
||||
public class Plugin extends PluginParent implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 13371L;
|
||||
|
||||
public final int LANG_JS = 0;
|
||||
public final int LANG_PY = 1;
|
||||
public final int LANG_JAVA = 2;
|
||||
|
||||
private ImageIcon icon;
|
||||
private String packageName = "";
|
||||
|
108
src/net/apocalypselabs/symat/plugin/PluginParent.java
Normal file
108
src/net/apocalypselabs/symat/plugin/PluginParent.java
Normal file
@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Netsyms Technologies
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* CODE LICENSE ==========
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. You adhere to the Media License detailed below. If you do not, this license
|
||||
* is automatically revoked and you must purge all copies of the software you
|
||||
* possess, in source or binary form.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* MEDIA LICENSE ==========
|
||||
* All images and other graphical files ("media") included with this
|
||||
* software are copyright (c) 2015 Netsyms Technologies. You may not distribute
|
||||
* the graphics or any program, source code repository, or other digital storage
|
||||
* media containing them without permission from Netsyms Technologies.
|
||||
* This ban on distribution only applies to publicly available systems.
|
||||
* A password-protected network file share, USB drive, or other storage scheme that
|
||||
* cannot be easily accessed by the public is generally allowed. If in doubt,
|
||||
* contact Netsyms Technologies. If Netsyms Technologies allows or denies
|
||||
* you permission, that decision is considered final and binding.
|
||||
*
|
||||
* You may only use the media for personal,
|
||||
* non-commercial, non-educational use unless:
|
||||
* 1, You have paid for the software and media via the SyMAT website,
|
||||
* or 2, you are using it as part of the 15-day trial period.
|
||||
* Other uses are prohibited without permission.
|
||||
* If any part of this license is deemed unenforcable, the remainder
|
||||
* of the license remains in full effect.
|
||||
*/
|
||||
package net.apocalypselabs.symat.plugin;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Skylar
|
||||
*/
|
||||
public abstract class PluginParent {
|
||||
|
||||
public abstract String getVersion();
|
||||
|
||||
public abstract void setVersion(String v);
|
||||
|
||||
public abstract String getPackage();
|
||||
|
||||
public abstract void setPackage(String pkg);
|
||||
|
||||
public abstract String getAuthor();
|
||||
|
||||
public abstract void setAuthor(String s);
|
||||
|
||||
public abstract String getWebsite();
|
||||
|
||||
public abstract void setWebsite(String url);
|
||||
|
||||
public abstract String getOther();
|
||||
|
||||
public abstract void setOther(String o);
|
||||
|
||||
public abstract ImageIcon getIcon();
|
||||
|
||||
public abstract void setIcon(ImageIcon i);
|
||||
|
||||
public abstract String getScript();
|
||||
|
||||
public abstract void setScript(String s);
|
||||
|
||||
public abstract String getTitle();
|
||||
|
||||
public abstract void setTitle(String n);
|
||||
|
||||
public abstract String getDesc();
|
||||
|
||||
public abstract void setDesc(String d);
|
||||
|
||||
public abstract String getLongTitle();
|
||||
|
||||
public abstract void setLongTitle(String t);
|
||||
|
||||
public abstract int getLang();
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user