Author: mes
Date: 2011-10-10 17:34:24 -0700 (Mon, 10 Oct 2011)
New Revision: 27121
Modified:
csplugins/trunk/ucsd/mes/cytable-reader/src/main/java/cytoscape/cytable/CyTableReaderAction.java
csplugins/trunk/ucsd/mes/cytable-reader/src/main/java/cytoscape/cytable/CyTableReaderPlugin.java
Log:
added command line handling
Modified:
csplugins/trunk/ucsd/mes/cytable-reader/src/main/java/cytoscape/cytable/CyTableReaderAction.java
===================================================================
---
csplugins/trunk/ucsd/mes/cytable-reader/src/main/java/cytoscape/cytable/CyTableReaderAction.java
2011-10-11 00:06:24 UTC (rev 27120)
+++
csplugins/trunk/ucsd/mes/cytable-reader/src/main/java/cytoscape/cytable/CyTableReaderAction.java
2011-10-11 00:34:24 UTC (rev 27121)
@@ -31,7 +31,7 @@
public void actionPerformed(ActionEvent e) {
- CyFileFilter nf = new CyFileFilter(".cytable");
+ CyFileFilter nf = new CyFileFilter("cytable");
File[] files = FileUtil.getFiles("Import " + type + " Attribute
CyTable", FileUtil.LOAD,
new CyFileFilter[] { nf });
Modified:
csplugins/trunk/ucsd/mes/cytable-reader/src/main/java/cytoscape/cytable/CyTableReaderPlugin.java
===================================================================
---
csplugins/trunk/ucsd/mes/cytable-reader/src/main/java/cytoscape/cytable/CyTableReaderPlugin.java
2011-10-11 00:06:24 UTC (rev 27120)
+++
csplugins/trunk/ucsd/mes/cytable-reader/src/main/java/cytoscape/cytable/CyTableReaderPlugin.java
2011-10-11 00:34:24 UTC (rev 27121)
@@ -1,15 +1,41 @@
package cytoscape.cytable;
import cytoscape.Cytoscape;
+import cytoscape.CytoscapeInit;
+import cytoscape.logger.CyLogger;
import cytoscape.plugin.CytoscapePlugin;
+import cytoscape.data.CyAttributes;
+import cytoscape.util.FileUtil;
+import java.net.URL;
+import java.io.File;
public class CyTableReaderPlugin extends CytoscapePlugin {
public CyTableReaderPlugin() {
Cytoscape.getDesktop().getCyMenus().addAction( new
CyTableReaderAction("Node"));
Cytoscape.getDesktop().getCyMenus().addAction( new
CyTableReaderAction("Edge"));
+
+
loadCmdLineTable(CytoscapeInit.getProperties().getProperty("node.cytable"),Cytoscape.getNodeAttributes());
+
loadCmdLineTable(CytoscapeInit.getProperties().getProperty("edge.cytable"),Cytoscape.getNodeAttributes());
}
+
+ private void loadCmdLineTable(Object loadNow, CyAttributes attrs) {
+ if ( loadNow == null )
+ return;
+
+ try {
+ String name = loadNow.toString();
+
+ if ( name.matches(FileUtil.urlPattern) )
+ new CyTableReader( new URL(name), attrs
).read();
+ else
+ new CyTableReader( new File(name).toURL(),
attrs ).read();
+
+ } catch (Exception e) {
+
CyLogger.getLogger(CyTableReaderPlugin.class).warn("failed to load table: " +
loadNow);
+ }
+ }
}
--
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.