Author: mes
Date: 2012-03-15 12:43:57 -0700 (Thu, 15 Mar 2012)
New Revision: 28554
Modified:
core3/impl/trunk/command-executor-impl/src/main/java/org/cytoscape/command/internal/tunables/AbstractStringTunableHandler.java
Log:
further tweaked command syntax
Modified:
core3/impl/trunk/command-executor-impl/src/main/java/org/cytoscape/command/internal/tunables/AbstractStringTunableHandler.java
===================================================================
---
core3/impl/trunk/command-executor-impl/src/main/java/org/cytoscape/command/internal/tunables/AbstractStringTunableHandler.java
2012-03-15 19:22:01 UTC (rev 28553)
+++
core3/impl/trunk/command-executor-impl/src/main/java/org/cytoscape/command/internal/tunables/AbstractStringTunableHandler.java
2012-03-15 19:43:57 UTC (rev 28554)
@@ -33,23 +33,31 @@
String[] args = s.split("\\s+");
- for ( int i = 0; i < args.length; i++ ) {
- String arg = args[i];
-
- // This finds an argument key with a value
following it.
- if ( arg.equals(getName()) && (i+1) <
args.length ) {
- Object value;
+ for ( String arg : args ) {
+
+ String[] keyValue = arg.split("=");
+
+ if ( keyValue.length != 2 ) {
+ logger.warn("couldn't parse 'key=value'
string from arg: '" + arg +"'");
+ continue;
+ }
+
+ String key = keyValue[0];
+ String value = keyValue[1];
+
+ if ( key.equals(getName()) ) {
+ Object result;
try {
// Now process the value, i.e.
set the tunable field/method
// with a value based on this
string.
- value = processArg(args[i+1]);
+ result = processArg(value);
} catch (Exception e) {
- logger.warn("Couldn't parse
value from: " + args[i+1], e);
+ logger.warn("Couldn't parse
value from: " + value, e);
return;
}
// This actually sets the value for the
tunable field/method.
- setValue(value);
+ setValue(result);
return;
}
}
--
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.