Author: mes
Date: 2012-03-13 14:41:05 -0700 (Tue, 13 Mar 2012)
New Revision: 28522

Added:
   core3/impl/trunk/gui-cmdline-parser-impl/
   core3/impl/trunk/gui-cmdline-parser-impl/pom.xml
   core3/impl/trunk/gui-cmdline-parser-impl/src/
   core3/impl/trunk/gui-cmdline-parser-impl/src/main/
   core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/
   core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/
   core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/
   core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/cmdline/
   
core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/cmdline/gui/
   
core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/cmdline/gui/internal/
   
core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/cmdline/gui/internal/CyActivator.java
   
core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/cmdline/gui/internal/Parser.java
   
core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/cmdline/gui/internal/StartupConfig.java
Modified:
   core3/gui-distribution/trunk/features/src/main/resources/features.xml
   
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/WelcomeScreenAction.java
Log:
added a command line parser for the gui application

Modified: core3/gui-distribution/trunk/features/src/main/resources/features.xml
===================================================================
--- core3/gui-distribution/trunk/features/src/main/resources/features.xml       
2012-03-13 20:57:09 UTC (rev 28521)
+++ core3/gui-distribution/trunk/features/src/main/resources/features.xml       
2012-03-13 21:41:05 UTC (rev 28522)
@@ -11,7 +11,7 @@
     <bundle 
start-level="102">mvn:cytoscape-temp/l2fprod-common-sheet/7.3</bundle>
 
     <bundle 
start-level="103">mvn:com.lowagie.text/com.springsource.com.lowagie.text/2.0.8</bundle>
-    <bundle 
start-level="103">mvn:org.cytoscape.wrappers/org.swinglabs.swingx/1.6.1</bundle>
+    <bundle 
start-level="103">mvn:cytoscape-temp/org.swinglabs.swingx/1.6.1</bundle>
     <bundle 
start-level="103">mvn:cytoscape-temp/l2fprod-common-shared/7.3</bundle>
     <bundle 
start-level="103">mvn:cytoscape-temp/l2fprod-common-fontchooser/7.3</bundle>
     <bundle start-level="103">wrap:mvn:net.sf.opencsv/opencsv/2.1</bundle>
@@ -19,9 +19,9 @@
     <bundle 
start-level="103">mvn:org.apache.commons/com.springsource.org.apache.commons.collections/3.2.1</bundle>
     <bundle start-level="103">mvn:cytoscape-temp/colt/1.2.0</bundle>
     <bundle start-level="103">mvn:cytoscape-temp/prefuse/20071021</bundle>
-    <bundle 
start-level="103">mvn:org.cytoscape.wrappers/org.apache.lucene/3.0.2</bundle>
+    <bundle 
start-level="103">mvn:cytoscape-temp/org.apache.lucene/3.0.2</bundle>
     <bundle 
start-level="103">mvn:org.jdom/com.springsource.org.jdom/1.1.0</bundle>
-    <bundle 
start-level="103">mvn:org.cytoscape.wrappers/org.swinglabs.swing-layout/1.0.3</bundle>
+    <bundle 
start-level="103">mvn:cytoscape-temp/org.swinglabs.swing-layout/1.0.3</bundle>
     <bundle 
start-level="103">mvn:cytoscape-temp/freehep-graphicsio/2.1.3</bundle>
     <bundle 
start-level="103">mvn:cytoscape-temp/freehep-graphicsio-svg/2.1.3</bundle>
     <bundle 
start-level="103">mvn:cytoscape-temp/freehep-graphics2d/2.1.3</bundle>
@@ -35,8 +35,6 @@
     <bundle 
start-level="103">mvn:org.dom4j/com.springsource.org.dom4j/1.6.1</bundle>
     <bundle start-level="103">mvn:cytoscape-temp/violinstrings/1.0.2</bundle>
     <bundle start-level="103">mvn:cytoscape-temp/jsbml/0.8-b1</bundle>
-    
-    
     <bundle start-level="103">mvn:cytoscape-temp/jigsaw/2.2.6</bundle>
     <bundle start-level="103">mvn:cytoscape-temp/stax2-api/3.0.1</bundle>
     <bundle start-level="103">mvn:cytoscape-temp/staxmate/2.0.0</bundle>
@@ -49,6 +47,7 @@
     <bundle start-level="103">mvn:cytoscape-temp/paxtools-core/4.1.1</bundle>
     <bundle 
start-level="103">mvn:cytoscape-temp/biopax-converter/4.1.1</bundle>
     <bundle 
start-level="103">mvn:com.googlecode.guava-osgi/guava-osgi/9.0.0</bundle>
+    <bundle 
start-level="103">mvn:org.cytoscape/cy-commons-cli/${cytoscape.support.version}</bundle>
     
     <bundle 
start-level="103">mvn:org.apache.commons/com.springsource.org.apache.commons.io/1.4.0</bundle>
     <bundle start-level="103">mvn:psidev.psi.tools/xxindex/0.11</bundle>
@@ -148,7 +147,8 @@
     
     <bundle 
start-level="180">mvn:org.cytoscape/scripting-impl/${cytoscape.impl.version}</bundle>
 
-    <bundle 
start-level="185">mvn:org.cytoscape/welcome-impl/${cytoscape.impl.version}</bundle>
+    <bundle 
start-level="185">mvn:org.cytoscape/gui-cmdline-parser-impl/${cytoscape.impl.version}</bundle>
+    <bundle 
start-level="190">mvn:org.cytoscape/welcome-impl/${cytoscape.impl.version}</bundle>
 
   </feature>
 </features>

Added: core3/impl/trunk/gui-cmdline-parser-impl/pom.xml
===================================================================
--- core3/impl/trunk/gui-cmdline-parser-impl/pom.xml                            
(rev 0)
+++ core3/impl/trunk/gui-cmdline-parser-impl/pom.xml    2012-03-13 21:41:05 UTC 
(rev 28522)
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+       <parent>
+               <artifactId>impl-parent</artifactId>
+               <groupId>org.cytoscape</groupId>
+               <version>3.0.0-alpha8-SNAPSHOT</version>
+       </parent>
+
+       <properties>
+               
<bundle.symbolicName>org.cytoscape.gui-cmdline-parser-impl</bundle.symbolicName>
+               
<bundle.namespace>org.cytoscape.cmdline.gui.internal</bundle.namespace>
+       </properties>
+
+       <modelVersion>4.0.0</modelVersion>
+       <artifactId>gui-cmdline-parser-impl</artifactId>
+
+       <name>${bundle.symbolicName} [${bundle.namespace}]</name>
+
+       <packaging>bundle</packaging>
+
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-jar-plugin</artifactId>
+                               <version>${maven-jar-plugin.version}</version>
+                               <executions>
+                                       <execution>
+                                               <goals>
+                                                       <goal>test-jar</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-surefire-plugin</artifactId>
+                               
<version>${maven-surefire-plugin.version}</version>
+                               <configuration>
+                                       
<redirectTestOutputToFile>true</redirectTestOutputToFile>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                               
<version>${maven-bundle-plugin.version}</version>
+                               <extensions>true</extensions>
+                               <configuration>
+                                       <instructions>
+                                               
<Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
+                                               
<Bundle-Version>${project.version}</Bundle-Version>
+                                               
<Export-Package>!${bundle.namespace}.*</Export-Package>
+                                               
<Private-Package>${bundle.namespace}.*</Private-Package>
+                                               
<Bundle-Activator>${bundle.namespace}.CyActivator</Bundle-Activator>
+                                       </instructions>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+
+       <repositories>
+               <repository>
+                       <id>cytoscape_snapshots</id>
+                       <snapshots>
+                               <enabled>true</enabled>
+                       </snapshots>
+                       <releases>
+                               <enabled>false</enabled>
+                       </releases>
+                       <name>Cytoscape Snapshots</name>
+                       
<url>http://code.cytoscape.org/nexus/content/repositories/snapshots/</url>
+               </repository>
+               <repository>
+                       <id>cytoscape_releases</id>
+                       <snapshots>
+                               <enabled>false</enabled>
+                       </snapshots>
+                       <releases>
+                               <enabled>true</enabled>
+                       </releases>
+                       <name>Cytoscape Releases</name>
+                       
<url>http://code.cytoscape.org/nexus/content/repositories/releases/</url>
+               </repository>
+       </repositories>
+       <dependencies>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>property-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>application-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>service-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>io-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>cy-commons-cli</artifactId>
+                       <version>${cytoscape.support.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>cmdline</artifactId>
+                       <version>${cytoscape.support.version}</version>
+               </dependency>
+       </dependencies>
+
+</project>

Added: 
core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/cmdline/gui/internal/CyActivator.java
===================================================================
--- 
core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/cmdline/gui/internal/CyActivator.java
                          (rev 0)
+++ 
core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/cmdline/gui/internal/CyActivator.java
  2012-03-13 21:41:05 UTC (rev 28522)
@@ -0,0 +1,32 @@
+package org.cytoscape.cmdline.gui.internal;
+
+import org.cytoscape.cmdline.CommandLineArgs;
+import org.cytoscape.property.CyProperty;
+import org.cytoscape.application.CyVersion;
+import org.cytoscape.application.CyShutdown;
+import org.cytoscape.io.util.StreamUtil;
+import org.cytoscape.service.util.AbstractCyActivator;
+import java.util.Properties; 
+
+import org.osgi.framework.BundleContext;
+
+public class CyActivator extends AbstractCyActivator {
+       public CyActivator() {
+               super();
+       }
+
+       public void start(BundleContext bc) {
+               CommandLineArgs args = getService(bc,CommandLineArgs.class);
+               CyVersion cyVersion = getService(bc,CyVersion.class);
+               CyShutdown cyShutdown = getService(bc,CyShutdown.class);
+               StreamUtil streamUtil = getService(bc,StreamUtil.class);
+
+               CyProperty<Properties> props = 
(CyProperty<Properties>)getService(bc, CyProperty.class, 
"(cyPropertyName=cytoscape3.props)");
+
+               StartupConfig sc = new 
StartupConfig(props.getProperties(),streamUtil);
+
+
+               Parser p = new Parser(args.getArgs(), cyShutdown, cyVersion, 
sc,props.getProperties());
+               sc.start();
+       }
+}

Added: 
core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/cmdline/gui/internal/Parser.java
===================================================================
--- 
core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/cmdline/gui/internal/Parser.java
                               (rev 0)
+++ 
core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/cmdline/gui/internal/Parser.java
       2012-03-13 21:41:05 UTC (rev 28522)
@@ -0,0 +1,214 @@
+/*
+ File: Parser.java
+
+ Copyright (c) 2010, The Cytoscape Consortium (www.cytoscape.org)
+
+ 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.cmdline.gui.internal;
+
+import org.cytoscape.application.CyShutdown;
+import org.cytoscape.application.CyVersion;
+
+import java.util.Properties;
+
+import java.awt.Dimension;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.cli.PosixParser;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Parser {
+       private static final Logger logger = 
LoggerFactory.getLogger(Parser.class);
+
+       private final String[] args;
+       private final Options options;
+       private final CyShutdown shutdown; 
+       private final CyVersion version; 
+       private final StartupConfig startupConfig; 
+       private final Properties props; 
+
+       public Parser(String[] args, CyShutdown shutdown, CyVersion version, 
StartupConfig startupConfig, Properties props) {
+               this.args = args;
+               this.shutdown = shutdown;
+               this.version = version;
+               this.startupConfig = startupConfig;
+               this.props = props;
+               options = initOptions(); 
+               parseCommandLine(args);
+       }
+
+       private Options initOptions() {
+               Options opt = new Options();
+
+               opt.addOption("h", "help", false, "Print this message.");
+               opt.addOption("v", "version", false, "Print the version 
number.");
+
+
+               opt.addOption(OptionBuilder
+                             .withLongOpt("session")
+                             .withDescription("Load a cytoscape session (.cys) 
file.")
+                             
.withValueSeparator('\0').withArgName("file").hasArg() // only allow one 
session!!!
+                             .create("s"));
+
+               opt.addOption(OptionBuilder
+                             .withLongOpt("network")
+                             .withDescription( "Load a network file (any 
format).")
+                             
.withValueSeparator('\0').withArgName("file").hasArgs()
+                             .create("N"));
+
+               opt.addOption(OptionBuilder
+                             .withLongOpt("edge-table")
+                             .withDescription("Load an edge attributes table 
file (any table format).")
+                             
.withValueSeparator('\0').withArgName("file").hasArgs()
+                             .create("e"));
+
+               opt.addOption(OptionBuilder
+                             .withLongOpt("node-table")
+                             .withDescription("Load a node attributes table 
file (any table format).")
+                             
.withValueSeparator('\0').withArgName("file").hasArgs()
+                             .create("n"));
+
+               opt.addOption(OptionBuilder
+                             .withLongOpt("global-table")
+                             .withDescription("Load a global attributes table 
file (any table format).")
+                             
.withValueSeparator('\0').withArgName("file").hasArgs()
+                             .create("g"));
+
+               opt.addOption(OptionBuilder
+                             .withLongOpt("plugin")
+                             .withDescription("Load a SIMPLIFIED plugin jar 
file/URL.")
+                             
.withValueSeparator('\0').withArgName("file").hasArgs()
+                             .create("p"));
+
+               opt.addOption(OptionBuilder
+                             .withLongOpt("bundle")
+                             .withDescription("Load a BUNDLE plugin jar file 
or URL.")
+                             
.withValueSeparator('\0').withArgName("file").hasArgs()
+                             .create("b"));
+
+               opt.addOption(OptionBuilder
+                             .withLongOpt("props")
+                             .withDescription(
+                             "Load cytoscape properties file (Java properties 
format) or individual property: -P name=value.")
+                             
.withValueSeparator('\0').withArgName("file").hasArgs()
+                             .create("P"));
+
+               opt.addOption(OptionBuilder
+                             .withLongOpt("vizmap")
+                             .withDescription("Load vizmap properties file 
(Cytoscape VizMap format).")
+                             
.withValueSeparator('\0').withArgName("file").hasArgs()
+                             .create("V"));
+
+               return opt;
+       }
+
+       private void parseCommandLine(String[] args) {
+
+               // try to parse the cmd line
+               CommandLineParser parser = new PosixParser();
+               CommandLine line = null;
+
+               // first load the simple exit options
+               try {
+                       line = parser.parse(options, args);
+               } catch (ParseException e) {
+                       logger.error("Parsing command line failed: " + 
e.getMessage());
+                       printHelp();
+                       props.setProperty("tempHideWelcomeScreen","true");
+                       shutdown.exit(1);
+                       return;
+               }
+               
+               if (line.hasOption("h")) {
+                       printHelp();
+                       shutdown.exit(0);
+                       props.setProperty("tempHideWelcomeScreen","true");
+                       return;
+               }
+
+               if (line.hasOption("v")) {
+                       logger.info("Cytoscape version: " + 
version.getVersion());
+                       System.out.println("Cytoscape version: " + 
version.getVersion());
+                       props.setProperty("tempHideWelcomeScreen","true");
+                       shutdown.exit(0);
+                       return;
+               }
+
+               // always load any properties specified
+               if (line.hasOption("P"))
+                       startupConfig.setProperties(line.getOptionValues("P"));
+
+               // always load any plugins specified
+               if (line.hasOption("p"))
+                       
startupConfig.setSimplifiedPlugins(line.getOptionValues("p"));
+
+               // always load any bundle plugins specified
+               if (line.hasOption("b"))
+                       
startupConfig.setBundlePlugins(line.getOptionValues("b"));
+
+               // Either load the session ...
+               if (line.hasOption("s")) {
+                       startupConfig.setSession(line.getOptionValue("s"));
+
+               // ... or all the rest.
+               } else {
+                       if (line.hasOption("N"))
+                               
startupConfig.setNetworks(line.getOptionValues("N"));
+
+                       if (line.hasOption("V"))
+                               
startupConfig.setVizMapProps(line.getOptionValues("V"));
+
+                       if (line.hasOption("n"))
+                               
startupConfig.setNodeTables(line.getOptionValues("n"));
+
+                       if (line.hasOption("e"))
+                               
startupConfig.setEdgeTables(line.getOptionValues("e"));
+
+                       if (line.hasOption("g"))
+                               
startupConfig.setGlobalTables(line.getOptionValues("g"));
+               }
+       }
+
+       private void printHelp() {
+               HelpFormatter formatter = new HelpFormatter();
+               formatter.printHelp("cytoscape.{sh|bat} [OPTIONS]", options);
+       }
+}

Added: 
core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/cmdline/gui/internal/StartupConfig.java
===================================================================
--- 
core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/cmdline/gui/internal/StartupConfig.java
                                (rev 0)
+++ 
core3/impl/trunk/gui-cmdline-parser-impl/src/main/java/org/cytoscape/cmdline/gui/internal/StartupConfig.java
        2012-03-13 21:41:05 UTC (rev 28522)
@@ -0,0 +1,175 @@
+/*
+ File: StartupConfig.java
+
+ Copyright (c) 2010, The Cytoscape Consortium (www.cytoscape.org)
+
+ 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.cmdline.gui.internal;
+
+import org.cytoscape.application.CyShutdown;
+import org.cytoscape.application.CyVersion;
+import org.cytoscape.io.util.StreamUtil;
+
+import java.util.Properties;
+
+import java.awt.Dimension;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class StartupConfig {
+       private static final Logger logger = 
LoggerFactory.getLogger(StartupConfig.class);
+
+       private final Properties globalProps; 
+       private final Properties localProps = new Properties(); 
+       private final StreamUtil streamUtil; 
+       private boolean taskStart = false;
+
+       public StartupConfig(Properties globalProps, StreamUtil streamUtil) {
+               this.globalProps = globalProps;
+               this.streamUtil = streamUtil;
+       }
+
+       public void setProperties(String[] potentialProps) {
+               Properties argProps = new Properties();
+
+               Matcher propPattern = 
Pattern.compile("^((\\w+\\.*)+)\\=(.+)$").matcher("");
+
+               for ( String potential : potentialProps ) {
+                       propPattern.reset(potential);
+
+                       // check to see if the string is a key value pair
+                       if (propPattern.matches()) {
+                               argProps.setProperty(propPattern.group(1), 
propPattern.group(3));
+
+                       // otherwise assume it's a file/url
+                       } else {
+                               try {
+                                       InputStream in = null;
+
+                    try {
+                                               in = 
streamUtil.getInputStream(potential);
+                        if (in != null)
+                            localProps.load(in);
+                        else
+                            logger.info("Couldn't load property: " + 
potential);
+                    } finally {
+                        if (in != null) {
+                            in.close();
+                        }
+                    }
+                               } catch (IOException e) {
+                                       logger.warn("Couldn't load property '"+ 
potential + "' from file: "+e.getMessage(), e);
+                               }
+                       }
+               }
+
+               // Transfer argument properties into the full properties.
+               // We do this so that anything specified on the command line
+               // overrides anything specified in a file.
+               localProps.putAll(argProps);
+       }
+
+       public void setSimplifiedPlugins(String[] args){
+               taskStart = true;
+       }
+
+       public void setBundlePlugins(String[] args){
+               taskStart = true;
+       }
+
+       public void setSession(String args){
+               taskStart = true;
+       }
+
+       public void setNetworks(String[] args){
+               taskStart = true;
+       }
+
+       public void setVizMapProps(String[] args){
+               taskStart = true;
+       }
+
+       public void setNodeTables(String[] args){
+               taskStart = true;
+       }
+
+       public void setEdgeTables(String[] args){
+               taskStart = true;
+       }
+
+       public void setGlobalTables(String[] args){
+               taskStart = true;
+       }
+
+       public void start() {
+               // set the properties
+               // no need to do this in a task since it's so fast
+               globalProps.putAll(localProps);
+
+               // Only proceed if we've specified tasks for execution
+               // on the command line.
+               if ( !taskStart )
+                       return;
+
+               // Since we've set command line args we presumably
+               // don't want to see the welcome screen, so we
+               // disable it here.
+               globalProps.setProperty("tempHideWelcomeScreen","true");
+
+       /*
+
+               taskIterator.append( pluginManager.loadSimplifiedPlugins() );
+               taskIterator.append( pluginManager.loadBundlePlugins() );
+                       
+               if ( sessionName != null )      {
+                       taskIterator.append( sessionTaskFactory.loadSession( 
sessionName ) );
+
+               } else {
+                       for ( String network : networkNames )
+                               taskIterator.append( loadNetwork.loadNetwork( 
network ) );
+                       for ( String nodeTable : nodeTables )
+                               taskIterator.append( loadTable.loadTable( 
nodeTable, CyNode.class ) );
+                       for ( String edgeTable : edgeTables )
+                               taskIterator.append( loadTable.loadTable( 
edgeTable, CyEdge.class ) );
+                       for ( String globalTable : globalTables )
+                               taskIterator.append( loadTable.loadTable( 
globalTable, null ) );
+                       for ( String vizmap : vizmapProps )
+                               taskIterator.append( vizmapLoader.loadVizmap( 
vizmap ) );
+               }
+
+               taskManager.execute(taskIterator);
+               */
+       }
+}

Modified: 
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/WelcomeScreenAction.java
===================================================================
--- 
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/WelcomeScreenAction.java
 2012-03-13 20:57:09 UTC (rev 28521)
+++ 
core3/impl/trunk/welcome-impl/src/main/java/org/cytoscape/welcome/internal/WelcomeScreenAction.java
 2012-03-13 21:41:05 UTC (rev 28522)
@@ -2,6 +2,7 @@
 
 import java.awt.event.ActionEvent;
 import java.util.Properties;
+import javax.swing.SwingUtilities;
 
 import org.cytoscape.application.CyApplicationConfiguration;
 import org.cytoscape.application.events.CyStartEvent;
@@ -21,7 +22,8 @@
 
        private static final long serialVersionUID = 2584201062371825221L;
        
-       public static final String DO_NOT_DISPLAY_PROP_NAME = 
"hideWelcomScreen";
+       public static final String DO_NOT_DISPLAY_PROP_NAME = 
"hideWelcomeScreen";
+       public static final String TEMP_DO_NOT_DISPLAY_PROP_NAME = 
"tempHideWelcomeScreen";
 
        private static final String MENU_NAME = "Show Welcome Screen...";
        private static final String PARENT_NAME = "Help";
@@ -65,7 +67,11 @@
                this.bc = bc;
                
                // Show it if necessary
-               startup();
+               SwingUtilities.invokeLater( new Runnable() { 
+                       public void run() {
+                               startup();
+                       }
+               });
        }
 
        @Override
@@ -79,20 +85,36 @@
        }
        
        public void startup() {
-               // Simply displays the dialog after startup.
+
+               // Displays the dialog after startup based on whether
+               // the specified property has been set.
                final String hideString = 
this.cyProps.getProperties().getProperty(DO_NOT_DISPLAY_PROP_NAME);
+               hide = parseBoolean(hideString);
+                       
+               if (!hide) {
+                       final String tempHideString = 
this.cyProps.getProperties().getProperty(TEMP_DO_NOT_DISPLAY_PROP_NAME);
+                       hide = parseBoolean(tempHideString);
+               }
                
+               // remove this property regardless!
+               
this.cyProps.getProperties().remove(TEMP_DO_NOT_DISPLAY_PROP_NAME);
+
+               if(!hide)
+                       actionPerformed(null);
+       }
+
+       private boolean parseBoolean(String hideString) {
+               boolean lhide = false;
                if (hideString == null)
-                       hide = false;
+                       lhide = false;
                else {
                        try {
-                               hide = Boolean.parseBoolean(hideString);
+                               // might make it true!
+                               lhide = Boolean.parseBoolean(hideString);
                        } catch (Exception ex) {
-                               hide = false;
+                               lhide = false;
                        }
                }
-               
-               if(hide == false)
-                       actionPerformed(null);
+               return lhide;
        }
 }

-- 
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