Author: pwang
Date: 2011-08-23 17:26:19 -0700 (Tue, 23 Aug 2011)
New Revision: 26628

Removed:
   
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/util/CytoscapeVersion.java
Modified:
   
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/DownloadableInfo.java
   
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/PluginManager.java
   
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/action/PluginManagerAction.java
   
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/ui/PluginManageDialog.java
   
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/ui/PluginUrlDialog.java
   
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/ui/TreeCellRenderer.java
   
core3/impl/trunk/plugin-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
   
core3/impl/trunk/plugin-impl/src/main/resources/META-INF/spring/bundle-context.xml
Log:
Fixed bug #348

Modified: 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/DownloadableInfo.java
===================================================================
--- 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/DownloadableInfo.java
      2011-08-23 19:53:34 UTC (rev 26627)
+++ 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/DownloadableInfo.java
      2011-08-24 00:26:19 UTC (rev 26628)
@@ -38,8 +38,8 @@
 import java.net.URL;
 import java.io.IOException;
 
+import org.cytoscape.plugin.internal.action.PluginManagerAction;
 import org.cytoscape.plugin.internal.util.URLUtil;
-import org.cytoscape.plugin.internal.util.CytoscapeVersion;
 
 import static org.cytoscape.plugin.internal.PluginVersionUtils.versionOk;
 import static org.cytoscape.plugin.internal.PluginVersionUtils.getNewerVersion;
@@ -400,7 +400,7 @@
        if (pluginVersion == null )
                return false;
 
-    String[] cyVersion = new 
CytoscapeVersion().getFullVersion().split(versionSplit);
+    String[] cyVersion = 
PluginManagerAction.cyVersion.getVersion().split(versionSplit);
     String[] plVersion = pluginVersion.split(versionSplit);
 
        if ( cyVersion.length < plVersion.length )
@@ -438,9 +438,8 @@
          }
          
        boolean compatible = false;
-    CytoscapeVersion cv = new CytoscapeVersion();
     for (String pluginVersion: compatibleCyVersions) {
-      String[] cyVersion = cv.getFullVersion().split(versionSplit);
+      String[] cyVersion = 
PluginManagerAction.cyVersion.getVersion().split(versionSplit);
       String[] plVersion = pluginVersion.split(versionSplit);
       if ( PluginVersionUtils.isVersion(pluginVersion, 
PluginVersionUtils.MINOR) ) {
           cyVersion = new String[]{cyVersion[0], cyVersion[1]};
@@ -527,7 +526,7 @@
                                        + getCytoscapeVersions().toString() + 
"<br>";
                        Html += "<font color='red'><i>" + toString()
                                        + " is not verfied to work in the 
current version ("
-                                       + CytoscapeVersion.version
+                                       + 
PluginManagerAction.cyVersion.getVersion()
                                        + ") of Cytoscape.</i></font>";
                }
                Html += "<p>";

Modified: 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/PluginManager.java
===================================================================
--- 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/PluginManager.java
 2011-08-23 19:53:34 UTC (rev 26627)
+++ 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/PluginManager.java
 2011-08-24 00:26:19 UTC (rev 26628)
@@ -69,7 +69,6 @@
 import java.util.jar.Manifest;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
-import org.cytoscape.plugin.internal.util.CytoscapeVersion;
 
 /**
  * @author skillcoy
@@ -256,10 +255,8 @@
        
        // create plugin manager
        private PluginManager(PluginTracker tracker, final 
CyApplicationConfiguration config) {
-
-               CytoscapeVersion cytoscapeVersion = new CytoscapeVersion();
                
-               cyVersion = cytoscapeVersion.getMajorVersion();
+               cyVersion = new 
Integer(PluginManagerAction.cyVersion.getMajorVersion()).toString();
                
                // XXX is this needed anymore?
                loadingErrors = new HashSet<Throwable>();
@@ -273,7 +270,7 @@
                        if (usingWebstartManager()) {
                                tempDir = new File(config.getSettingLocation(),
                                                "webstart" + File.separator
-                                                               + (new 
CytoscapeVersion()).getMajorVersion()
+                                                               + 
PluginManagerAction.cyVersion.getMajorVersion()
                                                                + 
File.separator + "plugins");
                                removeWebstartInstalls();
                                trackerFileName = "track_webstart_plugins.xml";

Modified: 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/action/PluginManagerAction.java
===================================================================
--- 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/action/PluginManagerAction.java
    2011-08-23 19:53:34 UTC (rev 26627)
+++ 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/action/PluginManagerAction.java
    2011-08-24 00:26:19 UTC (rev 26628)
@@ -43,10 +43,12 @@
 package org.cytoscape.plugin.internal.action;
 
 import java.awt.event.ActionEvent;
+import java.io.File;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
+import org.cytoscape.application.CyApplicationConfiguration;
 import org.cytoscape.application.CyApplicationManager;
 import org.cytoscape.application.CytoscapeVersion;
 import org.cytoscape.application.swing.AbstractCyAction;
@@ -82,13 +84,15 @@
 
        public static String cyConfigVerDir;
        public static String DefaultPluginUrl = null;
+       public static CytoscapeVersion cyVersion;
        
        /**
         * Creates a new BookmarkAction object.
         */
        public PluginManagerAction(CySwingApplication desktop, 
CyApplicationManager appMgr, CytoscapeVersion version,
                        CyProperty<Bookmarks> bookmarksProp, BookmarksUtil 
bookmarksUtil, GUITaskManager guiTaskManagerServiceRef
-                       , CyProperty<Properties> cytoscapePropertiesServiceRef, 
CyPluginAdapter adapter, TaskFactory pluginLoaderTaskFactory) {
+                       , CyProperty<Properties> cytoscapePropertiesServiceRef, 
CyPluginAdapter adapter, TaskFactory pluginLoaderTaskFactory,
+                       final CyApplicationConfiguration config) {
                                
                super("Plugin Manager", appMgr);
 
@@ -106,9 +110,10 @@
                DefaultPluginUrl = 
cytoscapePropertiesServiceRef.getProperties().getProperty("defaultPluginDownloadUrl");
                
                // initialize version
-               org.cytoscape.plugin.internal.util.CytoscapeVersion.version = 
version.getVersion();
-               cyConfigVerDir = version.getVersion();
+               cyVersion = version;
                
+               cyConfigVerDir = new File(config.getSettingLocation(), 
File.separator + version.getMajorVersion()).getAbsolutePath();
+                                               
                setPreferredMenu("Plugins");
                setMenuGravity(1.0f);
        

Modified: 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/ui/PluginManageDialog.java
===================================================================
--- 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/ui/PluginManageDialog.java
 2011-08-23 19:53:34 UTC (rev 26627)
+++ 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/ui/PluginManageDialog.java
 2011-08-24 00:26:19 UTC (rev 26628)
@@ -29,7 +29,7 @@
 package org.cytoscape.plugin.internal.ui;
 
 import org.cytoscape.plugin.internal.action.PluginManagerAction;
-import org.cytoscape.plugin.internal.util.CytoscapeVersion;
+
 import org.cytoscape.property.CyProperty;
 import org.cytoscape.property.bookmark.Bookmarks;
 import org.cytoscape.property.bookmark.BookmarksUtil;
@@ -296,7 +296,7 @@
 
                                if (NewPlugins.size() <= 0) {
                                        dialog.setError("No plugins compatible 
with "
-                                                       + new 
CytoscapeVersion().getFullVersion()
+                                                       + 
PluginManagerAction.cyVersion.getVersion()
                                                        + " available from this 
site.");
                                } else {
                                        dialog.setMessage("");
@@ -1571,15 +1571,15 @@
         List<DownloadableInfo> Plugins = new 
java.util.ArrayList<DownloadableInfo>();
 
                PluginInfo infoC = new PluginInfo("1", "A Plugin");
-               infoC.addCytoscapeVersion(CytoscapeVersion.version);
+               
infoC.addCytoscapeVersion(PluginManagerAction.cyVersion.getVersion());
                Plugins.add(infoC);
 
                infoC = new PluginInfo("2", "B Plugin");
-               infoC.addCytoscapeVersion(CytoscapeVersion.version);
+               
infoC.addCytoscapeVersion(PluginManagerAction.cyVersion.getVersion());
                Plugins.add(infoC);
 
                infoC = new PluginInfo("3", "C");
-               infoC.addCytoscapeVersion(CytoscapeVersion.version);
+               
infoC.addCytoscapeVersion(PluginManagerAction.cyVersion.getVersion());
                Plugins.add(infoC);
 
                pd.addCategory(Category.NONE.toString(), Plugins,

Modified: 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/ui/PluginUrlDialog.java
===================================================================
--- 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/ui/PluginUrlDialog.java
    2011-08-23 19:53:34 UTC (rev 26627)
+++ 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/ui/PluginUrlDialog.java
    2011-08-24 00:26:19 UTC (rev 26628)
@@ -27,6 +27,7 @@
 //import org.cytoscape.util.BookmarksUtil;
 
 import org.cytoscape.plugin.internal.CytoscapePlugin;
+import org.cytoscape.plugin.internal.action.PluginManagerAction;
 import org.jdesktop.layout.GroupLayout;
 import org.jdesktop.layout.LayoutStyle;
 import org.slf4j.Logger;
@@ -49,8 +50,8 @@
 import javax.swing.JPanel;
 import javax.swing.ListCellRenderer;
 import javax.swing.WindowConstants;
-import org.cytoscape.plugin.internal.util.CytoscapeVersion;
 
+
 /**
  * @author skillcoy
  */
@@ -395,7 +396,7 @@
 
                                if (NewPlugins.size() <= 0) {
                                        dialog.setError("No plugins compatible 
with "
-                                                       + new 
CytoscapeVersion().getFullVersion()
+                                                       + 
PluginManagerAction.cyVersion.getVersion()
                                                        + " available from this 
site.");
                                } else {
                                        dialog.setMessage("");

Modified: 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/ui/TreeCellRenderer.java
===================================================================
--- 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/ui/TreeCellRenderer.java
   2011-08-23 19:53:34 UTC (rev 26627)
+++ 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/ui/TreeCellRenderer.java
   2011-08-24 00:26:19 UTC (rev 26628)
@@ -6,7 +6,7 @@
 import javax.swing.tree.DefaultTreeCellRenderer;
 
 import org.cytoscape.plugin.internal.DownloadableInfo;
-import org.cytoscape.plugin.internal.util.CytoscapeVersion;
+import org.cytoscape.plugin.internal.action.PluginManagerAction;
 
 /**
  * @author skillcoy
@@ -38,7 +38,7 @@
                        } else if (leaf && !isOutdated(value)) {
                                setIcon(okIcon);
                                setToolTipText("Verified to work in "
-                                               + CytoscapeVersion.version);
+                                               + 
PluginManagerAction.cyVersion.getVersion());
                        } else {
                                setToolTipText(null); // no tool tip
                        }

Deleted: 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/util/CytoscapeVersion.java
===================================================================
--- 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/util/CytoscapeVersion.java
 2011-08-23 19:53:34 UTC (rev 26627)
+++ 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/util/CytoscapeVersion.java
 2011-08-24 00:26:19 UTC (rev 26628)
@@ -1,103 +0,0 @@
-/*
- * File: CytoscapeVersion.java Copyright (c) 2006, The Cytoscape Consortium
- * (www.cytoscape.org) The Cytoscape Consortium is: - Institute for Systems
- * Biology - University of California San Diego - Memorial Sloan-Kettering
- * Cancer Center - Institut Pasteur - Agilent Technologies This library is free
- * software; you can redistribute it and/or modify it under the terms of the 
GNU
- * Lesser General Public License as published by the Free Software Foundation;
- * either version 2.1 of the License, or any later version. This library is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY,
- * WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A
- * PARTICULAR PURPOSE. The software and documentation provided hereunder is on
- * an "as is" basis, and the Institute for Systems Biology and the Whitehead
- * Institute have no obligations to provide maintenance, support, updates,
- * enhancements or modifications. In no event shall the Institute for Systems
- * Biology and the Whitehead Institute be liable to any party for direct,
- * indirect, special, incidental or consequential damages, including lost
- * profits, arising out of the use of this software and its documentation, even
- * if the Institute for Systems Biology and the Whitehead Institute have been
- * advised of the possibility of such damage. See the GNU Lesser General Public
- * License for more details. You should have received a copy of the GNU Lesser
- * General Public License along with this library; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- */
-package org.cytoscape.plugin.internal.util;
-
-
-/** CytoscapeVersion: identify (and describe) successive versions of 
cytoscape. */
-public class CytoscapeVersion {
-       /**
-        * This value will be initialized when the bundle get started
-        */
-       public static String version= null;// = "3.0"; // 
=CytoscapeInit.getProperties().getProperty(
-                       //"cytoscape.version.number");
-
-       private static String majorMinorVersion;
-
-       private static String bugFixVersion = "0";
-
-       /**
-        */
-       public CytoscapeVersion() {
-               //version = props.getProperty("cytoscape.version.number");
-               if (version != null){
-
-                       String[] Versions = version.split("\\.");
-                       majorMinorVersion = Versions[0] + "." + Versions[1];
-
-                       if (Versions.length == 3) {
-                               bugFixVersion = Versions[2];
-                       }
-               }
-       }
-       
-       /**
-        * Returns the string 'Cytoscape Version ' and the version number Do 
not use
-        * to just get a version.
-        * 
-        * @return DOCUMENT ME!
-        */
-       public String getVersion() {
-               return "Cytoscape Version " + version;
-       }
-       
-       /**
-        * @return See getVersion()
-        */
-       public String toString() {
-               return getVersion();
-       }
-
-       /**
-        * This method gets the major and minor version for Cytsocape ignoring
-        * the bug fix version number.  Example: If Cytoscape is currently at 
2.4.6
-        * this method will return 2.4
-        * 
-        * @return The major and minor version numbers of the currently running
-        *         Cytoscape. 
-        */
-       public String getMajorVersion() {
-               return majorMinorVersion;
-       }
-
-       /**
-        * This method gets the bug fix version for Cytsocape.  
-        * Example: If Cytoscape is currently at 2.4.6 this method will return 6
-        * If there is no bug fix version the default is 0
-        * 
-        * @return Just the bug fix version
-        */
-       public String getBugFixVersion() {
-               return bugFixVersion;
-       }
-       
-       /**
-        * 
-        * @return Full version number for currently running Cytoscape.
-        *              Ex. 2.4.6
-        */
-       public String getFullVersion() {
-               return version;
-       }
-}

Modified: 
core3/impl/trunk/plugin-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
--- 
core3/impl/trunk/plugin-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
     2011-08-23 19:53:34 UTC (rev 26627)
+++ 
core3/impl/trunk/plugin-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
     2011-08-24 00:26:19 UTC (rev 26628)
@@ -140,7 +140,9 @@
        <osgi:reference id="bookmarksUtilServiceRef"
                interface="org.cytoscape.property.bookmark.BookmarksUtil" />
 
+       <osgi:reference id="cyApplicationConfigurationServiceRef" 
interface="org.cytoscape.application.CyApplicationConfiguration" />
 
+
     <osgi:service id="pluginLoaderTaskFactoryService" 
ref="pluginLoaderTaskFactory"
                interface="org.cytoscape.work.TaskFactory">
         <osgi:service-properties>

Modified: 
core3/impl/trunk/plugin-impl/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
--- 
core3/impl/trunk/plugin-impl/src/main/resources/META-INF/spring/bundle-context.xml
  2011-08-23 19:53:34 UTC (rev 26627)
+++ 
core3/impl/trunk/plugin-impl/src/main/resources/META-INF/spring/bundle-context.xml
  2011-08-24 00:26:19 UTC (rev 26628)
@@ -67,6 +67,7 @@
                <constructor-arg ref="cyPropertyRef" />
                <constructor-arg ref="cyPluginAdapter" />
                <constructor-arg ref="pluginLoaderTaskFactory" />
+               <constructor-arg ref="cyApplicationConfigurationServiceRef" />
        </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