Plugin system fully integrated
This commit is contained in:
parent
efcbd19823
commit
c0accff404
@ -52,6 +52,9 @@
|
|||||||
<SubComponents>
|
<SubComponents>
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="sampleHelloWorld">
|
<MenuItem class="javax.swing.JMenuItem" name="sampleHelloWorld">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||||
|
<KeyStroke key="Shift+Ctrl+1"/>
|
||||||
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" value="helloworld"/>
|
<Property name="text" type="java.lang.String" value="helloworld"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
@ -60,6 +63,9 @@
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="sampleGraph">
|
<MenuItem class="javax.swing.JMenuItem" name="sampleGraph">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||||
|
<KeyStroke key="Shift+Ctrl+2"/>
|
||||||
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" value="graph"/>
|
<Property name="text" type="java.lang.String" value="graph"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
@ -101,7 +107,7 @@
|
|||||||
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||||
<KeyStroke key="Ctrl+E"/>
|
<KeyStroke key="Ctrl+E"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" value="Export Code"/>
|
<Property name="text" type="java.lang.String" value="Export code"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exportMenuActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exportMenuActionPerformed"/>
|
||||||
@ -109,7 +115,10 @@
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="packPluginMenu">
|
<MenuItem class="javax.swing.JMenuItem" name="packPluginMenu">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="Package Plugin..."/>
|
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||||
|
<KeyStroke key="Shift+Ctrl+P"/>
|
||||||
|
</Property>
|
||||||
|
<Property name="text" type="java.lang.String" value="Package as plugin"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="packPluginMenuActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="packPluginMenuActionPerformed"/>
|
||||||
@ -119,6 +128,9 @@
|
|||||||
</Menu>
|
</Menu>
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="shareMenu">
|
<MenuItem class="javax.swing.JMenuItem" name="shareMenu">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||||
|
<KeyStroke key="Ctrl+B"/>
|
||||||
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" value="Share..."/>
|
<Property name="text" type="java.lang.String" value="Share..."/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
@ -127,6 +139,9 @@
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="shareAsMenu">
|
<MenuItem class="javax.swing.JMenuItem" name="shareAsMenu">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||||
|
<KeyStroke key="Shift+Ctrl+B"/>
|
||||||
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" value="Share as..."/>
|
<Property name="text" type="java.lang.String" value="Share as..."/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
@ -223,6 +238,9 @@
|
|||||||
<SubComponents>
|
<SubComponents>
|
||||||
<MenuItem class="javax.swing.JRadioButtonMenuItem" name="javascriptOption">
|
<MenuItem class="javax.swing.JRadioButtonMenuItem" name="javascriptOption">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||||
|
<KeyStroke key="Ctrl+J"/>
|
||||||
|
</Property>
|
||||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||||
<ComponentRef name="langBtnGroup"/>
|
<ComponentRef name="langBtnGroup"/>
|
||||||
</Property>
|
</Property>
|
||||||
@ -235,6 +253,9 @@
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem class="javax.swing.JRadioButtonMenuItem" name="pythonOption">
|
<MenuItem class="javax.swing.JRadioButtonMenuItem" name="pythonOption">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||||
|
<KeyStroke key="Ctrl+P"/>
|
||||||
|
</Property>
|
||||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||||
<ComponentRef name="langBtnGroup"/>
|
<ComponentRef name="langBtnGroup"/>
|
||||||
</Property>
|
</Property>
|
||||||
|
@ -348,6 +348,7 @@ public class Editor extends javax.swing.JInternalFrame {
|
|||||||
|
|
||||||
openSampleBtn.setText("Open Code Sample");
|
openSampleBtn.setText("Open Code Sample");
|
||||||
|
|
||||||
|
sampleHelloWorld.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_1, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
|
||||||
sampleHelloWorld.setText("helloworld");
|
sampleHelloWorld.setText("helloworld");
|
||||||
sampleHelloWorld.addActionListener(new java.awt.event.ActionListener() {
|
sampleHelloWorld.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
@ -356,6 +357,7 @@ public class Editor extends javax.swing.JInternalFrame {
|
|||||||
});
|
});
|
||||||
openSampleBtn.add(sampleHelloWorld);
|
openSampleBtn.add(sampleHelloWorld);
|
||||||
|
|
||||||
|
sampleGraph.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_2, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
|
||||||
sampleGraph.setText("graph");
|
sampleGraph.setText("graph");
|
||||||
sampleGraph.addActionListener(new java.awt.event.ActionListener() {
|
sampleGraph.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
@ -388,7 +390,7 @@ public class Editor extends javax.swing.JInternalFrame {
|
|||||||
jMenu1.setToolTipText("");
|
jMenu1.setToolTipText("");
|
||||||
|
|
||||||
exportMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
|
exportMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
|
||||||
exportMenu.setText("Export Code");
|
exportMenu.setText("Export code");
|
||||||
exportMenu.addActionListener(new java.awt.event.ActionListener() {
|
exportMenu.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
exportMenuActionPerformed(evt);
|
exportMenuActionPerformed(evt);
|
||||||
@ -396,7 +398,8 @@ public class Editor extends javax.swing.JInternalFrame {
|
|||||||
});
|
});
|
||||||
jMenu1.add(exportMenu);
|
jMenu1.add(exportMenu);
|
||||||
|
|
||||||
packPluginMenu.setText("Package Plugin...");
|
packPluginMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
|
||||||
|
packPluginMenu.setText("Package as plugin");
|
||||||
packPluginMenu.addActionListener(new java.awt.event.ActionListener() {
|
packPluginMenu.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
packPluginMenuActionPerformed(evt);
|
packPluginMenuActionPerformed(evt);
|
||||||
@ -406,6 +409,7 @@ public class Editor extends javax.swing.JInternalFrame {
|
|||||||
|
|
||||||
fileMenu.add(jMenu1);
|
fileMenu.add(jMenu1);
|
||||||
|
|
||||||
|
shareMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.CTRL_MASK));
|
||||||
shareMenu.setText("Share...");
|
shareMenu.setText("Share...");
|
||||||
shareMenu.addActionListener(new java.awt.event.ActionListener() {
|
shareMenu.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
@ -414,6 +418,7 @@ public class Editor extends javax.swing.JInternalFrame {
|
|||||||
});
|
});
|
||||||
fileMenu.add(shareMenu);
|
fileMenu.add(shareMenu);
|
||||||
|
|
||||||
|
shareAsMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
|
||||||
shareAsMenu.setText("Share as...");
|
shareAsMenu.setText("Share as...");
|
||||||
shareAsMenu.addActionListener(new java.awt.event.ActionListener() {
|
shareAsMenu.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
@ -488,6 +493,7 @@ public class Editor extends javax.swing.JInternalFrame {
|
|||||||
|
|
||||||
codeLangMenu.setText("Language");
|
codeLangMenu.setText("Language");
|
||||||
|
|
||||||
|
javascriptOption.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_J, java.awt.event.InputEvent.CTRL_MASK));
|
||||||
langBtnGroup.add(javascriptOption);
|
langBtnGroup.add(javascriptOption);
|
||||||
javascriptOption.setSelected(true);
|
javascriptOption.setSelected(true);
|
||||||
javascriptOption.setText("Javascript");
|
javascriptOption.setText("Javascript");
|
||||||
@ -498,6 +504,7 @@ public class Editor extends javax.swing.JInternalFrame {
|
|||||||
});
|
});
|
||||||
codeLangMenu.add(javascriptOption);
|
codeLangMenu.add(javascriptOption);
|
||||||
|
|
||||||
|
pythonOption.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK));
|
||||||
langBtnGroup.add(pythonOption);
|
langBtnGroup.add(pythonOption);
|
||||||
pythonOption.setText("Python");
|
pythonOption.setText("Python");
|
||||||
pythonOption.addActionListener(new java.awt.event.ActionListener() {
|
pythonOption.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
198
src/net/apocalypselabs/symat/InstallPlugin.form
Normal file
198
src/net/apocalypselabs/symat/InstallPlugin.form
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
|
||||||
|
<Properties>
|
||||||
|
<Property name="closable" type="boolean" value="true"/>
|
||||||
|
<Property name="iconifiable" type="boolean" value="true"/>
|
||||||
|
<Property name="title" type="java.lang.String" value="Install Plugin"/>
|
||||||
|
<Property name="frameIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||||
|
<Image iconType="3" name="/net/apocalypselabs/symat/icons/plugins.png"/>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
<SyntheticProperties>
|
||||||
|
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||||
|
</SyntheticProperties>
|
||||||
|
<AuxValues>
|
||||||
|
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
||||||
|
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||||
|
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
||||||
|
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||||
|
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||||
|
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||||
|
</AuxValues>
|
||||||
|
|
||||||
|
<Layout>
|
||||||
|
<DimensionLayout dim="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="103" groupAlignment="2" attributes="0">
|
||||||
|
<Group type="102" alignment="2" attributes="0">
|
||||||
|
<Component id="openPluginBtn" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="iconBox" min="-2" pref="104" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="installBtn" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Component id="jScrollPane1" alignment="2" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Component id="jLabel7" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="jLabel6" alignment="0" min="-2" pref="72" max="-2" attributes="0"/>
|
||||||
|
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<Component id="website" max="32767" attributes="0"/>
|
||||||
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
|
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
|
<Component id="version" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<Component id="pluginName" max="32767" attributes="0"/>
|
||||||
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
|
<Component id="jLabel4" min="-2" pref="39" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
|
<Component id="author" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Component id="shortDesc" alignment="0" min="-2" pref="317" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
<DimensionLayout dim="1">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" alignment="1" attributes="0">
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="2" attributes="0">
|
||||||
|
<Component id="openPluginBtn" alignment="2" min="-2" pref="32" max="-2" attributes="0"/>
|
||||||
|
<Component id="iconBox" alignment="2" min="-2" pref="80" max="-2" attributes="0"/>
|
||||||
|
<Component id="installBtn" alignment="2" min="-2" pref="32" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="pluginName" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="author" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="website" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="version" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="shortDesc" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="jScrollPane1" min="-2" pref="150" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
</Layout>
|
||||||
|
<SubComponents>
|
||||||
|
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Plugin Name:"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JTextField" name="pluginName">
|
||||||
|
<Properties>
|
||||||
|
<Property name="editable" type="boolean" value="false"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JLabel" name="jLabel4">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Author:"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JTextField" name="author">
|
||||||
|
<Properties>
|
||||||
|
<Property name="editable" type="boolean" value="false"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Website:"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JTextField" name="website">
|
||||||
|
<Properties>
|
||||||
|
<Property name="editable" type="boolean" value="false"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JTextField" name="version">
|
||||||
|
<Properties>
|
||||||
|
<Property name="editable" type="boolean" value="false"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JLabel" name="jLabel5">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Version:"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JLabel" name="jLabel6">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Description:"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JTextField" name="shortDesc">
|
||||||
|
<Properties>
|
||||||
|
<Property name="editable" type="boolean" value="false"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JLabel" name="jLabel7">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Long Description:"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||||
|
<AuxValues>
|
||||||
|
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||||
|
</AuxValues>
|
||||||
|
|
||||||
|
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||||
|
<SubComponents>
|
||||||
|
<Component class="javax.swing.JTextArea" name="longDesc">
|
||||||
|
<Properties>
|
||||||
|
<Property name="editable" type="boolean" value="false"/>
|
||||||
|
<Property name="columns" type="int" value="20"/>
|
||||||
|
<Property name="rows" type="int" value="5"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
</SubComponents>
|
||||||
|
</Container>
|
||||||
|
<Component class="javax.swing.JButton" name="openPluginBtn">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Open Plugin"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="openPluginBtnActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JLabel" name="iconBox">
|
||||||
|
<Properties>
|
||||||
|
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JButton" name="installBtn">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Install Plugin"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="installBtnActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
</SubComponents>
|
||||||
|
</Form>
|
299
src/net/apocalypselabs/symat/InstallPlugin.java
Normal file
299
src/net/apocalypselabs/symat/InstallPlugin.java
Normal file
@ -0,0 +1,299 @@
|
|||||||
|
/*
|
||||||
|
* CODE LICENSE =====================
|
||||||
|
* Copyright (c) 2015, Apocalypse Laboratories
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* 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 (the "graphics") included with this
|
||||||
|
* software are copyright (c) 2015 Apocalypse Laboratories. You may not distribute
|
||||||
|
* the graphics or any program, source code repository, or other digital storage
|
||||||
|
* media containing them without written permission from Apocalypse Laboratories.
|
||||||
|
* 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 Apocalypse Laboratories. If Apocalypse Laboratories allows or denies
|
||||||
|
* you permission, that decision is considered final and binding.
|
||||||
|
*/
|
||||||
|
package net.apocalypselabs.symat;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.swing.JFileChooser;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||||
|
import net.apocalypselabs.symat.plugin.LoadPlugin;
|
||||||
|
import net.apocalypselabs.symat.plugin.Plugin;
|
||||||
|
import org.python.google.common.io.Files;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Skylar
|
||||||
|
*/
|
||||||
|
public class InstallPlugin extends javax.swing.JInternalFrame {
|
||||||
|
|
||||||
|
private final JFileChooser fc = new JFileChooser();
|
||||||
|
|
||||||
|
private File f = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates new form InstallPlugin
|
||||||
|
*/
|
||||||
|
public InstallPlugin() {
|
||||||
|
fc.setFileFilter(new FileNameExtensionFilter(
|
||||||
|
"Plugin (sypl)",
|
||||||
|
"sypl"));
|
||||||
|
initComponents();
|
||||||
|
}
|
||||||
|
|
||||||
|
public InstallPlugin(File f) {
|
||||||
|
this();
|
||||||
|
openPlugin(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called from within the constructor to initialize the form.
|
||||||
|
* WARNING: Do NOT modify this code. The content of this method is always
|
||||||
|
* regenerated by the Form Editor.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
|
private void initComponents() {
|
||||||
|
|
||||||
|
jLabel1 = new javax.swing.JLabel();
|
||||||
|
pluginName = new javax.swing.JTextField();
|
||||||
|
jLabel4 = new javax.swing.JLabel();
|
||||||
|
author = new javax.swing.JTextField();
|
||||||
|
jLabel3 = new javax.swing.JLabel();
|
||||||
|
website = new javax.swing.JTextField();
|
||||||
|
version = new javax.swing.JTextField();
|
||||||
|
jLabel5 = new javax.swing.JLabel();
|
||||||
|
jLabel6 = new javax.swing.JLabel();
|
||||||
|
shortDesc = new javax.swing.JTextField();
|
||||||
|
jLabel7 = new javax.swing.JLabel();
|
||||||
|
jScrollPane1 = new javax.swing.JScrollPane();
|
||||||
|
longDesc = new javax.swing.JTextArea();
|
||||||
|
openPluginBtn = new javax.swing.JButton();
|
||||||
|
iconBox = new javax.swing.JLabel();
|
||||||
|
installBtn = new javax.swing.JButton();
|
||||||
|
|
||||||
|
setClosable(true);
|
||||||
|
setIconifiable(true);
|
||||||
|
setTitle("Install Plugin");
|
||||||
|
setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/net/apocalypselabs/symat/icons/plugins.png"))); // NOI18N
|
||||||
|
|
||||||
|
jLabel1.setText("Plugin Name:");
|
||||||
|
|
||||||
|
pluginName.setEditable(false);
|
||||||
|
|
||||||
|
jLabel4.setText("Author:");
|
||||||
|
|
||||||
|
author.setEditable(false);
|
||||||
|
|
||||||
|
jLabel3.setText("Website:");
|
||||||
|
|
||||||
|
website.setEditable(false);
|
||||||
|
|
||||||
|
version.setEditable(false);
|
||||||
|
|
||||||
|
jLabel5.setText("Version:");
|
||||||
|
|
||||||
|
jLabel6.setText("Description:");
|
||||||
|
|
||||||
|
shortDesc.setEditable(false);
|
||||||
|
|
||||||
|
jLabel7.setText("Long Description:");
|
||||||
|
|
||||||
|
longDesc.setEditable(false);
|
||||||
|
longDesc.setColumns(20);
|
||||||
|
longDesc.setRows(5);
|
||||||
|
jScrollPane1.setViewportView(longDesc);
|
||||||
|
|
||||||
|
openPluginBtn.setText("Open Plugin");
|
||||||
|
openPluginBtn.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
openPluginBtnActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
iconBox.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||||
|
|
||||||
|
installBtn.setText("Install Plugin");
|
||||||
|
installBtn.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
installBtnActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
|
getContentPane().setLayout(layout);
|
||||||
|
layout.setHorizontalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addComponent(openPluginBtn)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(iconBox, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(installBtn))
|
||||||
|
.addComponent(jScrollPane1))
|
||||||
|
.addComponent(jLabel7)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(jLabel3)
|
||||||
|
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(jLabel1))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addComponent(website)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
|
.addComponent(jLabel5)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
|
.addComponent(version))
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addComponent(pluginName)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
|
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
|
.addComponent(author))
|
||||||
|
.addComponent(shortDesc, javax.swing.GroupLayout.PREFERRED_SIZE, 317, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||||
|
);
|
||||||
|
layout.setVerticalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
|
.addContainerGap()
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||||
|
.addComponent(openPluginBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(iconBox, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(installBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(jLabel1)
|
||||||
|
.addComponent(pluginName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(jLabel4)
|
||||||
|
.addComponent(author, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(jLabel3)
|
||||||
|
.addComponent(website, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(jLabel5)
|
||||||
|
.addComponent(version, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(jLabel6)
|
||||||
|
.addComponent(shortDesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(jLabel7)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
);
|
||||||
|
|
||||||
|
pack();
|
||||||
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
private void openPluginBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openPluginBtnActionPerformed
|
||||||
|
int result = fc.showDialog(this, "Open Plugin");
|
||||||
|
if (result == JFileChooser.APPROVE_OPTION) {
|
||||||
|
openPlugin(fc.getSelectedFile());
|
||||||
|
}
|
||||||
|
}//GEN-LAST:event_openPluginBtnActionPerformed
|
||||||
|
|
||||||
|
private void openPlugin(File file) {
|
||||||
|
try {
|
||||||
|
Plugin p = (new LoadPlugin(file)).getPlugin();
|
||||||
|
pluginName.setText(p.getTitle());
|
||||||
|
shortDesc.setText(p.getLongTitle());
|
||||||
|
version.setText(p.getVersion());
|
||||||
|
longDesc.setText(p.getDesc());
|
||||||
|
website.setText(p.getWebsite());
|
||||||
|
author.setText(p.getAuthor());
|
||||||
|
iconBox.setIcon(p.getIcon());
|
||||||
|
f = file;
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Debug.stacktrace(ex);
|
||||||
|
JOptionPane.showInternalMessageDialog(this,
|
||||||
|
"Error opening plugin.\n\n" + ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void installBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_installBtnActionPerformed
|
||||||
|
if (f == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Files.copy(f,
|
||||||
|
new File(
|
||||||
|
System.getProperty("user.home")
|
||||||
|
+ "\\.symat\\plugins\\"
|
||||||
|
+ f.getName()));
|
||||||
|
Main.maingui.reloadRibbon();
|
||||||
|
JOptionPane.showInternalMessageDialog(this,
|
||||||
|
"Plugin installed!",
|
||||||
|
"Success",
|
||||||
|
JOptionPane.PLAIN_MESSAGE);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
Debug.stacktrace(ex);
|
||||||
|
JOptionPane.showInternalMessageDialog(this,
|
||||||
|
"Error: could not copy plugin file: " + ex.getMessage(),
|
||||||
|
"Error",
|
||||||
|
JOptionPane.ERROR_MESSAGE);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Debug.stacktrace(ex);
|
||||||
|
JOptionPane.showInternalMessageDialog(this,
|
||||||
|
"Error: could not install plugin file."
|
||||||
|
+ "Try restarting SyMAT.\n"
|
||||||
|
+ ex.getMessage(),
|
||||||
|
"Error",
|
||||||
|
JOptionPane.ERROR_MESSAGE);
|
||||||
|
}
|
||||||
|
}//GEN-LAST:event_installBtnActionPerformed
|
||||||
|
|
||||||
|
|
||||||
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private javax.swing.JTextField author;
|
||||||
|
private javax.swing.JLabel iconBox;
|
||||||
|
private javax.swing.JButton installBtn;
|
||||||
|
private javax.swing.JLabel jLabel1;
|
||||||
|
private javax.swing.JLabel jLabel3;
|
||||||
|
private javax.swing.JLabel jLabel4;
|
||||||
|
private javax.swing.JLabel jLabel5;
|
||||||
|
private javax.swing.JLabel jLabel6;
|
||||||
|
private javax.swing.JLabel jLabel7;
|
||||||
|
private javax.swing.JScrollPane jScrollPane1;
|
||||||
|
private javax.swing.JTextArea longDesc;
|
||||||
|
private javax.swing.JButton openPluginBtn;
|
||||||
|
private javax.swing.JTextField pluginName;
|
||||||
|
private javax.swing.JTextField shortDesc;
|
||||||
|
private javax.swing.JTextField version;
|
||||||
|
private javax.swing.JTextField website;
|
||||||
|
// End of variables declaration//GEN-END:variables
|
||||||
|
}
|
@ -147,7 +147,7 @@ public class Main extends JRibbonFrame {
|
|||||||
|
|
||||||
public static Main maingui;
|
public static Main maingui;
|
||||||
|
|
||||||
JRibbonBand pluginband = new JRibbonBand("Plugins", null);
|
public JRibbonBand pluginband;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the main app window and does some quick things that aren't
|
* Creates the main app window and does some quick things that aren't
|
||||||
@ -190,6 +190,8 @@ public class Main extends JRibbonFrame {
|
|||||||
Tasks tt = new Tasks(new File(argfile));
|
Tasks tt = new Tasks(new File(argfile));
|
||||||
loadFrame(tt);
|
loadFrame(tt);
|
||||||
argfile = "";
|
argfile = "";
|
||||||
|
} else if (argfile.endsWith(".sypl")) {
|
||||||
|
loadFrame(new InstallPlugin(new File(argfile)));
|
||||||
} else {
|
} else {
|
||||||
Editor ed = new Editor();
|
Editor ed = new Editor();
|
||||||
loadFrame(ed);
|
loadFrame(ed);
|
||||||
@ -273,6 +275,9 @@ public class Main extends JRibbonFrame {
|
|||||||
* Load plugins from disk.
|
* Load plugins from disk.
|
||||||
*/
|
*/
|
||||||
public void loadPlugins() {
|
public void loadPlugins() {
|
||||||
|
pluginband = new JRibbonBand("Plugins", null);
|
||||||
|
pluginband.setResizePolicies((List) Arrays.asList(
|
||||||
|
new IconRibbonBandResizePolicy(pluginband.getControlPanel())));
|
||||||
File dir = new File(System.getProperty("user.home") + "\\.symat\\plugins");
|
File dir = new File(System.getProperty("user.home") + "\\.symat\\plugins");
|
||||||
dir.mkdirs();
|
dir.mkdirs();
|
||||||
File[] files = dir.listFiles(new FilenameFilter() {
|
File[] files = dir.listFiles(new FilenameFilter() {
|
||||||
@ -285,14 +290,24 @@ public class Main extends JRibbonFrame {
|
|||||||
for (File pl : files) {
|
for (File pl : files) {
|
||||||
try {
|
try {
|
||||||
LoadPlugin lp = new LoadPlugin(pl);
|
LoadPlugin lp = new LoadPlugin(pl);
|
||||||
|
JCommandButton b = lp.getRibbonBtn();
|
||||||
pluginband.addCommandButton(
|
pluginband.addCommandButton(
|
||||||
lp.getRibbonBtn(),
|
b,
|
||||||
RibbonElementPriority.MEDIUM);
|
RibbonElementPriority.MEDIUM);
|
||||||
|
b.setVisible(true);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload the Ribbon tabs and all sub-components.
|
||||||
|
*/
|
||||||
|
public void reloadRibbon() {
|
||||||
|
getRibbon().removeAllTasks();
|
||||||
|
loadRibbon();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the ribbon in all its glory.
|
* Load the ribbon in all its glory.
|
||||||
@ -306,6 +321,7 @@ public class Main extends JRibbonFrame {
|
|||||||
JRibbonBand appsband = new JRibbonBand("Apps", null);
|
JRibbonBand appsband = new JRibbonBand("Apps", null);
|
||||||
JRibbonBand webband = new JRibbonBand("Community", null);
|
JRibbonBand webband = new JRibbonBand("Community", null);
|
||||||
JRibbonBand collabband = new JRibbonBand("Team", null);
|
JRibbonBand collabband = new JRibbonBand("Team", null);
|
||||||
|
JRibbonBand getpluginband = new JRibbonBand("Install", null);
|
||||||
loadPlugins();
|
loadPlugins();
|
||||||
|
|
||||||
shellbtn.addActionListener(new ActionListener() {
|
shellbtn.addActionListener(new ActionListener() {
|
||||||
@ -360,6 +376,12 @@ public class Main extends JRibbonFrame {
|
|||||||
loadFrame(new Tasks());
|
loadFrame(new Tasks());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
installpluginbtn.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent evt) {
|
||||||
|
loadFrame(new InstallPlugin());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
shellbtn.setActionRichTooltip(new RichTooltip("Command Shell",
|
shellbtn.setActionRichTooltip(new RichTooltip("Command Shell",
|
||||||
"Open a window for running interactive commands."));
|
"Open a window for running interactive commands."));
|
||||||
@ -377,6 +399,8 @@ public class Main extends JRibbonFrame {
|
|||||||
"Collaborate over the Internet on projects."));
|
"Collaborate over the Internet on projects."));
|
||||||
tasksbtn.setActionRichTooltip(new RichTooltip("Task List",
|
tasksbtn.setActionRichTooltip(new RichTooltip("Task List",
|
||||||
"Manage tasks and to-do lists for projects."));
|
"Manage tasks and to-do lists for projects."));
|
||||||
|
installpluginbtn.setActionRichTooltip(new RichTooltip("Install Plugin",
|
||||||
|
"Install a plugin from a file and view plugin info."));
|
||||||
|
|
||||||
coreband.addCommandButton(shellbtn, RibbonElementPriority.TOP);
|
coreband.addCommandButton(shellbtn, RibbonElementPriority.TOP);
|
||||||
coreband.addCommandButton(editorbtn, RibbonElementPriority.TOP);
|
coreband.addCommandButton(editorbtn, RibbonElementPriority.TOP);
|
||||||
@ -389,6 +413,8 @@ public class Main extends JRibbonFrame {
|
|||||||
|
|
||||||
collabband.addCommandButton(padsbtn, RibbonElementPriority.MEDIUM);
|
collabband.addCommandButton(padsbtn, RibbonElementPriority.MEDIUM);
|
||||||
collabband.addCommandButton(tasksbtn, RibbonElementPriority.MEDIUM);
|
collabband.addCommandButton(tasksbtn, RibbonElementPriority.MEDIUM);
|
||||||
|
|
||||||
|
getpluginband.addCommandButton(installpluginbtn, RibbonElementPriority.MEDIUM);
|
||||||
|
|
||||||
coreband.setResizePolicies((List) Arrays.asList(
|
coreband.setResizePolicies((List) Arrays.asList(
|
||||||
new CoreRibbonResizePolicies.None(coreband.getControlPanel()),
|
new CoreRibbonResizePolicies.None(coreband.getControlPanel()),
|
||||||
@ -397,18 +423,21 @@ public class Main extends JRibbonFrame {
|
|||||||
new CoreRibbonResizePolicies.None(appsband.getControlPanel()),
|
new CoreRibbonResizePolicies.None(appsband.getControlPanel()),
|
||||||
new IconRibbonBandResizePolicy(appsband.getControlPanel())));
|
new IconRibbonBandResizePolicy(appsband.getControlPanel())));
|
||||||
webband.setResizePolicies((List) Arrays.asList(
|
webband.setResizePolicies((List) Arrays.asList(
|
||||||
new CoreRibbonResizePolicies.None(appsband.getControlPanel()),
|
new CoreRibbonResizePolicies.None(webband.getControlPanel()),
|
||||||
new IconRibbonBandResizePolicy(appsband.getControlPanel())));
|
new IconRibbonBandResizePolicy(webband.getControlPanel())));
|
||||||
collabband.setResizePolicies((List) Arrays.asList(
|
collabband.setResizePolicies((List) Arrays.asList(
|
||||||
|
new CoreRibbonResizePolicies.None(collabband.getControlPanel()),
|
||||||
|
new IconRibbonBandResizePolicy(collabband.getControlPanel())));
|
||||||
|
getpluginband.setResizePolicies((List) Arrays.asList(
|
||||||
new CoreRibbonResizePolicies.None(appsband.getControlPanel()),
|
new CoreRibbonResizePolicies.None(appsband.getControlPanel()),
|
||||||
new IconRibbonBandResizePolicy(appsband.getControlPanel())));
|
new IconRibbonBandResizePolicy(pluginband.getControlPanel())));
|
||||||
pluginband.setResizePolicies((List) Arrays.asList(
|
pluginband.setResizePolicies((List) Arrays.asList(
|
||||||
new CoreRibbonResizePolicies.None(appsband.getControlPanel()),
|
new CoreRibbonResizePolicies.None(appsband.getControlPanel()),
|
||||||
new IconRibbonBandResizePolicy(appsband.getControlPanel())));
|
new IconRibbonBandResizePolicy(pluginband.getControlPanel())));
|
||||||
|
|
||||||
RibbonTask hometask = new RibbonTask("Home", coreband, appsband);
|
RibbonTask hometask = new RibbonTask("Home", coreband, appsband);
|
||||||
RibbonTask webtask = new RibbonTask("Tools", webband, collabband);
|
RibbonTask webtask = new RibbonTask("Tools", webband, collabband);
|
||||||
RibbonTask plugintask = new RibbonTask("Plugins", pluginband);
|
RibbonTask plugintask = new RibbonTask("Plugins", getpluginband, pluginband);
|
||||||
|
|
||||||
loadRibbonMenu(null);
|
loadRibbonMenu(null);
|
||||||
|
|
||||||
@ -1059,6 +1088,8 @@ public class Main extends JRibbonFrame {
|
|||||||
= new JCommandButton("Pads", getRibbonIcon("pads"));
|
= new JCommandButton("Pads", getRibbonIcon("pads"));
|
||||||
public static JCommandButton tasksbtn
|
public static JCommandButton tasksbtn
|
||||||
= new JCommandButton("Tasks", getRibbonIcon("tasks"));
|
= new JCommandButton("Tasks", getRibbonIcon("tasks"));
|
||||||
|
public static JCommandButton installpluginbtn
|
||||||
|
= new JCommandButton("Install", getRibbonIcon("installplugin"));
|
||||||
public static RibbonApplicationMenuEntryPrimary openbtn;
|
public static RibbonApplicationMenuEntryPrimary openbtn;
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
<Property name="closable" type="boolean" value="true"/>
|
<Property name="closable" type="boolean" value="true"/>
|
||||||
<Property name="iconifiable" type="boolean" value="true"/>
|
<Property name="iconifiable" type="boolean" value="true"/>
|
||||||
<Property name="title" type="java.lang.String" value="Package Plugin"/>
|
<Property name="title" type="java.lang.String" value="Package Plugin"/>
|
||||||
|
<Property name="frameIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||||
|
<Image iconType="3" name="/net/apocalypselabs/symat/icons/plugins.png"/>
|
||||||
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
<SyntheticProperties>
|
<SyntheticProperties>
|
||||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||||
|
@ -137,6 +137,7 @@ public class PackagePlugin extends javax.swing.JInternalFrame {
|
|||||||
setClosable(true);
|
setClosable(true);
|
||||||
setIconifiable(true);
|
setIconifiable(true);
|
||||||
setTitle("Package Plugin");
|
setTitle("Package Plugin");
|
||||||
|
setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/net/apocalypselabs/symat/icons/plugins.png"))); // NOI18N
|
||||||
|
|
||||||
jLabel1.setText("Plugin Name:");
|
jLabel1.setText("Plugin Name:");
|
||||||
|
|
||||||
|
@ -68,6 +68,8 @@ public class SingleInstanceServer extends NanoHTTPD {
|
|||||||
if (parms.get("arg").endsWith(".sytt")) {
|
if (parms.get("arg").endsWith(".sytt")) {
|
||||||
Tasks tt = new Tasks(new File(parms.get("arg")));
|
Tasks tt = new Tasks(new File(parms.get("arg")));
|
||||||
Main.loadFrame(tt);
|
Main.loadFrame(tt);
|
||||||
|
} else if (parms.get("arg").endsWith(".sypl")) {
|
||||||
|
Main.loadFrame(new InstallPlugin(new File(parms.get("arg"))));
|
||||||
} else {
|
} else {
|
||||||
Editor ed = new Editor();
|
Editor ed = new Editor();
|
||||||
Main.loadFrame(ed);
|
Main.loadFrame(ed);
|
||||||
|
BIN
src/net/apocalypselabs/symat/icons/plugins.png
Normal file
BIN
src/net/apocalypselabs/symat/icons/plugins.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 564 B |
BIN
src/net/apocalypselabs/symat/images/installplugin.png
Normal file
BIN
src/net/apocalypselabs/symat/images/installplugin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
@ -104,5 +104,9 @@ public class LoadPlugin {
|
|||||||
CodeRunner cr = new CodeRunner(p.getLang());
|
CodeRunner cr = new CodeRunner(p.getLang());
|
||||||
cr.evalString(p.getScript());
|
cr.evalString(p.getScript());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Plugin getPlugin() {
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user