diff --git a/src/net/apocalypselabs/symat/Editor.form b/src/net/apocalypselabs/symat/Editor.form index 9312f49..403606e 100644 --- a/src/net/apocalypselabs/symat/Editor.form +++ b/src/net/apocalypselabs/symat/Editor.form @@ -52,6 +52,9 @@ + + + @@ -60,6 +63,9 @@ + + + @@ -101,7 +107,7 @@ - + @@ -109,7 +115,10 @@ - + + + + @@ -119,6 +128,9 @@ + + + @@ -127,6 +139,9 @@ + + + @@ -223,6 +238,9 @@ + + + @@ -235,6 +253,9 @@ + + + diff --git a/src/net/apocalypselabs/symat/Editor.java b/src/net/apocalypselabs/symat/Editor.java index d4fa762..4919965 100644 --- a/src/net/apocalypselabs/symat/Editor.java +++ b/src/net/apocalypselabs/symat/Editor.java @@ -348,6 +348,7 @@ public class Editor extends javax.swing.JInternalFrame { 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.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -356,6 +357,7 @@ public class Editor extends javax.swing.JInternalFrame { }); 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.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -388,7 +390,7 @@ public class Editor extends javax.swing.JInternalFrame { jMenu1.setToolTipText(""); 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() { public void actionPerformed(java.awt.event.ActionEvent evt) { exportMenuActionPerformed(evt); @@ -396,7 +398,8 @@ public class Editor extends javax.swing.JInternalFrame { }); 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() { public void actionPerformed(java.awt.event.ActionEvent evt) { packPluginMenuActionPerformed(evt); @@ -406,6 +409,7 @@ public class Editor extends javax.swing.JInternalFrame { 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.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -414,6 +418,7 @@ public class Editor extends javax.swing.JInternalFrame { }); 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.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -488,6 +493,7 @@ public class Editor extends javax.swing.JInternalFrame { codeLangMenu.setText("Language"); + javascriptOption.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_J, java.awt.event.InputEvent.CTRL_MASK)); langBtnGroup.add(javascriptOption); javascriptOption.setSelected(true); javascriptOption.setText("Javascript"); @@ -498,6 +504,7 @@ public class Editor extends javax.swing.JInternalFrame { }); codeLangMenu.add(javascriptOption); + pythonOption.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK)); langBtnGroup.add(pythonOption); pythonOption.setText("Python"); pythonOption.addActionListener(new java.awt.event.ActionListener() { diff --git a/src/net/apocalypselabs/symat/InstallPlugin.form b/src/net/apocalypselabs/symat/InstallPlugin.form new file mode 100644 index 0000000..d97026b --- /dev/null +++ b/src/net/apocalypselabs/symat/InstallPlugin.form @@ -0,0 +1,198 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/net/apocalypselabs/symat/InstallPlugin.java b/src/net/apocalypselabs/symat/InstallPlugin.java new file mode 100644 index 0000000..cbe883e --- /dev/null +++ b/src/net/apocalypselabs/symat/InstallPlugin.java @@ -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") + // //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(); + }// //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 +} diff --git a/src/net/apocalypselabs/symat/Main.java b/src/net/apocalypselabs/symat/Main.java index a995c43..e9fabf3 100644 --- a/src/net/apocalypselabs/symat/Main.java +++ b/src/net/apocalypselabs/symat/Main.java @@ -147,7 +147,7 @@ public class Main extends JRibbonFrame { 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 @@ -190,6 +190,8 @@ public class Main extends JRibbonFrame { Tasks tt = new Tasks(new File(argfile)); loadFrame(tt); argfile = ""; + } else if (argfile.endsWith(".sypl")) { + loadFrame(new InstallPlugin(new File(argfile))); } else { Editor ed = new Editor(); loadFrame(ed); @@ -273,6 +275,9 @@ public class Main extends JRibbonFrame { * Load plugins from disk. */ 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"); dir.mkdirs(); File[] files = dir.listFiles(new FilenameFilter() { @@ -285,14 +290,24 @@ public class Main extends JRibbonFrame { for (File pl : files) { try { LoadPlugin lp = new LoadPlugin(pl); + JCommandButton b = lp.getRibbonBtn(); pluginband.addCommandButton( - lp.getRibbonBtn(), + b, RibbonElementPriority.MEDIUM); + b.setVisible(true); } catch (Exception ex) { } } } + + /** + * Reload the Ribbon tabs and all sub-components. + */ + public void reloadRibbon() { + getRibbon().removeAllTasks(); + loadRibbon(); + } /** * Load the ribbon in all its glory. @@ -306,6 +321,7 @@ public class Main extends JRibbonFrame { JRibbonBand appsband = new JRibbonBand("Apps", null); JRibbonBand webband = new JRibbonBand("Community", null); JRibbonBand collabband = new JRibbonBand("Team", null); + JRibbonBand getpluginband = new JRibbonBand("Install", null); loadPlugins(); shellbtn.addActionListener(new ActionListener() { @@ -360,6 +376,12 @@ public class Main extends JRibbonFrame { loadFrame(new Tasks()); } }); + installpluginbtn.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent evt) { + loadFrame(new InstallPlugin()); + } + }); shellbtn.setActionRichTooltip(new RichTooltip("Command Shell", "Open a window for running interactive commands.")); @@ -377,6 +399,8 @@ public class Main extends JRibbonFrame { "Collaborate over the Internet on projects.")); tasksbtn.setActionRichTooltip(new RichTooltip("Task List", "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(editorbtn, RibbonElementPriority.TOP); @@ -389,6 +413,8 @@ public class Main extends JRibbonFrame { collabband.addCommandButton(padsbtn, RibbonElementPriority.MEDIUM); collabband.addCommandButton(tasksbtn, RibbonElementPriority.MEDIUM); + + getpluginband.addCommandButton(installpluginbtn, RibbonElementPriority.MEDIUM); coreband.setResizePolicies((List) Arrays.asList( new CoreRibbonResizePolicies.None(coreband.getControlPanel()), @@ -397,18 +423,21 @@ public class Main extends JRibbonFrame { new CoreRibbonResizePolicies.None(appsband.getControlPanel()), new IconRibbonBandResizePolicy(appsband.getControlPanel()))); webband.setResizePolicies((List) Arrays.asList( - new CoreRibbonResizePolicies.None(appsband.getControlPanel()), - new IconRibbonBandResizePolicy(appsband.getControlPanel()))); + new CoreRibbonResizePolicies.None(webband.getControlPanel()), + new IconRibbonBandResizePolicy(webband.getControlPanel()))); 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 IconRibbonBandResizePolicy(appsband.getControlPanel()))); + new IconRibbonBandResizePolicy(pluginband.getControlPanel()))); pluginband.setResizePolicies((List) Arrays.asList( new CoreRibbonResizePolicies.None(appsband.getControlPanel()), - new IconRibbonBandResizePolicy(appsband.getControlPanel()))); + new IconRibbonBandResizePolicy(pluginband.getControlPanel()))); RibbonTask hometask = new RibbonTask("Home", coreband, appsband); RibbonTask webtask = new RibbonTask("Tools", webband, collabband); - RibbonTask plugintask = new RibbonTask("Plugins", pluginband); + RibbonTask plugintask = new RibbonTask("Plugins", getpluginband, pluginband); loadRibbonMenu(null); @@ -1059,6 +1088,8 @@ public class Main extends JRibbonFrame { = new JCommandButton("Pads", getRibbonIcon("pads")); public static JCommandButton tasksbtn = new JCommandButton("Tasks", getRibbonIcon("tasks")); + public static JCommandButton installpluginbtn + = new JCommandButton("Install", getRibbonIcon("installplugin")); public static RibbonApplicationMenuEntryPrimary openbtn; // Variables declaration - do not modify//GEN-BEGIN:variables diff --git a/src/net/apocalypselabs/symat/PackagePlugin.form b/src/net/apocalypselabs/symat/PackagePlugin.form index 6c994f4..ebd0008 100644 --- a/src/net/apocalypselabs/symat/PackagePlugin.form +++ b/src/net/apocalypselabs/symat/PackagePlugin.form @@ -5,6 +5,9 @@ + + +
diff --git a/src/net/apocalypselabs/symat/PackagePlugin.java b/src/net/apocalypselabs/symat/PackagePlugin.java index 3955f4b..48ebd5d 100644 --- a/src/net/apocalypselabs/symat/PackagePlugin.java +++ b/src/net/apocalypselabs/symat/PackagePlugin.java @@ -137,6 +137,7 @@ public class PackagePlugin extends javax.swing.JInternalFrame { setClosable(true); setIconifiable(true); setTitle("Package Plugin"); + setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/net/apocalypselabs/symat/icons/plugins.png"))); // NOI18N jLabel1.setText("Plugin Name:"); diff --git a/src/net/apocalypselabs/symat/SingleInstanceServer.java b/src/net/apocalypselabs/symat/SingleInstanceServer.java index 83ecd00..2938e26 100644 --- a/src/net/apocalypselabs/symat/SingleInstanceServer.java +++ b/src/net/apocalypselabs/symat/SingleInstanceServer.java @@ -68,6 +68,8 @@ public class SingleInstanceServer extends NanoHTTPD { if (parms.get("arg").endsWith(".sytt")) { Tasks tt = new Tasks(new File(parms.get("arg"))); Main.loadFrame(tt); + } else if (parms.get("arg").endsWith(".sypl")) { + Main.loadFrame(new InstallPlugin(new File(parms.get("arg")))); } else { Editor ed = new Editor(); Main.loadFrame(ed); diff --git a/src/net/apocalypselabs/symat/icons/plugins.png b/src/net/apocalypselabs/symat/icons/plugins.png new file mode 100644 index 0000000..1ce6859 Binary files /dev/null and b/src/net/apocalypselabs/symat/icons/plugins.png differ diff --git a/src/net/apocalypselabs/symat/images/installplugin.png b/src/net/apocalypselabs/symat/images/installplugin.png new file mode 100644 index 0000000..f324307 Binary files /dev/null and b/src/net/apocalypselabs/symat/images/installplugin.png differ diff --git a/src/net/apocalypselabs/symat/plugin/LoadPlugin.java b/src/net/apocalypselabs/symat/plugin/LoadPlugin.java index 9dfb2bd..1e06363 100644 --- a/src/net/apocalypselabs/symat/plugin/LoadPlugin.java +++ b/src/net/apocalypselabs/symat/plugin/LoadPlugin.java @@ -104,5 +104,9 @@ public class LoadPlugin { CodeRunner cr = new CodeRunner(p.getLang()); cr.evalString(p.getScript()); } + + public Plugin getPlugin() { + return p; + } }