Author: pwang
Date: 2011-06-16 15:14:48 -0700 (Thu, 16 Jun 2011)
New Revision: 25783

Modified:
   
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/action/PluginManagerAction.java
   
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/ui/PluginManageDialog.java
   core3/plugin-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
Log:
Import local plugin from Plugin manager

Modified: 
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/action/PluginManagerAction.java
===================================================================
--- 
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/action/PluginManagerAction.java
 2011-06-16 20:15:07 UTC (rev 25782)
+++ 
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/action/PluginManagerAction.java
 2011-06-16 22:14:48 UTC (rev 25783)
@@ -57,6 +57,7 @@
 //import java.util.Properties;
 import org.cytoscape.plugin.internal.*;
 //import org.cytoscape.plugin.internal.ui.*;
+import org.cytoscape.work.TaskFactory;
 
 import java.util.List;
 import java.util.Map;
@@ -73,16 +74,18 @@
        private Bookmarks theBookmarks;
        private GUITaskManager guiTaskManagerServiceRef;
        private CyProperty cytoscapePropertiesServiceRef;
+       private TaskFactory pluginLoaderTaskFactory;
        
        // Hard-coded for now, should get system configuration
        public static String cyConfigDir = ".cytoscape";
        public static String cyConfigVerDir = "3.0.0";
+       
        /**
         * Creates a new BookmarkAction object.
         */
        public PluginManagerAction(CySwingApplication desktop, 
CyApplicationManager appMgr, CytoscapeVersion version,
                        CyProperty<Bookmarks> bookmarksProp, BookmarksUtil 
bookmarksUtil, GUITaskManager guiTaskManagerServiceRef
-                       , CyProperty cytoscapePropertiesServiceRef, 
CyPluginAdapter adapter) {
+                       , CyProperty cytoscapePropertiesServiceRef, 
CyPluginAdapter adapter, TaskFactory pluginLoaderTaskFactory) {
                                
                super("Plugin Manager", appMgr);
 
@@ -92,6 +95,8 @@
                this.bookmarksUtil = bookmarksUtil;
                this.guiTaskManagerServiceRef = guiTaskManagerServiceRef;
 
+               this.pluginLoaderTaskFactory =  pluginLoaderTaskFactory;
+
                // Note: We need pass cyConfigDir = ".cytoscape" and 
cyConfigVerDir to PluginManager.java
                this.cytoscapePropertiesServiceRef = 
cytoscapePropertiesServiceRef;
                                
@@ -136,7 +141,7 @@
        public void actionPerformed(ActionEvent e) {
                
                PluginManageDialog dlg = new 
PluginManageDialog(desktop.getJFrame(), theBookmarks, this.bookmarksUtil, 
-                               this.guiTaskManagerServiceRef);
+                               this.guiTaskManagerServiceRef, 
this.pluginLoaderTaskFactory);
                
                List<DownloadableInfo> Current = 
PluginManager.getPluginManager().getDownloadables(PluginStatus.CURRENT);
                Map<String, List<DownloadableInfo>> InstalledInfo = 
ManagerUtil.sortByCategory(Current);                                

Modified: 
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/ui/PluginManageDialog.java
===================================================================
--- 
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/ui/PluginManageDialog.java
      2011-06-16 20:15:07 UTC (rev 25782)
+++ 
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/ui/PluginManageDialog.java
      2011-06-16 22:14:48 UTC (rev 25783)
@@ -87,6 +87,7 @@
 import org.cytoscape.work.swing.GUITaskManager;
 import org.cytoscape.work.TaskFactory;
 import org.cytoscape.plugin.internal.PluginManagerInquireTaskFactory;
+import java.io.File;
 
 public class PluginManageDialog extends javax.swing.JDialog implements
                TreeSelectionListener, ActionListener {
@@ -105,7 +106,8 @@
        private String bookmarkCategory = "plugins";
        private Bookmarks theBookmarks;
        private BookmarksUtil bookmarksUtil;
-
+       private TaskFactory pluginLoaderTaskFactory;
+       
        //private final TaskManager taskManager;
        private GUITaskManager guiTaskManagerServiceRef;
        
@@ -158,7 +160,7 @@
        }
 */
        public PluginManageDialog(JFrame owner, Bookmarks bookmarks, 
BookmarksUtil bookmarksUtil,
-                       GUITaskManager guiTaskManagerServiceRef) {
+                       GUITaskManager guiTaskManagerServiceRef, TaskFactory 
pluginLoaderTaskFactory) {
 
                super(owner, "Manage Plugins");
                this.desktop = owner;
@@ -166,7 +168,8 @@
                this.theBookmarks = bookmarks;
                this.bookmarksUtil = bookmarksUtil;
                this.guiTaskManagerServiceRef = guiTaskManagerServiceRef;
-               
+               this.pluginLoaderTaskFactory =  pluginLoaderTaskFactory;
+
                setLocationRelativeTo(owner);
                initComponents();
                initTree();
@@ -765,7 +768,7 @@
      * WARNING: Do NOT modify this code. The content of this method is
      * always regenerated by the Form Editor.
      */
-    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">          
                
+    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">   
     private void initComponents() {
         java.awt.GridBagConstraints gridBagConstraints;
 
@@ -789,9 +792,8 @@
         lstDownloadSites = new javax.swing.JList();
         pnlImportLocalPlugin = new javax.swing.JPanel();
         lbSelectLocalFile = new javax.swing.JLabel();
-        tfLocalPluginFile = new javax.swing.JTextField();
         btnSelectLocalPlugin = new javax.swing.JButton();
-        btnImportLocalPlugin = new javax.swing.JButton();
+        jLabel1 = new javax.swing.JLabel();
         jPanel3 = new javax.swing.JPanel();
         availablePluginsLabel = new javax.swing.JLabel();
         versionCheck = new javax.swing.JCheckBox();
@@ -967,7 +969,7 @@
 
         pnlImportLocalPlugin.setLayout(new java.awt.GridBagLayout());
 
-        lbSelectLocalFile.setText("Please selct a plugin file");
+        lbSelectLocalFile.setText("Please selct a plugin file to load:");
         gridBagConstraints = new java.awt.GridBagConstraints();
         gridBagConstraints.gridx = 0;
         gridBagConstraints.gridy = 0;
@@ -975,14 +977,6 @@
         gridBagConstraints.insets = new java.awt.Insets(10, 20, 10, 0);
         pnlImportLocalPlugin.add(lbSelectLocalFile, gridBagConstraints);
 
-        gridBagConstraints = new java.awt.GridBagConstraints();
-        gridBagConstraints.gridy = 1;
-        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
-        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
-        gridBagConstraints.weightx = 1.0;
-        gridBagConstraints.insets = new java.awt.Insets(0, 20, 10, 0);
-        pnlImportLocalPlugin.add(tfLocalPluginFile, gridBagConstraints);
-
         btnSelectLocalPlugin.setText("Select");
         btnSelectLocalPlugin.addActionListener(new 
java.awt.event.ActionListener() {
             public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -991,22 +985,14 @@
         });
 
         gridBagConstraints = new java.awt.GridBagConstraints();
-        gridBagConstraints.gridy = 1;
         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
-        gridBagConstraints.insets = new java.awt.Insets(0, 20, 10, 30);
+        gridBagConstraints.insets = new java.awt.Insets(0, 20, 10, 0);
         pnlImportLocalPlugin.add(btnSelectLocalPlugin, gridBagConstraints);
 
-        btnImportLocalPlugin.setText("Load");
-        btnImportLocalPlugin.addActionListener(new 
java.awt.event.ActionListener() {
-            public void actionPerformed(java.awt.event.ActionEvent evt) {
-                btnImportLocalPluginActionPerformed(evt);
-            }
-        });
-
         gridBagConstraints = new java.awt.GridBagConstraints();
-        gridBagConstraints.gridy = 2;
-        gridBagConstraints.insets = new java.awt.Insets(0, 0, 20, 0);
-        pnlImportLocalPlugin.add(btnImportLocalPlugin, gridBagConstraints);
+        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+        gridBagConstraints.weightx = 1.0;
+        pnlImportLocalPlugin.add(jLabel1, gridBagConstraints);
 
         jTabbedPane1.addTab("Import Local Plugin", pnlImportLocalPlugin);
 
@@ -1129,13 +1115,10 @@
         pack();
     }// </editor-fold>                        
 
-    private void 
btnImportLocalPluginActionPerformed(java.awt.event.ActionEvent evt) {           
                                          
-// TODO add your handling code here:
+                                                      
+    private void 
btnSelectLocalPluginActionPerformed(java.awt.event.ActionEvent evt) {
+        this.guiTaskManagerServiceRef.execute(this.pluginLoaderTaskFactory);
     }                                                    
-   
-    private void 
btnSelectLocalPluginActionPerformed(java.awt.event.ActionEvent evt) {           
                                          
-       // TODO add your handling code here:
-    }                                                    
 
     private void btnDeleteSiteActionPerformed(java.awt.event.ActionEvent evt) 
{                                              
        /*
@@ -1420,7 +1403,6 @@
     private javax.swing.JButton btnClear;
     private javax.swing.JButton btnDeleteSite;
     private javax.swing.JButton btnEditSite;
-    private javax.swing.JButton btnImportLocalPlugin;
     private javax.swing.JButton btnSearch;
     private javax.swing.JButton btnSelectLocalPlugin;
     private javax.swing.JPanel buttonPanel;
@@ -1429,6 +1411,7 @@
     private javax.swing.JScrollPane infoScrollPane;
     private javax.swing.JEditorPane infoTextPane;
     private javax.swing.JButton installDeleteButton;
+    private javax.swing.JLabel jLabel1;
     private javax.swing.JLabel jLabel3;
     private javax.swing.JPanel jPanel2;
     private javax.swing.JPanel jPanel3;
@@ -1446,7 +1429,6 @@
     private javax.swing.JPanel pnlSearch;
     private javax.swing.JPanel pnlSettings;
     private javax.swing.JPanel sitePanel;
-    private javax.swing.JTextField tfLocalPluginFile;
     private javax.swing.JTextField tfSearch;
     private javax.swing.JPanel topPane;
     private javax.swing.JScrollPane treeScrollPane;

Modified: 
core3/plugin-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
--- 
core3/plugin-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml   
    2011-06-16 20:15:07 UTC (rev 25782)
+++ 
core3/plugin-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml   
    2011-06-16 22:14:48 UTC (rev 25783)
@@ -66,6 +66,7 @@
                <constructor-arg ref="guiTaskManagerRef" />
                <constructor-arg ref="cyPropertyRef" />
                <constructor-arg ref="cyPluginAdapter" />
+               <constructor-arg ref="pluginLoaderTaskFactory" />
        </bean>
 
        <bean id="startupMostlyFinished" 
class="org.cytoscape.plugin.internal.StartupMostlyFinished">

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to