You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by re...@apache.org on 2015/03/27 16:33:29 UTC
[01/11] incubator-taverna-workbench git commit:
Repository: incubator-taverna-workbench
Updated Branches:
refs/heads/master a9a52bd52 -> bf8a7ea28
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/test/resources/nested_iteration.t2flow
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/test/resources/nested_iteration.t2flow b/taverna-graph-view/src/test/resources/nested_iteration.t2flow
index 9b50c7f..9b31fe9 100644
--- a/taverna-graph-view/src/test/resources/nested_iteration.t2flow
+++ b/taverna-graph-view/src/test/resources/nested_iteration.t2flow
@@ -1,20 +1,20 @@
-<workflow xmlns="http://taverna.sf.net/2008/xml/t2flow"><dataflow id="23f84bb1-4a04-47fa-8150-7063310db697" role="top"><name>nested_iteration</name><inputPorts /><outputPorts><port><name>concat</name></port><port><name>list</name></port><port><name>constant</name></port></outputPorts><processors><processor><name>constant</name><inputPorts /><outputPorts><port><name>value</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>stringconstant-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.activities.stringconstant.StringConstantActivity</class><inputMap /><outputMap><map from="value" to="value" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean xmlns="">
+<workflow xmlns="http://taverna.sf.net/2008/xml/t2flow"><dataflow id="23f84bb1-4a04-47fa-8150-7063310db697" role="top"><name>nested_iteration</name><inputPorts /><outputPorts><port><name>concat</name></port><port><name>list</name></port><port><name>constant</name></port></outputPorts><processors><processor><name>constant</name><inputPorts /><outputPorts><port><name>value</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>stringconstant-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.activities.stringconstant.StringConstantActivity</class><inputMap /><outputMap><map from="value" to="value" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.stringconstant.StringConstantConfigurationBean xmlns="">
<value>constant</value>
-</net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+</org.apache.taverna.activities.stringconstant.StringConstantConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><org.apache.taverna.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
<maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryCo
nfig xmlns="">
+</org.apache.taverna.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><org.apache.taverna.workflowmodel.processor.dispatch.layers.Re
tryConfig xmlns="">
<backoffFactor>1.0</backoffFactor>
<initialDelay>0</initialDelay>
<maxDelay>0</maxDelay>
<maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross /></strategy></iteration></iterationStrategyStack></processor><processor><name>generate_list</name><inputPorts><port><name>prefix</name><depth>0</depth></port></inputPorts><outputPorts><port><name>list</name><depth>1</depth><granularDepth>1</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>beanshell-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.activities.beanshell.BeanshellActivity</class><inputMap><map from="prefix" to="prefi
x" /></inputMap><outputMap><map from="list" to="list" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean xmlns="">
+</org.apache.taverna.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross /></strategy></iteration></iterationStrategyStack></processor><processor><name>generate_list</name><inputPorts><port><name>prefix</name><depth>0</depth></port></inputPorts><outputPorts><port><name>list</name><depth>1</depth><granularDepth>1</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>beanshell-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.activities.beanshell.BeanshellActivity</class><inputMap><map from="prefix" to="pr
efix" /></inputMap><outputMap><map from="list" to="list" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.beanshell.BeanshellActivityConfigurationBean xmlns="">
<script>list = new ArrayList();
for (int i = 0; i < 20; i++) {
list.add(prefix + i);
}</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -23,54 +23,54 @@ for (int i = 0; i < 20; i++) {
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>list</name>
<depth>1</depth>
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+</org.apache.taverna.activities.beanshell.BeanshellActivityConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><org.apache.taverna.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
<maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryCo
nfig xmlns="">
+</org.apache.taverna.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><org.apache.taverna.workflowmodel.processor.dispatch.layers.Re
tryConfig xmlns="">
<backoffFactor>1.0</backoffFactor>
<initialDelay>0</initialDelay>
<maxDelay>0</maxDelay>
<maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><port name="prefix" depth="0" /></strategy></iteration></iterationStrategyStack></processor><processor><name>merge</name><inputPorts><port><name>in1</name><depth>0</depth></port><port><name>in2</name><depth>0</depth></port></inputPorts><outputPorts><port><name>out</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>dataflow-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.activities.dataflow.DataflowA
ctivity</class><inputMap><map from="in2" to="in2" /><map from="in1" to="in1" /></inputMap><outputMap><map from="out" to="out" /></outputMap><configBean encoding="dataflow"><dataflow ref="79ad4092-abcb-42bf-ac98-d66dfac67dff" /></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+</org.apache.taverna.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><port name="prefix" depth="0" /></strategy></iteration></iterationStrategyStack></processor><processor><name>merge</name><inputPorts><port><name>in1</name><depth>0</depth></port><port><name>in2</name><depth>0</depth></port></inputPorts><outputPorts><port><name>out</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>dataflow-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.activities.dataflow.Datafl
owActivity</class><inputMap><map from="in2" to="in2" /><map from="in1" to="in1" /></inputMap><outputMap><map from="out" to="out" /></outputMap><configBean encoding="dataflow"><dataflow ref="79ad4092-abcb-42bf-ac98-d66dfac67dff" /></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><org.apache.taverna.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
<maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryCo
nfig xmlns="">
+</org.apache.taverna.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><org.apache.taverna.workflowmodel.processor.dispatch.layers.Re
tryConfig xmlns="">
<backoffFactor>1.0</backoffFactor>
<initialDelay>0</initialDelay>
<maxDelay>0</maxDelay>
<maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="in1" depth="0" /><port name="in2" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>generate_list_prefix_defaultValue</name><inputPorts /><outputPorts><port><name>value</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>stringconstant-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.activities.stringconstant.StringConstantActivity</cla
ss><inputMap /><outputMap><map from="value" to="value" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean xmlns="">
+</org.apache.taverna.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="in1" depth="0" /><port name="in2" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>generate_list_prefix_defaultValue</name><inputPorts /><outputPorts><port><name>value</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>stringconstant-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.activities.stringconstant.StringConstantActivity</
class><inputMap /><outputMap><map from="value" to="value" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.stringconstant.StringConstantConfigurationBean xmlns="">
<value>prefix</value>
-</net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+</org.apache.taverna.activities.stringconstant.StringConstantConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><org.apache.taverna.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
<maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryCo
nfig xmlns="">
+</org.apache.taverna.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><org.apache.taverna.workflowmodel.processor.dispatch.layers.Re
tryConfig xmlns="">
<backoffFactor>1.0</backoffFactor>
<initialDelay>0</initialDelay>
<maxDelay>0</maxDelay>
<maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross /></strategy></iteration></iterationStrategyStack></processor></processors><conditions><condition control="generate_list" target="constant" /></conditions><datalinks><datalink><sink type="processor"><processor>generate_list</processor><port>prefix</port></sink><source type="processor"><processor>generate_list_prefix_defaultValue</processor><port>value</port></source></datalink><datalink><sink type="processor"><processor>merge</processor><port>in1</port></sink><source type="processor"><processor>constant</processor><port>value</port></
source></datalink><datalink><sink type="merge"><processor>merge</processor><port>in2</port></sink><source type="processor"><processor>generate_list</processor><port>list</port></source></datalink><datalink><sink type="merge"><processor>merge</processor><port>in2</port></sink><source type="processor"><processor>generate_list</processor><port>list</port></source></datalink><datalink><sink type="dataflow"><port>concat</port></sink><source type="processor"><processor>merge</processor><port>out</port></source></datalink><datalink><sink type="dataflow"><port>list</port></sink><source type="processor"><processor>generate_list</processor><port>list</port></source></datalink><datalink><sink type="dataflow"><port>constant</port></sink><source type="processor"><processor>constant</processor><port>value</port></source></datalink></datalinks></dataflow><dataflow id="79ad4092-abcb-42bf-ac98-d66dfac67dff" role="nested"><name>Untitled workflow #24</name><inputPorts><port><name>in1</name><depth>0</d
epth><granularDepth>0</granularDepth></port><port><name>in2</name><depth>0</depth><granularDepth>0</granularDepth></port></inputPorts><outputPorts><port><name>out</name></port></outputPorts><processors><processor><name>Nested_Workflow</name><inputPorts><port><name>in2</name><depth>0</depth></port><port><name>in1</name><depth>0</depth></port></inputPorts><outputPorts><port><name>out</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>dataflow-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.activities.dataflow.DataflowActivity</class><inputMap><map from="in2" to="in2" /><map from="in1" to="in1" /></inputMap><outputMap><map from="out" to="out" /></outputMap><configBean encoding="dataflow"><dataflow ref="ebd93027-c046-4a04-befa-c5715e8ba3da" /></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</gro
up><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+</org.apache.taverna.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross /></strategy></iteration></iterationStrategyStack></processor></processors><conditions><condition control="generate_list" target="constant" /></conditions><datalinks><datalink><sink type="processor"><processor>generate_list</processor><port>prefix</port></sink><source type="processor"><processor>generate_list_prefix_defaultValue</processor><port>value</port></source></datalink><datalink><sink type="processor"><processor>merge</processor><port>in1</port></sink><source type="processor"><processor>constant</processor><port>value</port>
</source></datalink><datalink><sink type="merge"><processor>merge</processor><port>in2</port></sink><source type="processor"><processor>generate_list</processor><port>list</port></source></datalink><datalink><sink type="merge"><processor>merge</processor><port>in2</port></sink><source type="processor"><processor>generate_list</processor><port>list</port></source></datalink><datalink><sink type="dataflow"><port>concat</port></sink><source type="processor"><processor>merge</processor><port>out</port></source></datalink><datalink><sink type="dataflow"><port>list</port></sink><source type="processor"><processor>generate_list</processor><port>list</port></source></datalink><datalink><sink type="dataflow"><port>constant</port></sink><source type="processor"><processor>constant</processor><port>value</port></source></datalink></datalinks></dataflow><dataflow id="79ad4092-abcb-42bf-ac98-d66dfac67dff" role="nested"><name>Untitled workflow #24</name><inputPorts><port><name>in1</name><depth>0<
/depth><granularDepth>0</granularDepth></port><port><name>in2</name><depth>0</depth><granularDepth>0</granularDepth></port></inputPorts><outputPorts><port><name>out</name></port></outputPorts><processors><processor><name>Nested_Workflow</name><inputPorts><port><name>in2</name><depth>0</depth></port><port><name>in1</name><depth>0</depth></port></inputPorts><outputPorts><port><name>out</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>dataflow-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.activities.dataflow.DataflowActivity</class><inputMap><map from="in2" to="in2" /><map from="in1" to="in1" /></inputMap><outputMap><map from="out" to="out" /></outputMap><configBean encoding="dataflow"><dataflow ref="ebd93027-c046-4a04-befa-c5715e8ba3da" /></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</
group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><org.apache.taverna.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
<maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryCo
nfig xmlns="">
+</org.apache.taverna.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><org.apache.taverna.workflowmodel.processor.dispatch.layers.Re
tryConfig xmlns="">
<backoffFactor>1.0</backoffFactor>
<initialDelay>0</initialDelay>
<maxDelay>0</maxDelay>
<maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="in1" depth="0" /><port name="in2" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor></processors><conditions /><datalinks><datalink><sink type="processor"><processor>Nested_Workflow</processor><port>in2</port></sink><source type="dataflow"><port>in2</port></source></datalink><datalink><sink type="processor"><processor>Nested_Workflow</processor><port>in1</port></sink><source type="dataflow"><port>in1</port></source></datalink><datalink><sink type="dataflow"><port>out</port></sink><source type=
"processor"><processor>Nested_Workflow</processor><port>out</port></source></datalink></datalinks></dataflow><dataflow id="ebd93027-c046-4a04-befa-c5715e8ba3da" role="nested"><name>Untitled workflow #36</name><inputPorts><port><name>in1</name><depth>0</depth><granularDepth>0</granularDepth></port><port><name>in2</name><depth>0</depth><granularDepth>0</granularDepth></port></inputPorts><outputPorts><port><name>out</name></port></outputPorts><processors><processor><name>concat</name><inputPorts><port><name>in1</name><depth>0</depth></port><port><name>in2</name><depth>0</depth></port></inputPorts><outputPorts><port><name>out</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>beanshell-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.activities.beanshell.BeanshellActivity</class><inputMap><map from="in2" to="in2" /><map from="in1" to="in1" /></i
nputMap><outputMap><map from="out" to="out" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean xmlns="">
+</org.apache.taverna.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="in1" depth="0" /><port name="in2" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor></processors><conditions /><datalinks><datalink><sink type="processor"><processor>Nested_Workflow</processor><port>in2</port></sink><source type="dataflow"><port>in2</port></source></datalink><datalink><sink type="processor"><processor>Nested_Workflow</processor><port>in1</port></sink><source type="dataflow"><port>in1</port></source></datalink><datalink><sink type="dataflow"><port>out</port></sink><source typ
e="processor"><processor>Nested_Workflow</processor><port>out</port></source></datalink></datalinks></dataflow><dataflow id="ebd93027-c046-4a04-befa-c5715e8ba3da" role="nested"><name>Untitled workflow #36</name><inputPorts><port><name>in1</name><depth>0</depth><granularDepth>0</granularDepth></port><port><name>in2</name><depth>0</depth><granularDepth>0</granularDepth></port></inputPorts><outputPorts><port><name>out</name></port></outputPorts><processors><processor><name>concat</name><inputPorts><port><name>in1</name><depth>0</depth></port><port><name>in2</name><depth>0</depth></port></inputPorts><outputPorts><port><name>out</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2</group><artifact>beanshell-activity</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.activities.beanshell.BeanshellActivity</class><inputMap><map from="in2" to="in2" /><map from="in1" to="in1" />
</inputMap><outputMap><map from="out" to="out" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.beanshell.BeanshellActivityConfigurationBean xmlns="">
<script>Thread.sleep(200);
out = in1 + in2;</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -79,8 +79,8 @@ out = in1 + in2;</script>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -89,23 +89,23 @@ out = in1 + in2;</script>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>out</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+</org.apache.taverna.activities.beanshell.BeanshellActivityConfigurationBean></configBean></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><org.apache.taverna.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
<maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryCo
nfig xmlns="">
+</org.apache.taverna.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><org.apache.taverna.workflowmodel.processor.dispatch.layers.Re
tryConfig xmlns="">
<backoffFactor>1.0</backoffFactor>
<initialDelay>0</initialDelay>
<maxDelay>0</maxDelay>
<maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="in1" depth="0" /><port name="in2" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor></processors><conditions /><datalinks><datalink><sink type="processor"><processor>concat</processor><port>in1</port></sink><source type="dataflow"><port>in1</port></source></datalink><datalink><sink type="processor"><processor>concat</processor><port>in2</port></sink><source type="dataflow"><port>in2</port></source></datalink><datalink><sink type="dataflow"><port>out</port></sink><source type="processor"><proce
ssor>concat</processor><port>out</port></source></datalink></datalinks></dataflow></workflow>
\ No newline at end of file
+</org.apache.taverna.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2</group><artifact>workflowmodel-impl</artifact><version>0.3-SNAPSHOT</version></raven><class>org.apache.taverna.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="in1" depth="0" /><port name="in2" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor></processors><conditions /><datalinks><datalink><sink type="processor"><processor>concat</processor><port>in1</port></sink><source type="dataflow"><port>in1</port></source></datalink><datalink><sink type="processor"><processor>concat</processor><port>in2</port></sink><source type="dataflow"><port>in2</port></source></datalink><datalink><sink type="dataflow"><port>out</port></sink><source type="processor"><pro
cessor>concat</processor><port>out</port></source></datalink></datalinks></dataflow></workflow>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-httpproxy-config/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/pom.xml b/taverna-httpproxy-config/pom.xml
index 25e0eda..895b6b2 100644
--- a/taverna-httpproxy-config/pom.xml
+++ b/taverna-httpproxy-config/pom.xml
@@ -28,13 +28,14 @@
<name>Apache Taverna HTTP Proxy configuration</name>
<dependencies>
<dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-ui</artifactId>
- <version>${project.parent.version}</version>
+ <groupId>org.apache.taverna.osgi</groupId>
+ <artifactId>taverna-configuration-api</artifactId>
+ <version>${taverna.osgi.version}</version>
</dependency>
+
<dependency>
- <groupId>org.apache.taverna.osgi</groupId>
- <artifactId>taverna-osgi-api</artifactId>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>taverna-ui</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationPanel.java b/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
index 4c57cb2..1d32108 100644
--- a/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
+++ b/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
@@ -62,7 +62,7 @@ import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import org.apache.taverna.lang.ui.DialogTextArea;
-import org..taverna.configuration.proxy.HttpProxyConfiguration;
+import uk.org.taverna.configuration.proxy.HttpProxyConfiguration;
/**
* The HttpProxyConfigurationPanel provides the user interface to a
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java b/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
index dabe6a8..71a0133 100644
--- a/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
+++ b/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
@@ -22,7 +22,7 @@ package org.apache.taverna.workbench.httpproxy.config;
import javax.swing.JPanel;
-import org.apache.taverna.configuration.Configurable;
+import uk.org.taverna.configuration.Configurable;
import uk.org.taverna.configuration.ConfigurationUIFactory;
import uk.org.taverna.configuration.proxy.HttpProxyConfiguration;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-loop-ui/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/pom.xml b/taverna-loop-ui/pom.xml
index bbe1af8..97be01c 100644
--- a/taverna-loop-ui/pom.xml
+++ b/taverna-loop-ui/pom.xml
@@ -27,7 +27,12 @@
<packaging>bundle</packaging>
<name>Apache Taverna Loop layer contextual view</name>
<dependencies>
-
+ <dependency>
+ <groupId>org.apache.taverna.engine</groupId>
+ <artifactId>taverna-workflowmodel-extensions</artifactId>
+ <version>${taverna.engine.version}</version>
+ </dependency>
+
<dependency>
<groupId>org.apache.taverna.osgi</groupId>
<artifactId>taverna-app-configuration-api</artifactId>
@@ -103,6 +108,5 @@
<version>${project.parent.version}</version>
<scope>test</scope>
</dependency>
-
</dependencies>
</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigurationPanel.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigurationPanel.java
index f9d768a..28fd47e 100644
--- a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigurationPanel.java
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigurationPanel.java
@@ -30,9 +30,7 @@ import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
-import java.util.Properties;
import javax.swing.AbstractAction;
import javax.swing.Box;
@@ -46,7 +44,6 @@ import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
-import net.sf.taverna.t2.activities.beanshell.views.BeanshellConfigurationPanel;
import org.apache.taverna.workbench.helper.HelpEnabledDialog;
import org.apache.taverna.workbench.loop.comparisons.Comparison;
import org.apache.taverna.workbench.ui.Utils;
@@ -61,6 +58,7 @@ import org.apache.taverna.scufl2.api.core.Processor;
import org.apache.taverna.scufl2.api.profiles.Profile;
import com.fasterxml.jackson.databind.node.ObjectNode;
+import net.sf.taverna.t2.activities.beanshell.views.BeanshellConfigurationPanel;
/**
* UI for {@link LoopConfiguration}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureAction.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureAction.java
index 05b8a43..d324c95 100644
--- a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureAction.java
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureAction.java
@@ -30,6 +30,8 @@ import org.apache.taverna.scufl2.api.profiles.Profile;
import org.apache.taverna.workbench.edits.EditManager;
import org.apache.taverna.workbench.file.FileManager;
import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+import org.apache.taverna.workflowmodel.Edit;
+import org.apache.taverna.workflowmodel.processor.dispatch.layers.LoopConfiguration;
/**
* @author Alan R Williams
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureMenuAction.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureMenuAction.java
index 061c225..dafb348 100644
--- a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureMenuAction.java
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureMenuAction.java
@@ -33,6 +33,7 @@ import org.apache.taverna.scufl2.api.core.Processor;
import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
import org.apache.taverna.workbench.edits.EditManager;
import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workflowmodel.processor.dispatch.DispatchLayer;
public class LoopConfigureMenuAction extends AbstractContextualMenuAction {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopRemoveMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopRemoveMenuAction.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopRemoveMenuAction.java
index 0d8fb3c..f68ba05 100644
--- a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopRemoveMenuAction.java
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopRemoveMenuAction.java
@@ -33,6 +33,7 @@ import org.apache.taverna.workbench.file.FileManager;
import org.apache.log4j.Logger;
import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.workflowmodel.processor.dispatch.layers.Loop;
public class LoopRemoveMenuAction extends AbstractContextualMenuAction {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-loop-ui/src/test/java/org/apache/taverna/workbench/loop/ShowContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/test/java/org/apache/taverna/workbench/loop/ShowContextualView.java b/taverna-loop-ui/src/test/java/org/apache/taverna/workbench/loop/ShowContextualView.java
index 2fe8351..7d2da10 100644
--- a/taverna-loop-ui/src/test/java/org/apache/taverna/workbench/loop/ShowContextualView.java
+++ b/taverna-loop-ui/src/test/java/org/apache/taverna/workbench/loop/ShowContextualView.java
@@ -38,7 +38,7 @@ import org.apache.taverna.scufl2.api.core.Processor;
import org.apache.taverna.workbench.edits.EditManager;
import org.apache.taverna.workbench.edits.impl.EditManagerImpl;
import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.FileManagerImpl;
+import org.apache.taverna.workbench.file.impl.FileManagerImpl;
import org.apache.taverna.workbench.selection.SelectionManager;
import org.apache.taverna.workbench.selection.impl.SelectionManagerImpl;
import org.apache.taverna.workbench.ui.views.contextualviews.impl.ContextualViewComponent;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-menu-items/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-menu-items/pom.xml b/taverna-menu-items/pom.xml
index 2ff102f..81a550a 100644
--- a/taverna-menu-items/pom.xml
+++ b/taverna-menu-items/pom.xml
@@ -27,12 +27,13 @@
<packaging>bundle</packaging>
<name>Apache Taverna menu items</name>
<dependencies>
+<!--
<dependency>
<groupId>org.apache.taverna.osgi</groupId>
<artifactId>taverna-services-api</artifactId>
<version>${taverna.osgi.version}</version>
</dependency>
-
+-->
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>taverna-contextual-views-impl</artifactId>
@@ -83,12 +84,17 @@
<artifactId>stringconstant-activity-ui</artifactId>
<version>${project.parent.version}</version>
</dependency>
- <!-- TODO remove dependencies on implementations -->
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-contextual-views-impl</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
-
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-stringconstant-activity-ui</artifactId>
+ <version>3.1.0-incubating-SNAPSHOT</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-contextual-views-impl</artifactId>
+ <version>3.1.0-incubating-SNAPSHOT</version>
+ <type>jar</type>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-menu-items/src/main/java/org/apache/taverna/ui/menu/items/activityport/AddInputPortDefaultValueAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/org/apache/taverna/ui/menu/items/activityport/AddInputPortDefaultValueAction.java b/taverna-menu-items/src/main/java/org/apache/taverna/ui/menu/items/activityport/AddInputPortDefaultValueAction.java
index 8c4e6f5..74dfefb 100644
--- a/taverna-menu-items/src/main/java/org/apache/taverna/ui/menu/items/activityport/AddInputPortDefaultValueAction.java
+++ b/taverna-menu-items/src/main/java/org/apache/taverna/ui/menu/items/activityport/AddInputPortDefaultValueAction.java
@@ -28,7 +28,7 @@ import java.util.List;
import javax.swing.JOptionPane;
-import net.sf.taverna.t2.activities.stringconstant.views.StringConstantConfigView;
+import org.apache.taverna.activities.stringconstant.views.StringConstantConfigView;
import org.apache.taverna.workbench.design.actions.DataflowEditAction;
import org.apache.taverna.workbench.edits.CompoundEdit;
import org.apache.taverna.workbench.edits.Edit;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-monitor-view/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-monitor-view/pom.xml b/taverna-monitor-view/pom.xml
index 739306e..74a1b82 100644
--- a/taverna-monitor-view/pom.xml
+++ b/taverna-monitor-view/pom.xml
@@ -28,6 +28,12 @@
<name>Apache Taverna Monitor View</name>
<dependencies>
<dependency>
+ <groupId>org.apache.taverna.engine</groupId>
+ <artifactId>taverna-run-api</artifactId>
+ <version>${taverna.engine.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>taverna-workbench-api</artifactId>
<version>${project.parent.version}</version>
@@ -63,12 +69,6 @@
<version>${taverna.engine.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.taverna.engine</groupId>
- <artifactId>taverna-run-api</artifactId>
- <version>${taverna.engine.version}</version>
- </dependency>
-
- <dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>${commons.beanutils.version}</version>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-monitor-view/src/main/java/org/apache/taverna/workbench/views/monitor/graph/MonitorGraphComponent.java
----------------------------------------------------------------------
diff --git a/taverna-monitor-view/src/main/java/org/apache/taverna/workbench/views/monitor/graph/MonitorGraphComponent.java b/taverna-monitor-view/src/main/java/org/apache/taverna/workbench/views/monitor/graph/MonitorGraphComponent.java
index 87cab4e..37a1bc6 100644
--- a/taverna-monitor-view/src/main/java/org/apache/taverna/workbench/views/monitor/graph/MonitorGraphComponent.java
+++ b/taverna-monitor-view/src/main/java/org/apache/taverna/workbench/views/monitor/graph/MonitorGraphComponent.java
@@ -52,10 +52,10 @@ import org.apache.taverna.workbench.models.graph.svg.SVGGraphController;
import org.apache.taverna.workbench.selection.DataflowSelectionModel;
import org.apache.taverna.workbench.selection.SelectionManager;
import org.apache.taverna.workbench.ui.Updatable;
-import net.sf.taverna.t2.workbench.views.graph.AutoScrollInteractor;
-import net.sf.taverna.t2.workbench.views.graph.menu.ResetDiagramAction;
-import net.sf.taverna.t2.workbench.views.graph.menu.ZoomInAction;
-import net.sf.taverna.t2.workbench.views.graph.menu.ZoomOutAction;
+import org.apache.taverna.workbench.views.graph.AutoScrollInteractor;
+import org.apache.taverna.workbench.views.graph.menu.ResetDiagramAction;
+import org.apache.taverna.workbench.views.graph.menu.ZoomInAction;
+import org.apache.taverna.workbench.views.graph.menu.ZoomOutAction;
import org.apache.batik.swing.JSVGCanvas;
import org.apache.batik.swing.JSVGScrollPane;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-monitor-view/src/main/java/org/apache/taverna/workbench/views/monitor/progressreport/WorkflowRunProgressTreeTable.java
----------------------------------------------------------------------
diff --git a/taverna-monitor-view/src/main/java/org/apache/taverna/workbench/views/monitor/progressreport/WorkflowRunProgressTreeTable.java b/taverna-monitor-view/src/main/java/org/apache/taverna/workbench/views/monitor/progressreport/WorkflowRunProgressTreeTable.java
index 0836b23..9d1b564 100644
--- a/taverna-monitor-view/src/main/java/org/apache/taverna/workbench/views/monitor/progressreport/WorkflowRunProgressTreeTable.java
+++ b/taverna-monitor-view/src/main/java/org/apache/taverna/workbench/views/monitor/progressreport/WorkflowRunProgressTreeTable.java
@@ -9,7 +9,7 @@ import javax.swing.tree.TreePath;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.SwingAwareObserver;
-import net.sf.taverna.lang.ui.treetable.JTreeTable;
+import org.apache.taverna.lang.ui.treetable.JTreeTable;
import org.apache.taverna.workbench.activityicons.ActivityIconManager;
import org.apache.taverna.workbench.selection.DataflowSelectionModel;
import org.apache.taverna.workbench.selection.events.DataflowSelectionMessage;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-perspective-design/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-perspective-design/pom.xml b/taverna-perspective-design/pom.xml
index e3f59b2..22c3887 100644
--- a/taverna-perspective-design/pom.xml
+++ b/taverna-perspective-design/pom.xml
@@ -64,11 +64,6 @@
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-graph-view</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
<artifactId>taverna-workflow-explorer</artifactId>
<version>${project.parent.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/MainComponent.java
----------------------------------------------------------------------
diff --git a/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/MainComponent.java b/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/MainComponent.java
index 50d88cd..41acdbc 100644
--- a/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/MainComponent.java
+++ b/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/MainComponent.java
@@ -40,7 +40,7 @@ import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.StyleSheet;
import org.apache.taverna.lang.ui.ShadedLabel;
-import net.sf.taverna.t2.ui.perspectives.PerspectiveRegistry;
+import org.apache.taverna.ui.perspectives.PerspectiveRegistry;
import org.apache.taverna.ui.perspectives.myexperiment.model.MyExperimentClient;
import org.apache.taverna.ui.perspectives.myexperiment.model.Resource;
import org.apache.taverna.ui.perspectives.myexperiment.model.Util;
@@ -54,7 +54,7 @@ import org.apache.taverna.workbench.icons.WorkbenchIcons;
import org.apache.taverna.workbench.ui.zaria.PerspectiveSPI;
import org.apache.taverna.workbench.ui.zaria.UIComponentSPI;
import org.apache.taverna.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.serialization.xml.impl.XMLSerializationConstants;
+import org.apache.taverna.workflowmodel.serialization.xml.impl.XMLSerializationConstants;
import org.apache.log4j.Logger;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/MainComponentShutdownHook.java
----------------------------------------------------------------------
diff --git a/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/MainComponentShutdownHook.java b/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/MainComponentShutdownHook.java
index 77a6ca0..83a4431 100644
--- a/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/MainComponentShutdownHook.java
+++ b/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/MainComponentShutdownHook.java
@@ -20,7 +20,7 @@
******************************************************************************/
package org.apache.taverna.ui.perspectives.myexperiment;
-import net.sf.taverna.t2.ui.perspectives.PerspectiveRegistry;
+import org.apache.taverna.ui.perspectives.PerspectiveRegistry;
import org.apache.taverna.ui.perspectives.myexperiment.model.MyExperimentClient;
import org.apache.taverna.workbench.ShutdownSPI;
import org.apache.taverna.workbench.ui.zaria.PerspectiveSPI;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64$InputStream.class
----------------------------------------------------------------------
diff --git a/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64$InputStream.class b/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64$InputStream.class
deleted file mode 100644
index a1a5f82..0000000
Binary files a/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64$InputStream.class and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64$OutputStream.class
----------------------------------------------------------------------
diff --git a/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64$OutputStream.class b/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64$OutputStream.class
deleted file mode 100644
index e754656..0000000
Binary files a/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64$OutputStream.class and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64.class
----------------------------------------------------------------------
diff --git a/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64.class b/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64.class
deleted file mode 100644
index 84fcee9..0000000
Binary files a/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64.class and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64.java
----------------------------------------------------------------------
diff --git a/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64.java b/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64.java
index 3afcdae..729eed2 100644
--- a/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64.java
+++ b/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/Base64.java
@@ -1,6 +1,6 @@
package org.apache.taverna.ui.perspectives.myexperiment.model;
-import net.sf.taverna.t2.activities.dataflow.views.DataflowActivityConfigView;
+//import org.apache.taverna.activities.dataflow.views.DataflowActivityConfigView;
import org.apache.log4j.Logger;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/MyExperimentClient.class
----------------------------------------------------------------------
diff --git a/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/MyExperimentClient.class b/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/MyExperimentClient.class
deleted file mode 100644
index 0f243ee..0000000
Binary files a/taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/model/MyExperimentClient.class and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-perspective-results/src/main/java/org/apache/taverna/ui/perspectives/results/ResultsPerspectiveComponent.java
----------------------------------------------------------------------
diff --git a/taverna-perspective-results/src/main/java/org/apache/taverna/ui/perspectives/results/ResultsPerspectiveComponent.java b/taverna-perspective-results/src/main/java/org/apache/taverna/ui/perspectives/results/ResultsPerspectiveComponent.java
index 049b8d2..c55ee61 100644
--- a/taverna-perspective-results/src/main/java/org/apache/taverna/ui/perspectives/results/ResultsPerspectiveComponent.java
+++ b/taverna-perspective-results/src/main/java/org/apache/taverna/ui/perspectives/results/ResultsPerspectiveComponent.java
@@ -50,10 +50,10 @@ import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
import org.apache.taverna.workbench.selection.events.WorkflowRunSelectionEvent;
import org.apache.taverna.workbench.ui.Updatable;
import net.sf.taverna.t2.workbench.views.monitor.graph.MonitorGraphComponent;
-import net.sf.taverna.t2.workbench.views.monitor.progressreport.TableMonitorComponent;
-import net.sf.taverna.t2.workbench.views.results.ResultsComponent;
-import net.sf.taverna.t2.workbench.views.results.saveactions.SaveAllResultsSPI;
-import net.sf.taverna.t2.workbench.views.results.saveactions.SaveIndividualResultSPI;
+import org.apache.taverna.workbench.views.monitor.progressreport.TableMonitorComponent;
+import org.apache.taverna.workbench.views.results.ResultsComponent;
+import org.apache.taverna.workbench.views.results.saveactions.SaveAllResultsSPI;
+import org.apache.taverna.workbench.views.results.saveactions.SaveIndividualResultSPI;
import org.apache.log4j.Logger;
import org.osgi.service.event.Event;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-renderers-exts/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-renderers-exts/pom.xml b/taverna-renderers-exts/pom.xml
index d0d07ac..88fe060 100644
--- a/taverna-renderers-exts/pom.xml
+++ b/taverna-renderers-exts/pom.xml
@@ -31,16 +31,21 @@
<artifactId>taverna-renderers-api</artifactId>
<version>${project.parent.version}</version>
</dependency>
+<!--
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>taverna-workbench-impl</artifactId>
<version>${project.parent.version}</version>
</dependency>
+-->
+<!--
<dependency>
<groupId>org.apache.taverna.language</groupId>
<artifactId>databundle</artifactId>
<version>${taverna.language.version}</version>
</dependency>
+-->
+
<!--
<dependency>
<groupId>uk.org.mygrid.resources</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-renderers-exts/src/main/java/org/apache/taverna/renderers/PDFRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-renderers-exts/src/main/java/org/apache/taverna/renderers/PDFRenderer.java b/taverna-renderers-exts/src/main/java/org/apache/taverna/renderers/PDFRenderer.java
index 7e788ea..f89a9de 100644
--- a/taverna-renderers-exts/src/main/java/org/apache/taverna/renderers/PDFRenderer.java
+++ b/taverna-renderers-exts/src/main/java/org/apache/taverna/renderers/PDFRenderer.java
@@ -21,9 +21,6 @@ package org.apache.taverna.renderers;
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
******************************************************************************/
-import org.apache.taverna.renderers.Renderer;
-import org.apache.taverna.renderers.RendererUtils;
-import org.apache.taverna.renderers.RendererException;
import java.io.InputStream;
import java.nio.file.Path;
import java.util.regex.Pattern;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-renderers-exts/src/main/java/org/apache/taverna/renderers/SeqVistaRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-renderers-exts/src/main/java/org/apache/taverna/renderers/SeqVistaRenderer.java b/taverna-renderers-exts/src/main/java/org/apache/taverna/renderers/SeqVistaRenderer.java
index b94b247..9927a11 100644
--- a/taverna-renderers-exts/src/main/java/org/apache/taverna/renderers/SeqVistaRenderer.java
+++ b/taverna-renderers-exts/src/main/java/org/apache/taverna/renderers/SeqVistaRenderer.java
@@ -20,9 +20,6 @@
******************************************************************************/
package org.apache.taverna.renderers;
-import org.apache.taverna.renderers.Renderer;
-import org.apache.taverna.renderers.RendererUtils;
-import org.apache.taverna.renderers.RendererException;
import java.nio.file.Path;
import javax.swing.JComponent;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-report-explainer/src/main/java/org/apache/taverna/workbench/report/explainer/BasicExplainer.java
----------------------------------------------------------------------
diff --git a/taverna-report-explainer/src/main/java/org/apache/taverna/workbench/report/explainer/BasicExplainer.java b/taverna-report-explainer/src/main/java/org/apache/taverna/workbench/report/explainer/BasicExplainer.java
index a3519bf..242c4f6 100644
--- a/taverna-report-explainer/src/main/java/org/apache/taverna/workbench/report/explainer/BasicExplainer.java
+++ b/taverna-report-explainer/src/main/java/org/apache/taverna/workbench/report/explainer/BasicExplainer.java
@@ -42,23 +42,23 @@ import javax.swing.JPanel;
import org.apache.taverna.activities.dataflow.DataflowActivity;
import org.apache.taverna.activities.dataflow.actions.EditNestedDataflowAction;
import org.apache.taverna.activities.disabled.actions.DisabledActivityConfigurationAction;
-import net.sf.taverna.t2.activities.wsdl.InputPortTypeDescriptorActivity;
-import net.sf.taverna.t2.activities.wsdl.xmlsplitter.AddXMLSplitterEdit;
+import org.apache.taverna.activities.wsdl.InputPortTypeDescriptorActivity;
+import org.apache.taverna.activities.wsdl.xmlsplitter.AddXMLSplitterEdit;
import org.apache.taverna.lang.ui.ReadOnlyTextArea;
import org.apache.taverna.visit.DataflowCollation;
import org.apache.taverna.visit.VisitKind;
import org.apache.taverna.visit.VisitReport;
-import org.sf.taverna.t2.visit.fragility.FragilityCheck;
+import org.apache.taverna.visit.fragility.FragilityCheck;
import org.apache.taverna.workbench.activityicons.ActivityIconManager;
import org.apache.taverna.workbench.design.actions.AddDataflowOutputAction;
import org.apache.taverna.workbench.edits.EditManager;
import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.report.FailedEntityKind;
-import net.sf.taverna.t2.workbench.report.IncompleteDataflowKind;
-import net.sf.taverna.t2.workbench.report.InvalidDataflowKind;
+import org.apache.taverna.workbench.report.FailedEntityKind;
+import org.apache.taverna.workbench.report.IncompleteDataflowKind;
+import org.apache.taverna.workbench.report.InvalidDataflowKind;
import org.apache.taverna.workbench.report.ReportManager;
-import net.sf.taverna.t2.workbench.report.UnresolvedOutputKind;
-import net.sf.taverna.t2.workbench.report.UnsatisfiedEntityKind;
+import org.apache.taverna.workbench.report.UnresolvedOutputKind;
+import org.apache.taverna.workbench.report.UnsatisfiedEntityKind;
import org.apache.taverna.workbench.report.view.ReportViewConfigureAction;
import org.apache.taverna.workbench.retry.RetryConfigureAction;
import org.apache.taverna.workbench.selection.SelectionManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-report-impl/src/main/java/org/apache/taverna/workbench/report/impl/ReportManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-report-impl/src/main/java/org/apache/taverna/workbench/report/impl/ReportManagerImpl.java b/taverna-report-impl/src/main/java/org/apache/taverna/workbench/report/impl/ReportManagerImpl.java
index fbea4b6..d0a6649 100644
--- a/taverna-report-impl/src/main/java/org/apache/taverna/workbench/report/impl/ReportManagerImpl.java
+++ b/taverna-report-impl/src/main/java/org/apache/taverna/workbench/report/impl/ReportManagerImpl.java
@@ -27,14 +27,14 @@ import org.apache.taverna.workbench.file.FileManager;
import org.apache.taverna.workbench.file.events.ClosedDataflowEvent;
import org.apache.taverna.workbench.file.events.FileManagerEvent;
import org.apache.taverna.workbench.file.events.SetCurrentDataflowEvent;
-import net.sf.taverna.t2.workbench.report.DataflowReportEvent;
-import net.sf.taverna.t2.workbench.report.FailedEntityKind;
-import net.sf.taverna.t2.workbench.report.IncompleteDataflowKind;
-import net.sf.taverna.t2.workbench.report.InvalidDataflowKind;
+import org.apache.taverna.workbench.report.DataflowReportEvent;
+import org.apache.taverna.workbench.report.FailedEntityKind;
+import org.apache.taverna.workbench.report.IncompleteDataflowKind;
+import org.apache.taverna.workbench.report.InvalidDataflowKind;
import org.apache.taverna.workbench.report.ReportManager;
import org.apache.taverna.workbench.report.ReportManagerEvent;
-import net.sf.taverna.t2.workbench.report.UnresolvedOutputKind;
-import net.sf.taverna.t2.workbench.report.UnsatisfiedEntityKind;
+import org.apache.taverna.workbench.report.UnresolvedOutputKind;
+import org.apache.taverna.workbench.report.UnsatisfiedEntityKind;
import org.apache.taverna.workbench.report.config.ReportManagerConfiguration;
import org.apache.taverna.workflowmodel.Dataflow;
import org.apache.taverna.workflowmodel.DataflowValidationReport;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-workbench-impl/src/main/java/org/apache/taverna/workbench/ui/impl/WorkbenchImpl.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-impl/src/main/java/org/apache/taverna/workbench/ui/impl/WorkbenchImpl.java b/taverna-workbench-impl/src/main/java/org/apache/taverna/workbench/ui/impl/WorkbenchImpl.java
index 4c5fdaa..48252d1 100644
--- a/taverna-workbench-impl/src/main/java/org/apache/taverna/workbench/ui/impl/WorkbenchImpl.java
+++ b/taverna-workbench-impl/src/main/java/org/apache/taverna/workbench/ui/impl/WorkbenchImpl.java
@@ -63,18 +63,18 @@ import javax.swing.UIManager;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.SwingAwareObserver;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.ui.menu.MenuManager.MenuManagerEvent;
-import net.sf.taverna.t2.ui.menu.MenuManager.UpdatedMenuManagerEvent;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.ui.menu.MenuManager.MenuManagerEvent;
+import org.apache.taverna.ui.menu.MenuManager.UpdatedMenuManagerEvent;
import org.apache.taverna.workbench.ShutdownSPI;
import org.apache.taverna.workbench.StartupSPI;
-import net.sf.taverna.t2.workbench.configuration.workbench.WorkbenchConfiguration;
-import net.sf.taverna.t2.workbench.configuration.workbench.ui.T2ConfigurationFrame;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
-import net.sf.taverna.t2.workbench.helper.Helper;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.configuration.workbench.ui.T2ConfigurationFrame;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.helper.Helper;
+import org.apache.taverna.workbench.selection.SelectionManager;
import org.apache.taverna.workbench.ui.Workbench;
import org.apache.taverna.workbench.ui.zaria.PerspectiveSPI;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-workflow-explorer/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-workflow-explorer/pom.xml b/taverna-workflow-explorer/pom.xml
index f6b913f..8f93fba 100644
--- a/taverna-workflow-explorer/pom.xml
+++ b/taverna-workflow-explorer/pom.xml
@@ -23,10 +23,10 @@
<artifactId>taverna-workbench</artifactId>
<version>3.1.0-incubating-SNAPSHOT</version>
</parent>
- <artifactId>workflow-explorer</artifactId>
+ <artifactId>taverna-workflow-explorer</artifactId>
<packaging>bundle</packaging>
- <name>Workflow Explorer</name>
- <description>Workflow Explorer</description>
+ <name>Apache Taverna Workflow Explorer</name>
+ <description>Apache taverna Workflow Explorer</description>
<dependencies>
<dependency>
<groupId>org.apache.taverna.engine</groupId>
[10/11] incubator-taverna-workbench git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileManagerImpl.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileManagerImpl.java
deleted file mode 100644
index eed7d51..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileManagerImpl.java
+++ /dev/null
@@ -1,601 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2010 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl;
-
-import static java.awt.GraphicsEnvironment.isHeadless;
-import static java.util.Collections.singleton;
-import static javax.swing.SwingUtilities.invokeAndWait;
-import static javax.swing.SwingUtilities.isEventDispatchThread;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import javax.swing.filechooser.FileFilter;
-
-import org.apache.taverna.lang.observer.MultiCaster;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.edits.EditManager.AbstractDataflowEditEvent;
-import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
-import org.apache.taverna.workbench.file.DataflowInfo;
-import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.events.ClosedDataflowEvent;
-import org.apache.taverna.workbench.file.events.ClosingDataflowEvent;
-import org.apache.taverna.workbench.file.events.FileManagerEvent;
-import org.apache.taverna.workbench.file.events.OpenedDataflowEvent;
-import org.apache.taverna.workbench.file.events.SavedDataflowEvent;
-import org.apache.taverna.workbench.file.events.SetCurrentDataflowEvent;
-import org.apache.taverna.workbench.file.exceptions.OpenException;
-import org.apache.taverna.workbench.file.exceptions.OverwriteException;
-import org.apache.taverna.workbench.file.exceptions.SaveException;
-import org.apache.taverna.workbench.file.exceptions.UnsavedException;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-/**
- * Implementation of {@link FileManager}
- *
- * @author Stian Soiland-Reyes
- */
-public class FileManagerImpl implements FileManager {
- private static Logger logger = Logger.getLogger(FileManagerImpl.class);
- private static int nameIndex = 1;
-
- /**
- * The last blank workflowBundle created using #newDataflow() until it has
- * been changed - when this variable will be set to null again. Used to
- * automatically close unmodified blank workflowBundles on open.
- */
- private WorkflowBundle blankWorkflowBundle = null;
- @SuppressWarnings("unused")
- private EditManager editManager;
- private EditManagerObserver editManagerObserver = new EditManagerObserver();
- protected MultiCaster<FileManagerEvent> observers = new MultiCaster<>(this);
- /**
- * Ordered list of open WorkflowBundle
- */
- private LinkedHashMap<WorkflowBundle, OpenDataflowInfo> openDataflowInfos = new LinkedHashMap<>();
- private DataflowPersistenceHandlerRegistry dataflowPersistenceHandlerRegistry;
- private Scufl2Tools scufl2Tools = new Scufl2Tools();
- private WorkflowBundle currentWorkflowBundle;
-
- public DataflowPersistenceHandlerRegistry getPersistanceHandlerRegistry() {
- return dataflowPersistenceHandlerRegistry;
- }
-
- public FileManagerImpl(EditManager editManager) {
- this.editManager = editManager;
- editManager.addObserver(editManagerObserver);
- }
-
- /**
- * Add an observer to be notified of {@link FileManagerEvent}s, such as
- * {@link OpenedDataflowEvent} and {@link SavedDataflowEvent}.
- *
- * {@inheritDoc}
- */
- @Override
- public void addObserver(Observer<FileManagerEvent> observer) {
- observers.addObserver(observer);
- }
-
- @Override
- public boolean canSaveWithoutDestination(WorkflowBundle workflowBundle) {
- OpenDataflowInfo dataflowInfo = getOpenDataflowInfo(workflowBundle);
- if (dataflowInfo.getSource() == null)
- return false;
- Set<?> handlers = getPersistanceHandlerRegistry()
- .getSaveHandlersForType(
- dataflowInfo.getFileType(),
- dataflowInfo.getDataflowInfo().getCanonicalSource()
- .getClass());
- return !handlers.isEmpty();
- }
-
- @Override
- public boolean closeDataflow(WorkflowBundle workflowBundle,
- boolean failOnUnsaved) throws UnsavedException {
- if (workflowBundle == null)
- throw new NullPointerException("Dataflow can't be null");
- ClosingDataflowEvent message = new ClosingDataflowEvent(workflowBundle);
- observers.notify(message);
- if (message.isAbortClose())
- return false;
- if ((failOnUnsaved && getOpenDataflowInfo(workflowBundle).isChanged()))
- throw new UnsavedException(workflowBundle);
- if (workflowBundle.equals(getCurrentDataflow())) {
- // We'll need to change current workflowBundle
- // Find best candidate to the left or right
- List<WorkflowBundle> workflowBundles = getOpenDataflows();
- int openIndex = workflowBundles.indexOf(workflowBundle);
- if (openIndex == -1)
- throw new IllegalArgumentException("Workflow was not opened "
- + workflowBundle);
-
- if (openIndex > 0)
- setCurrentDataflow(workflowBundles.get(openIndex - 1));
- else if (openIndex == 0 && workflowBundles.size() > 1)
- setCurrentDataflow(workflowBundles.get(1));
- else
- // If it was the last one, start a new, empty workflowBundle
- newDataflow();
- }
- if (workflowBundle == blankWorkflowBundle)
- blankWorkflowBundle = null;
- openDataflowInfos.remove(workflowBundle);
- observers.notify(new ClosedDataflowEvent(workflowBundle));
- return true;
- }
-
- @Override
- public WorkflowBundle getCurrentDataflow() {
- return currentWorkflowBundle;
- }
-
- @Override
- public WorkflowBundle getDataflowBySource(Object source) {
- for (Entry<WorkflowBundle, OpenDataflowInfo> infoEntry : openDataflowInfos
- .entrySet()) {
- OpenDataflowInfo info = infoEntry.getValue();
- if (source.equals(info.getSource()))
- return infoEntry.getKey();
- }
- // Not found
- return null;
- }
-
- @Override
- public String getDataflowName(WorkflowBundle workflowBundle) {
- Object source = null;
- if (isDataflowOpen(workflowBundle))
- source = getDataflowSource(workflowBundle);
- // Fallback
- String name;
- Workflow workflow = workflowBundle.getMainWorkflow();
- if (workflow != null)
- name = workflow.getName();
- else
- name = workflowBundle.getName();
- if (source == null)
- return name;
- if (source instanceof File)
- return ((File) source).getAbsolutePath();
- else if (source instanceof URL)
- return source.toString();
-
- // Check if it has implemented a toString() method
- Method toStringMethod = null;
- Method toStringMethodFromObject = null;
- try {
- toStringMethod = source.getClass().getMethod("toString");
- toStringMethodFromObject = Object.class.getMethod("toString");
- } catch (Exception e) {
- throw new IllegalStateException(
- "Source did not implement Object.toString() " + source);
- }
- if (!toStringMethod.equals(toStringMethodFromObject))
- return source.toString();
- return name;
- }
-
- @Override
- public String getDefaultWorkflowName() {
- return "Workflow" + (nameIndex++);
- }
-
- @Override
- public Object getDataflowSource(WorkflowBundle workflowBundle) {
- return getOpenDataflowInfo(workflowBundle).getSource();
- }
-
- @Override
- public FileType getDataflowType(WorkflowBundle workflowBundle) {
- return getOpenDataflowInfo(workflowBundle).getFileType();
- }
-
- @Override
- public List<Observer<FileManagerEvent>> getObservers() {
- return observers.getObservers();
- }
-
- /**
- * Get the {@link OpenDataflowInfo} for the given WorkflowBundle
- *
- * @throws NullPointerException
- * if the WorkflowBundle was <code>null</code>
- * @throws IllegalArgumentException
- * if the WorkflowBundle was not open.
- * @param workflowBundle
- * WorkflowBundle which information is to be found
- * @return The {@link OpenDataflowInfo} describing the WorkflowBundle
- */
- protected synchronized OpenDataflowInfo getOpenDataflowInfo(
- WorkflowBundle workflowBundle) {
- if (workflowBundle == null)
- throw new NullPointerException("Dataflow can't be null");
- OpenDataflowInfo info = openDataflowInfos.get(workflowBundle);
- if (info == null)
- throw new IllegalArgumentException("Workflow was not opened "
- + workflowBundle);
- return info;
- }
-
- @Override
- public List<WorkflowBundle> getOpenDataflows() {
- return new ArrayList<>(openDataflowInfos.keySet());
- }
-
- @Override
- public List<FileFilter> getOpenFileFilters() {
- List<FileFilter> fileFilters = new ArrayList<>();
-
- Set<FileType> fileTypes = getPersistanceHandlerRegistry()
- .getOpenFileTypes();
- if (!fileTypes.isEmpty())
- fileFilters.add(new MultipleFileTypes(fileTypes,
- "All supported workflows"));
- for (FileType fileType : fileTypes)
- fileFilters.add(new FileTypeFileFilter(fileType));
- return fileFilters;
- }
-
- @Override
- public List<FileFilter> getOpenFileFilters(Class<?> sourceClass) {
- List<FileFilter> fileFilters = new ArrayList<>();
- for (FileType fileType : getPersistanceHandlerRegistry()
- .getOpenFileTypesFor(sourceClass))
- fileFilters.add(new FileTypeFileFilter(fileType));
- return fileFilters;
- }
-
- @Override
- public List<FileFilter> getSaveFileFilters() {
- List<FileFilter> fileFilters = new ArrayList<>();
- for (FileType fileType : getPersistanceHandlerRegistry()
- .getSaveFileTypes())
- fileFilters.add(new FileTypeFileFilter(fileType));
- return fileFilters;
- }
-
- @Override
- public List<FileFilter> getSaveFileFilters(Class<?> destinationClass) {
- List<FileFilter> fileFilters = new ArrayList<>();
- for (FileType fileType : getPersistanceHandlerRegistry()
- .getSaveFileTypesFor(destinationClass))
- fileFilters.add(new FileTypeFileFilter(fileType));
- return fileFilters;
- }
-
- @Override
- public boolean isDataflowChanged(WorkflowBundle workflowBundle) {
- return getOpenDataflowInfo(workflowBundle).isChanged();
- }
-
- @Override
- public boolean isDataflowOpen(WorkflowBundle workflowBundle) {
- return openDataflowInfos.containsKey(workflowBundle);
- }
-
- @Override
- public WorkflowBundle newDataflow() {
- WorkflowBundle workflowBundle = new WorkflowBundle();
- workflowBundle.setMainWorkflow(new Workflow());
- workflowBundle.getMainWorkflow().setName(getDefaultWorkflowName());
- workflowBundle.setMainProfile(new Profile());
- scufl2Tools.setParents(workflowBundle);
- blankWorkflowBundle = null;
- openDataflowInternal(workflowBundle);
- blankWorkflowBundle = workflowBundle;
- observers.notify(new OpenedDataflowEvent(workflowBundle));
- return workflowBundle;
- }
-
- @Override
- public void openDataflow(WorkflowBundle workflowBundle) {
- openDataflowInternal(workflowBundle);
- observers.notify(new OpenedDataflowEvent(workflowBundle));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public WorkflowBundle openDataflow(FileType fileType, Object source)
- throws OpenException {
- if (isHeadless())
- return performOpenDataflow(fileType, source);
-
- OpenDataflowRunnable r = new OpenDataflowRunnable(this, fileType,
- source);
- if (isEventDispatchThread()) {
- r.run();
- } else
- try {
- invokeAndWait(r);
- } catch (InterruptedException | InvocationTargetException e) {
- throw new OpenException("Opening was interrupted", e);
- }
- OpenException thrownException = r.getException();
- if (thrownException != null)
- throw thrownException;
- return r.getDataflow();
- }
-
- public WorkflowBundle performOpenDataflow(FileType fileType, Object source)
- throws OpenException {
- DataflowInfo dataflowInfo;
- WorkflowBundle workflowBundle;
- dataflowInfo = openDataflowSilently(fileType, source);
- workflowBundle = dataflowInfo.getDataflow();
- openDataflowInternal(workflowBundle);
- getOpenDataflowInfo(workflowBundle).setOpenedFrom(dataflowInfo);
- observers.notify(new OpenedDataflowEvent(workflowBundle));
- return workflowBundle;
- }
-
- @Override
- public DataflowInfo openDataflowSilently(FileType fileType, Object source)
- throws OpenException {
- Set<DataflowPersistenceHandler> handlers;
- Class<? extends Object> sourceClass = source.getClass();
-
- boolean unknownFileType = (fileType == null);
- if (unknownFileType)
- handlers = getPersistanceHandlerRegistry().getOpenHandlersFor(
- sourceClass);
- else
- handlers = getPersistanceHandlerRegistry().getOpenHandlersFor(
- fileType, sourceClass);
- if (handlers.isEmpty())
- throw new OpenException("Unsupported file type or class "
- + fileType + " " + sourceClass);
-
- Throwable lastException = null;
- for (DataflowPersistenceHandler handler : handlers) {
- Collection<FileType> fileTypes;
- if (unknownFileType)
- fileTypes = handler.getOpenFileTypes();
- else
- fileTypes = singleton(fileType);
- for (FileType candidateFileType : fileTypes) {
- if (unknownFileType && (source instanceof File))
- /*
- * If source is file but fileType was not explicitly set
- * from the open workflow dialog - check the file extension
- * and decide which handler to use based on that (so that we
- * do not loop though all handlers)
- */
- if (!((File) source).getPath().endsWith(
- candidateFileType.getExtension()))
- continue;
-
- try {
- DataflowInfo openDataflow = handler.openDataflow(
- candidateFileType, source);
- WorkflowBundle workflowBundle = openDataflow.getDataflow();
- logger.info("Loaded workflow: " + workflowBundle.getName()
- + " " + workflowBundle.getGlobalBaseURI()
- + " from " + source + " using " + handler);
- return openDataflow;
- } catch (OpenException ex) {
- logger.warn("Could not open workflow " + source + " using "
- + handler + " of type " + candidateFileType);
- lastException = ex;
- }
- }
- }
- throw new OpenException("Could not open workflow " + source + "\n",
- lastException);
- }
-
- /**
- * Mark the WorkflowBundle as opened, and close the blank WorkflowBundle if
- * needed.
- *
- * @param workflowBundle
- * WorkflowBundle that has been opened
- */
- protected void openDataflowInternal(WorkflowBundle workflowBundle) {
- if (workflowBundle == null)
- throw new NullPointerException("Dataflow can't be null");
- if (isDataflowOpen(workflowBundle))
- throw new IllegalArgumentException("Workflow is already open: "
- + workflowBundle);
-
- openDataflowInfos.put(workflowBundle, new OpenDataflowInfo());
- setCurrentDataflow(workflowBundle);
- if (openDataflowInfos.size() == 2 && blankWorkflowBundle != null)
- /*
- * Behave like a word processor and close the blank WorkflowBundle
- * when another workflow has been opened
- */
- try {
- closeDataflow(blankWorkflowBundle, true);
- } catch (UnsavedException e) {
- logger.error("Blank workflow was modified "
- + "and could not be closed");
- }
- }
-
- @Override
- public void removeObserver(Observer<FileManagerEvent> observer) {
- observers.removeObserver(observer);
- }
-
- @Override
- public void saveDataflow(WorkflowBundle workflowBundle,
- boolean failOnOverwrite) throws SaveException {
- if (workflowBundle == null)
- throw new NullPointerException("Dataflow can't be null");
- OpenDataflowInfo lastSave = getOpenDataflowInfo(workflowBundle);
- if (lastSave.getSource() == null)
- throw new SaveException("Can't save without source "
- + workflowBundle);
- saveDataflow(workflowBundle, lastSave.getFileType(),
- lastSave.getSource(), failOnOverwrite);
- }
-
- @Override
- public void saveDataflow(WorkflowBundle workflowBundle, FileType fileType,
- Object destination, boolean failOnOverwrite) throws SaveException {
- DataflowInfo savedDataflow = saveDataflowSilently(workflowBundle,
- fileType, destination, failOnOverwrite);
- getOpenDataflowInfo(workflowBundle).setSavedTo(savedDataflow);
- observers.notify(new SavedDataflowEvent(workflowBundle));
- }
-
- @Override
- public DataflowInfo saveDataflowSilently(WorkflowBundle workflowBundle,
- FileType fileType, Object destination, boolean failOnOverwrite)
- throws SaveException, OverwriteException {
- Set<DataflowPersistenceHandler> handlers;
-
- Class<? extends Object> destinationClass = destination.getClass();
- if (fileType != null)
- handlers = getPersistanceHandlerRegistry().getSaveHandlersForType(
- fileType, destinationClass);
- else
- handlers = getPersistanceHandlerRegistry().getSaveHandlersFor(
- destinationClass);
-
- SaveException lastException = null;
- for (DataflowPersistenceHandler handler : handlers) {
- if (failOnOverwrite) {
- OpenDataflowInfo openDataflowInfo = getOpenDataflowInfo(workflowBundle);
- if (handler.wouldOverwriteDataflow(workflowBundle, fileType,
- destination, openDataflowInfo.getDataflowInfo()))
- throw new OverwriteException(destination);
- }
- try {
- DataflowInfo savedDataflow = handler.saveDataflow(
- workflowBundle, fileType, destination);
- savedDataflow.getDataflow();
- logger.info("Saved workflow: " + workflowBundle.getName() + " "
- + workflowBundle.getGlobalBaseURI() + " to "
- + savedDataflow.getCanonicalSource() + " using "
- + handler);
- return savedDataflow;
- } catch (SaveException ex) {
- logger.warn("Could not save to " + destination + " using "
- + handler);
- lastException = ex;
- }
- }
-
- if (lastException == null)
- throw new SaveException("Unsupported file type or class "
- + fileType + " " + destinationClass);
- throw new SaveException("Could not save to " + destination + ":\n"
- + lastException.getLocalizedMessage(), lastException);
- }
-
- @Override
- public void setCurrentDataflow(WorkflowBundle workflowBundle) {
- setCurrentDataflow(workflowBundle, false);
- }
-
- @Override
- public void setCurrentDataflow(WorkflowBundle workflowBundle,
- boolean openIfNeeded) {
- currentWorkflowBundle = workflowBundle;
- if (!isDataflowOpen(workflowBundle)) {
- if (!openIfNeeded)
- throw new IllegalArgumentException("Workflow is not open: "
- + workflowBundle);
- openDataflow(workflowBundle);
- return;
- }
- observers.notify(new SetCurrentDataflowEvent(workflowBundle));
- }
-
- @Override
- public void setDataflowChanged(WorkflowBundle workflowBundle,
- boolean isChanged) {
- getOpenDataflowInfo(workflowBundle).setIsChanged(isChanged);
- if (blankWorkflowBundle == workflowBundle)
- blankWorkflowBundle = null;
- }
-
- @Override
- public Object getCanonical(Object source) throws IllegalArgumentException,
- URISyntaxException, IOException {
- Object canonicalSource = source;
-
- if (source instanceof URL) {
- URL url = ((URL) source);
- if (url.getProtocol().equalsIgnoreCase("file"))
- canonicalSource = new File(url.toURI());
- }
-
- if (canonicalSource instanceof File)
- canonicalSource = ((File) canonicalSource).getCanonicalFile();
- return canonicalSource;
- }
-
- public void setDataflowPersistenceHandlerRegistry(
- DataflowPersistenceHandlerRegistry dataflowPersistenceHandlerRegistry) {
- this.dataflowPersistenceHandlerRegistry = dataflowPersistenceHandlerRegistry;
- }
-
- /**
- * Observe the {@link EditManager} for changes to open workflowBundles. A
- * change of an open workflow would set it as changed using
- * {@link FileManagerImpl#setDataflowChanged(Dataflow, boolean)}.
- *
- * @author Stian Soiland-Reyes
- *
- */
- private final class EditManagerObserver implements
- Observer<EditManagerEvent> {
- @Override
- public void notify(Observable<EditManagerEvent> sender,
- EditManagerEvent message) throws Exception {
- if (message instanceof AbstractDataflowEditEvent) {
- AbstractDataflowEditEvent dataflowEdit = (AbstractDataflowEditEvent) message;
- WorkflowBundle workflowBundle = dataflowEdit.getDataFlow();
- /**
- * TODO: on undo/redo - keep last event or similar to determine
- * if workflow was saved before. See
- * FileManagerTest#isChangedWithUndo().
- */
- setDataflowChanged(workflowBundle, true);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileTypeFileFilter.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileTypeFileFilter.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileTypeFileFilter.java
deleted file mode 100644
index 6383295..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileTypeFileFilter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl;
-
-import java.io.File;
-
-import javax.swing.filechooser.FileFilter;
-
-import org.apache.taverna.workbench.file.FileType;
-
-public class FileTypeFileFilter extends FileFilter {
- private final FileType fileType;
-
- public FileTypeFileFilter(FileType fileType) {
- this.fileType = fileType;
- }
-
- @Override
- public String getDescription() {
- return fileType.getDescription();
- }
-
- @Override
- public boolean accept(File file) {
- if (file.isDirectory())
- // Don't grey out directories
- return true;
- if (fileType.getExtension() == null)
- return false;
- return file.getName().toLowerCase()
- .endsWith("." + fileType.getExtension());
- }
-
- public FileType getFileType() {
- return fileType;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/MultipleFileTypes.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/MultipleFileTypes.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/MultipleFileTypes.java
deleted file mode 100644
index 0205d86..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/MultipleFileTypes.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl;
-
-import java.io.File;
-import java.util.Set;
-
-import javax.swing.filechooser.FileFilter;
-
-import org.apache.taverna.workbench.file.FileType;
-
-public class MultipleFileTypes extends FileFilter {
- private String description;
- private final Set<FileType> fileTypes;
-
- public MultipleFileTypes(Set<FileType> fileTypes, String description) {
- this.fileTypes = fileTypes;
- this.description = description;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public boolean accept(File file) {
- if (file.isDirectory())
- return true;
-
- String lowerFileName = file.getName().toLowerCase();
- for (FileType fileType : fileTypes) {
- if (fileType.getExtension() == null)
- continue;
- if (lowerFileName.endsWith(fileType.getExtension()))
- return true;
- }
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInProgressDialog.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInProgressDialog.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInProgressDialog.java
deleted file mode 100644
index 021a1b2..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInProgressDialog.java
+++ /dev/null
@@ -1,88 +0,0 @@
-
-/*******************************************************************************
- * Copyright (C) 2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl;
-
-import static java.awt.BorderLayout.CENTER;
-import static org.apache.taverna.workbench.MainWindow.getMainWindow;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.workingIcon;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.EmptyBorder;
-
-import org.apache.taverna.workbench.helper.HelpEnabledDialog;
-
-/**
- * Dialog that is popped up while we are opening a workflow.
- *
- * @author Alex Nenadic
- * @author Alan R Williams
- */
-@SuppressWarnings("serial")
-public class OpenDataflowInProgressDialog extends HelpEnabledDialog {
- private boolean userCancelled = false;
-
- public OpenDataflowInProgressDialog() {
- super(getMainWindow(), "Opening workflow", true);
- setResizable(false);
- setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
-
- JPanel panel = new JPanel(new BorderLayout());
- panel.setBorder(new EmptyBorder(10,10,10,10));
-
- JPanel textPanel = new JPanel();
- JLabel text = new JLabel(workingIcon);
- text.setText("Opening workflow...");
- text.setBorder(new EmptyBorder(10,0,10,0));
- textPanel.add(text);
- panel.add(textPanel, CENTER);
-
-/*
- * Cancellation does not work when opening
-
- // Cancel button
- JButton cancelButton = new JButton("Cancel");
- cancelButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- userCancelled = true;
- setVisible(false);
- dispose();
- }
- });
- JPanel cancelButtonPanel = new JPanel();
- cancelButtonPanel.add(cancelButton);
- panel.add(cancelButtonPanel, BorderLayout.SOUTH);
-*/
- setContentPane(panel);
- setPreferredSize(new Dimension(300, 100));
-
- pack();
- }
-
- public boolean hasUserCancelled() {
- return userCancelled;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInfo.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInfo.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInfo.java
deleted file mode 100644
index 00245f1..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInfo.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl;
-
-import java.util.Date;
-
-import org.apache.taverna.workbench.file.DataflowInfo;
-import org.apache.taverna.workbench.file.FileType;
-
-/**
- * Information about an open dataflow.
- *
- * @author Stian Soiland-Reyes
- */
-public class OpenDataflowInfo {
- private DataflowInfo dataflowInfo;
- private boolean isChanged;
- private Date openedAt;
-
- public OpenDataflowInfo() {
- }
-
- public FileType getFileType() {
- if (dataflowInfo == null)
- return null;
- return dataflowInfo.getFileType();
- }
-
- public Date getLastModified() {
- if (dataflowInfo == null)
- return null;
- return dataflowInfo.getLastModified();
- }
-
- public Date getOpenedAtDate() {
- return openedAt;
- }
-
- public Object getSource() {
- if (dataflowInfo == null)
- return null;
- return dataflowInfo.getCanonicalSource();
- }
-
- public boolean isChanged() {
- return isChanged;
- }
-
- public void setIsChanged(boolean isChanged) {
- this.isChanged = isChanged;
- }
-
- public synchronized void setOpenedFrom(DataflowInfo dataflowInfo) {
- setDataflowInfo(dataflowInfo);
- setOpenedAt(new Date());
- setIsChanged(false);
- }
-
- public synchronized void setSavedTo(DataflowInfo dataflowInfo) {
- setDataflowInfo(dataflowInfo);
- setIsChanged(false);
- }
-
- private void setDataflowInfo(DataflowInfo dataflowInfo) {
- this.dataflowInfo = dataflowInfo;
- }
-
- private void setOpenedAt(Date openedAt) {
- this.openedAt = openedAt;
- }
-
- public DataflowInfo getDataflowInfo() {
- return dataflowInfo;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowRunnable.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowRunnable.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowRunnable.java
deleted file mode 100644
index 504c2a9..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowRunnable.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.workbench.file.impl;
-
-import static java.lang.Thread.sleep;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.exceptions.OpenException;
-import org.apache.taverna.workbench.ui.SwingWorkerCompletionWaiter;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @author alanrw
- */
-public class OpenDataflowRunnable implements Runnable {
- private final FileManagerImpl fileManager;
- private final FileType fileType;
- private final Object source;
- private WorkflowBundle dataflow;
- private OpenException e;
-
- public OpenDataflowRunnable(FileManagerImpl fileManager, FileType fileType,
- Object source) {
- this.fileManager = fileManager;
- this.fileType = fileType;
- this.source = source;
- }
-
- @Override
- public void run() {
- OpenDataflowSwingWorker openDataflowSwingWorker = new OpenDataflowSwingWorker(
- fileType, source, fileManager);
- OpenDataflowInProgressDialog dialog = new OpenDataflowInProgressDialog();
- openDataflowSwingWorker
- .addPropertyChangeListener(new SwingWorkerCompletionWaiter(
- dialog));
- openDataflowSwingWorker.execute();
-
- /*
- * Give a chance to the SwingWorker to finish so we do not have to
- * display the dialog
- */
- try {
- sleep(500);
- } catch (InterruptedException e) {
- this.e = new OpenException("Opening was interrupted");
- }
- if (!openDataflowSwingWorker.isDone())
- dialog.setVisible(true); // this will block the GUI
- boolean userCancelled = dialog.hasUserCancelled(); // see if user cancelled the dialog
-
- if (userCancelled) {
- // Stop the OpenDataflowSwingWorker if it is still working
- openDataflowSwingWorker.cancel(true);
- dataflow = null;
- this.e = new OpenException("Opening was cancelled");
- // exit
- return;
- }
- dataflow = openDataflowSwingWorker.getDataflow();
- this.e = openDataflowSwingWorker.getException();
- }
-
- public WorkflowBundle getDataflow() {
- return dataflow;
- }
-
- public OpenException getException() {
- return this.e;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowSwingWorker.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowSwingWorker.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowSwingWorker.java
deleted file mode 100644
index ba74b03..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowSwingWorker.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl;
-
-import javax.swing.SwingWorker;
-
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.exceptions.OpenException;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-public class OpenDataflowSwingWorker extends
- SwingWorker<WorkflowBundle, Object> {
- @SuppressWarnings("unused")
- private Logger logger = Logger.getLogger(OpenDataflowSwingWorker.class);
- private FileType fileType;
- private Object source;
- private FileManagerImpl fileManagerImpl;
- private WorkflowBundle workflowBundle;
- private OpenException e = null;
-
- public OpenDataflowSwingWorker(FileType fileType, Object source,
- FileManagerImpl fileManagerImpl) {
- this.fileType = fileType;
- this.source = source;
- this.fileManagerImpl = fileManagerImpl;
- }
-
- @Override
- protected WorkflowBundle doInBackground() throws Exception {
- try {
- workflowBundle = fileManagerImpl.performOpenDataflow(fileType,
- source);
- } catch (OpenException e) {
- this.e = e;
- }
- return workflowBundle;
- }
-
- public WorkflowBundle getDataflow() {
- return workflowBundle;
- }
-
- public OpenException getException() {
- return e;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2DataflowOpener.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2DataflowOpener.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2DataflowOpener.java
deleted file mode 100644
index d6e0db2..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2DataflowOpener.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
-import org.apache.taverna.workbench.file.DataflowInfo;
-import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.exceptions.OpenException;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.io.ReaderException;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-
-public class T2DataflowOpener extends AbstractDataflowPersistenceHandler
- implements DataflowPersistenceHandler {
- private static final T2FlowFileType T2_FLOW_FILE_TYPE = new T2FlowFileType();
- private static Logger logger = Logger.getLogger(T2DataflowOpener.class);
-
- private WorkflowBundleIO workflowBundleIO;
-
- @SuppressWarnings("resource")
- @Override
- public DataflowInfo openDataflow(FileType fileType, Object source)
- throws OpenException {
- if (!getOpenFileTypes().contains(fileType))
- throw new OpenException("Unsupported file type "
- + fileType);
- InputStream inputStream;
- Date lastModified = null;
- Object canonicalSource = source;
- if (source instanceof InputStream)
- inputStream = (InputStream) source;
- else if (source instanceof File)
- try {
- inputStream = new FileInputStream((File) source);
- } catch (FileNotFoundException e) {
- throw new OpenException("Could not open file " + source + ":\n" + e.getLocalizedMessage(), e);
- }
- else if (source instanceof URL) {
- URL url = ((URL) source);
- try {
- URLConnection connection = url.openConnection();
- connection.setRequestProperty("Accept", "text/xml");
- inputStream = connection.getInputStream();
- if (connection.getLastModified() != 0)
- lastModified = new Date(connection.getLastModified());
- } catch (IOException e) {
- throw new OpenException("Could not open connection to URL "
- + source+ ":\n" + e.getLocalizedMessage(), e);
- }
- try {
- if (url.getProtocol().equalsIgnoreCase("file"))
- canonicalSource = new File(url.toURI());
- } catch (URISyntaxException e) {
- logger.warn("Invalid file URI created from " + url);
- }
- } else {
- throw new OpenException("Unsupported source type "
- + source.getClass());
- }
-
- final WorkflowBundle workflowBundle;
- try {
- workflowBundle = openDataflowStream(inputStream);
- } finally {
- try {
- if (!(source instanceof InputStream))
- // We created the stream, we'll close it
- inputStream.close();
- } catch (IOException ex) {
- logger.warn("Could not close inputstream " + inputStream, ex);
- }
- }
- if (canonicalSource instanceof File)
- return new FileDataflowInfo(T2_FLOW_FILE_TYPE,
- (File) canonicalSource, workflowBundle);
- return new DataflowInfo(T2_FLOW_FILE_TYPE, canonicalSource,
- workflowBundle, lastModified);
- }
-
- protected WorkflowBundle openDataflowStream(InputStream workflowXMLstream)
- throws OpenException {
- WorkflowBundle workflowBundle;
- try {
- workflowBundle = workflowBundleIO.readBundle(workflowXMLstream, null);
- } catch (ReaderException e) {
- throw new OpenException("Could not read the workflow", e);
- } catch (IOException e) {
- throw new OpenException("Could not open the workflow file for parsing", e);
- } catch (Exception e) {
- throw new OpenException("Error while opening workflow", e);
- }
-
- return workflowBundle;
- }
-
- @Override
- public List<FileType> getOpenFileTypes() {
- return Arrays.<FileType> asList(new T2FlowFileType());
- }
-
- @Override
- public List<Class<?>> getOpenSourceTypes() {
- return Arrays.<Class<?>> asList(InputStream.class, URL.class,
- File.class);
- }
-
- public void setWorkflowBundleIO(WorkflowBundleIO workflowBundleIO) {
- this.workflowBundleIO = workflowBundleIO;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2FileFilter.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2FileFilter.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2FileFilter.java
deleted file mode 100644
index 62b5892..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2FileFilter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-/**
- *
- */
-package net.sf.taverna.t2.workbench.file.impl;
-
-import java.io.File;
-
-import javax.swing.filechooser.FileFilter;
-
-public class T2FileFilter extends FileFilter {
- @Override
- public boolean accept(final File file) {
- return file.getName().toLowerCase().endsWith(".t2flow");
- }
-
- @Override
- public String getDescription() {
- return "Taverna 2 workflows";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2FlowFileType.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2FlowFileType.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2FlowFileType.java
deleted file mode 100644
index cb2b399..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2FlowFileType.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl;
-
-import org.apache.taverna.workbench.file.FileType;
-
-public class T2FlowFileType extends FileType {
- public static final String APPLICATION_VND_TAVERNA_T2FLOW_XML = "application/vnd.taverna.t2flow+xml";
-
- @Override
- public String getDescription() {
- return "Taverna 2 workflow";
- }
-
- @Override
- public String getExtension() {
- return "t2flow";
- }
-
- @Override
- public String getMimeType() {
- return APPLICATION_VND_TAVERNA_T2FLOW_XML;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleFileFilter.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleFileFilter.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleFileFilter.java
deleted file mode 100644
index d272b41..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleFileFilter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-/**
- *
- */
-package net.sf.taverna.t2.workbench.file.impl;
-
-import java.io.File;
-
-import javax.swing.filechooser.FileFilter;
-
-public class WorkflowBundleFileFilter extends FileFilter {
- @Override
- public boolean accept(final File file) {
- return file.getName().toLowerCase().endsWith(".wfbundle");
- }
-
- @Override
- public String getDescription() {
- return "Taverna 3 workflows";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleFileType.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleFileType.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleFileType.java
deleted file mode 100644
index ad50f79..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleFileType.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl;
-
-import org.apache.taverna.workbench.file.FileType;
-
-public class WorkflowBundleFileType extends FileType {
- public static final String APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE = "application/vnd.taverna.scufl2.workflow-bundle";
-
- @Override
- public String getDescription() {
- return "Taverna 3 workflow";
- }
-
- @Override
- public String getExtension() {
- return "wfbundle";
- }
-
- @Override
- public String getMimeType() {
- return APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleOpener.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleOpener.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleOpener.java
deleted file mode 100644
index 6092dad..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleOpener.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
-import org.apache.taverna.workbench.file.DataflowInfo;
-import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.exceptions.OpenException;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.io.ReaderException;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-
-public class WorkflowBundleOpener extends AbstractDataflowPersistenceHandler
- implements DataflowPersistenceHandler {
- private static final WorkflowBundleFileType WF_BUNDLE_FILE_TYPE = new WorkflowBundleFileType();
- private static Logger logger = Logger.getLogger(WorkflowBundleOpener.class);
- private WorkflowBundleIO workflowBundleIO;
-
- @SuppressWarnings("resource")
- @Override
- public DataflowInfo openDataflow(FileType fileType, Object source)
- throws OpenException {
- if (!getOpenFileTypes().contains(fileType))
- throw new OpenException("Unsupported file type " + fileType);
- InputStream inputStream;
- Date lastModified = null;
- Object canonicalSource = source;
- if (source instanceof InputStream) {
- inputStream = (InputStream) source;
- } else if (source instanceof File) {
- try {
- inputStream = new FileInputStream((File) source);
- } catch (FileNotFoundException e) {
- throw new OpenException("Could not open file " + source + ":\n"
- + e.getLocalizedMessage(), e);
- }
- } else if (source instanceof URL) {
- URL url = ((URL) source);
- try {
- URLConnection connection = url.openConnection();
- connection.setRequestProperty("Accept", "application/zip");
- inputStream = connection.getInputStream();
- if (connection.getLastModified() != 0)
- lastModified = new Date(connection.getLastModified());
- } catch (IOException e) {
- throw new OpenException("Could not open connection to URL "
- + source + ":\n" + e.getLocalizedMessage(), e);
- }
- try {
- if (url.getProtocol().equalsIgnoreCase("file"))
- canonicalSource = new File(url.toURI());
- } catch (URISyntaxException e) {
- logger.warn("Invalid file URI created from " + url);
- }
- } else
- throw new OpenException("Unsupported source type "
- + source.getClass());
-
- final WorkflowBundle workflowBundle;
- try {
- workflowBundle = openDataflowStream(inputStream);
- } finally {
- // We created the stream, we'll close it
- try {
- if (!(source instanceof InputStream))
- inputStream.close();
- } catch (IOException ex) {
- logger.warn("Could not close inputstream " + inputStream, ex);
- }
- }
- if (canonicalSource instanceof File)
- return new FileDataflowInfo(WF_BUNDLE_FILE_TYPE,
- (File) canonicalSource, workflowBundle);
- return new DataflowInfo(WF_BUNDLE_FILE_TYPE, canonicalSource,
- workflowBundle, lastModified);
- }
-
- protected WorkflowBundle openDataflowStream(InputStream inputStream)
- throws OpenException {
- WorkflowBundle workflowBundle;
- try {
- workflowBundle = workflowBundleIO.readBundle(inputStream, null);
- } catch (ReaderException e) {
- throw new OpenException("Could not read the workflow", e);
- } catch (IOException e) {
- throw new OpenException("Could not open the workflow for parsing",
- e);
- } catch (Exception e) {
- throw new OpenException("Error while opening workflow", e);
- }
-
- return workflowBundle;
- }
-
- @Override
- public List<FileType> getOpenFileTypes() {
- return Arrays.<FileType> asList(WF_BUNDLE_FILE_TYPE);
- }
-
- @Override
- public List<Class<?>> getOpenSourceTypes() {
- return Arrays.<Class<?>> asList(InputStream.class, URL.class,
- File.class);
- }
-
- public void setWorkflowBundleIO(WorkflowBundleIO workflowBundleIO) {
- this.workflowBundleIO = workflowBundleIO;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleSaver.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleSaver.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleSaver.java
deleted file mode 100644
index 3933e67..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleSaver.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl;
-
-import static net.sf.taverna.t2.workbench.file.impl.WorkflowBundleFileType.APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
-import org.apache.taverna.workbench.file.DataflowInfo;
-import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.exceptions.SaveException;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-
-public class WorkflowBundleSaver extends AbstractDataflowPersistenceHandler
- implements DataflowPersistenceHandler {
- private static final WorkflowBundleFileType WF_BUNDLE_FILE_TYPE = new WorkflowBundleFileType();
- private static Logger logger = Logger.getLogger(WorkflowBundleSaver.class);
- private WorkflowBundleIO workflowBundleIO;
-
- @Override
- public DataflowInfo saveDataflow(WorkflowBundle workflowBundle, FileType fileType,
- Object destination) throws SaveException {
- if (!getSaveFileTypes().contains(fileType))
- throw new IllegalArgumentException("Unsupported file type "
- + fileType);
- OutputStream outStream;
- if (destination instanceof File)
- try {
- outStream = new FileOutputStream((File) destination);
- } catch (FileNotFoundException e) {
- throw new SaveException("Can't create workflow file "
- + destination + ":\n" + e.getLocalizedMessage(), e);
- }
- else if (destination instanceof OutputStream)
- outStream = (OutputStream) destination;
- else
- throw new SaveException("Unsupported destination type "
- + destination.getClass());
-
- try {
- saveDataflowToStream(workflowBundle, outStream);
- } finally {
- try {
- // Only close if we opened the stream
- if (!(destination instanceof OutputStream))
- outStream.close();
- } catch (IOException e) {
- logger.warn("Could not close stream", e);
- }
- }
-
- if (destination instanceof File)
- return new FileDataflowInfo(WF_BUNDLE_FILE_TYPE, (File) destination,
- workflowBundle);
- return new DataflowInfo(WF_BUNDLE_FILE_TYPE, destination, workflowBundle);
- }
-
- protected void saveDataflowToStream(WorkflowBundle workflowBundle,
- OutputStream fileOutStream) throws SaveException {
- try {
- workflowBundleIO.writeBundle(workflowBundle, fileOutStream,
- APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
- } catch (Exception e) {
- throw new SaveException("Can't write workflow:\n"
- + e.getLocalizedMessage(), e);
- }
- }
-
- @Override
- public List<FileType> getSaveFileTypes() {
- return Arrays.<FileType> asList(WF_BUNDLE_FILE_TYPE);
- }
-
- @Override
- public List<Class<?>> getSaveDestinationTypes() {
- return Arrays.<Class<?>> asList(File.class, OutputStream.class);
- }
-
- @Override
- public boolean wouldOverwriteDataflow(WorkflowBundle workflowBundle, FileType fileType,
- Object destination, DataflowInfo lastDataflowInfo) {
- if (!getSaveFileTypes().contains(fileType))
- throw new IllegalArgumentException("Unsupported file type "
- + fileType);
- if (!(destination instanceof File))
- return false;
-
- File file;
- try {
- file = ((File) destination).getCanonicalFile();
- } catch (IOException e) {
- return false;
- }
- if (!file.exists())
- return false;
- if (lastDataflowInfo == null)
- return true;
- Object lastDestination = lastDataflowInfo.getCanonicalSource();
- if (!(lastDestination instanceof File))
- return true;
- File lastFile = (File) lastDestination;
- if (!lastFile.getAbsoluteFile().equals(file))
- return true;
-
- Date lastModified = new Date(file.lastModified());
- if (lastModified.equals(lastDataflowInfo.getLastModified()))
- return false;
- return true;
- }
-
- public void setWorkflowBundleIO(WorkflowBundleIO workflowBundleIO) {
- this.workflowBundleIO = workflowBundleIO;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseAllWorkflowsAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseAllWorkflowsAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseAllWorkflowsAction.java
deleted file mode 100644
index 337d9a3..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseAllWorkflowsAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.actions;
-
-import static java.awt.Toolkit.getDefaultToolkit;
-import static java.awt.event.InputEvent.SHIFT_DOWN_MASK;
-import static java.awt.event.KeyEvent.VK_L;
-import static java.awt.event.KeyEvent.VK_W;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.closeAllIcon;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.util.Collections;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.file.FileManager;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-@SuppressWarnings("serial")
-public class CloseAllWorkflowsAction extends AbstractAction {
- @SuppressWarnings("unused")
- private static Logger logger = Logger.getLogger(CloseWorkflowAction.class);
- private static final String CLOSE_ALL_WORKFLOWS = "Close all workflows";
- private FileManager fileManager;
- private CloseWorkflowAction closeWorkflowAction;
-
- public CloseAllWorkflowsAction(EditManager editManager, FileManager fileManager) {
- super(CLOSE_ALL_WORKFLOWS, closeAllIcon);
- this.fileManager = fileManager;
- closeWorkflowAction = new CloseWorkflowAction(editManager, fileManager);
- putValue(
- ACCELERATOR_KEY,
- getKeyStroke(VK_W, getDefaultToolkit().getMenuShortcutKeyMask()
- | SHIFT_DOWN_MASK));
- putValue(MNEMONIC_KEY, VK_L);
- }
-
- @Override
- public void actionPerformed(ActionEvent event) {
- Component parentComponent = null;
- if (event.getSource() instanceof Component)
- parentComponent = (Component) event.getSource();
- closeAllWorkflows(parentComponent);
- }
-
- public boolean closeAllWorkflows(Component parentComponent) {
- // Close in reverse so we can save nested workflows first
- List<WorkflowBundle> workflowBundles = fileManager.getOpenDataflows();
-
- Collections.reverse(workflowBundles);
-
- for (WorkflowBundle workflowBundle : workflowBundles) {
- boolean success = closeWorkflowAction.closeWorkflow(
- parentComponent, workflowBundle);
- if (!success)
- return false;
- }
- return true;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseWorkflowAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseWorkflowAction.java
deleted file mode 100644
index b696fae..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseWorkflowAction.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.actions;
-
-import static java.awt.Toolkit.getDefaultToolkit;
-import static java.awt.event.KeyEvent.VK_C;
-import static java.awt.event.KeyEvent.VK_W;
-import static javax.swing.JOptionPane.CANCEL_OPTION;
-import static javax.swing.JOptionPane.NO_OPTION;
-import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
-import static javax.swing.JOptionPane.YES_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.closeIcon;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.exceptions.UnsavedException;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-@SuppressWarnings("serial")
-public class CloseWorkflowAction extends AbstractAction {
- private static Logger logger = Logger.getLogger(CloseWorkflowAction.class);
- private static final String CLOSE_WORKFLOW = "Close workflow";
- private final SaveWorkflowAction saveWorkflowAction;
- private FileManager fileManager;
-
- public CloseWorkflowAction(EditManager editManager, FileManager fileManager) {
- super(CLOSE_WORKFLOW, closeIcon);
- this.fileManager = fileManager;
- saveWorkflowAction = new SaveWorkflowAction(editManager, fileManager);
- putValue(
- ACCELERATOR_KEY,
- getKeyStroke(VK_W, getDefaultToolkit().getMenuShortcutKeyMask()));
- putValue(MNEMONIC_KEY, VK_C);
-
- }
- @Override
- public void actionPerformed(ActionEvent e) {
- Component parentComponent = null;
- if (e.getSource() instanceof Component)
- parentComponent = (Component) e.getSource();
- closeWorkflow(parentComponent, fileManager.getCurrentDataflow());
- }
-
- public boolean closeWorkflow(Component parentComponent, WorkflowBundle workflowBundle) {
- if (workflowBundle == null) {
- logger.warn("Attempted to close a null workflow");
- return false;
- }
-
- try {
- return fileManager.closeDataflow(workflowBundle, true);
- } catch (UnsavedException e1) {
- fileManager.setCurrentDataflow(workflowBundle);
- String msg = "Do you want to save changes before closing the workflow "
- + fileManager.getDataflowName(workflowBundle) + "?";
- switch (showConfirmDialog(parentComponent, msg, "Save workflow?",
- YES_NO_CANCEL_OPTION)) {
- case NO_OPTION:
- try {
- fileManager.closeDataflow(workflowBundle, false);
- return true;
- } catch (UnsavedException e2) {
- logger.error("Unexpected UnsavedException while "
- + "closing workflow", e2);
- return false;
- }
- case YES_OPTION:
- boolean saved = saveWorkflowAction.saveDataflow(
- parentComponent, workflowBundle);
- if (!saved)
- return false;
- return closeWorkflow(parentComponent, workflowBundle);
- case CANCEL_OPTION:
- default:
- return false;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/NewWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/NewWorkflowAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/NewWorkflowAction.java
deleted file mode 100644
index 3497d77..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/NewWorkflowAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.actions;
-
-import static java.awt.Toolkit.getDefaultToolkit;
-import static java.awt.event.KeyEvent.VK_N;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.newIcon;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-
-import javax.swing.AbstractAction;
-
-import org.apache.taverna.workbench.file.FileManager;
-
-import org.apache.log4j.Logger;
-
-@SuppressWarnings("serial")
-public class NewWorkflowAction extends AbstractAction {
- @SuppressWarnings("unused")
- private static Logger logger = Logger.getLogger(NewWorkflowAction.class);
- private static final String NEW_WORKFLOW = "New workflow";
- private FileManager fileManager;
-
- public NewWorkflowAction(FileManager fileManager) {
- super(NEW_WORKFLOW, newIcon);
- this.fileManager = fileManager;
- putValue(SHORT_DESCRIPTION, NEW_WORKFLOW);
- putValue(MNEMONIC_KEY, KeyEvent.VK_N);
- putValue(
- ACCELERATOR_KEY,
- getKeyStroke(VK_N, getDefaultToolkit().getMenuShortcutKeyMask()));
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- fileManager.newDataflow();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenNestedWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenNestedWorkflowAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenNestedWorkflowAction.java
deleted file mode 100644
index 91c9caa..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenNestedWorkflowAction.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.actions;
-
-import java.awt.Component;
-import java.io.File;
-
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.exceptions.OpenException;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * An action for opening a nested workflow from a file.
- *
- * @author Alex Nenadic
- */
-public class OpenNestedWorkflowAction extends OpenWorkflowAction {
- private static final long serialVersionUID = -5398423684000142379L;
- private static Logger logger = Logger
- .getLogger(OpenNestedWorkflowAction.class);
-
- public OpenNestedWorkflowAction(FileManager fileManager) {
- super(fileManager);
- }
-
- /**
- * Opens a nested workflow from a file (should be one file even though the
- * method takes a list of files - this is because it overrides the
- * {@link OpenWorkflowAction#openWorkflows(Component, File[], FileType, OpenCallback)
- * openWorkflows(...)} method).
- */
- @Override
- public void openWorkflows(final Component parentComponent, File[] files,
- FileType fileType, OpenCallback openCallback) {
- ErrorLoggingOpenCallbackWrapper callback = new ErrorLoggingOpenCallbackWrapper(
- openCallback);
- for (File file : files)
- try {
- callback.aboutToOpenDataflow(file);
- WorkflowBundle workflowBundle = fileManager.openDataflow(
- fileType, file);
- callback.openedDataflow(file, workflowBundle);
- } catch (final RuntimeException ex) {
- logger.warn("Could not open workflow from " + file, ex);
- if (!callback.couldNotOpenDataflow(file, ex))
- showErrorMessage(parentComponent, file, ex);
- } catch (final OpenException ex) {
- logger.warn("Could not open workflow from " + file, ex);
- if (!callback.couldNotOpenDataflow(file, ex))
- showErrorMessage(parentComponent, file, ex);
- return;
- }
- }
-}
[11/11] incubator-taverna-workbench git commit:
Posted by re...@apache.org.
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/commit/bf8a7ea2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/tree/bf8a7ea2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/diff/bf8a7ea2
Branch: refs/heads/master
Commit: bf8a7ea28576c03e8ad7cf06e444a3234f528f17
Parents: a9a52bd
Author: Dmitry Repchevsky <re...@list.ru>
Authored: Fri Mar 27 16:33:01 2015 +0100
Committer: Dmitry Repchevsky <re...@list.ru>
Committed: Fri Mar 27 16:33:01 2015 +0100
----------------------------------------------------------------------
.../ActivityPaletteConfigurationTest.java | 1 -
taverna-configuration-impl/pom.xml | 5 +
.../menu/AddNestedWorkflowMenuAction.java | 2 +-
.../gui/ImportWizardLauncher.java | 2 +-
.../DisabledActivityConfigurationAction.java | 2 +
.../disabled/views/DisabledConfigView.java | 1 +
taverna-edits-api/pom.xml | 18 +-
.../AbstractDataflowPersistenceHandler.java | 39 +-
.../taverna/workbench/file/DataflowInfo.java | 39 +-
.../file/DataflowPersistenceHandler.java | 39 +-
.../taverna/workbench/file/FileManager.java | 39 +-
.../apache/taverna/workbench/file/FileType.java | 39 +-
.../file/events/AbstractDataflowEvent.java | 39 +-
.../file/events/ClosedDataflowEvent.java | 39 +-
.../file/events/ClosingDataflowEvent.java | 39 +-
.../workbench/file/events/FileManagerEvent.java | 39 +-
.../file/events/OpenedDataflowEvent.java | 39 +-
.../file/events/SavedDataflowEvent.java | 39 +-
.../file/events/SetCurrentDataflowEvent.java | 39 +-
.../file/exceptions/FileException.java | 39 +-
.../file/exceptions/OpenException.java | 39 +-
.../file/exceptions/OverwriteException.java | 39 +-
.../file/exceptions/SaveException.java | 39 +-
.../file/exceptions/UnsavedException.java | 39 +-
.../DataflowFromDataflowPersistenceHandler.java | 49 --
.../DataflowPersistenceHandlerRegistry.java | 238 --------
.../workbench/file/impl/FileDataflowInfo.java | 67 ---
.../t2/workbench/file/impl/FileManagerImpl.java | 601 -------------------
.../workbench/file/impl/FileTypeFileFilter.java | 55 --
.../workbench/file/impl/MultipleFileTypes.java | 58 --
.../file/impl/OpenDataflowInProgressDialog.java | 88 ---
.../workbench/file/impl/OpenDataflowInfo.java | 93 ---
.../file/impl/OpenDataflowRunnable.java | 71 ---
.../file/impl/OpenDataflowSwingWorker.java | 67 ---
.../workbench/file/impl/T2DataflowOpener.java | 144 -----
.../t2/workbench/file/impl/T2FileFilter.java | 40 --
.../t2/workbench/file/impl/T2FlowFileType.java | 42 --
.../file/impl/WorkflowBundleFileFilter.java | 40 --
.../file/impl/WorkflowBundleFileType.java | 42 --
.../file/impl/WorkflowBundleOpener.java | 143 -----
.../file/impl/WorkflowBundleSaver.java | 145 -----
.../impl/actions/CloseAllWorkflowsAction.java | 85 ---
.../file/impl/actions/CloseWorkflowAction.java | 107 ----
.../file/impl/actions/NewWorkflowAction.java | 58 --
.../impl/actions/OpenNestedWorkflowAction.java | 76 ---
.../file/impl/actions/OpenWorkflowAction.java | 395 ------------
.../impl/actions/OpenWorkflowFromURLAction.java | 139 -----
.../file/impl/actions/PasswordInput.java | 221 -------
.../impl/actions/SaveAllWorkflowsAction.java | 104 ----
.../file/impl/actions/SaveWorkflowAction.java | 175 ------
.../file/impl/actions/SaveWorkflowAsAction.java | 219 -------
.../impl/hooks/CloseWorkflowsOnShutdown.java | 56 --
.../file/impl/menu/FileCloseAllMenuAction.java | 51 --
.../file/impl/menu/FileCloseMenuAction.java | 50 --
.../file/impl/menu/FileNewMenuAction.java | 47 --
.../impl/menu/FileOpenFromURLMenuAction.java | 48 --
.../file/impl/menu/FileOpenMenuAction.java | 47 --
.../file/impl/menu/FileOpenMenuSection.java | 36 --
.../impl/menu/FileOpenRecentMenuAction.java | 418 -------------
.../file/impl/menu/FileSaveAllMenuAction.java | 47 --
.../file/impl/menu/FileSaveAsMenuAction.java | 43 --
.../file/impl/menu/FileSaveMenuAction.java | 46 --
.../file/impl/menu/FileSaveMenuSection.java | 36 --
.../workbench/file/impl/menu/WorkflowsMenu.java | 163 -----
.../file/impl/toolbar/CloseToolbarAction.java | 55 --
.../impl/toolbar/FileToolbarMenuSection.java | 36 --
.../file/impl/toolbar/NewToolbarAction.java | 47 --
.../file/impl/toolbar/OpenToolbarAction.java | 47 --
.../OpenWorkflowFromURLToolbarAction.java | 47 --
.../file/impl/toolbar/SaveToolbarAction.java | 50 --
.../DataflowFromDataflowPersistenceHandler.java | 65 ++
.../DataflowPersistenceHandlerRegistry.java | 237 ++++++++
.../workbench/file/impl/FileDataflowInfo.java | 66 ++
.../workbench/file/impl/FileManagerImpl.java | 600 ++++++++++++++++++
.../workbench/file/impl/FileTypeFileFilter.java | 54 ++
.../workbench/file/impl/MultipleFileTypes.java | 57 ++
.../file/impl/OpenDataflowInProgressDialog.java | 86 +++
.../workbench/file/impl/OpenDataflowInfo.java | 92 +++
.../file/impl/OpenDataflowRunnable.java | 87 +++
.../file/impl/OpenDataflowSwingWorker.java | 66 ++
.../workbench/file/impl/T2DataflowOpener.java | 143 +++++
.../workbench/file/impl/T2FileFilter.java | 36 ++
.../workbench/file/impl/T2FlowFileType.java | 41 ++
.../file/impl/WorkflowBundleFileFilter.java | 36 ++
.../file/impl/WorkflowBundleFileType.java | 41 ++
.../file/impl/WorkflowBundleOpener.java | 142 +++++
.../file/impl/WorkflowBundleSaver.java | 144 +++++
.../impl/actions/CloseAllWorkflowsAction.java | 84 +++
.../file/impl/actions/CloseWorkflowAction.java | 106 ++++
.../file/impl/actions/NewWorkflowAction.java | 57 ++
.../impl/actions/OpenNestedWorkflowAction.java | 75 +++
.../file/impl/actions/OpenWorkflowAction.java | 394 ++++++++++++
.../impl/actions/OpenWorkflowFromURLAction.java | 138 +++++
.../file/impl/actions/PasswordInput.java | 220 +++++++
.../impl/actions/SaveAllWorkflowsAction.java | 103 ++++
.../file/impl/actions/SaveWorkflowAction.java | 174 ++++++
.../file/impl/actions/SaveWorkflowAsAction.java | 218 +++++++
.../impl/hooks/CloseWorkflowsOnShutdown.java | 55 ++
.../file/impl/menu/FileCloseAllMenuAction.java | 50 ++
.../file/impl/menu/FileCloseMenuAction.java | 49 ++
.../file/impl/menu/FileNewMenuAction.java | 46 ++
.../impl/menu/FileOpenFromURLMenuAction.java | 47 ++
.../file/impl/menu/FileOpenMenuAction.java | 46 ++
.../file/impl/menu/FileOpenMenuSection.java | 35 ++
.../impl/menu/FileOpenRecentMenuAction.java | 437 ++++++++++++++
.../file/impl/menu/FileSaveAllMenuAction.java | 46 ++
.../file/impl/menu/FileSaveAsMenuAction.java | 42 ++
.../file/impl/menu/FileSaveMenuAction.java | 45 ++
.../file/impl/menu/FileSaveMenuSection.java | 35 ++
.../workbench/file/impl/menu/WorkflowsMenu.java | 162 +++++
.../file/impl/toolbar/CloseToolbarAction.java | 54 ++
.../impl/toolbar/FileToolbarMenuSection.java | 35 ++
.../file/impl/toolbar/NewToolbarAction.java | 46 ++
.../file/impl/toolbar/OpenToolbarAction.java | 46 ++
.../OpenWorkflowFromURLToolbarAction.java | 46 ++
.../file/impl/toolbar/SaveToolbarAction.java | 49 ++
.../org.apache.taverna.ui.menu.MenuComponent | 36 +-
.../org.apache.taverna.workbench.ShutdownSPI | 2 +-
...na.workbench.file.DataflowPersistenceHandler | 4 +-
...rg.apache.taverna.workbench.file.FileManager | 2 +-
.../t2/workbench/file/impl/FileManagerTest.java | 385 ------------
.../workbench/file/impl/FileManagerTest.java | 384 ++++++++++++
.../workbench/file/impl/dummy-workflow.t2flow | 157 -----
.../workbench/file/impl/dummy-workflow.t2flow | 157 +++++
taverna-graph-model/pom.xml | 5 -
.../views/graph/AutoScrollInteractor.java | 181 ------
.../views/graph/GraphViewComponent.java | 548 -----------------
.../views/graph/GraphViewComponentFactory.java | 100 ---
.../views/graph/actions/AddWFInputAction.java | 69 ---
.../views/graph/actions/AddWFOutputAction.java | 69 ---
.../actions/DeleteGraphComponentAction.java | 180 ------
.../RenameWFInputOutputProcessorAction.java | 184 ------
.../graph/config/GraphViewConfiguration.java | 80 ---
.../config/GraphViewConfigurationPanel.java | 360 -----------
.../config/GraphViewConfigurationUIFactory.java | 55 --
.../views/graph/menu/AddWFInputMenuAction.java | 60 --
.../views/graph/menu/AddWFOutputMenuAction.java | 60 --
.../menu/DeleteGraphComponentMenuAction.java | 61 --
.../workbench/views/graph/menu/DiagramMenu.java | 44 --
.../graph/menu/DiagramSaveMenuSection.java | 39 --
.../graph/menu/DiagramZoomMenuSection.java | 40 --
.../views/graph/menu/GraphCopyMenuSection.java | 39 --
.../graph/menu/GraphDeleteMenuSection.java | 39 --
.../graph/menu/GraphDetailsMenuSection.java | 40 --
.../views/graph/menu/GraphEditMenuSection.java | 39 --
.../views/graph/menu/GraphMenuSection.java | 39 --
.../workbench/views/graph/menu/InsertMenu.java | 30 -
.../RenameWFInputOutputProcessorMenuAction.java | 62 --
.../views/graph/menu/ResetDiagramAction.java | 64 --
.../graph/menu/ResetDiagramMenuAction.java | 50 --
.../views/graph/menu/SaveGraphImageSubMenu.java | 315 ----------
.../views/graph/menu/ZoomInAction.java | 72 ---
.../views/graph/menu/ZoomInMenuAction.java | 50 --
.../views/graph/menu/ZoomOutAction.java | 65 --
.../views/graph/menu/ZoomOutMenuAction.java | 50 --
.../graph/toolbar/AddWFInputToolbarAction.java | 60 --
.../graph/toolbar/AddWFOutputToolbarAction.java | 60 --
.../DeleteGraphComponentToolbarAction.java | 60 --
.../toolbar/GraphDeleteToolbarSection.java | 39 --
.../graph/toolbar/GraphEditToolbarSection.java | 39 --
...nameWFInputOutputProcessorToolbarAction.java | 63 --
.../views/graph/AutoScrollInteractor.java | 200 ++++++
.../views/graph/GraphViewComponent.java | 547 +++++++++++++++++
.../views/graph/GraphViewComponentFactory.java | 99 +++
.../views/graph/actions/AddWFInputAction.java | 68 +++
.../views/graph/actions/AddWFOutputAction.java | 68 +++
.../actions/DeleteGraphComponentAction.java | 179 ++++++
.../RenameWFInputOutputProcessorAction.java | 183 ++++++
.../graph/config/GraphViewConfiguration.java | 79 +++
.../config/GraphViewConfigurationPanel.java | 359 +++++++++++
.../config/GraphViewConfigurationUIFactory.java | 54 ++
.../views/graph/menu/AddWFInputMenuAction.java | 59 ++
.../views/graph/menu/AddWFOutputMenuAction.java | 59 ++
.../menu/DeleteGraphComponentMenuAction.java | 60 ++
.../workbench/views/graph/menu/DiagramMenu.java | 43 ++
.../graph/menu/DiagramSaveMenuSection.java | 38 ++
.../graph/menu/DiagramZoomMenuSection.java | 39 ++
.../views/graph/menu/GraphCopyMenuSection.java | 38 ++
.../graph/menu/GraphDeleteMenuSection.java | 38 ++
.../graph/menu/GraphDetailsMenuSection.java | 39 ++
.../views/graph/menu/GraphEditMenuSection.java | 38 ++
.../views/graph/menu/GraphMenuSection.java | 38 ++
.../workbench/views/graph/menu/InsertMenu.java | 46 ++
.../RenameWFInputOutputProcessorMenuAction.java | 61 ++
.../views/graph/menu/ResetDiagramAction.java | 63 ++
.../graph/menu/ResetDiagramMenuAction.java | 49 ++
.../views/graph/menu/SaveGraphImageSubMenu.java | 314 ++++++++++
.../views/graph/menu/ZoomInAction.java | 71 +++
.../views/graph/menu/ZoomInMenuAction.java | 49 ++
.../views/graph/menu/ZoomOutAction.java | 64 ++
.../views/graph/menu/ZoomOutMenuAction.java | 49 ++
.../graph/toolbar/AddWFInputToolbarAction.java | 59 ++
.../graph/toolbar/AddWFOutputToolbarAction.java | 59 ++
.../DeleteGraphComponentToolbarAction.java | 59 ++
.../toolbar/GraphDeleteToolbarSection.java | 38 ++
.../graph/toolbar/GraphEditToolbarSection.java | 38 ++
...nameWFInputOutputProcessorToolbarAction.java | 62 ++
.../org.apache.taverna.ui.menu.MenuComponent | 50 +-
...rkbench.configuration.ConfigurationUIFactory | 2 +-
...rna.workbench.ui.zaria.UIComponentFactorySPI | 2 +-
...he.taverna.workbench.ui.zaria.UIComponentSPI | 2 +-
.../src/test/resources/nested_iteration.t2flow | 54 +-
taverna-httpproxy-config/pom.xml | 11 +-
.../config/HttpProxyConfigurationPanel.java | 2 +-
.../config/HttpProxyConfigurationUIFactory.java | 2 +-
taverna-loop-ui/pom.xml | 8 +-
.../workbench/loop/LoopConfigurationPanel.java | 4 +-
.../workbench/loop/LoopConfigureAction.java | 2 +
.../workbench/loop/LoopConfigureMenuAction.java | 1 +
.../workbench/loop/LoopRemoveMenuAction.java | 1 +
.../workbench/loop/ShowContextualView.java | 2 +-
taverna-menu-items/pom.xml | 22 +-
.../AddInputPortDefaultValueAction.java | 2 +-
taverna-monitor-view/pom.xml | 12 +-
.../monitor/graph/MonitorGraphComponent.java | 8 +-
.../WorkflowRunProgressTreeTable.java | 2 +-
taverna-perspective-design/pom.xml | 5 -
.../myexperiment/MainComponent.java | 4 +-
.../myexperiment/MainComponentShutdownHook.java | 2 +-
.../myexperiment/model/Base64$InputStream.class | Bin 2083 -> 0 bytes
.../model/Base64$OutputStream.class | Bin 2307 -> 0 bytes
.../myexperiment/model/Base64.class | Bin 15458 -> 0 bytes
.../perspectives/myexperiment/model/Base64.java | 2 +-
.../myexperiment/model/MyExperimentClient.class | Bin 3174 -> 0 bytes
.../results/ResultsPerspectiveComponent.java | 8 +-
taverna-renderers-exts/pom.xml | 5 +
.../apache/taverna/renderers/PDFRenderer.java | 3 -
.../taverna/renderers/SeqVistaRenderer.java | 3 -
.../report/explainer/BasicExplainer.java | 16 +-
.../report/impl/ReportManagerImpl.java | 12 +-
.../workbench/ui/impl/WorkbenchImpl.java | 20 +-
taverna-workflow-explorer/pom.xml | 6 +-
232 files changed, 9386 insertions(+), 9391 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-activity-palette-impl/src/test/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationTest.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/test/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationTest.java b/taverna-activity-palette-impl/src/test/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationTest.java
index 51dcacb..b9d326a 100644
--- a/taverna-activity-palette-impl/src/test/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationTest.java
+++ b/taverna-activity-palette-impl/src/test/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationTest.java
@@ -20,7 +20,6 @@
******************************************************************************/
package org.apache.taverna.workbench.ui.activitypalette;
-import org.apache.taverna.workbench.ui.activitypalette.ActivityPaletteConfiguration;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-configuration-impl/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/pom.xml b/taverna-configuration-impl/pom.xml
index 56b57df..2b19bc4 100644
--- a/taverna-configuration-impl/pom.xml
+++ b/taverna-configuration-impl/pom.xml
@@ -42,6 +42,11 @@
<artifactId>taverna-configuration-ui-api</artifactId>
<version>${project.parent.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>taverna-configuration-ui-impl</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.taverna.osgi</groupId>
<artifactId>taverna-configuration-api</artifactId>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/AddNestedWorkflowMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/AddNestedWorkflowMenuAction.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/AddNestedWorkflowMenuAction.java
index 759d24a..8b17e23 100644
--- a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/AddNestedWorkflowMenuAction.java
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/AddNestedWorkflowMenuAction.java
@@ -35,7 +35,7 @@ import org.apache.taverna.workbench.edits.EditManager;
import org.apache.taverna.workbench.file.FileManager;
import org.apache.taverna.workbench.file.importworkflow.actions.AddNestedWorkflowAction;
import org.apache.taverna.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.views.graph.menu.InsertMenu;
+import org.apache.taverna.workbench.views.graph.menu.InsertMenu;
/**
* An action to add a nested workflow activity + a wrapping processor to the
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/gui/ImportWizardLauncher.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/gui/ImportWizardLauncher.java b/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/gui/ImportWizardLauncher.java
index 96f67bf..52a04b9 100644
--- a/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/gui/ImportWizardLauncher.java
+++ b/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/gui/ImportWizardLauncher.java
@@ -6,7 +6,7 @@ import javax.swing.UIManager;
import org.apache.taverna.workbench.edits.EditManager;
import org.apache.taverna.workbench.edits.impl.EditManagerImpl;
import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.FileManagerImpl;
+import org.apache.taverna.workbench.file.impl.FileManagerImpl;
public class ImportWizardLauncher {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/actions/DisabledActivityConfigurationAction.java
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/actions/DisabledActivityConfigurationAction.java b/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/actions/DisabledActivityConfigurationAction.java
index da38c6c..043447f 100644
--- a/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/actions/DisabledActivityConfigurationAction.java
+++ b/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/actions/DisabledActivityConfigurationAction.java
@@ -33,11 +33,13 @@ import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.activities.disabled.views.DisabledConfigView;
import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.Edit;
import org.apache.taverna.workbench.edits.EditManager;
import org.apache.taverna.workbench.file.FileManager;
import org.apache.taverna.workbench.report.ReportManager;
import org.apache.taverna.workbench.ui.actions.activity.ActivityConfigurationAction;
import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
+import org.apache.taverna.workflowmodel.Dataflow;
@SuppressWarnings("serial")
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledConfigView.java
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledConfigView.java b/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledConfigView.java
index b3ec316..2b0abda 100644
--- a/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledConfigView.java
+++ b/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledConfigView.java
@@ -40,6 +40,7 @@ import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityCo
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
+import org.apache.taverna.workflowmodel.processor.activity.ActivityAndBeanWrapper;
@SuppressWarnings("serial")
public class DisabledConfigView extends ActivityConfigurationPanel {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-edits-api/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-edits-api/pom.xml b/taverna-edits-api/pom.xml
index 3ca3a59..8ed6670 100644
--- a/taverna-edits-api/pom.xml
+++ b/taverna-edits-api/pom.xml
@@ -15,14 +15,16 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<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">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.workbench</groupId>
- <artifactId>taverna-workbench</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
- </parent>
+<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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-workbench</artifactId>
+ <version>3.1.0-incubating-SNAPSHOT</version>
+ </parent>
+
<artifactId>taverna-edits-api</artifactId>
<packaging>bundle</packaging>
<name>Apache Edits API</name>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/AbstractDataflowPersistenceHandler.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/AbstractDataflowPersistenceHandler.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/AbstractDataflowPersistenceHandler.java
index 71a3c12..3dcec1c 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/AbstractDataflowPersistenceHandler.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/AbstractDataflowPersistenceHandler.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file;
import java.util.Collections;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowInfo.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowInfo.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowInfo.java
index b841aa9..0b24212 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowInfo.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowInfo.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file;
import java.util.Date;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowPersistenceHandler.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowPersistenceHandler.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowPersistenceHandler.java
index b3cc260..5480c9b 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowPersistenceHandler.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowPersistenceHandler.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file;
import java.io.File;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileManager.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileManager.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileManager.java
index 7626de5..a4ac86a 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileManager.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileManager.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file;
import java.io.File;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileType.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileType.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileType.java
index ef2d53c..93fcf99 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileType.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileType.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/AbstractDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/AbstractDataflowEvent.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/AbstractDataflowEvent.java
index fa97fe0..93ad5f1 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/AbstractDataflowEvent.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/AbstractDataflowEvent.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file.events;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosedDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosedDataflowEvent.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosedDataflowEvent.java
index ac69c89..8b70385 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosedDataflowEvent.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosedDataflowEvent.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file.events;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosingDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosingDataflowEvent.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosingDataflowEvent.java
index 26142b5..baa1176 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosingDataflowEvent.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosingDataflowEvent.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file.events;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/FileManagerEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/FileManagerEvent.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/FileManagerEvent.java
index 025ea97..8cd04cb 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/FileManagerEvent.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/FileManagerEvent.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file.events;
import org.apache.taverna.lang.observer.Observable;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/OpenedDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/OpenedDataflowEvent.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/OpenedDataflowEvent.java
index 31f8222..f72908e 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/OpenedDataflowEvent.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/OpenedDataflowEvent.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file.events;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SavedDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SavedDataflowEvent.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SavedDataflowEvent.java
index 70fc778..0408f16 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SavedDataflowEvent.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SavedDataflowEvent.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file.events;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SetCurrentDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SetCurrentDataflowEvent.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SetCurrentDataflowEvent.java
index cd27705..ec286b0 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SetCurrentDataflowEvent.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SetCurrentDataflowEvent.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file.events;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/FileException.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/FileException.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/FileException.java
index 67e17ac..0bfe23a 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/FileException.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/FileException.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file.exceptions;
import org.apache.taverna.workbench.file.FileManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OpenException.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OpenException.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OpenException.java
index e687c94..97649d4 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OpenException.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OpenException.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file.exceptions;
/** Indicate that something went wrong during opening a file */
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OverwriteException.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OverwriteException.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OverwriteException.java
index fff8aa0..73ff4e0 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OverwriteException.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OverwriteException.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file.exceptions;
/** Indicate that something could not be overwritten. */
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/SaveException.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/SaveException.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/SaveException.java
index 4d2866f..3b775b3 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/SaveException.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/SaveException.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file.exceptions;
/** Indicate that a workflow could not be saved. */
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/UnsavedException.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/UnsavedException.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/UnsavedException.java
index a72606d..e3bab5c 100644
--- a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/UnsavedException.java
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/UnsavedException.java
@@ -1,23 +1,22 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
package org.apache.taverna.workbench.file.exceptions;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowFromDataflowPersistenceHandler.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowFromDataflowPersistenceHandler.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowFromDataflowPersistenceHandler.java
deleted file mode 100644
index 0c498bc..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowFromDataflowPersistenceHandler.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.workbench.file.impl;
-
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
-import org.apache.taverna.workbench.file.DataflowInfo;
-import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.exceptions.OpenException;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * @author alanrw
- */
-public class DataflowFromDataflowPersistenceHandler extends
- AbstractDataflowPersistenceHandler implements
- DataflowPersistenceHandler {
- private static final WorkflowBundleFileType WORKFLOW_BUNDLE_FILE_TYPE = new WorkflowBundleFileType();
-
- @Override
- public DataflowInfo openDataflow(FileType fileType, Object source)
- throws OpenException {
- if (!getOpenFileTypes().contains(fileType))
- throw new IllegalArgumentException("Unsupported file type "
- + fileType);
-
- WorkflowBundle workflowBundle = (WorkflowBundle) source;
- Date lastModified = null;
- Object canonicalSource = null;
- return new DataflowInfo(WORKFLOW_BUNDLE_FILE_TYPE, canonicalSource,
- workflowBundle, lastModified);
- }
-
- @Override
- public List<FileType> getOpenFileTypes() {
- return Arrays.<FileType> asList(WORKFLOW_BUNDLE_FILE_TYPE);
- }
-
- @Override
- public List<Class<?>> getOpenSourceTypes() {
- return Arrays.<Class<?>> asList(Workflow.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowPersistenceHandlerRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowPersistenceHandlerRegistry.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowPersistenceHandlerRegistry.java
deleted file mode 100644
index c33119d..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowPersistenceHandlerRegistry.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl;
-
-import static org.apache.commons.collections.map.LazyMap.decorate;
-import static org.apache.commons.lang.ClassUtils.getAllInterfaces;
-import static org.apache.commons.lang.ClassUtils.getAllSuperclasses;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
-import org.apache.taverna.workbench.file.FileType;
-
-import org.apache.commons.collections.Factory;
-
-// TODO: Cache lookups / build one massive structure
-public class DataflowPersistenceHandlerRegistry {
- private static final MapFactory MAP_FACTORY = new MapFactory();
- private static final SetFactory SET_FACTORY = new SetFactory();
-
- @SuppressWarnings("unchecked")
- protected static List<Class<?>> findAllParentClasses(
- final Class<?> sourceClass) {
- List<Class<?>> superClasses = new ArrayList<>();
- superClasses.add(sourceClass);
- superClasses.addAll(getAllSuperclasses(sourceClass));
- superClasses.addAll(getAllInterfaces(sourceClass));
- return superClasses;
- }
-
- private Map<Class<?>, Set<DataflowPersistenceHandler>> openClassToHandlers;
- private Map<Class<?>, Set<FileType>> openClassToTypes;
- private Map<FileType, Map<Class<?>, Set<DataflowPersistenceHandler>>> openFileClassToHandler;
- private Map<FileType, Set<DataflowPersistenceHandler>> openFileToHandler;
- private Map<Class<?>, Set<DataflowPersistenceHandler>> saveClassToHandlers;
- private Map<Class<?>, Set<FileType>> saveClassToTypes;
- private Map<FileType, Map<Class<?>, Set<DataflowPersistenceHandler>>> saveFileClassToHandler;
- private Map<FileType, Set<DataflowPersistenceHandler>> saveFileToHandler;
-
- private List<DataflowPersistenceHandler> dataflowPersistenceHandlers;
-
- public DataflowPersistenceHandlerRegistry() {
- }
-
- public Set<FileType> getOpenFileTypes() {
- return getOpenFileClassToHandler().keySet();
- }
-
- public Set<FileType> getOpenFileTypesFor(Class<?> sourceClass) {
- Set<FileType> fileTypes = new LinkedHashSet<>();
- for (Class<?> candidateClass : findAllParentClasses(sourceClass))
- fileTypes.addAll(getOpenClassToTypes().get(candidateClass));
- return fileTypes;
- }
-
- public Set<DataflowPersistenceHandler> getOpenHandlersFor(
- Class<? extends Object> sourceClass) {
- Set<DataflowPersistenceHandler> handlers = new LinkedHashSet<>();
- for (Class<?> candidateClass : findAllParentClasses(sourceClass))
- handlers.addAll(getOpenClassToHandlers().get(candidateClass));
- return handlers;
- }
-
- public Set<DataflowPersistenceHandler> getOpenHandlersFor(
- FileType fileType, Class<? extends Object> sourceClass) {
- Set<DataflowPersistenceHandler> handlers = new LinkedHashSet<>();
- for (Class<?> candidateClass : findAllParentClasses(sourceClass))
- handlers.addAll(getOpenFileClassToHandler().get(fileType).get(
- candidateClass));
- return handlers;
- }
-
- public Set<DataflowPersistenceHandler> getOpenHandlersForType(
- FileType fileType) {
- return getOpenFileToHandler().get(fileType);
- }
-
- public synchronized Set<DataflowPersistenceHandler> getOpenHandlersForType(
- FileType fileType, Class<?> sourceClass) {
- Set<DataflowPersistenceHandler> handlers = new LinkedHashSet<>();
- for (Class<?> candidateClass : findAllParentClasses(sourceClass))
- handlers.addAll(getOpenFileClassToHandler().get(fileType).get(
- candidateClass));
- return handlers;
- }
-
- public Set<FileType> getSaveFileTypes() {
- return getSaveFileClassToHandler().keySet();
- }
-
- public Set<FileType> getSaveFileTypesFor(Class<?> destinationClass) {
- Set<FileType> fileTypes = new LinkedHashSet<>();
- for (Class<?> candidateClass : findAllParentClasses(destinationClass))
- fileTypes.addAll(getSaveClassToTypes().get(candidateClass));
- return fileTypes;
- }
-
- public Set<DataflowPersistenceHandler> getSaveHandlersFor(
- Class<? extends Object> destinationClass) {
- Set<DataflowPersistenceHandler> handlers = new LinkedHashSet<>();
- for (Class<?> candidateClass : findAllParentClasses(destinationClass))
- handlers.addAll(getSaveClassToHandlers().get(candidateClass));
- return handlers;
- }
-
- public Set<DataflowPersistenceHandler> getSaveHandlersForType(
- FileType fileType, Class<?> destinationClass) {
- Set<DataflowPersistenceHandler> handlers = new LinkedHashSet<>();
- for (Class<?> candidateClass : findAllParentClasses(destinationClass))
- handlers.addAll(getSaveFileClassToHandler().get(fileType).get(
- candidateClass));
- return handlers;
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- private synchronized void createCollections() {
- openFileClassToHandler = decorate(new HashMap(), MAP_FACTORY);
- openFileToHandler = decorate(new HashMap(), SET_FACTORY);
- openClassToTypes = decorate(new HashMap(), SET_FACTORY);
- openClassToHandlers = decorate(new HashMap(), SET_FACTORY);
-
- saveFileClassToHandler = decorate(new HashMap(), MAP_FACTORY);
- saveFileToHandler = decorate(new HashMap(), SET_FACTORY);
- saveClassToTypes = decorate(new HashMap(), SET_FACTORY);
- saveClassToHandlers = decorate(new HashMap(), SET_FACTORY);
- }
-
- private Map<Class<?>, Set<DataflowPersistenceHandler>> getOpenClassToHandlers() {
- return openClassToHandlers;
- }
-
- private synchronized Map<Class<?>, Set<FileType>> getOpenClassToTypes() {
- return openClassToTypes;
- }
-
- private synchronized Map<FileType, Map<Class<?>, Set<DataflowPersistenceHandler>>> getOpenFileClassToHandler() {
- return openFileClassToHandler;
- }
-
- private Map<FileType, Set<DataflowPersistenceHandler>> getOpenFileToHandler() {
- return openFileToHandler;
- }
-
- private Map<Class<?>, Set<DataflowPersistenceHandler>> getSaveClassToHandlers() {
- return saveClassToHandlers;
- }
-
- private synchronized Map<Class<?>, Set<FileType>> getSaveClassToTypes() {
- return saveClassToTypes;
- }
-
- private synchronized Map<FileType, Map<Class<?>, Set<DataflowPersistenceHandler>>> getSaveFileClassToHandler() {
- return saveFileClassToHandler;
- }
-
- /**
- * Bind method for SpringDM.
- *
- * @param service
- * @param properties
- */
- public void update(Object service, Map<?, ?> properties) {
- if (dataflowPersistenceHandlers != null)
- updateColletions();
- }
-
- public synchronized void updateColletions() {
- createCollections();
- for (DataflowPersistenceHandler handler : dataflowPersistenceHandlers) {
- for (FileType openFileType : handler.getOpenFileTypes()) {
- Set<DataflowPersistenceHandler> set = openFileToHandler
- .get(openFileType);
- set.add(handler);
- for (Class<?> openClass : handler.getOpenSourceTypes()) {
- openFileClassToHandler.get(openFileType).get(openClass)
- .add(handler);
- openClassToTypes.get(openClass).add(openFileType);
- }
- }
- for (Class<?> openClass : handler.getOpenSourceTypes())
- openClassToHandlers.get(openClass).add(handler);
-
- for (FileType saveFileType : handler.getSaveFileTypes()) {
- saveFileToHandler.get(saveFileType).add(handler);
- for (Class<?> saveClass : handler.getSaveDestinationTypes()) {
- saveFileClassToHandler.get(saveFileType).get(saveClass)
- .add(handler);
- saveClassToTypes.get(saveClass).add(saveFileType);
- }
- }
- for (Class<?> openClass : handler.getSaveDestinationTypes())
- saveClassToHandlers.get(openClass).add(handler);
- }
- }
-
- public void setDataflowPersistenceHandlers(
- List<DataflowPersistenceHandler> dataflowPersistenceHandlers) {
- this.dataflowPersistenceHandlers = dataflowPersistenceHandlers;
- }
-
- private static class MapFactory implements Factory {
- @Override
- @SuppressWarnings("rawtypes")
- public Object create() {
- return decorate(new HashMap(), SET_FACTORY);
- }
- }
-
- private static class SetFactory implements Factory {
- @Override
- public Object create() {
- return new LinkedHashSet<Object>();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileDataflowInfo.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileDataflowInfo.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileDataflowInfo.java
deleted file mode 100644
index b7377e9..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileDataflowInfo.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Date;
-
-import org.apache.taverna.workbench.file.DataflowInfo;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.FileType;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * Information about an open dataflow that was opened from or saved to a
- * {@link File}.
- *
- * @see DataflowInfo
- * @see FileManager
- * @author Stian Soiland-Reyes
- */
-public class FileDataflowInfo extends DataflowInfo {
- private static Logger logger = Logger.getLogger(FileDataflowInfo.class);
-
- public FileDataflowInfo(FileType fileType, File source,
- WorkflowBundle workflowBundle) {
- super(fileType, canonicalFile(source), workflowBundle,
- lastModifiedFile(source));
- }
-
- protected static Date lastModifiedFile(File file) {
- long lastModifiedLong = file.lastModified();
- if (lastModifiedLong == 0)
- return null;
- return new Date(lastModifiedLong);
- }
-
- public static File canonicalFile(File file) {
- try {
- return file.getCanonicalFile();
- } catch (IOException e) {
- logger.warn("Could not find canonical file for " + file);
- return file;
- }
- }
-}
[04/11] incubator-taverna-workbench git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationPanel.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationPanel.java
deleted file mode 100644
index ff03ce1..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationPanel.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.config;
-
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.NORTHWEST;
-import static java.awt.GridBagConstraints.RELATIVE;
-import static java.awt.GridBagConstraints.REMAINDER;
-import static java.awt.GridBagConstraints.WEST;
-import static javax.swing.SwingConstants.LEFT;
-import static org.apache.taverna.workbench.helper.Helper.showHelp;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.allportIcon;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.blobIcon;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.horizontalIcon;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.noportIcon;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.verticalIcon;
-import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.ALIGNMENT;
-import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.ANIMATION_ENABLED;
-import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.ANIMATION_SPEED;
-import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.PORT_STYLE;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.Hashtable;
-
-import javax.swing.AbstractAction;
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JSlider;
-import javax.swing.JTextArea;
-import javax.swing.border.EmptyBorder;
-
-import org.apache.taverna.workbench.models.graph.Graph.Alignment;
-import org.apache.taverna.workbench.models.graph.GraphController.PortStyle;
-
-/**
- * UI for GraphViewConfiguration.
- *
- * @author David Withers
- */
-public class GraphViewConfigurationPanel extends JPanel {
- private static final long serialVersionUID = 3779779432230124131L;
- private static final int ANIMATION_SPEED_MIN = 100;
- private static final int ANIMATION_SPEED_MAX = 3100;
-
- private GraphViewConfiguration configuration;
- private JRadioButton noPorts;
- private JRadioButton allPorts;
- private JRadioButton blobs;
- private JRadioButton vertical;
- private JRadioButton horizontal;
- private JCheckBox animation;
- private JLabel animationSpeedLabel;
- private JSlider animationSpeedSlider;
-
- public GraphViewConfigurationPanel(GraphViewConfiguration configuration) {
- this.configuration = configuration;
- GridBagLayout gridbag = new GridBagLayout();
- GridBagConstraints c = new GridBagConstraints();
- setLayout(gridbag);
-
- // Title describing what kind of settings we are configuring here
- JTextArea descriptionText = new JTextArea(
- "Default settings for the workflow diagram");
- descriptionText.setLineWrap(true);
- descriptionText.setWrapStyleWord(true);
- descriptionText.setEditable(false);
- descriptionText.setFocusable(false);
- descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
-
- JLabel defaultLayoutLabel = new JLabel("Service display");
-
- noPorts = new JRadioButton();
- allPorts = new JRadioButton();
- blobs = new JRadioButton();
-
- JLabel noPortsLabel = new JLabel("Name only", noportIcon, LEFT);
- JLabel allPortsLabel = new JLabel("Name and ports", allportIcon, LEFT);
- JLabel blobsLabel = new JLabel("No text", blobIcon, LEFT);
-
- ButtonGroup buttonGroup = new ButtonGroup();
- buttonGroup.add(noPorts);
- buttonGroup.add(allPorts);
- buttonGroup.add(blobs);
-
- JLabel defaultAlignmentLabel = new JLabel("Diagram alignment");
-
- vertical = new JRadioButton();
- horizontal = new JRadioButton();
-
- JLabel verticalLabel = new JLabel("Vertical", verticalIcon, LEFT);
- JLabel horizontalLabel = new JLabel("Horizontal", horizontalIcon, LEFT);
-
- ButtonGroup alignmentButtonGroup = new ButtonGroup();
- alignmentButtonGroup.add(horizontal);
- alignmentButtonGroup.add(vertical);
-
- animation = new JCheckBox("Enable animation");
-
- animationSpeedLabel = new JLabel("Animation speed");
-
- animationSpeedSlider = new JSlider(ANIMATION_SPEED_MIN,
- ANIMATION_SPEED_MAX);
- animationSpeedSlider.setMajorTickSpacing(500);
- animationSpeedSlider.setMinorTickSpacing(100);
- animationSpeedSlider.setPaintTicks(true);
- animationSpeedSlider.setPaintLabels(true);
- animationSpeedSlider.setInverted(true);
- animationSpeedSlider.setSnapToTicks(true);
-
- Hashtable<Integer, JLabel> labelTable = new Hashtable<>();
- labelTable.put(new Integer(ANIMATION_SPEED_MIN), new JLabel("Fast"));
- labelTable.put(new Integer(
- ((ANIMATION_SPEED_MAX - ANIMATION_SPEED_MIN) / 2)
- + ANIMATION_SPEED_MIN), new JLabel("Medium"));
- labelTable.put(new Integer(ANIMATION_SPEED_MAX), new JLabel("Slow"));
- animationSpeedSlider.setLabelTable(labelTable);
-
- animation.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent e) {
- boolean animationEnabled = animation.isSelected();
- animationSpeedLabel.setEnabled(animationEnabled);
- animationSpeedSlider.setEnabled(animationEnabled);
- }
- });
-
- // Set current configuration values
- setFields(configuration);
-
- c.anchor = WEST;
- c.gridx = 0;
- c.gridwidth = REMAINDER;
- c.weightx = 1d;
- c.weighty = 0d;
- c.fill = HORIZONTAL;
-
- add(descriptionText, c);
-
- c.insets = new Insets(10, 0, 10, 0);
- add(defaultLayoutLabel, c);
-
- c.insets = new Insets(0, 20, 0, 0);
- c.gridwidth = 1;
- c.weightx = 0d;
- add(noPorts, c);
- c.insets = new Insets(0, 5, 0, 0);
- c.gridx = RELATIVE;
- add(noPortsLabel, c);
-
- c.insets = new Insets(0, 10, 0, 0);
- add(allPorts, c);
- c.insets = new Insets(0, 5, 0, 0);
- add(allPortsLabel, c);
-
- c.insets = new Insets(0, 10, 0, 0);
- add(blobs, c);
- c.insets = new Insets(0, 5, 0, 0);
- c.gridwidth = REMAINDER;
- c.weightx = 1d;
- add(blobsLabel, c);
-
- // alignment
- c.insets = new Insets(20, 0, 10, 0);
- c.gridx = 0;
- add(defaultAlignmentLabel, c);
-
- c.insets = new Insets(0, 20, 0, 0);
- c.gridx = 0;
- c.gridwidth = 1;
- c.weightx = 0d;
- add(vertical, c);
- c.insets = new Insets(0, 5, 0, 0);
- c.gridx = RELATIVE;
- add(verticalLabel, c);
-
- c.insets = new Insets(0, 10, 0, 0);
- add(horizontal, c);
- c.insets = new Insets(0, 5, 0, 0);
- c.gridwidth = REMAINDER;
- c.weightx = 1d;
- add(horizontalLabel, c);
-
- // animation
- c.gridx = 0;
- c.gridwidth = REMAINDER;
- c.insets = new Insets(20, 0, 10, 0);
- add(animation, c);
-
- c.insets = new Insets(0, 20, 0, 0);
- add(animationSpeedLabel, c);
-
- c.insets = new Insets(0, 20, 10, 30);
- c.anchor = NORTHWEST;
- c.weighty = 0d;
- add(animationSpeedSlider, c);
-
- // Buttons
- c.gridx = 0;
- c.insets = new Insets(0, 20, 10, 30);
- c.anchor = NORTHWEST;
- c.weighty = 1d;
- add(createButtonPanel(), c);
- }
-
- /**
- * Create the panel with the buttons.
- */
- @SuppressWarnings("serial")
- private JPanel createButtonPanel() {
- final JPanel panel = new JPanel();
-
- /**
- * The helpButton shows help about the current component
- */
- JButton helpButton = new JButton(new AbstractAction("Help") {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- showHelp(panel);
- }
- });
- panel.add(helpButton);
-
- /**
- * The resetButton changes the property values shown to those
- * corresponding to the configuration currently applied.
- */
- JButton resetButton = new JButton(new AbstractAction("Reset") {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- setFields(configuration);
- }
- });
- panel.add(resetButton);
-
- /**
- * The applyButton applies the shown field values to the
- * {@link HttpProxyConfiguration} and saves them for future.
- */
- JButton applyButton = new JButton(new AbstractAction("Apply") {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- applySettings();
- setFields(configuration);
- }
- });
- panel.add(applyButton);
-
- return panel;
- }
-
- /**
- * Save the currently set field values to the {@link GraphViewConfiguration}
- * . Also apply those values to the currently running Taverna.
- */
- private void applySettings() {
- // Service display
- if (noPorts.isSelected()) {
- configuration.setProperty(PORT_STYLE, PortStyle.NONE.toString());
- } else if (allPorts.isSelected()) {
- configuration.setProperty(PORT_STYLE, PortStyle.ALL.toString());
- } else if (blobs.isSelected()) {
- configuration.setProperty(PORT_STYLE, PortStyle.BLOB.toString());
- }
-
- // Diagram alignment
- if (vertical.isSelected()) {
- configuration.setProperty(ALIGNMENT, Alignment.VERTICAL.toString());
- } else if (horizontal.isSelected()) {
- configuration.setProperty(ALIGNMENT,
- Alignment.HORIZONTAL.toString());
- }
-
- // Animation and its speed
- if (animation.isSelected()) {
- configuration.setProperty(ANIMATION_ENABLED, String.valueOf(true));
- } else {
- configuration.setProperty(ANIMATION_ENABLED, String.valueOf(false));
- }
- int speed = animationSpeedSlider.getValue();
- configuration.setProperty(ANIMATION_SPEED, String.valueOf(speed));
- }
-
- /**
- * Set the shown configuration field values to those currently in use (i.e.
- * last saved configuration).
- */
- private void setFields(GraphViewConfiguration configurable) {
- PortStyle portStyle = PortStyle.valueOf(configurable
- .getProperty(PORT_STYLE));
- if (portStyle.equals(PortStyle.NONE)) {
- noPorts.setSelected(true);
- } else if (portStyle.equals(PortStyle.ALL)) {
- allPorts.setSelected(true);
- } else {
- blobs.setSelected(true);
- }
-
- Alignment alignment = Alignment.valueOf(configurable
- .getProperty(ALIGNMENT));
- if (alignment.equals(Alignment.VERTICAL)) {
- vertical.setSelected(true);
- } else {
- horizontal.setSelected(true);
- }
-
- boolean animationEnabled = Boolean.parseBoolean(configurable
- .getProperty(ANIMATION_ENABLED));
- animation.setSelected(animationEnabled);
-
- Integer animationSpeed = Integer.valueOf(configurable
- .getProperty(ANIMATION_SPEED));
- if (animationSpeed > ANIMATION_SPEED_MAX) {
- animationSpeed = ANIMATION_SPEED_MAX;
- } else if (animationSpeed < ANIMATION_SPEED_MIN) {
- animationSpeed = ANIMATION_SPEED_MIN;
- }
- animationSpeedSlider.setValue(animationSpeed);
- animationSpeedSlider.setEnabled(animationEnabled);
-
- animationSpeedLabel.setEnabled(animationEnabled);
- }
-
- // for testing only
- public static void main(String[] args) {
- JDialog dialog = new JDialog();
- dialog.add(new GraphViewConfigurationPanel(null));
- dialog.setModal(true);
- dialog.setSize(500, 400);
- dialog.setVisible(true);
- System.exit(0);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationUIFactory.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationUIFactory.java
deleted file mode 100644
index 959b598..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationUIFactory.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.config;
-
-import javax.swing.JPanel;
-
-import uk.org.taverna.configuration.Configurable;
-import uk.org.taverna.configuration.ConfigurationUIFactory;
-
-/**
- * ConfigurationFactory for the GraphViewConfiguration.
- *
- * @author David Withers
- */
-public class GraphViewConfigurationUIFactory implements ConfigurationUIFactory {
- private GraphViewConfiguration graphViewConfiguration;
-
- @Override
- public boolean canHandle(String uuid) {
- return uuid.equals(getConfigurable().getUUID());
- }
-
- @Override
- public JPanel getConfigurationPanel() {
- return new GraphViewConfigurationPanel(graphViewConfiguration);
- }
-
- @Override
- public Configurable getConfigurable() {
- return graphViewConfiguration;
- }
-
- public void setGraphViewConfiguration(
- GraphViewConfiguration graphViewConfiguration) {
- this.graphViewConfiguration = graphViewConfiguration;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFInputMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFInputMenuAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFInputMenuAction.java
deleted file mode 100644
index 41919e2..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFInputMenuAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static net.sf.taverna.t2.workbench.views.graph.menu.InsertMenu.INSERT;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.views.graph.actions.AddWFInputAction;
-
-/**
- * @author Alex Nenadic
- */
-public class AddWFInputMenuAction extends AbstractMenuAction {
- private static final URI ADD_WF_INPUT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddWFInput");
-
- private EditManager editManager;
- private SelectionManager selectionManager;
-
- public AddWFInputMenuAction() {
- super(INSERT, 10, ADD_WF_INPUT_URI);
- }
-
- @Override
- protected Action createAction() {
- return new AddWFInputAction(editManager, selectionManager);
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFOutputMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFOutputMenuAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFOutputMenuAction.java
deleted file mode 100644
index b019811..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFOutputMenuAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static net.sf.taverna.t2.workbench.views.graph.menu.InsertMenu.INSERT;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.views.graph.actions.AddWFOutputAction;
-
-/**
- * @author Alex Nenadic
- */
-public class AddWFOutputMenuAction extends AbstractMenuAction {
- private static final URI ADD_WF_OUTPUT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddWFOutput");
-
- private EditManager editManager;
- private SelectionManager selectionManager;
-
- public AddWFOutputMenuAction() {
- super(INSERT, 20, ADD_WF_OUTPUT_URI);
- }
-
- @Override
- protected Action createAction() {
- return new AddWFOutputAction(editManager, selectionManager);
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java
deleted file mode 100644
index 1cb4a98..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static net.sf.taverna.t2.workbench.views.graph.menu.GraphDeleteMenuSection.GRAPH_DELETE_MENU_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.views.graph.actions.DeleteGraphComponentAction;
-
-/**
- * @author Alex Nenadic
- * @author Alan R Williams
- */
-public class DeleteGraphComponentMenuAction extends AbstractMenuAction {
- private static final URI DELETE_GRAPH_COMPONENT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuDeleteGraphComponent");
-
- private EditManager editManager;
- private SelectionManager selectionManager;
-
- public DeleteGraphComponentMenuAction() {
- super(GRAPH_DELETE_MENU_SECTION, 10, DELETE_GRAPH_COMPONENT_URI);
- }
-
- @Override
- protected Action createAction() {
- return new DeleteGraphComponentAction(editManager, selectionManager);
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramMenu.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramMenu.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramMenu.java
deleted file mode 100644
index 742042c..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramMenu.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static java.awt.event.KeyEvent.VK_V;
-import static javax.swing.Action.MNEMONIC_KEY;
-import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
-
-import java.net.URI;
-
-import org.apache.taverna.ui.menu.AbstractMenu;
-
-public class DiagramMenu extends AbstractMenu {
- public static final URI DIAGRAM = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#diagram");
-
- public DiagramMenu() {
- super(DEFAULT_MENU_BAR, 65, DIAGRAM, "View");
- }
-
- public static DummyAction makeAction() {
- DummyAction action = new DummyAction("View");
- action.putValue(MNEMONIC_KEY, VK_V);
- return action;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramSaveMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramSaveMenuSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramSaveMenuSection.java
deleted file mode 100644
index 593e7c1..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramSaveMenuSection.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static net.sf.taverna.t2.workbench.views.graph.menu.DiagramMenu.DIAGRAM;
-
-import java.net.URI;
-
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-/**
- * @author Alex Nenadic
- */
-public class DiagramSaveMenuSection extends AbstractMenuSection {
- public static final URI DIAGRAM_SAVE_MENU_SECTION = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#diagramSaveMenuSection");
-
- public DiagramSaveMenuSection() {
- super(DIAGRAM, 40, DIAGRAM_SAVE_MENU_SECTION);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramZoomMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramZoomMenuSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramZoomMenuSection.java
deleted file mode 100644
index 5330c05..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramZoomMenuSection.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static net.sf.taverna.t2.workbench.views.graph.menu.DiagramMenu.DIAGRAM;
-
-import java.net.URI;
-
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-/**
- * @author Alex Nenadic
- * @author Alan R Williams
- */
-public class DiagramZoomMenuSection extends AbstractMenuSection {
- public static final URI DIAGRAM_ZOOM_MENU_SECTION = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#diagramZoomMenuSection");
-
- public DiagramZoomMenuSection() {
- super(DIAGRAM, 20, DIAGRAM_ZOOM_MENU_SECTION);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphCopyMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphCopyMenuSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphCopyMenuSection.java
deleted file mode 100644
index 8457bdf..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphCopyMenuSection.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection.GRAPH_MENU_SECTION;
-
-import java.net.URI;
-
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-/**
- * ???
- */
-public class GraphCopyMenuSection extends AbstractMenuSection {
- public static final URI GRAPH_COPY_MENU_SECTION = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphCopyMenuSection");
-
- public GraphCopyMenuSection() {
- super(GRAPH_MENU_SECTION, 15, GRAPH_COPY_MENU_SECTION);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDeleteMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDeleteMenuSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDeleteMenuSection.java
deleted file mode 100644
index f118ece..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDeleteMenuSection.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection.GRAPH_MENU_SECTION;
-
-import java.net.URI;
-
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-/**
- * @author Alex Nenadic
- */
-public class GraphDeleteMenuSection extends AbstractMenuSection {
- public static final URI GRAPH_DELETE_MENU_SECTION = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphDeleteMenuSection");
-
- public GraphDeleteMenuSection() {
- super(GRAPH_MENU_SECTION, 30, GRAPH_DELETE_MENU_SECTION);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDetailsMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDetailsMenuSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDetailsMenuSection.java
deleted file mode 100644
index e14e6d1..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDetailsMenuSection.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection.GRAPH_MENU_SECTION;
-
-import java.net.URI;
-
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-/**
- * @author Alex Nenadic
- * @author Alan R Williams
- */
-public class GraphDetailsMenuSection extends AbstractMenuSection {
- public static final URI GRAPH_DETAILS_MENU_SECTION = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphDetailsMenuSection");
-
- public GraphDetailsMenuSection() {
- super(GRAPH_MENU_SECTION, 25, GRAPH_DETAILS_MENU_SECTION);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphEditMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphEditMenuSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphEditMenuSection.java
deleted file mode 100644
index 51eb370..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphEditMenuSection.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection.GRAPH_MENU_SECTION;
-
-import java.net.URI;
-
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-/**
- * @author Alex Nenadic
- */
-public class GraphEditMenuSection extends AbstractMenuSection {
- public static final URI GRAPH_EDIT_MENU_SECTION = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphEditMenuSection");
-
- public GraphEditMenuSection() {
- super(GRAPH_MENU_SECTION, 20, GRAPH_EDIT_MENU_SECTION);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphMenuSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphMenuSection.java
deleted file mode 100644
index e5e3979..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphMenuSection.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import java.net.URI;
-
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-/**
- * @author Alex Nenadic
- */
-public class GraphMenuSection extends AbstractMenuSection {
- public static final URI GRAPH_MENU_SECTION = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuSection");
- public static final URI EDIT_MENU_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#edit");
-
- public GraphMenuSection() {
- super(EDIT_MENU_URI, 20, GRAPH_MENU_SECTION);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/InsertMenu.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/InsertMenu.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/InsertMenu.java
deleted file mode 100644
index 556ee53..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/InsertMenu.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static java.awt.event.KeyEvent.VK_I;
-import static javax.swing.Action.MNEMONIC_KEY;
-import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
-
-import java.net.URI;
-
-import org.apache.taverna.ui.menu.AbstractMenu;
-
-/**
- * @author alanrw
- */
-public class InsertMenu extends AbstractMenu {
- public static final URI INSERT = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#insert");
-
- public InsertMenu() {
- super(DEFAULT_MENU_BAR, 64, INSERT, makeAction());
- }
-
- public static DummyAction makeAction() {
- DummyAction action = new DummyAction("Insert");
- action.putValue(MNEMONIC_KEY, VK_I);
- return action;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java
deleted file mode 100644
index 0e49157..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static net.sf.taverna.t2.workbench.views.graph.menu.GraphDetailsMenuSection.GRAPH_DETAILS_MENU_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.views.graph.actions.RenameWFInputOutputProcessorAction;
-
-/**
- * @author Alex Nenadic
- */
-public class RenameWFInputOutputProcessorMenuAction extends AbstractMenuAction {
- private static final URI RENAME_WF_INPUT_OUTPUT_PROCESSOR_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuRenameWFInputOutputProcessor");
-
- private EditManager editManager;
- private SelectionManager selectionManager;
-
- public RenameWFInputOutputProcessorMenuAction() {
- super(GRAPH_DETAILS_MENU_SECTION, 30,
- RENAME_WF_INPUT_OUTPUT_PROCESSOR_URI);
- }
-
- @Override
- protected Action createAction() {
- return new RenameWFInputOutputProcessorAction(editManager,
- selectionManager);
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramAction.java
deleted file mode 100644
index f3b3928..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static java.awt.Toolkit.getDefaultToolkit;
-import static java.awt.event.KeyEvent.VK_0;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.refreshIcon;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.DesignOrResultsAction;
-
-@SuppressWarnings("serial")
-public class ResetDiagramAction extends AbstractAction implements
- DesignOrResultsAction {
- private static Action designAction = null;
- @SuppressWarnings("unused")
- private static Action resultsAction = null;
-
- public static void setResultsAction(Action resultsAction) {
- ResetDiagramAction.resultsAction = resultsAction;
- }
-
- public static void setDesignAction(Action designAction) {
- ResetDiagramAction.designAction = designAction;
- }
-
- public ResetDiagramAction() {
- super("Reset diagram", refreshIcon);
- putValue(
- ACCELERATOR_KEY,
- getKeyStroke(VK_0, getDefaultToolkit().getMenuShortcutKeyMask()));
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
-// if (isWorkflowPerspective() && (designAction != null))
- designAction.actionPerformed(e);
-// else if (isResultsPerspective() && (resultsAction != null))
-// resultsAction.actionPerformed(e);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramMenuAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramMenuAction.java
deleted file mode 100644
index d99f097..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramMenuAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static net.sf.taverna.t2.workbench.views.graph.menu.DiagramZoomMenuSection.DIAGRAM_ZOOM_MENU_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-
-/**
- * An action that zooms a diagram image
- *
- * @author Alex Nenadic
- * @author Tom Oinn
- * @author Alan R Williams
- */
-public class ResetDiagramMenuAction extends AbstractMenuAction {
- public static final URI RESET_DIAGRAM_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#diagramMenuResetDiagram");
-
- public ResetDiagramMenuAction() {
- super(DIAGRAM_ZOOM_MENU_SECTION, 5, RESET_DIAGRAM_URI);
- }
-
- @Override
- protected Action createAction() {
- return new ResetDiagramAction();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/SaveGraphImageSubMenu.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/SaveGraphImageSubMenu.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/SaveGraphImageSubMenu.java
deleted file mode 100644
index 360500f..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/SaveGraphImageSubMenu.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static javax.swing.JFileChooser.APPROVE_OPTION;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.YES_NO_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static net.sf.taverna.t2.workbench.views.graph.menu.DiagramSaveMenuSection.DIAGRAM_SAVE_MENU_SECTION;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.URI;
-import java.net.URL;
-import java.util.prefs.Preferences;
-
-import javax.swing.AbstractAction;
-import javax.swing.ImageIcon;
-import javax.swing.JFileChooser;
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-
-import org.apache.taverna.lang.io.StreamCopier;
-import org.apache.taverna.lang.io.StreamDevourer;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.SwingAwareObserver;
-import org.apache.taverna.lang.ui.ExtensionFileFilter;
-import org.apache.taverna.ui.menu.AbstractMenuCustom;
-import org.apache.taverna.ui.menu.DesignOnlyAction;
-import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.icons.WorkbenchIcons;
-import org.apache.taverna.workbench.models.graph.DotWriter;
-import org.apache.taverna.workbench.models.graph.GraphController;
-import org.apache.taverna.workbench.models.graph.svg.SVGUtil;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import org.apache.taverna.workbench.selection.events.PerspectiveSelectionEvent;
-import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
-import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * An action that saves graph diagram image.
- *
- * @author Alex Nenadic
- * @author Tom Oinn
- */
-public class SaveGraphImageSubMenu extends AbstractMenuCustom {
- private static final Logger logger = Logger
- .getLogger(SaveGraphImageSubMenu.class);
- private static final String[] saveTypes = { "dot", "png", "svg", "ps",
- "ps2" };
- private static final String[] saveExtensions = { "dot", "png", "svg", "ps",
- "ps" };
- private static final String[] saveTypeNames = { "dot text", "PNG bitmap",
- "scalable vector graphics", "postscript", "postscript for PDF" };
- public static final URI SAVE_GRAPH_IMAGE_MENU_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuSaveGraphImage");
-
- private JMenu saveDiagramMenu;
- private FileManager fileManager;
- private SelectionManager selectionManager;
- private WorkbenchConfiguration workbenchConfiguration;
- private GraphViewComponent graphViewComponent;
-
- public SaveGraphImageSubMenu() {
- super(DIAGRAM_SAVE_MENU_SECTION, 70, SAVE_GRAPH_IMAGE_MENU_URI);
- }
-
- @Override
- protected Component createCustomComponent() {
- saveDiagramMenu = new JMenu("Export diagram");
- saveDiagramMenu
- .setToolTipText("Open this menu to export the diagram in various formats");
- for (int i = 0; i < saveTypes.length; i++) {
- String type = saveTypes[i];
- String extension = saveExtensions[i];
- ImageIcon icon = new ImageIcon(
- WorkbenchIcons.class.getResource("graph/saveAs"
- + type.toUpperCase() + ".png"));
- JMenuItem item = new JMenuItem(new DotInvoker("Export as "
- + saveTypeNames[i], icon, type, extension));
- saveDiagramMenu.add(item);
- }
- return saveDiagramMenu;
- }
-
- @SuppressWarnings("serial")
- class DotInvoker extends AbstractAction implements DesignOnlyAction {
- String type = "dot";
- String extension = "dot";
-
- public DotInvoker(String name, ImageIcon icon, String type,
- String extension) {
- super(name, icon);
- this.type = type;
- this.extension = extension;
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- Workflow workflow = selectionManager.getSelectedWorkflow();
- if (workflow == null) {
- showMessageDialog(null, "Cannot export an empty diagram.",
- "Warning", WARNING_MESSAGE);
- return;
- }
-
- File file = saveDialogue(null, workflow, extension,
- "Export workflow diagram");
- if (file == null)
- // User cancelled
- return;
-
- try {
- GraphController graphController = graphViewComponent
- .getGraphController(workflow);
-
- if (type.equals("dot")) {
- // Just write out the dot text, no processing required
- PrintWriter out = new PrintWriter(new FileWriter(file));
- DotWriter dotWriter = new DotWriter(out);
- dotWriter.writeGraph(graphController.generateGraph());
- out.flush();
- out.close();
- } else {
- String dotLocation = (String) workbenchConfiguration
- .getProperty("taverna.dotlocation");
- if (dotLocation == null)
- dotLocation = "dot";
- logger.debug("GraphViewComponent: Invoking dot...");
- Process dotProcess = Runtime.getRuntime().exec(
- new String[] { dotLocation, "-T" + type });
-
- FileOutputStream fos = new FileOutputStream(file);
-
- StringWriter stringWriter = new StringWriter();
- DotWriter dotWriter = new DotWriter(stringWriter);
- dotWriter.writeGraph(graphController.generateGraph());
-
- OutputStream dotOut = dotProcess.getOutputStream();
- dotOut.write(SVGUtil.getDot(stringWriter.toString(),
- workbenchConfiguration).getBytes());
- dotOut.flush();
- dotOut.close();
- new StreamDevourer(dotProcess.getErrorStream()).start();
- new StreamCopier(dotProcess.getInputStream(), fos).start();
- }
- } catch (Exception ex) {
- logger.warn("GraphViewComponent: Could not export diagram to " + file, ex);
- showMessageDialog(null,
- "Problem saving diagram : \n" + ex.getMessage(),
- "Error!", ERROR_MESSAGE);
- }
- }
- }
-
- /**
- * Pop up a save dialogue relating to the given workflow. This method can be
- * used, for example, for saving the workflow diagram as .png, and will use
- * the existing workflow title as a base for suggesting a filename.
- *
- * @param parentComponent
- * Parent component for dialogue window
- * @param model
- * Workflow to save
- * @param extension
- * Extension for filename, such as "jpg"
- * @param windowTitle
- * Title for dialogue box, such as "Save workflow diagram"
- * @return File instance for the selected abstract filename, or null if the
- * dialogue was cancelled.
- */
- private File saveDialogue(Component parentComponent, Workflow workflow,
- String extension, String windowTitle) {
- JFileChooser fc = new JFileChooser();
- Preferences prefs = Preferences
- .userNodeForPackage(SaveGraphImageSubMenu.class);
- String curDir = prefs
- .get("currentDir", System.getProperty("user.home"));
- String suggestedFileName = "";
- // Get the source the workflow was loaded from - can be File, URL, or InputStream
- Object source = fileManager.getDataflowSource(workflow.getParent());
- if (source instanceof File) {
- suggestedFileName = ((File) source).getName();
- // remove the file extension
- suggestedFileName = suggestedFileName.substring(0,
- suggestedFileName.lastIndexOf("."));
- } else if (source instanceof URL) {
- suggestedFileName = ((URL) source).getPath();
- // remove the file extension
- suggestedFileName = suggestedFileName.substring(0,
- suggestedFileName.lastIndexOf("."));
- } else {
- // We cannot suggest the file name if workflow was read from an InputStream
- }
-
- fc.setDialogTitle(windowTitle);
- fc.resetChoosableFileFilters();
- fc.setFileFilter(new ExtensionFileFilter(new String[] { extension }));
- if (suggestedFileName.isEmpty())
- // No file suggestion, just the directory
- fc.setCurrentDirectory(new File(curDir));
- else
- // Suggest a filename from the workflow file name
- fc.setSelectedFile(new File(curDir, suggestedFileName + "." + extension));
-
- while (true) {
- if (fc.showSaveDialog(parentComponent) != APPROVE_OPTION) {
- logger.info("GraphViewComponent: Aborting diagram export to "
- + suggestedFileName);
- return null;
- }
-
- File file = fixExtension(fc.getSelectedFile(), extension);
- logger.debug("GraphViewComponent: Selected " + file + " as export target");
- prefs.put("currentDir", fc.getCurrentDirectory().toString());
-
- // If file doesn't exist, we may write it! (Well, probably...)
- if (!file.exists())
- return file;
-
- // Ask the user if they want to overwrite the file
- String msg = file.getAbsolutePath()
- + " already exists. Do you want to overwrite it?";
- if (showConfirmDialog(null, msg, "File already exists",
- YES_NO_OPTION) == JOptionPane.YES_OPTION)
- return file;
- }
- }
-
- /**
- * Make sure given File has the given extension. If it has no extension,
- * a new File instance will be returned. Otherwise, the passed instance is
- * returned unchanged.
- *
- * @param file
- * File which extension is to be checked
- * @param extension
- * Extension desired, example: "xml"
- * @return file parameter if the extension was OK, or a new File instance
- * with the correct extension
- */
- private File fixExtension(File file, String extension) {
- if (file.getName().endsWith("." + extension))
- return file;
- // Append the extension (keep the existing one)
- String name = file.getName();
- return new File(file.getParent(), name + "." + extension);
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setWorkbenchConfiguration(
- WorkbenchConfiguration workbenchConfiguration) {
- this.workbenchConfiguration = workbenchConfiguration;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
- public void setGraphViewComponent(GraphViewComponent graphViewComponent) {
- this.graphViewComponent = graphViewComponent;
- }
-
- private static final String DESIGN_PERSPECTIVE_ID = "net.sf.taverna.t2.ui.perspectives.design.DesignPerspective";
-
- @SuppressWarnings("unused")
- private final class SelectionManagerObserver extends
- SwingAwareObserver<SelectionManagerEvent> {
- @Override
- public void notifySwing(Observable<SelectionManagerEvent> sender,
- SelectionManagerEvent message) {
- if (!(message instanceof PerspectiveSelectionEvent))
- return;
- PerspectiveSelectionEvent event = (PerspectiveSelectionEvent) message;
-
- saveDiagramMenu.setEnabled((DESIGN_PERSPECTIVE_ID.equals(event
- .getSelectedPerspective().getID())));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInAction.java
deleted file mode 100644
index 55ee8ff..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInAction.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static java.awt.Toolkit.getDefaultToolkit;
-import static java.awt.event.KeyEvent.VK_EQUALS;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.zoomInIcon;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.DesignOrResultsAction;
-
-import org.apache.log4j.Logger;
-
-@SuppressWarnings("serial")
-public class ZoomInAction extends AbstractAction implements
- DesignOrResultsAction {
- @SuppressWarnings("unused")
- private static Logger logger = Logger.getLogger(ZoomInAction.class);
- private static Action designAction = null;
- @SuppressWarnings("unused")
- private static Action resultsAction = null;
-
- public static void setResultsAction(Action resultsAction) {
- ZoomInAction.resultsAction = resultsAction;
- }
-
- public static void setDesignAction(Action designAction) {
- ZoomInAction.designAction = designAction;
- }
-
- ZoomInAction() {
- super("Zoom in", zoomInIcon);
- putValue(
- ACCELERATOR_KEY,
- getKeyStroke(VK_EQUALS, getDefaultToolkit()
- .getMenuShortcutKeyMask()));
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
-// if (isWorkflowPerspective()) {
-// if (designAction != null)
- designAction.actionPerformed(e);
-// else
-// logger.error("ZoomInAction.designAction is null");
-// } else if (isResultsPerspective() && (resultsAction != null))
-// resultsAction.actionPerformed(e);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInMenuAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInMenuAction.java
deleted file mode 100644
index 82ab39b..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInMenuAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static net.sf.taverna.t2.workbench.views.graph.menu.DiagramZoomMenuSection.DIAGRAM_ZOOM_MENU_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-
-/**
- * An action that zooms a diagram image
- *
- * @author Alex Nenadic
- * @author Tom Oinn
- * @author Alan R Williams
- */
-public class ZoomInMenuAction extends AbstractMenuAction {
- public static final URI ZOOM_IN_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#diagramMenuZoomIn");
-
- public ZoomInMenuAction() {
- super(DIAGRAM_ZOOM_MENU_SECTION, 10, ZOOM_IN_URI);
- }
-
- @Override
- protected Action createAction() {
- return new ZoomInAction();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutAction.java
deleted file mode 100644
index 4dd769e..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static java.awt.Toolkit.getDefaultToolkit;
-import static java.awt.event.KeyEvent.VK_MINUS;
-import static javax.swing.KeyStroke.getKeyStroke;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.DesignOrResultsAction;
-import org.apache.taverna.workbench.icons.WorkbenchIcons;
-
-@SuppressWarnings("serial")
-public class ZoomOutAction extends AbstractAction implements
- DesignOrResultsAction {
- private static Action designAction = null;
- @SuppressWarnings("unused")
- private static Action resultsAction = null;
-
- public static void setResultsAction(Action resultsAction) {
- ZoomOutAction.resultsAction = resultsAction;
- }
-
- public static void setDesignAction(Action designAction) {
- ZoomOutAction.designAction = designAction;
- }
-
- ZoomOutAction() {
- super("Zoom out", WorkbenchIcons.zoomOutIcon);
- putValue(
- ACCELERATOR_KEY,
- getKeyStroke(VK_MINUS, getDefaultToolkit()
- .getMenuShortcutKeyMask()));
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
-// if (isWorkflowPerspective() && (designAction != null))
- designAction.actionPerformed(e);
-// else if (isResultsPerspective() && (resultsAction != null))
-// resultsAction.actionPerformed(e);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutMenuAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutMenuAction.java
deleted file mode 100644
index 1b68a1d..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutMenuAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.menu;
-
-import static net.sf.taverna.t2.workbench.views.graph.menu.DiagramZoomMenuSection.DIAGRAM_ZOOM_MENU_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-
-/**
- * An action that zooms a diagram image
- *
- * @author Alex Nenadic
- * @author Tom Oinn
- * @author Alan R Williams
- */
-public class ZoomOutMenuAction extends AbstractMenuAction {
- public static final URI ZOOM_OUT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#diagramMenuZoomOut");
-
- public ZoomOutMenuAction() {
- super(DIAGRAM_ZOOM_MENU_SECTION, 20, ZOOM_OUT_URI);
- }
-
- @Override
- protected Action createAction() {
- return new ZoomOutAction();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFInputToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFInputToolbarAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFInputToolbarAction.java
deleted file mode 100644
index d408bbd..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFInputToolbarAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.toolbar;
-
-import static net.sf.taverna.t2.workbench.views.graph.toolbar.GraphEditToolbarSection.GRAPH_EDIT_TOOLBAR_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.views.graph.actions.AddWFInputAction;
-
-/**
- * @author Alex Nenadic
- */
-public class AddWFInputToolbarAction extends AbstractMenuAction {
- private static final URI ADD_WF_INPUT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphToolbarAddWFInput");
-
- private EditManager editManager;
- private SelectionManager selectionManager;
-
- public AddWFInputToolbarAction() {
- super(GRAPH_EDIT_TOOLBAR_SECTION, 10, ADD_WF_INPUT_URI);
- }
-
- @Override
- protected Action createAction() {
- return new AddWFInputAction(editManager, selectionManager);
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java
deleted file mode 100644
index 09f94d3..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.toolbar;
-
-import static net.sf.taverna.t2.workbench.views.graph.toolbar.GraphEditToolbarSection.GRAPH_EDIT_TOOLBAR_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.views.graph.actions.AddWFOutputAction;
-
-/**
- * @author Alex Nenadic
- */
-public class AddWFOutputToolbarAction extends AbstractMenuAction {
- private static final URI ADD_WF_OUTPUT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphToolbarAddWFOutput");
-
- private EditManager editManager;
- private SelectionManager selectionManager;
-
- public AddWFOutputToolbarAction() {
- super(GRAPH_EDIT_TOOLBAR_SECTION, 20, ADD_WF_OUTPUT_URI);
- }
-
- @Override
- protected Action createAction() {
- return new AddWFOutputAction(editManager, selectionManager);
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java
deleted file mode 100644
index 9fc472e..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.toolbar;
-
-import static net.sf.taverna.t2.workbench.views.graph.toolbar.GraphDeleteToolbarSection.GRAPH_DELETE_TOOLBAR_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.views.graph.actions.DeleteGraphComponentAction;
-
-/**
- * @author Alex Nenadic
- */
-public class DeleteGraphComponentToolbarAction extends AbstractMenuAction {
- private static final URI DELETE_GRAPH_COMPONENT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphToolbarDeleteGraphComponent");
-
- private EditManager editManager;
- private SelectionManager selectionManager;
-
- public DeleteGraphComponentToolbarAction() {
- super(GRAPH_DELETE_TOOLBAR_SECTION, 10, DELETE_GRAPH_COMPONENT_URI);
- }
-
- @Override
- protected Action createAction() {
- return new DeleteGraphComponentAction(editManager, selectionManager);
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphDeleteToolbarSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphDeleteToolbarSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphDeleteToolbarSection.java
deleted file mode 100644
index 78d510b..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphDeleteToolbarSection.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.toolbar;
-
-import static org.apache.taverna.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
-
-import java.net.URI;
-
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-/**
- * @author Alex Nenadic
- */
-public class GraphDeleteToolbarSection extends AbstractMenuSection {
- public static final URI GRAPH_DELETE_TOOLBAR_SECTION = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphDeleteToolbarSection");
-
- public GraphDeleteToolbarSection() {
- super(DEFAULT_TOOL_BAR, 80, GRAPH_DELETE_TOOLBAR_SECTION);
- }
-}
[05/11] incubator-taverna-workbench git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/test/java/org/apache/taverna/workbench/file/impl/FileManagerTest.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/test/java/org/apache/taverna/workbench/file/impl/FileManagerTest.java b/taverna-file-impl/src/test/java/org/apache/taverna/workbench/file/impl/FileManagerTest.java
new file mode 100644
index 0000000..2cfc51d
--- /dev/null
+++ b/taverna-file-impl/src/test/java/org/apache/taverna/workbench/file/impl/FileManagerTest.java
@@ -0,0 +1,384 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.impl.EditManagerImpl;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.file.events.SetCurrentDataflowEvent;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.file.exceptions.OverwriteException;
+import org.apache.taverna.workflow.edits.AddProcessorEdit;
+import org.apache.taverna.workflow.edits.RenameEdit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleReader;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleWriter;
+import org.apache.taverna.scufl2.rdfxml.RDFXMLReader;
+import org.apache.taverna.scufl2.rdfxml.RDFXMLWriter;
+import org.apache.taverna.scufl2.translator.t2flow.T2FlowReader;
+
+public class FileManagerTest {
+
+ private static final WorkflowBundleFileType WF_BUNDLE_FILE_TYPE = new WorkflowBundleFileType();
+ private static final T2FlowFileType T2_FLOW_FILE_TYPE = new T2FlowFileType();
+
+ private static final String DUMMY_WORKFLOW_T2FLOW = "dummy-workflow.t2flow";
+
+ private FileManagerImpl fileManager;
+ private EditManager editManager;
+
+ private FileManagerObserver fileManagerObserver= new FileManagerObserver();;
+
+ @Test
+ public void close() throws Exception {
+ assertTrue("Non-empty set of open dataflows", fileManager
+ .getOpenDataflows().isEmpty());
+ WorkflowBundle dataflow = openDataflow();
+ assertEquals("Unexpected list of open dataflows", Arrays
+ .asList(dataflow), fileManager.getOpenDataflows());
+ fileManager.closeDataflow(dataflow, true);
+ assertNotSame(dataflow, fileManager.getOpenDataflows().get(0));
+ assertTrue("Did not insert empty dataflow after close", fileManager
+ .getOpenDataflows().get(0).getMainWorkflow().getProcessors().isEmpty());
+ }
+
+ @Test
+ public void openRemovesEmptyDataflow() throws Exception {
+ WorkflowBundle newDataflow = fileManager.newDataflow();
+ assertEquals("Unexpected list of open dataflows", Arrays
+ .asList(newDataflow), fileManager.getOpenDataflows());
+ WorkflowBundle dataflow = openDataflow();
+ // Should have removed newDataflow
+ assertEquals("Unexpected list of open dataflows", Arrays
+ .asList(dataflow), fileManager.getOpenDataflows());
+ }
+
+ @Test
+ public void isChanged() throws Exception {
+ WorkflowBundle dataflow = openDataflow();
+ assertFalse("Dataflow should not have changed", fileManager
+ .isDataflowChanged(dataflow));
+
+ // Do a change
+ Processor emptyProcessor = new Processor();
+ Edit<Workflow> addProcessorEdit = new AddProcessorEdit(dataflow.getMainWorkflow(),
+ emptyProcessor);
+ editManager.doDataflowEdit(dataflow, addProcessorEdit);
+ assertTrue("Dataflow should have changed", fileManager
+ .isDataflowChanged(dataflow));
+
+ // Save it with the change
+ File dataflowFile = File.createTempFile("test", ".t2flow");
+ dataflowFile.deleteOnExit();
+ dataflowFile.delete();
+
+ fileManager.saveDataflow(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, false);
+ assertFalse("Dataflow should no longer be marked as changed",
+ fileManager.isDataflowChanged(dataflow));
+ }
+
+ @Ignore("Undo support for ischanged not yet implemented")
+ @Test
+ public void isChangedWithUndo() throws Exception {
+ WorkflowBundle dataflow = openDataflow();
+ // Do a change
+ Processor emptyProcessor = new Processor();
+ Edit<Workflow> addProcessorEdit = new AddProcessorEdit(dataflow.getMainWorkflow(),
+ emptyProcessor);
+ editManager.doDataflowEdit(dataflow, addProcessorEdit);
+ assertTrue("Dataflow should have changed", fileManager
+ .isDataflowChanged(dataflow));
+ editManager.undoDataflowEdit(dataflow);
+ assertFalse(
+ "Dataflow should no longer be marked as changed after undo",
+ fileManager.isDataflowChanged(dataflow));
+ editManager.redoDataflowEdit(dataflow);
+ assertTrue("Dataflow should have changed after redo before save",
+ fileManager.isDataflowChanged(dataflow));
+
+ // Save it with the change
+ File dataflowFile = File.createTempFile("test", ".t2flow");
+ dataflowFile.deleteOnExit();
+ dataflowFile.delete();
+ fileManager.saveDataflow(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, false);
+ assertFalse("Dataflow should no longer be marked as changed",
+ fileManager.isDataflowChanged(dataflow));
+
+ editManager.undoDataflowEdit(dataflow);
+ assertTrue("Dataflow should have changed after undo", fileManager
+ .isDataflowChanged(dataflow));
+ fileManager.saveDataflow(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, false);
+ editManager.redoDataflowEdit(dataflow);
+ assertTrue("Dataflow should have changed after redo after save",
+ fileManager.isDataflowChanged(dataflow));
+ }
+
+ @Test
+ public void isListed() throws Exception {
+ assertTrue("Non-empty set of open data flows", fileManager
+ .getOpenDataflows().isEmpty());
+ WorkflowBundle dataflow = openDataflow();
+ assertEquals("Unexpected list of open dataflows", Arrays
+ .asList(dataflow), fileManager.getOpenDataflows());
+ }
+
+ /**
+ * Always uses a <strong>new</strong> file manager instead of the instance
+ * one from {@link FileManager#getInstance()}.
+ *
+ * @see #getFileManagerInstance()
+ *
+ */
+ @Before
+ public void makeFileManager() {
+ System.setProperty("java.awt.headless", "true");
+ editManager = new EditManagerImpl();
+ fileManager = new FileManagerImpl(editManager);
+ fileManagerObserver = new FileManagerObserver();
+ fileManager.addObserver(fileManagerObserver);
+ WorkflowBundleIO workflowBundleIO = new WorkflowBundleIO();
+ workflowBundleIO.setReaders(Arrays.<WorkflowBundleReader>asList(new RDFXMLReader(), new T2FlowReader()));
+ workflowBundleIO.setWriters(Arrays.<WorkflowBundleWriter>asList(new RDFXMLWriter()));
+ T2DataflowOpener t2DataflowOpener = new T2DataflowOpener();
+ t2DataflowOpener.setWorkflowBundleIO(workflowBundleIO);
+ WorkflowBundleOpener workflowBundleOpener = new WorkflowBundleOpener();
+ workflowBundleOpener.setWorkflowBundleIO(workflowBundleIO);
+ WorkflowBundleSaver workflowBundleSaver = new WorkflowBundleSaver();
+ workflowBundleSaver.setWorkflowBundleIO(workflowBundleIO);
+ DataflowPersistenceHandlerRegistry dataflowPersistenceHandlerRegistry = new DataflowPersistenceHandlerRegistry();
+ dataflowPersistenceHandlerRegistry.setDataflowPersistenceHandlers(Arrays.asList(
+ new DataflowPersistenceHandler[] {t2DataflowOpener, workflowBundleOpener, workflowBundleSaver}));
+ dataflowPersistenceHandlerRegistry.updateColletions();
+ fileManager.setDataflowPersistenceHandlerRegistry(dataflowPersistenceHandlerRegistry);
+ }
+
+ @Test
+ public void open() throws Exception {
+ assertTrue("ModelMapObserver already contained messages",
+ fileManagerObserver.messages.isEmpty());
+ WorkflowBundle dataflow = openDataflow();
+ assertNotNull("Dataflow was not loaded", dataflow);
+ assertEquals("Loaded dataflow was not set as current dataflow",
+ dataflow, fileManager.getCurrentDataflow());
+ assertFalse("ModelMapObserver did not contain message",
+ fileManagerObserver.messages.isEmpty());
+ assertEquals("ModelMapObserver contained unexpected messages", 2,
+ fileManagerObserver.messages.size());
+ FileManagerEvent event = fileManagerObserver.messages.get(0);
+ assertTrue(event instanceof SetCurrentDataflowEvent);
+ assertEquals(dataflow, ((SetCurrentDataflowEvent) event).getDataflow());
+ }
+
+ @Test
+ public void openSilently() throws Exception {
+ assertTrue("ModelMapObserver already contained messages",
+ fileManagerObserver.messages.isEmpty());
+ URL url = getClass().getResource(DUMMY_WORKFLOW_T2FLOW);
+ DataflowInfo info = fileManager.openDataflowSilently(T2_FLOW_FILE_TYPE, url);
+
+ WorkflowBundle dataflow = info.getDataflow();
+ assertNotNull("Dataflow was not loaded", dataflow);
+
+ assertNotSame("Loaded dataflow was set as current dataflow",
+ dataflow, fileManager.getCurrentDataflow());
+ assertTrue("ModelMapObserver contained unexpected messages",
+ fileManagerObserver.messages.isEmpty());
+ }
+
+ @Test
+ public void canSaveDataflow() throws Exception {
+ WorkflowBundle savedDataflow = openDataflow();
+ File dataflowFile = File.createTempFile("test", ".t2flow");
+ dataflowFile.deleteOnExit();
+ dataflowFile.delete();
+ fileManager.saveDataflow(savedDataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, true);
+ assertTrue(fileManager.canSaveWithoutDestination(savedDataflow));
+ fileManager.saveDataflow(savedDataflow, true);
+ fileManager.closeDataflow(savedDataflow, true);
+
+ WorkflowBundle otherFlow = fileManager.openDataflow(WF_BUNDLE_FILE_TYPE, dataflowFile.toURI()
+ .toURL());
+ assertTrue(fileManager.canSaveWithoutDestination(otherFlow));
+ }
+
+ @Test
+ public void save() throws Exception {
+ WorkflowBundle savedDataflow = openDataflow();
+ File dataflowFile = File.createTempFile("test", ".t2flow");
+ dataflowFile.deleteOnExit();
+ dataflowFile.delete();
+ assertFalse("File should not exist", dataflowFile.isFile());
+ fileManager.saveDataflow(savedDataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, false);
+ assertTrue("File should exist", dataflowFile.isFile());
+ WorkflowBundle loadedDataflow = fileManager.openDataflow(WF_BUNDLE_FILE_TYPE, dataflowFile.toURI()
+ .toURL());
+ assertNotSame("Dataflow was not reopened", savedDataflow,
+ loadedDataflow);
+ assertEquals("Unexpected number of processors in saved dataflow", 1,
+ savedDataflow.getMainWorkflow().getProcessors().size());
+ assertEquals("Unexpected number of processors in loaded dataflow", 1,
+ loadedDataflow.getMainWorkflow().getProcessors().size());
+
+ Processor savedProcessor = savedDataflow.getMainWorkflow().getProcessors().first();
+ Processor loadedProcessor = loadedDataflow.getMainWorkflow().getProcessors().first();
+ assertEquals("Loaded processor had wrong name", savedProcessor
+ .getName(), loadedProcessor.getName());
+
+ // TODO convert to scufl2
+// BeanshellActivity savedActivity = (BeanshellActivity) savedProcessor
+// .getActivityList().get(0);
+// BeanshellActivity loadedActivity = (BeanshellActivity) loadedProcessor
+// .getActivityList().get(0);
+// String savedScript = savedActivity.getConfiguration().getScript();
+// String loadedScript = loadedActivity.getConfiguration().getScript();
+// assertEquals("Unexpected saved script",
+// "String output = input + \"XXX\";", savedScript);
+// assertEquals("Loaded script did not matched saved script", savedScript,
+// loadedScript);
+ }
+
+ @Test
+ public void saveSilent() throws Exception {
+ assertTrue("ModelMapObserver contained unexpected messages",
+ fileManagerObserver.messages.isEmpty());
+
+ URL url = getClass().getResource(DUMMY_WORKFLOW_T2FLOW);
+ DataflowInfo info = fileManager.openDataflowSilently(T2_FLOW_FILE_TYPE, url);
+ WorkflowBundle dataflow = info.getDataflow();
+ assertTrue("ModelMapObserver contained unexpected messages",
+ fileManagerObserver.messages.isEmpty());
+
+ File dataflowFile = File.createTempFile("test", ".t2flow");
+ dataflowFile.deleteOnExit();
+ dataflowFile.delete();
+ assertFalse("File should not exist", dataflowFile.isFile());
+
+ fileManager.saveDataflowSilently(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, false);
+ assertTrue("File should exist", dataflowFile.isFile());
+
+ assertTrue("ModelMapObserver contained unexpected messages",
+ fileManagerObserver.messages.isEmpty());
+
+ }
+
+ @Test
+ public void saveOverwriteAgain() throws Exception {
+ WorkflowBundle dataflow = openDataflow();
+ File dataflowFile = File.createTempFile("test", ".t2flow");
+ dataflowFile.delete();
+ dataflowFile.deleteOnExit();
+ // File did NOT exist, should not fail
+ fileManager.saveDataflow(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, true);
+
+ Processor processor = dataflow.getMainWorkflow().getProcessors().first();
+ Edit<Processor> renameEdit = new RenameEdit<Processor>(processor,
+ processor.getName() + "-changed");
+ editManager.doDataflowEdit(dataflow, renameEdit);
+
+ // Last save was OURs, so should *not* fail - even if we now use
+ // the specific saveDataflow() method
+ fileManager.saveDataflow(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, true);
+
+ //Thread.sleep(1500);
+ WorkflowBundle otherFlow = openDataflow();
+ // Saving another flow to same file should still fail
+ try {
+ fileManager.saveDataflow(otherFlow,WF_BUNDLE_FILE_TYPE, dataflowFile, true);
+ fail("Should have thrown OverwriteException");
+ } catch (OverwriteException ex) {
+ // Expected
+ }
+ }
+
+ @Test(expected = OverwriteException.class)
+ public void saveOverwriteWarningFails() throws Exception {
+ WorkflowBundle dataflow = openDataflow();
+ File dataflowFile = File.createTempFile("test", ".t2flow");
+ dataflowFile.deleteOnExit();
+ // Should fail as file already exists
+ fileManager.saveDataflow(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, true);
+ }
+
+ @Test
+ public void saveOverwriteWarningWorks() throws Exception {
+ WorkflowBundle dataflow = openDataflow();
+ File dataflowFile = File.createTempFile("test", ".t2flow");
+ dataflowFile.delete();
+ dataflowFile.deleteOnExit();
+ // File did NOT exist, should not fail
+ fileManager.saveDataflow(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, true);
+ }
+
+ @After
+ public void stopListeningToModelMap() {
+ fileManager.removeObserver(fileManagerObserver);
+ }
+
+ protected WorkflowBundle openDataflow() throws OpenException {
+ URL url = getClass().getResource(DUMMY_WORKFLOW_T2FLOW);
+ assertNotNull(url);
+ WorkflowBundle dataflow = fileManager.openDataflow(T2_FLOW_FILE_TYPE, url);
+ assertNotNull(dataflow);
+ return dataflow;
+ }
+
+ private final class FileManagerObserver implements Observer<FileManagerEvent> {
+ protected List<FileManagerEvent> messages = new ArrayList<FileManagerEvent>();
+
+ @Override
+ public void notify(Observable<FileManagerEvent> sender, FileManagerEvent message) throws Exception {
+ messages.add(message);
+ if (message instanceof SetCurrentDataflowEvent) {
+ assertTrue("Dataflow was not listed as open when set current",
+ fileManager.getOpenDataflows().contains(
+ ((SetCurrentDataflowEvent) message).getDataflow()));
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/test/resources/net/sf/taverna/t2/workbench/file/impl/dummy-workflow.t2flow
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/test/resources/net/sf/taverna/t2/workbench/file/impl/dummy-workflow.t2flow b/taverna-file-impl/src/test/resources/net/sf/taverna/t2/workbench/file/impl/dummy-workflow.t2flow
deleted file mode 100644
index b9a1075..0000000
--- a/taverna-file-impl/src/test/resources/net/sf/taverna/t2/workbench/file/impl/dummy-workflow.t2flow
+++ /dev/null
@@ -1,157 +0,0 @@
-<workflow xmlns="http://taverna.sf.net/2008/xml/t2flow" version="1" producedBy="test">
- <dataflow id="ec0991ba-275c-49ed-b1d6-38534180fb7c" role="top">
- <name>simple_workflow_with_input</name>
- <inputPorts>
- <port>
- <name>input</name>
- <depth>0</depth>
- <granularDepth>0</granularDepth>
- </port>
- </inputPorts>
- <outputPorts>
- <port>
- <name>output</name>
- </port>
- </outputPorts>
- <processors>
- <processor>
- <name>Concat_XXX</name>
- <inputPorts>
- <port>
- <name>input</name>
- <depth>0</depth>
- </port>
- </inputPorts>
- <outputPorts>
- <port>
- <name>output</name>
- <depth>0</depth>
- <granularDepth>0</granularDepth>
- </port>
- </outputPorts>
- <annotations />
- <activities>
- <activity>
- <class>
- net.sf.taverna.t2.activities.beanshell.BeanshellActivity
- </class>
- <inputMap>
- <map from="input" to="input" />
- </inputMap>
- <outputMap>
- <map from="output" to="output" />
- </outputMap>
- <configBean encoding="xstream">
- <net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean
- xmlns="">
- <script>String output = input + "XXX";</script>
- <dependencies />
- <inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <handledReferenceSchemes />
- <translatedElementType>java.lang.String</translatedElementType>
- <allowsLiteralValues>true</allowsLiteralValues>
- <name>input</name>
- <depth>0</depth>
- <mimeTypes>
- <string>'text/plain'</string>
- </mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- </inputs>
- <outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
- <granularDepth>0</granularDepth>
- <name>output</name>
- <depth>0</depth>
- <mimeTypes>
- <string>'text/plain'</string>
- </mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
- </outputs>
- </net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean>
- </configBean>
- </activity>
- </activities>
- <dispatchStack>
- <dispatchLayer>
- <class>
- net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize
- </class>
- <configBean encoding="xstream">
- <net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig
- xmlns="">
- <maxJobs>1</maxJobs>
- </net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig>
- </configBean>
- </dispatchLayer>
- <dispatchLayer>
- <class>
- net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce
- </class>
- <configBean encoding="xstream">
- <null xmlns="" />
- </configBean>
- </dispatchLayer>
- <dispatchLayer>
- <class>
- net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover
- </class>
- <configBean encoding="xstream">
- <null xmlns="" />
- </configBean>
- </dispatchLayer>
- <dispatchLayer>
- <class>
- net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry
- </class>
- <configBean encoding="xstream">
- <net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig
- xmlns="">
- <backoffFactor>1.0</backoffFactor>
- <initialDelay>0</initialDelay>
- <maxDelay>0</maxDelay>
- <maxRetries>0</maxRetries>
- </net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig>
- </configBean>
- </dispatchLayer>
- <dispatchLayer>
- <class>
- net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke
- </class>
- <configBean encoding="xstream">
- <null xmlns="" />
- </configBean>
- </dispatchLayer>
- </dispatchStack>
- <iterationStrategyStack>
- <iteration>
- <strategy>
- <port name="input" depth="0" />
- </strategy>
- </iteration>
- </iterationStrategyStack>
- </processor>
- </processors>
- <conditions />
- <datalinks>
- <datalink>
- <sink type="processor">
- <processor>Concat_XXX</processor>
- <port>input</port>
- </sink>
- <source type="dataflow">
- <port>input</port>
- </source>
- </datalink>
- <datalink>
- <sink type="dataflow">
- <port>output</port>
- </sink>
- <source type="processor">
- <processor>Concat_XXX</processor>
- <port>output</port>
- </source>
- </datalink>
- </datalinks>
- </dataflow>
-</workflow>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/test/resources/org/apache/taverna/workbench/file/impl/dummy-workflow.t2flow
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/test/resources/org/apache/taverna/workbench/file/impl/dummy-workflow.t2flow b/taverna-file-impl/src/test/resources/org/apache/taverna/workbench/file/impl/dummy-workflow.t2flow
new file mode 100644
index 0000000..b9a1075
--- /dev/null
+++ b/taverna-file-impl/src/test/resources/org/apache/taverna/workbench/file/impl/dummy-workflow.t2flow
@@ -0,0 +1,157 @@
+<workflow xmlns="http://taverna.sf.net/2008/xml/t2flow" version="1" producedBy="test">
+ <dataflow id="ec0991ba-275c-49ed-b1d6-38534180fb7c" role="top">
+ <name>simple_workflow_with_input</name>
+ <inputPorts>
+ <port>
+ <name>input</name>
+ <depth>0</depth>
+ <granularDepth>0</granularDepth>
+ </port>
+ </inputPorts>
+ <outputPorts>
+ <port>
+ <name>output</name>
+ </port>
+ </outputPorts>
+ <processors>
+ <processor>
+ <name>Concat_XXX</name>
+ <inputPorts>
+ <port>
+ <name>input</name>
+ <depth>0</depth>
+ </port>
+ </inputPorts>
+ <outputPorts>
+ <port>
+ <name>output</name>
+ <depth>0</depth>
+ <granularDepth>0</granularDepth>
+ </port>
+ </outputPorts>
+ <annotations />
+ <activities>
+ <activity>
+ <class>
+ net.sf.taverna.t2.activities.beanshell.BeanshellActivity
+ </class>
+ <inputMap>
+ <map from="input" to="input" />
+ </inputMap>
+ <outputMap>
+ <map from="output" to="output" />
+ </outputMap>
+ <configBean encoding="xstream">
+ <net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean
+ xmlns="">
+ <script>String output = input + "XXX";</script>
+ <dependencies />
+ <inputs>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <handledReferenceSchemes />
+ <translatedElementType>java.lang.String</translatedElementType>
+ <allowsLiteralValues>true</allowsLiteralValues>
+ <name>input</name>
+ <depth>0</depth>
+ <mimeTypes>
+ <string>'text/plain'</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </inputs>
+ <outputs>
+ <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <granularDepth>0</granularDepth>
+ <name>output</name>
+ <depth>0</depth>
+ <mimeTypes>
+ <string>'text/plain'</string>
+ </mimeTypes>
+ </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </outputs>
+ </net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean>
+ </configBean>
+ </activity>
+ </activities>
+ <dispatchStack>
+ <dispatchLayer>
+ <class>
+ net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize
+ </class>
+ <configBean encoding="xstream">
+ <net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig
+ xmlns="">
+ <maxJobs>1</maxJobs>
+ </net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig>
+ </configBean>
+ </dispatchLayer>
+ <dispatchLayer>
+ <class>
+ net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce
+ </class>
+ <configBean encoding="xstream">
+ <null xmlns="" />
+ </configBean>
+ </dispatchLayer>
+ <dispatchLayer>
+ <class>
+ net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover
+ </class>
+ <configBean encoding="xstream">
+ <null xmlns="" />
+ </configBean>
+ </dispatchLayer>
+ <dispatchLayer>
+ <class>
+ net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry
+ </class>
+ <configBean encoding="xstream">
+ <net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig
+ xmlns="">
+ <backoffFactor>1.0</backoffFactor>
+ <initialDelay>0</initialDelay>
+ <maxDelay>0</maxDelay>
+ <maxRetries>0</maxRetries>
+ </net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig>
+ </configBean>
+ </dispatchLayer>
+ <dispatchLayer>
+ <class>
+ net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke
+ </class>
+ <configBean encoding="xstream">
+ <null xmlns="" />
+ </configBean>
+ </dispatchLayer>
+ </dispatchStack>
+ <iterationStrategyStack>
+ <iteration>
+ <strategy>
+ <port name="input" depth="0" />
+ </strategy>
+ </iteration>
+ </iterationStrategyStack>
+ </processor>
+ </processors>
+ <conditions />
+ <datalinks>
+ <datalink>
+ <sink type="processor">
+ <processor>Concat_XXX</processor>
+ <port>input</port>
+ </sink>
+ <source type="dataflow">
+ <port>input</port>
+ </source>
+ </datalink>
+ <datalink>
+ <sink type="dataflow">
+ <port>output</port>
+ </sink>
+ <source type="processor">
+ <processor>Concat_XXX</processor>
+ <port>output</port>
+ </source>
+ </datalink>
+ </datalinks>
+ </dataflow>
+</workflow>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-model/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-graph-model/pom.xml b/taverna-graph-model/pom.xml
index f40acbc..8a117a3 100644
--- a/taverna-graph-model/pom.xml
+++ b/taverna-graph-model/pom.xml
@@ -121,11 +121,6 @@
<artifactId>taverna-configuration-ui-api</artifactId>
<version>${project.parent.version}</version>
</dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>taverna-io</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
<dependency>
<groupId>org.apache.batik</groupId>
<artifactId>batik-osgi</artifactId>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/AutoScrollInteractor.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/AutoScrollInteractor.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/AutoScrollInteractor.java
deleted file mode 100644
index 65a4aa5..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/AutoScrollInteractor.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package net.sf.taverna.t2.workbench.views.graph;
-
-import static java.awt.event.InputEvent.BUTTON1_DOWN_MASK;
-import static java.awt.event.InputEvent.BUTTON1_MASK;
-import static java.awt.event.MouseEvent.BUTTON1;
-import static java.awt.event.MouseEvent.MOUSE_DRAGGED;
-import static java.awt.event.MouseEvent.MOUSE_PRESSED;
-import static java.lang.System.currentTimeMillis;
-
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.event.InputEvent;
-import java.awt.event.MouseEvent;
-import java.awt.geom.AffineTransform;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import org.apache.batik.swing.JSVGCanvas;
-import org.apache.batik.swing.gvt.InteractorAdapter;
-import org.apache.batik.swing.gvt.JGVTComponent;
-
-/**
- * An interactor that scrolls the canvas view if the mouse is dragged to the
- * edge of the canvas.
- *
- * @author David Withers
- */
-public class AutoScrollInteractor extends InteractorAdapter {
- /**
- * Defines the border around the canvas in which the auto scroll will become
- * active.
- */
- private static final int BORDER = 25;
- /**
- * The interval, in milliseconds, between scroll events.
- */
- private static final long SCROLL_INTERVAL = 100;
-
- private JSVGCanvas svgCanvas;
- private Dimension canvasSize;
- private int scrollX;
- private int scrollY;
- private int mouseX;
- private int mouseY;
-
- /**
- * Component used to identify mouse events generated by this class
- */
- private Component eventIdentifier = new Component() {
- private static final long serialVersionUID = -295542754718804222L;
- };
-
- private static Timer timer = new Timer("GraphAutoScrollTimer", true);
-
- private TimerTask task;
-
- /**
- * Whether the interactor has finished.
- */
- protected boolean finished = true;
-
- public AutoScrollInteractor(JSVGCanvas svgCanvas) {
- this.svgCanvas = svgCanvas;
- }
-
- @Override
- public boolean startInteraction(InputEvent ie) {
- int mods = ie.getModifiers();
- if (ie.getID() == MOUSE_PRESSED && (mods & BUTTON1_MASK) != 0) {
- AffineTransform transform = svgCanvas.getRenderingTransform();
- // check if we're zoomed in
- if (transform.getScaleX() > 1d || transform.getScaleY() > 1d) {
- canvasSize = svgCanvas.getSize();
- return true;
- }
- }
- return false;
- }
-
- @Override
- public boolean endInteraction() {
- return finished;
- }
-
- @Override
- public void mousePressed(final MouseEvent e) {
- if (startInteraction(e)) {
- finished = false;
- task = new TimerTask() {
- @Override
- public void run() {
- scrollTimerCallback(e);
- }
- };
- timer.schedule(task, 0, SCROLL_INTERVAL);
- }
- }
-
- /**
- * Dispatches a mouse drag event that updates the mouse location by the
- * amount that the canvas has been scrolled.
- *
- * @param dragX
- * @param dragY
- */
- private void dispatchDragEvent(double dragX, double dragY) {
- int x = (int) (mouseX + dragX);
- int y = (int) (mouseY + dragY);
- MouseEvent mouseDragEvent = new MouseEvent(eventIdentifier,
- MOUSE_DRAGGED, currentTimeMillis(), BUTTON1_DOWN_MASK, x, y, 1,
- false, BUTTON1);
- svgCanvas.dispatchEvent(mouseDragEvent);
- }
-
- @Override
- public void mouseReleased(MouseEvent e) {
- if (!finished) {
- finished = true;
- scrollX = 0;
- scrollY = 0;
- if (task != null)
- task.cancel();
- }
- }
-
- @Override
- public void mouseDragged(MouseEvent e) {
- // ignore events generated by this class
- if (!finished && e.getSource() != eventIdentifier) {
- mouseX = e.getX();
- mouseY = e.getY();
- int minX = BORDER;
- int maxX = canvasSize.width - BORDER;
- int minY = BORDER;
- int maxY = canvasSize.height - BORDER;
-
- scrollX = (mouseX < minX) ? (minX - mouseX)
- : (mouseX > maxX) ? (maxX - mouseX) : 0;
- scrollY = (mouseY < minY) ? (minY - mouseY)
- : (mouseY > maxY) ? (maxY - mouseY) : 0;
- }
- }
-
- private void scrollTimerCallback(MouseEvent e) {
- double x = scrollX;
- double y = scrollY;
- if (x == 0 && y == 0)
- return;
-
- JGVTComponent c = (JGVTComponent) e.getSource();
- AffineTransform rt = (AffineTransform) c.getRenderingTransform()
- .clone();
- double currentTranslateX = rt.getTranslateX();
- double currentTranslateY = rt.getTranslateY();
- // the tranlation that will show the east edge
- double maxTranslateX = -((canvasSize.width * rt.getScaleX()) - canvasSize.width);
- // the translation that will show the south
- double maxTranslateY = -((canvasSize.height * rt.getScaleY()) - canvasSize.height);
-
- if (x > 0 && currentTranslateX + x > 0)
- // scroll left && not at west edge
- x = -currentTranslateX;
- else if (x < 0 && currentTranslateX + x < maxTranslateX)
- // scroll right && not at east edge
- x = maxTranslateX - currentTranslateX;
-
- if (y > 0 && currentTranslateY + y > 0)
- // scroll up && not at north edge
- y = -currentTranslateY;
- else if (y < 0 && currentTranslateY + y < maxTranslateY)
- // scroll down && not at south edge
- y = maxTranslateY - currentTranslateY;
-
- if (x != 0d || y != 0d) {
- AffineTransform at = AffineTransform.getTranslateInstance(x, y);
- rt.preConcatenate(at);
- c.setRenderingTransform(rt);
- dispatchDragEvent(x, y);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponent.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponent.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponent.java
deleted file mode 100644
index dac96ab..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponent.java
+++ /dev/null
@@ -1,548 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static javax.swing.Action.SHORT_DESCRIPTION;
-import static javax.swing.Action.SMALL_ICON;
-import static javax.swing.BoxLayout.PAGE_AXIS;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.allportIcon;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.blobIcon;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.expandNestedIcon;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.horizontalIcon;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.noportIcon;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.refreshIcon;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.verticalIcon;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.zoomInIcon;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.zoomOutIcon;
-import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.ALIGNMENT;
-import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.ANIMATION_ENABLED;
-import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.ANIMATION_SPEED;
-import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.PORT_STYLE;
-import static org.apache.batik.swing.svg.AbstractJSVGComponent.ALWAYS_DYNAMIC;
-
-import java.awt.BorderLayout;
-import java.awt.CardLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.BoxLayout;
-import javax.swing.ButtonGroup;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JToggleButton;
-import javax.swing.JToolBar;
-import javax.swing.Timer;
-import javax.swing.border.EmptyBorder;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.SwingAwareObserver;
-import org.apache.taverna.ui.menu.MenuManager;
-import org.apache.taverna.workbench.configuration.colour.ColourManager;
-import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.edits.EditManager.AbstractDataflowEditEvent;
-import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.events.ClosedDataflowEvent;
-import org.apache.taverna.workbench.file.events.FileManagerEvent;
-import org.apache.taverna.workbench.models.graph.Graph.Alignment;
-import org.apache.taverna.workbench.models.graph.GraphController;
-import org.apache.taverna.workbench.models.graph.GraphController.PortStyle;
-import org.apache.taverna.workbench.models.graph.svg.SVGGraphController;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
-import org.apache.taverna.workbench.selection.events.WorkflowBundleSelectionEvent;
-import org.apache.taverna.workbench.selection.events.WorkflowSelectionEvent;
-import org.apache.taverna.workbench.ui.dndhandler.ServiceTransferHandler;
-import org.apache.taverna.workbench.ui.zaria.UIComponentSPI;
-import net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration;
-import net.sf.taverna.t2.workbench.views.graph.menu.ResetDiagramAction;
-import net.sf.taverna.t2.workbench.views.graph.menu.ZoomInAction;
-import net.sf.taverna.t2.workbench.views.graph.menu.ZoomOutAction;
-
-import org.apache.batik.swing.JSVGCanvas;
-import org.apache.batik.swing.JSVGScrollPane;
-import org.apache.batik.swing.gvt.GVTTreeRendererAdapter;
-import org.apache.batik.swing.gvt.GVTTreeRendererEvent;
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * @author David Withers
- * @author Alex Nenadic
- * @author Tom Oinn
- */
-public class GraphViewComponent extends JPanel implements UIComponentSPI {
- private static final long serialVersionUID = 7404937056378331528L;
- private static final Logger logger = Logger.getLogger(GraphViewComponent.class);
-
- private Workflow workflow;
- private SVGGraphController graphController;
- private JPanel diagramPanel;
-
- private Map<WorkflowBundle, Set<Workflow>> workflowsMap = new IdentityHashMap<>();
-
- private Map<Workflow, SVGGraphController> graphControllerMap = new IdentityHashMap<>();
- private Map<Workflow, JPanel> diagramPanelMap = new IdentityHashMap<>();
- private Map<Workflow, Action[]> diagramActionsMap = new IdentityHashMap<>();
-
- private Timer timer;
-
- private CardLayout cardLayout;
-
- private final ColourManager colourManager;
- private final EditManager editManager;
- private final MenuManager menuManager;
- private final GraphViewConfiguration graphViewConfiguration;
- private final WorkbenchConfiguration workbenchConfiguration;
- private final SelectionManager selectionManager;
- private final ServiceRegistry serviceRegistry;
-
- public GraphViewComponent(ColourManager colourManager,
- EditManager editManager, FileManager fileManager,
- MenuManager menuManager,
- GraphViewConfiguration graphViewConfiguration,
- WorkbenchConfiguration workbenchConfiguration,
- SelectionManager selectionManager, ServiceRegistry serviceRegistry) {
- this.colourManager = colourManager;
- this.editManager = editManager;
- this.menuManager = menuManager;
- this.graphViewConfiguration = graphViewConfiguration;
- this.workbenchConfiguration = workbenchConfiguration;
- this.selectionManager = selectionManager;
- this.serviceRegistry = serviceRegistry;
-
- cardLayout = new CardLayout();
- setLayout(cardLayout);
-
- ActionListener taskPerformer = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent evt) {
- if (graphController != null)
- graphController.redraw();
- timer.stop();
- }
- };
- timer = new Timer(100, taskPerformer);
-
- addComponentListener(new ComponentAdapter() {
- @Override
- public void componentResized(ComponentEvent e) {
- if (timer.isRunning())
- timer.restart();
- else
- timer.start();
- }
- });
-
- editManager.addObserver(new EditManagerObserver());
- selectionManager.addObserver(new SelectionManagerObserver());
- fileManager.addObserver(new FileManagerObserver());
- }
-
- @Override
- protected void finalize() throws Throwable {
- if (timer != null)
- timer.stop();
- }
-
- @Override
- public String getName() {
- return "Graph View Component";
- }
-
- @Override
- public ImageIcon getIcon() {
- return null;
- }
-
- @Override
- public void onDisplay() {
- }
-
- @Override
- public void onDispose() {
- if (timer != null)
- timer.stop();
- }
-
- private JPanel createDiagramPanel(Workflow workflow) {
- final JPanel diagramPanel = new JPanel(new BorderLayout());
-
- // get the default diagram settings
- Alignment alignment = Alignment.valueOf(graphViewConfiguration
- .getProperty(ALIGNMENT));
- PortStyle portStyle = PortStyle.valueOf(graphViewConfiguration
- .getProperty(PORT_STYLE));
- boolean animationEnabled = Boolean.parseBoolean(graphViewConfiguration
- .getProperty(ANIMATION_ENABLED));
- int animationSpeed = Integer.parseInt(graphViewConfiguration
- .getProperty(ANIMATION_SPEED));
-
- // create an SVG canvas
- final JSVGCanvas svgCanvas = new JSVGCanvas(null, true, false);
- svgCanvas.setEnableZoomInteractor(false);
- svgCanvas.setEnableRotateInteractor(false);
- svgCanvas.setDocumentState(ALWAYS_DYNAMIC);
- svgCanvas.setTransferHandler(new ServiceTransferHandler(editManager,
- menuManager, selectionManager, serviceRegistry));
-
- AutoScrollInteractor asi = new AutoScrollInteractor(svgCanvas);
- svgCanvas.addMouseListener(asi);
- svgCanvas.addMouseMotionListener(asi);
-
- final JSVGScrollPane svgScrollPane = new MySvgScrollPane(svgCanvas);
-
- GVTTreeRendererAdapter gvtTreeRendererAdapter = new GVTTreeRendererAdapter() {
- @Override
- public void gvtRenderingCompleted(GVTTreeRendererEvent e) {
- logger.info("Rendered svg");
- svgScrollPane.reset();
- diagramPanel.revalidate();
- }
- };
- svgCanvas.addGVTTreeRendererListener(gvtTreeRendererAdapter);
-
- // create a graph controller
- SVGGraphController svgGraphController = new SVGGraphController(
- workflow, selectionManager.getSelectedProfile(), false,
- svgCanvas, alignment, portStyle, editManager, menuManager,
- colourManager, workbenchConfiguration);
- svgGraphController.setDataflowSelectionModel(selectionManager
- .getDataflowSelectionModel(workflow.getParent()));
- svgGraphController.setAnimationSpeed(animationEnabled ? animationSpeed
- : 0);
-
- graphControllerMap.put(workflow, svgGraphController);
-
- // Toolbar with actions related to graph
- JToolBar graphActionsToolbar = graphActionsToolbar(workflow,
- svgGraphController, svgCanvas, alignment, portStyle);
- graphActionsToolbar.setAlignmentX(LEFT_ALIGNMENT);
- graphActionsToolbar.setFloatable(false);
-
- // Panel to hold the toolbars
- JPanel toolbarPanel = new JPanel();
- toolbarPanel.setLayout(new BoxLayout(toolbarPanel, PAGE_AXIS));
- toolbarPanel.add(graphActionsToolbar);
-
- diagramPanel.add(toolbarPanel, NORTH);
- diagramPanel.add(svgScrollPane, CENTER);
-
- // JTextField workflowHierarchy = new JTextField(workflow.getName());
- // diagramPanel.add(workflowHierarchy, BorderLayout.SOUTH);
-
- return diagramPanel;
- }
-
- @SuppressWarnings("serial")
- private JToolBar graphActionsToolbar(Workflow workflow,
- final SVGGraphController graphController, JSVGCanvas svgCanvas,
- Alignment alignment, PortStyle portStyle) {
- JToolBar toolBar = new JToolBar();
-
- JButton resetDiagramButton = new JButton();
- resetDiagramButton.setBorder(new EmptyBorder(0, 2, 0, 2));
- JButton zoomInButton = new JButton();
- zoomInButton.setBorder(new EmptyBorder(0, 2, 0, 2));
- JButton zoomOutButton = new JButton();
- zoomOutButton.setBorder(new EmptyBorder(0, 2, 0, 2));
-
- Action resetDiagramAction = svgCanvas.new ResetTransformAction();
- ResetDiagramAction.setDesignAction(resetDiagramAction);
- resetDiagramAction.putValue(SHORT_DESCRIPTION, "Reset Diagram");
- resetDiagramAction.putValue(SMALL_ICON, refreshIcon);
- resetDiagramButton.setAction(resetDiagramAction);
-
- Action zoomInAction = svgCanvas.new ZoomAction(1.2);
- ZoomInAction.setDesignAction(zoomInAction);
- zoomInAction.putValue(SHORT_DESCRIPTION, "Zoom In");
- zoomInAction.putValue(SMALL_ICON, zoomInIcon);
- zoomInButton.setAction(zoomInAction);
-
- Action zoomOutAction = svgCanvas.new ZoomAction(1 / 1.2);
- ZoomOutAction.setDesignAction(zoomOutAction);
- zoomOutAction.putValue(SHORT_DESCRIPTION, "Zoom Out");
- zoomOutAction.putValue(SMALL_ICON, zoomOutIcon);
- zoomOutButton.setAction(zoomOutAction);
-
- diagramActionsMap.put(workflow, new Action[] { resetDiagramAction,
- zoomInAction, zoomOutAction });
-
- toolBar.add(resetDiagramButton);
- toolBar.add(zoomInButton);
- toolBar.add(zoomOutButton);
-
- toolBar.addSeparator();
-
- ButtonGroup nodeTypeGroup = new ButtonGroup();
-
- JToggleButton noPorts = new JToggleButton();
- JToggleButton allPorts = new JToggleButton();
- JToggleButton blobs = new JToggleButton();
- nodeTypeGroup.add(noPorts);
- nodeTypeGroup.add(allPorts);
- nodeTypeGroup.add(blobs);
-
- if (portStyle.equals(PortStyle.NONE))
- noPorts.setSelected(true);
- else if (portStyle.equals(PortStyle.ALL))
- allPorts.setSelected(true);
- else
- blobs.setSelected(true);
-
- noPorts.setAction(new AbstractAction() {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- graphController.setPortStyle(PortStyle.NONE);
- graphController.redraw();
- }
- });
- noPorts.getAction().putValue(SHORT_DESCRIPTION,
- "Display no service ports");
- noPorts.getAction().putValue(SMALL_ICON, noportIcon);
- noPorts.setFocusPainted(false);
-
- allPorts.setAction(new AbstractAction() {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- graphController.setPortStyle(PortStyle.ALL);
- graphController.redraw();
- }
- });
- allPorts.getAction().putValue(SHORT_DESCRIPTION,
- "Display all service ports");
- allPorts.getAction().putValue(SMALL_ICON, allportIcon);
- allPorts.setFocusPainted(false);
-
- blobs.setAction(new AbstractAction() {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- graphController.setPortStyle(PortStyle.BLOB);
- graphController.redraw();
- }
- });
- blobs.getAction().putValue(SHORT_DESCRIPTION,
- "Display services as circles");
- blobs.getAction().putValue(SMALL_ICON, blobIcon);
- blobs.setFocusPainted(false);
-
- toolBar.add(noPorts);
- toolBar.add(allPorts);
- toolBar.add(blobs);
-
- toolBar.addSeparator();
-
- ButtonGroup alignmentGroup = new ButtonGroup();
-
- JToggleButton vertical = new JToggleButton();
- JToggleButton horizontal = new JToggleButton();
- alignmentGroup.add(vertical);
- alignmentGroup.add(horizontal);
-
- if (alignment.equals(Alignment.VERTICAL)) {
- vertical.setSelected(true);
- } else {
- horizontal.setSelected(true);
- }
-
- vertical.setAction(new AbstractAction() {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- graphController.setAlignment(Alignment.VERTICAL);
- graphController.redraw();
- }
- });
- vertical.getAction().putValue(SHORT_DESCRIPTION,
- "Align services vertically");
- vertical.getAction().putValue(SMALL_ICON, verticalIcon);
- vertical.setFocusPainted(false);
-
- horizontal.setAction(new AbstractAction() {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- graphController.setAlignment(Alignment.HORIZONTAL);
- graphController.redraw();
- }
-
- });
- horizontal.getAction().putValue(SHORT_DESCRIPTION,
- "Align services horizontally");
- horizontal.getAction().putValue(SMALL_ICON, horizontalIcon);
- horizontal.setFocusPainted(false);
-
- toolBar.add(vertical);
- toolBar.add(horizontal);
-
- toolBar.addSeparator();
-
- JToggleButton expandNested = new JToggleButton();
- expandNested.setSelected(true);
-
- expandNested.setAction(new AbstractAction() {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- graphController.setExpandNestedDataflows(!graphController
- .expandNestedDataflows());
- graphController.redraw();
- }
- });
- expandNested.getAction().putValue(SHORT_DESCRIPTION,
- "Expand Nested Workflows");
- expandNested.getAction().putValue(SMALL_ICON, expandNestedIcon);
- expandNested.setFocusPainted(false);
- toolBar.add(expandNested);
-
- return toolBar;
- }
-
- /**
- * Sets the Workflow to display in the graph view.
- *
- * @param workflow
- */
- private void setWorkflow(Workflow workflow) {
- this.workflow = workflow;
- if (!diagramPanelMap.containsKey(workflow))
- addWorkflow(workflow);
- graphController = graphControllerMap.get(workflow);
- diagramPanel = diagramPanelMap.get(workflow);
- Action[] actions = diagramActionsMap.get(workflow);
- if (actions != null && actions.length == 3) {
- ResetDiagramAction.setDesignAction(actions[0]);
- ZoomInAction.setDesignAction(actions[1]);
- ZoomOutAction.setDesignAction(actions[2]);
- }
- cardLayout.show(this, String.valueOf(diagramPanel.hashCode()));
- graphController.redraw();
- }
-
- private void addWorkflow(Workflow workflow) {
- JPanel newDiagramPanel = createDiagramPanel(workflow);
- add(newDiagramPanel, String.valueOf(newDiagramPanel.hashCode()));
- diagramPanelMap.put(workflow, newDiagramPanel);
- if (!workflowsMap.containsKey(workflow.getParent()))
- workflowsMap.put(workflow.getParent(), new HashSet<Workflow>());
- workflowsMap.get(workflow.getParent()).add(workflow);
- }
-
- private void removeWorkflow(Workflow workflow) {
- JPanel panel = diagramPanelMap.remove(workflow);
- if (panel != null)
- remove(panel);
- SVGGraphController removedController = graphControllerMap.remove(workflow);
- if (removedController != null)
- removedController.shutdown();
- diagramActionsMap.remove(workflow);
- Set<Workflow> workflows = workflowsMap.get(workflow.getParent());
- if (workflows != null)
- workflows.remove(workflow);
- }
-
- public GraphController getGraphController(Workflow workflow) {
- return graphControllerMap.get(workflow);
- }
-
- private class EditManagerObserver extends
- SwingAwareObserver<EditManagerEvent> {
- @Override
- public void notifySwing(Observable<EditManagerEvent> sender,
- EditManagerEvent message) {
- if (!(message instanceof AbstractDataflowEditEvent))
- return;
- AbstractDataflowEditEvent dataflowEditEvent = (AbstractDataflowEditEvent) message;
- if (dataflowEditEvent.getDataFlow() != workflow.getParent())
- return;
-
- boolean animationEnabled = Boolean
- .parseBoolean(graphViewConfiguration
- .getProperty(ANIMATION_ENABLED));
- int animationSpeed = (animationEnabled ? Integer
- .parseInt(graphViewConfiguration
- .getProperty(ANIMATION_SPEED)) : 0);
- boolean animationSettingChanged = (animationEnabled != (graphController
- .getAnimationSpeed() != 0));
-
- if (graphController.isDotMissing() || animationSettingChanged) {
- removeWorkflow(workflow);
- setWorkflow(workflow);
- } else {
- if (animationSpeed != graphController.getAnimationSpeed())
- graphController.setAnimationSpeed(animationSpeed);
- graphController.redraw();
- }
- }
- }
-
- private class FileManagerObserver extends SwingAwareObserver<FileManagerEvent> {
- @Override
- public void notifySwing(Observable<FileManagerEvent> sender, final FileManagerEvent message) {
- if (!(message instanceof ClosedDataflowEvent))
- return;
- ClosedDataflowEvent closedDataflowEvent = (ClosedDataflowEvent) message;
-
- WorkflowBundle workflowBundle = closedDataflowEvent.getDataflow();
- if (workflowsMap.containsKey(workflowBundle))
- for (Workflow workflow : workflowsMap.remove(workflowBundle))
- removeWorkflow(workflow);
- }
- }
-
- private class SelectionManagerObserver extends
- SwingAwareObserver<SelectionManagerEvent> {
- @Override
- public void notifySwing(Observable<SelectionManagerEvent> sender,
- SelectionManagerEvent message) {
- if (message instanceof WorkflowSelectionEvent)
- setWorkflow(selectionManager.getSelectedWorkflow());
- else if (message instanceof WorkflowBundleSelectionEvent)
- setWorkflow(selectionManager.getSelectedWorkflow());
- }
- }
-
- private class MySvgScrollPane extends JSVGScrollPane {
- private static final long serialVersionUID = -1539947450704269879L;
-
- public MySvgScrollPane(JSVGCanvas canvas) {
- super(canvas);
- }
-
- @Override
- public void reset() {
- super.resizeScrollBars();
- super.reset();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponentFactory.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponentFactory.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponentFactory.java
deleted file mode 100644
index 4f603d6..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponentFactory.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph;
-
-import javax.swing.ImageIcon;
-
-import org.apache.taverna.commons.services.ServiceRegistry;
-
-import org.apache.taverna.ui.menu.MenuManager;
-import org.apache.taverna.workbench.configuration.colour.ColourManager;
-import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI;
-import org.apache.taverna.workbench.ui.zaria.UIComponentSPI;
-import net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration;
-
-/**
- * @author David Withers
- */
-public class GraphViewComponentFactory implements UIComponentFactorySPI {
- private EditManager editManager;
- private FileManager fileManager;
- private MenuManager menuManager;
- private SelectionManager selectionManager;
- private ColourManager colourManager;
- private WorkbenchConfiguration workbenchConfiguration;
- private GraphViewConfiguration graphViewConfiguration;
- private ServiceRegistry serviceRegistry;
-
- @Override
- public UIComponentSPI getComponent() {
- return new GraphViewComponent(colourManager, editManager, fileManager,
- menuManager, graphViewConfiguration, workbenchConfiguration,
- selectionManager, serviceRegistry);
- }
-
- @Override
- public ImageIcon getIcon() {
- return null;
- }
-
- @Override
- public String getName() {
- return "Graph View";
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setMenuManager(MenuManager menuManager) {
- this.menuManager = menuManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
- public void setColourManager(ColourManager colourManager) {
- this.colourManager = colourManager;
- }
-
- public void setWorkbenchConfiguration(
- WorkbenchConfiguration workbenchConfiguration) {
- this.workbenchConfiguration = workbenchConfiguration;
- }
-
- public void setGraphViewConfiguration(
- GraphViewConfiguration graphViewConfiguration) {
- this.graphViewConfiguration = graphViewConfiguration;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFInputAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFInputAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFInputAction.java
deleted file mode 100644
index c102cd6..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFInputAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.actions;
-
-import static java.awt.event.InputEvent.ALT_DOWN_MASK;
-import static java.awt.event.InputEvent.SHIFT_DOWN_MASK;
-import static java.awt.event.KeyEvent.VK_I;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.inputIcon;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import org.apache.taverna.ui.menu.DesignOnlyAction;
-import org.apache.taverna.workbench.design.actions.AddDataflowInputAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * An action that adds a workflow input.
- *
- * @author Alex Nenadic
- * @author Alan R Williams
- */
-@SuppressWarnings("serial")
-public class AddWFInputAction extends AbstractAction implements
- DesignOnlyAction {
- private final EditManager editManager;
- private final SelectionManager selectionManager;
-
- public AddWFInputAction(EditManager editManager,
- SelectionManager selectionManager) {
- super();
- this.editManager = editManager;
- this.selectionManager = selectionManager;
- putValue(SMALL_ICON, inputIcon);
- putValue(NAME, "Workflow input port");
- putValue(SHORT_DESCRIPTION, "Workflow input port");
- putValue(ACCELERATOR_KEY,
- getKeyStroke(VK_I, SHIFT_DOWN_MASK | ALT_DOWN_MASK));
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- Workflow workflow = selectionManager.getSelectedWorkflow();
- new AddDataflowInputAction(workflow, null, editManager,
- selectionManager).actionPerformed(e);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFOutputAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFOutputAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFOutputAction.java
deleted file mode 100644
index 72dfc61..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFOutputAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.actions;
-
-import static java.awt.event.InputEvent.ALT_DOWN_MASK;
-import static java.awt.event.InputEvent.SHIFT_DOWN_MASK;
-import static java.awt.event.KeyEvent.VK_O;
-import static javax.swing.KeyStroke.getKeyStroke;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import org.apache.taverna.ui.menu.DesignOnlyAction;
-import org.apache.taverna.workbench.design.actions.AddDataflowOutputAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.icons.WorkbenchIcons;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * An action that adds a workflow output.
- *
- * @author Alex Nenadic
- * @author Alan R Williams
- */
-@SuppressWarnings("serial")
-public class AddWFOutputAction extends AbstractAction implements
- DesignOnlyAction {
- private final EditManager editManager;
- private final SelectionManager selectionManager;
-
- public AddWFOutputAction(EditManager editManager,
- SelectionManager selectionManager) {
- super();
- this.editManager = editManager;
- this.selectionManager = selectionManager;
- putValue(SMALL_ICON, WorkbenchIcons.outputIcon);
- putValue(NAME, "Workflow output port");
- putValue(SHORT_DESCRIPTION, "Workflow output port");
- putValue(ACCELERATOR_KEY,
- getKeyStroke(VK_O, SHIFT_DOWN_MASK | ALT_DOWN_MASK));
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- Workflow workflow = selectionManager.getSelectedWorkflow();
- new AddDataflowOutputAction(workflow, null, editManager,
- selectionManager).actionPerformed(e);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/DeleteGraphComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/DeleteGraphComponentAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/DeleteGraphComponentAction.java
deleted file mode 100644
index 3d2736d..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/DeleteGraphComponentAction.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.actions;
-
-import static java.awt.event.KeyEvent.VK_DELETE;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.deleteIcon;
-
-import java.awt.event.ActionEvent;
-import java.util.Set;
-
-import javax.swing.AbstractAction;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.lang.observer.SwingAwareObserver;
-import org.apache.taverna.ui.menu.DesignOnlyAction;
-import org.apache.taverna.workbench.design.actions.RemoveConditionAction;
-import org.apache.taverna.workbench.design.actions.RemoveDataflowInputPortAction;
-import org.apache.taverna.workbench.design.actions.RemoveDataflowOutputPortAction;
-import org.apache.taverna.workbench.design.actions.RemoveDatalinkAction;
-import org.apache.taverna.workbench.design.actions.RemoveProcessorAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.selection.DataflowSelectionModel;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import org.apache.taverna.workbench.selection.events.DataflowSelectionMessage;
-import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
-import org.apache.taverna.workbench.selection.events.WorkflowBundleSelectionEvent;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.ControlLink;
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-
-/**
- * An action that deletes the selected graph component.
- *
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class DeleteGraphComponentAction extends AbstractAction implements DesignOnlyAction {
- /** Current workflow's selection model event observer.*/
- private Observer<DataflowSelectionMessage> workflowSelectionObserver = new DataflowSelectionObserver();
-
- private final EditManager editManager;
- private final SelectionManager selectionManager;
-
- public DeleteGraphComponentAction(EditManager editManager, final SelectionManager selectionManager) {
- super();
- this.editManager = editManager;
- this.selectionManager = selectionManager;
- putValue(SMALL_ICON, deleteIcon);
- putValue(NAME, "Delete");
- putValue(SHORT_DESCRIPTION, "Delete selected component");
- putValue(ACCELERATOR_KEY, getKeyStroke(VK_DELETE, 0));
- setEnabled(false);
-
- selectionManager.addObserver(new SelectionManagerObserver());
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- WorkflowBundle workflowBundle = selectionManager
- .getSelectedWorkflowBundle();
- DataflowSelectionModel dataFlowSelectionModel = selectionManager
- .getDataflowSelectionModel(workflowBundle);
- // Get all selected components
- Set<Object> selectedWFComponents = dataFlowSelectionModel.getSelection();
- for (Object selectedWFComponent : selectedWFComponents)
- if (selectedWFComponent instanceof Processor) {
- Processor processor = (Processor) selectedWFComponent;
- new RemoveProcessorAction(processor.getParent(), processor,
- null, editManager, selectionManager).actionPerformed(e);
- } else if (selectedWFComponent instanceof DataLink) {
- DataLink dataLink = (DataLink) selectedWFComponent;
- new RemoveDatalinkAction(dataLink.getParent(), dataLink, null,
- editManager, selectionManager).actionPerformed(e);
- } else if (selectedWFComponent instanceof InputWorkflowPort) {
- InputWorkflowPort port = (InputWorkflowPort) selectedWFComponent;
- new RemoveDataflowInputPortAction(port.getParent(), port, null,
- editManager, selectionManager).actionPerformed(e);
- } else if (selectedWFComponent instanceof OutputWorkflowPort) {
- OutputWorkflowPort port = (OutputWorkflowPort) selectedWFComponent;
- new RemoveDataflowOutputPortAction(port.getParent(), port,
- null, editManager, selectionManager).actionPerformed(e);
- } else if (selectedWFComponent instanceof ControlLink) {
- ControlLink controlLink = (ControlLink) selectedWFComponent;
- new RemoveConditionAction(controlLink.getParent(), controlLink,
- null, editManager, selectionManager).actionPerformed(e);
- }
- }
-
- /**
- * Check if action should be enabled or disabled and update its status.
- */
- public void updateStatus(WorkflowBundle selectionWorkflowBundle) {
- if (selectionWorkflowBundle != null) {
- DataflowSelectionModel selectionModel = selectionManager
- .getDataflowSelectionModel(selectionWorkflowBundle);
- Set<Object> selection = selectionModel.getSelection();
- if (!selection.isEmpty()) {
- // Take the first selected item - we only support single selections anyway
- Object selected = selection.toArray()[0];
- if ((selected instanceof Processor)
- || (selected instanceof InputWorkflowPort)
- || (selected instanceof OutputWorkflowPort)
- || (selected instanceof DataLink)
- || (selected instanceof ControlLink)) {
- setEnabled(true);
- return;
- }
- }
- }
- setEnabled(false);
- }
-
- /**
- * Observes events on workflow Selection Manager, i.e. when a workflow node
- * is selected in the graph view, and enables/disables this action
- * accordingly.
- */
- private final class DataflowSelectionObserver extends
- SwingAwareObserver<DataflowSelectionMessage> {
- @Override
- public void notifySwing(Observable<DataflowSelectionMessage> sender,
- DataflowSelectionMessage message) {
- updateStatus(selectionManager.getSelectedWorkflowBundle());
- }
- }
-
- private final class SelectionManagerObserver extends
- SwingAwareObserver<SelectionManagerEvent> {
- @Override
- public void notifySwing(Observable<SelectionManagerEvent> sender,
- SelectionManagerEvent message) {
- if (!(message instanceof WorkflowBundleSelectionEvent))
- return;
- WorkflowBundleSelectionEvent workflowBundleSelectionEvent = (WorkflowBundleSelectionEvent) message;
- WorkflowBundle oldFlow = workflowBundleSelectionEvent
- .getPreviouslySelectedWorkflowBundle();
- WorkflowBundle newFlow = workflowBundleSelectionEvent
- .getSelectedWorkflowBundle();
-
- /*
- * Remove the workflow selection model listener from the previous
- * (if any) and add to the new workflow (if any)
- */
- if (oldFlow != null)
- selectionManager.getDataflowSelectionModel(oldFlow)
- .removeObserver(workflowSelectionObserver);
-
- // Update the buttons status as current dataflow has changed
- updateStatus(newFlow);
-
- if (newFlow != null)
- selectionManager.getDataflowSelectionModel(newFlow)
- .addObserver(workflowSelectionObserver);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/RenameWFInputOutputProcessorAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/RenameWFInputOutputProcessorAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/RenameWFInputOutputProcessorAction.java
deleted file mode 100644
index ea7e626..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/RenameWFInputOutputProcessorAction.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.actions;
-
-import static java.awt.event.KeyEvent.VK_F2;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.KeyStroke.getKeyStroke;
-
-import java.awt.event.ActionEvent;
-import java.util.Set;
-
-import javax.swing.AbstractAction;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.lang.observer.SwingAwareObserver;
-import org.apache.taverna.ui.menu.DesignOnlyAction;
-import org.apache.taverna.workbench.design.actions.EditDataflowInputPortAction;
-import org.apache.taverna.workbench.design.actions.EditDataflowOutputPortAction;
-import org.apache.taverna.workbench.design.actions.RenameProcessorAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.icons.WorkbenchIcons;
-import org.apache.taverna.workbench.selection.DataflowSelectionModel;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import org.apache.taverna.workbench.selection.events.DataflowSelectionMessage;
-import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
-import org.apache.taverna.workbench.selection.events.WorkflowBundleSelectionEvent;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-
-/**
- * An action that allows user to rename workflow input, output or
- * processor, in case one of these is currently selected in the Graph View.
- *
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class RenameWFInputOutputProcessorAction extends AbstractAction implements DesignOnlyAction {
- /** Current workflow's selection model event observer.*/
- private Observer<DataflowSelectionMessage> workflowSelectionObserver = new DataflowSelectionObserver();
-
- private final EditManager editManager;
- private final SelectionManager selectionManager;
-
- public RenameWFInputOutputProcessorAction(EditManager editManager,
- final SelectionManager selectionManager) {
- super();
- this.editManager = editManager;
- this.selectionManager = selectionManager;
- putValue(SMALL_ICON, WorkbenchIcons.renameIcon);
- putValue(NAME, "Rename");
- putValue(SHORT_DESCRIPTION, "Rename inputs, outputs or services");
- putValue(ACCELERATOR_KEY, getKeyStroke(VK_F2, 0));
- setEnabled(false);
-
- selectionManager.addObserver(new SelectionManagerObserver());
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- WorkflowBundle workflowBundle = selectionManager
- .getSelectedWorkflowBundle();
- DataflowSelectionModel dataFlowSelectionModel = selectionManager
- .getDataflowSelectionModel(workflowBundle);
- // Get selected port
- Set<Object> selectedWFComponents = dataFlowSelectionModel
- .getSelection();
- if (selectedWFComponents.size() > 1) {
- showMessageDialog(
- null,
- "Only one workflow component should be selected for this action.",
- "Warning", WARNING_MESSAGE);
- } else {
- Object selectedWFComponent = selectedWFComponents.toArray()[0];
- if (selectedWFComponent instanceof InputWorkflowPort) {
- InputWorkflowPort port = (InputWorkflowPort) selectedWFComponent;
- new EditDataflowInputPortAction(port.getParent(), port, null,
- editManager, selectionManager).actionPerformed(e);
- } else if (selectedWFComponent instanceof OutputWorkflowPort) {
- OutputWorkflowPort port = (OutputWorkflowPort) selectedWFComponent;
- new EditDataflowOutputPortAction(port.getParent(), port, null,
- editManager, selectionManager).actionPerformed(e);
- } else if (selectedWFComponent instanceof Processor) {
- Processor processor = (Processor) selectedWFComponent;
- new RenameProcessorAction(processor.getParent(), processor,
- null, editManager, selectionManager).actionPerformed(e);
- } else { // should not happen as the button will be disabled otherwise, but ...
- showMessageDialog(
- null,
- "This action does not apply for the selected component.",
- "Warning", WARNING_MESSAGE);
- }
- }
- }
-
- /**
- * Check if action should be enabled or disabled and update its status.
- */
- public void updateStatus() {
- WorkflowBundle workflowBundle = selectionManager
- .getSelectedWorkflowBundle();
- DataflowSelectionModel selectionModel = selectionManager
- .getDataflowSelectionModel(workflowBundle);
-
- // List of all selected objects in the graph view
- Set<Object> selection = selectionModel.getSelection();
-
- if (!selection.isEmpty()) {
- // Take the first selected item - we only support single selections anyway
- Object selected = selection.toArray()[0];
- if ((selected instanceof Processor)
- || (selected instanceof InputWorkflowPort)
- || (selected instanceof OutputWorkflowPort)) {
- setEnabled(true);
- return;
- }
- }
- setEnabled(false);
- }
-
- /**
- * Observes events on workflow Selection Manager, i.e. when a workflow node
- * is selected in the graph view, and enables/disables this action
- * accordingly.
- */
- private final class DataflowSelectionObserver extends
- SwingAwareObserver<DataflowSelectionMessage> {
- @Override
- public void notifySwing(Observable<DataflowSelectionMessage> sender,
- DataflowSelectionMessage message) {
- updateStatus();
- }
- }
-
- private final class SelectionManagerObserver extends
- SwingAwareObserver<SelectionManagerEvent> {
- @Override
- public void notifySwing(Observable<SelectionManagerEvent> sender,
- SelectionManagerEvent message) {
- if (!(message instanceof WorkflowBundleSelectionEvent))
- return;
- WorkflowBundleSelectionEvent workflowBundleSelectionEvent = (WorkflowBundleSelectionEvent) message;
- WorkflowBundle oldFlow = workflowBundleSelectionEvent
- .getPreviouslySelectedWorkflowBundle();
- WorkflowBundle newFlow = workflowBundleSelectionEvent
- .getSelectedWorkflowBundle();
- // Update the buttons status as current dataflow has changed
- updateStatus();
-
- /*
- * Remove the workflow selection model listener from the previous
- * (if any) and add to the new workflow (if any)
- */
- if (oldFlow != null)
- selectionManager.getDataflowSelectionModel(oldFlow)
- .removeObserver(workflowSelectionObserver);
-
- if (newFlow != null)
- selectionManager.getDataflowSelectionModel(newFlow)
- .addObserver(workflowSelectionObserver);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfiguration.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfiguration.java
deleted file mode 100644
index 1400064..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfiguration.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.config;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import uk.org.taverna.configuration.AbstractConfigurable;
-import uk.org.taverna.configuration.ConfigurationManager;
-
-import org.apache.taverna.workbench.models.graph.Graph.Alignment;
-import org.apache.taverna.workbench.models.graph.GraphController.PortStyle;
-
-/**
- * Configuration for the GraphViewComponent.
- *
- * @author David Withers
- */
-public class GraphViewConfiguration extends AbstractConfigurable {
- public static final String PORT_STYLE = "portStyle";
- public static final String ALIGNMENT = "alignment";
- public static final String ANIMATION_ENABLED = "animationEnabled";
- public static final String ANIMATION_SPEED = "animationSpeed";
-
- private Map<String, String> defaultPropertyMap;
-
- public GraphViewConfiguration(ConfigurationManager configurationManager) {
- super(configurationManager);
- }
-
- @Override
- public String getCategory() {
- return "general";
- }
-
- @Override
- public Map<String, String> getDefaultPropertyMap() {
- if (defaultPropertyMap == null) {
- defaultPropertyMap = new HashMap<>();
- defaultPropertyMap.put(PORT_STYLE, PortStyle.NONE.toString());
- defaultPropertyMap.put(ALIGNMENT, Alignment.VERTICAL.toString());
- defaultPropertyMap.put(ANIMATION_ENABLED, "false");
- defaultPropertyMap.put(ANIMATION_SPEED, "800");
- }
- return defaultPropertyMap;
- }
-
- @Override
- public String getDisplayName() {
- return "Diagram";
- }
-
- @Override
- public String getFilePrefix() {
- return "Diagram";
- }
-
- @Override
- public String getUUID() {
- return "3686BA31-449F-4147-A8AC-0C3F63AFC68F";
- }
-}
[03/11] incubator-taverna-workbench git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphEditToolbarSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphEditToolbarSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphEditToolbarSection.java
deleted file mode 100644
index 7a06acc..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphEditToolbarSection.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.toolbar;
-
-import static org.apache.taverna.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
-
-import java.net.URI;
-
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-/**
- * @author Alex Nenadic
- */
-public class GraphEditToolbarSection extends AbstractMenuSection {
- public static final URI GRAPH_EDIT_TOOLBAR_SECTION = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphEditToolbarSection");
-
- public GraphEditToolbarSection() {
- super(DEFAULT_TOOL_BAR, 30, GRAPH_EDIT_TOOLBAR_SECTION);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/RenameWFInputOutputProcessorToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/RenameWFInputOutputProcessorToolbarAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/RenameWFInputOutputProcessorToolbarAction.java
deleted file mode 100644
index 4a55db8..0000000
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/RenameWFInputOutputProcessorToolbarAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.views.graph.toolbar;
-
-import static net.sf.taverna.t2.workbench.views.graph.toolbar.GraphEditToolbarSection.GRAPH_EDIT_TOOLBAR_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.views.graph.actions.RenameWFInputOutputProcessorAction;
-
-/**
- * @author Alex Nenadic
- */
-public class RenameWFInputOutputProcessorToolbarAction extends
- AbstractMenuAction {
- private static final URI RENAME_WF_INPUT_OUTPUT_PROCESSOR_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphToolbarRenameWFInputOutputProcessor");
-
- private EditManager editManager;
- private SelectionManager selectionManager;
-
- public RenameWFInputOutputProcessorToolbarAction() {
- super(GRAPH_EDIT_TOOLBAR_SECTION, 30,
- RENAME_WF_INPUT_OUTPUT_PROCESSOR_URI);
- }
-
- @Override
- protected Action createAction() {
- return new RenameWFInputOutputProcessorAction(editManager,
- selectionManager);
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/AutoScrollInteractor.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/AutoScrollInteractor.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/AutoScrollInteractor.java
new file mode 100644
index 0000000..50237ea
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/AutoScrollInteractor.java
@@ -0,0 +1,200 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph;
+
+import static java.awt.event.InputEvent.BUTTON1_DOWN_MASK;
+import static java.awt.event.InputEvent.BUTTON1_MASK;
+import static java.awt.event.MouseEvent.BUTTON1;
+import static java.awt.event.MouseEvent.MOUSE_DRAGGED;
+import static java.awt.event.MouseEvent.MOUSE_PRESSED;
+import static java.lang.System.currentTimeMillis;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
+import java.awt.geom.AffineTransform;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.apache.batik.swing.JSVGCanvas;
+import org.apache.batik.swing.gvt.InteractorAdapter;
+import org.apache.batik.swing.gvt.JGVTComponent;
+
+/**
+ * An interactor that scrolls the canvas view if the mouse is dragged to the
+ * edge of the canvas.
+ *
+ * @author David Withers
+ */
+public class AutoScrollInteractor extends InteractorAdapter {
+ /**
+ * Defines the border around the canvas in which the auto scroll will become
+ * active.
+ */
+ private static final int BORDER = 25;
+ /**
+ * The interval, in milliseconds, between scroll events.
+ */
+ private static final long SCROLL_INTERVAL = 100;
+
+ private JSVGCanvas svgCanvas;
+ private Dimension canvasSize;
+ private int scrollX;
+ private int scrollY;
+ private int mouseX;
+ private int mouseY;
+
+ /**
+ * Component used to identify mouse events generated by this class
+ */
+ private Component eventIdentifier = new Component() {
+ private static final long serialVersionUID = -295542754718804222L;
+ };
+
+ private static Timer timer = new Timer("GraphAutoScrollTimer", true);
+
+ private TimerTask task;
+
+ /**
+ * Whether the interactor has finished.
+ */
+ protected boolean finished = true;
+
+ public AutoScrollInteractor(JSVGCanvas svgCanvas) {
+ this.svgCanvas = svgCanvas;
+ }
+
+ @Override
+ public boolean startInteraction(InputEvent ie) {
+ int mods = ie.getModifiers();
+ if (ie.getID() == MOUSE_PRESSED && (mods & BUTTON1_MASK) != 0) {
+ AffineTransform transform = svgCanvas.getRenderingTransform();
+ // check if we're zoomed in
+ if (transform.getScaleX() > 1d || transform.getScaleY() > 1d) {
+ canvasSize = svgCanvas.getSize();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean endInteraction() {
+ return finished;
+ }
+
+ @Override
+ public void mousePressed(final MouseEvent e) {
+ if (startInteraction(e)) {
+ finished = false;
+ task = new TimerTask() {
+ @Override
+ public void run() {
+ scrollTimerCallback(e);
+ }
+ };
+ timer.schedule(task, 0, SCROLL_INTERVAL);
+ }
+ }
+
+ /**
+ * Dispatches a mouse drag event that updates the mouse location by the
+ * amount that the canvas has been scrolled.
+ *
+ * @param dragX
+ * @param dragY
+ */
+ private void dispatchDragEvent(double dragX, double dragY) {
+ int x = (int) (mouseX + dragX);
+ int y = (int) (mouseY + dragY);
+ MouseEvent mouseDragEvent = new MouseEvent(eventIdentifier,
+ MOUSE_DRAGGED, currentTimeMillis(), BUTTON1_DOWN_MASK, x, y, 1,
+ false, BUTTON1);
+ svgCanvas.dispatchEvent(mouseDragEvent);
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ if (!finished) {
+ finished = true;
+ scrollX = 0;
+ scrollY = 0;
+ if (task != null)
+ task.cancel();
+ }
+ }
+
+ @Override
+ public void mouseDragged(MouseEvent e) {
+ // ignore events generated by this class
+ if (!finished && e.getSource() != eventIdentifier) {
+ mouseX = e.getX();
+ mouseY = e.getY();
+ int minX = BORDER;
+ int maxX = canvasSize.width - BORDER;
+ int minY = BORDER;
+ int maxY = canvasSize.height - BORDER;
+
+ scrollX = (mouseX < minX) ? (minX - mouseX)
+ : (mouseX > maxX) ? (maxX - mouseX) : 0;
+ scrollY = (mouseY < minY) ? (minY - mouseY)
+ : (mouseY > maxY) ? (maxY - mouseY) : 0;
+ }
+ }
+
+ private void scrollTimerCallback(MouseEvent e) {
+ double x = scrollX;
+ double y = scrollY;
+ if (x == 0 && y == 0)
+ return;
+
+ JGVTComponent c = (JGVTComponent) e.getSource();
+ AffineTransform rt = (AffineTransform) c.getRenderingTransform()
+ .clone();
+ double currentTranslateX = rt.getTranslateX();
+ double currentTranslateY = rt.getTranslateY();
+ // the tranlation that will show the east edge
+ double maxTranslateX = -((canvasSize.width * rt.getScaleX()) - canvasSize.width);
+ // the translation that will show the south
+ double maxTranslateY = -((canvasSize.height * rt.getScaleY()) - canvasSize.height);
+
+ if (x > 0 && currentTranslateX + x > 0)
+ // scroll left && not at west edge
+ x = -currentTranslateX;
+ else if (x < 0 && currentTranslateX + x < maxTranslateX)
+ // scroll right && not at east edge
+ x = maxTranslateX - currentTranslateX;
+
+ if (y > 0 && currentTranslateY + y > 0)
+ // scroll up && not at north edge
+ y = -currentTranslateY;
+ else if (y < 0 && currentTranslateY + y < maxTranslateY)
+ // scroll down && not at south edge
+ y = maxTranslateY - currentTranslateY;
+
+ if (x != 0d || y != 0d) {
+ AffineTransform at = AffineTransform.getTranslateInstance(x, y);
+ rt.preConcatenate(at);
+ c.setRenderingTransform(rt);
+ dispatchDragEvent(x, y);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/GraphViewComponent.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/GraphViewComponent.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/GraphViewComponent.java
new file mode 100644
index 0000000..4ec1a28
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/GraphViewComponent.java
@@ -0,0 +1,547 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.NORTH;
+import static javax.swing.Action.SHORT_DESCRIPTION;
+import static javax.swing.Action.SMALL_ICON;
+import static javax.swing.BoxLayout.PAGE_AXIS;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.allportIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.blobIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.expandNestedIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.horizontalIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.noportIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.refreshIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.verticalIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.zoomInIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.zoomOutIcon;
+import static org.apache.taverna.workbench.views.graph.config.GraphViewConfiguration.ALIGNMENT;
+import static org.apache.taverna.workbench.views.graph.config.GraphViewConfiguration.ANIMATION_ENABLED;
+import static org.apache.taverna.workbench.views.graph.config.GraphViewConfiguration.ANIMATION_SPEED;
+import static org.apache.taverna.workbench.views.graph.config.GraphViewConfiguration.PORT_STYLE;
+import static org.apache.batik.swing.svg.AbstractJSVGComponent.ALWAYS_DYNAMIC;
+
+import java.awt.BorderLayout;
+import java.awt.CardLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.util.HashSet;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.BoxLayout;
+import javax.swing.ButtonGroup;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JToggleButton;
+import javax.swing.JToolBar;
+import javax.swing.Timer;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.SwingAwareObserver;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.EditManager.AbstractDataflowEditEvent;
+import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.events.ClosedDataflowEvent;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.models.graph.Graph.Alignment;
+import org.apache.taverna.workbench.models.graph.GraphController;
+import org.apache.taverna.workbench.models.graph.GraphController.PortStyle;
+import org.apache.taverna.workbench.models.graph.svg.SVGGraphController;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
+import org.apache.taverna.workbench.selection.events.WorkflowBundleSelectionEvent;
+import org.apache.taverna.workbench.selection.events.WorkflowSelectionEvent;
+import org.apache.taverna.workbench.ui.dndhandler.ServiceTransferHandler;
+import org.apache.taverna.workbench.ui.zaria.UIComponentSPI;
+import org.apache.taverna.workbench.views.graph.config.GraphViewConfiguration;
+import org.apache.taverna.workbench.views.graph.menu.ResetDiagramAction;
+import org.apache.taverna.workbench.views.graph.menu.ZoomInAction;
+import org.apache.taverna.workbench.views.graph.menu.ZoomOutAction;
+
+import org.apache.batik.swing.JSVGCanvas;
+import org.apache.batik.swing.JSVGScrollPane;
+import org.apache.batik.swing.gvt.GVTTreeRendererAdapter;
+import org.apache.batik.swing.gvt.GVTTreeRendererEvent;
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * @author David Withers
+ * @author Alex Nenadic
+ * @author Tom Oinn
+ */
+public class GraphViewComponent extends JPanel implements UIComponentSPI {
+ private static final long serialVersionUID = 7404937056378331528L;
+ private static final Logger logger = Logger.getLogger(GraphViewComponent.class);
+
+ private Workflow workflow;
+ private SVGGraphController graphController;
+ private JPanel diagramPanel;
+
+ private Map<WorkflowBundle, Set<Workflow>> workflowsMap = new IdentityHashMap<>();
+
+ private Map<Workflow, SVGGraphController> graphControllerMap = new IdentityHashMap<>();
+ private Map<Workflow, JPanel> diagramPanelMap = new IdentityHashMap<>();
+ private Map<Workflow, Action[]> diagramActionsMap = new IdentityHashMap<>();
+
+ private Timer timer;
+
+ private CardLayout cardLayout;
+
+ private final ColourManager colourManager;
+ private final EditManager editManager;
+ private final MenuManager menuManager;
+ private final GraphViewConfiguration graphViewConfiguration;
+ private final WorkbenchConfiguration workbenchConfiguration;
+ private final SelectionManager selectionManager;
+ private final ServiceRegistry serviceRegistry;
+
+ public GraphViewComponent(ColourManager colourManager,
+ EditManager editManager, FileManager fileManager,
+ MenuManager menuManager,
+ GraphViewConfiguration graphViewConfiguration,
+ WorkbenchConfiguration workbenchConfiguration,
+ SelectionManager selectionManager, ServiceRegistry serviceRegistry) {
+ this.colourManager = colourManager;
+ this.editManager = editManager;
+ this.menuManager = menuManager;
+ this.graphViewConfiguration = graphViewConfiguration;
+ this.workbenchConfiguration = workbenchConfiguration;
+ this.selectionManager = selectionManager;
+ this.serviceRegistry = serviceRegistry;
+
+ cardLayout = new CardLayout();
+ setLayout(cardLayout);
+
+ ActionListener taskPerformer = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent evt) {
+ if (graphController != null)
+ graphController.redraw();
+ timer.stop();
+ }
+ };
+ timer = new Timer(100, taskPerformer);
+
+ addComponentListener(new ComponentAdapter() {
+ @Override
+ public void componentResized(ComponentEvent e) {
+ if (timer.isRunning())
+ timer.restart();
+ else
+ timer.start();
+ }
+ });
+
+ editManager.addObserver(new EditManagerObserver());
+ selectionManager.addObserver(new SelectionManagerObserver());
+ fileManager.addObserver(new FileManagerObserver());
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ if (timer != null)
+ timer.stop();
+ }
+
+ @Override
+ public String getName() {
+ return "Graph View Component";
+ }
+
+ @Override
+ public ImageIcon getIcon() {
+ return null;
+ }
+
+ @Override
+ public void onDisplay() {
+ }
+
+ @Override
+ public void onDispose() {
+ if (timer != null)
+ timer.stop();
+ }
+
+ private JPanel createDiagramPanel(Workflow workflow) {
+ final JPanel diagramPanel = new JPanel(new BorderLayout());
+
+ // get the default diagram settings
+ Alignment alignment = Alignment.valueOf(graphViewConfiguration
+ .getProperty(ALIGNMENT));
+ PortStyle portStyle = PortStyle.valueOf(graphViewConfiguration
+ .getProperty(PORT_STYLE));
+ boolean animationEnabled = Boolean.parseBoolean(graphViewConfiguration
+ .getProperty(ANIMATION_ENABLED));
+ int animationSpeed = Integer.parseInt(graphViewConfiguration
+ .getProperty(ANIMATION_SPEED));
+
+ // create an SVG canvas
+ final JSVGCanvas svgCanvas = new JSVGCanvas(null, true, false);
+ svgCanvas.setEnableZoomInteractor(false);
+ svgCanvas.setEnableRotateInteractor(false);
+ svgCanvas.setDocumentState(ALWAYS_DYNAMIC);
+ svgCanvas.setTransferHandler(new ServiceTransferHandler(editManager,
+ menuManager, selectionManager, serviceRegistry));
+
+ AutoScrollInteractor asi = new AutoScrollInteractor(svgCanvas);
+ svgCanvas.addMouseListener(asi);
+ svgCanvas.addMouseMotionListener(asi);
+
+ final JSVGScrollPane svgScrollPane = new MySvgScrollPane(svgCanvas);
+
+ GVTTreeRendererAdapter gvtTreeRendererAdapter = new GVTTreeRendererAdapter() {
+ @Override
+ public void gvtRenderingCompleted(GVTTreeRendererEvent e) {
+ logger.info("Rendered svg");
+ svgScrollPane.reset();
+ diagramPanel.revalidate();
+ }
+ };
+ svgCanvas.addGVTTreeRendererListener(gvtTreeRendererAdapter);
+
+ // create a graph controller
+ SVGGraphController svgGraphController = new SVGGraphController(
+ workflow, selectionManager.getSelectedProfile(), false,
+ svgCanvas, alignment, portStyle, editManager, menuManager,
+ colourManager, workbenchConfiguration);
+ svgGraphController.setDataflowSelectionModel(selectionManager
+ .getDataflowSelectionModel(workflow.getParent()));
+ svgGraphController.setAnimationSpeed(animationEnabled ? animationSpeed
+ : 0);
+
+ graphControllerMap.put(workflow, svgGraphController);
+
+ // Toolbar with actions related to graph
+ JToolBar graphActionsToolbar = graphActionsToolbar(workflow,
+ svgGraphController, svgCanvas, alignment, portStyle);
+ graphActionsToolbar.setAlignmentX(LEFT_ALIGNMENT);
+ graphActionsToolbar.setFloatable(false);
+
+ // Panel to hold the toolbars
+ JPanel toolbarPanel = new JPanel();
+ toolbarPanel.setLayout(new BoxLayout(toolbarPanel, PAGE_AXIS));
+ toolbarPanel.add(graphActionsToolbar);
+
+ diagramPanel.add(toolbarPanel, NORTH);
+ diagramPanel.add(svgScrollPane, CENTER);
+
+ // JTextField workflowHierarchy = new JTextField(workflow.getName());
+ // diagramPanel.add(workflowHierarchy, BorderLayout.SOUTH);
+
+ return diagramPanel;
+ }
+
+ @SuppressWarnings("serial")
+ private JToolBar graphActionsToolbar(Workflow workflow,
+ final SVGGraphController graphController, JSVGCanvas svgCanvas,
+ Alignment alignment, PortStyle portStyle) {
+ JToolBar toolBar = new JToolBar();
+
+ JButton resetDiagramButton = new JButton();
+ resetDiagramButton.setBorder(new EmptyBorder(0, 2, 0, 2));
+ JButton zoomInButton = new JButton();
+ zoomInButton.setBorder(new EmptyBorder(0, 2, 0, 2));
+ JButton zoomOutButton = new JButton();
+ zoomOutButton.setBorder(new EmptyBorder(0, 2, 0, 2));
+
+ Action resetDiagramAction = svgCanvas.new ResetTransformAction();
+ ResetDiagramAction.setDesignAction(resetDiagramAction);
+ resetDiagramAction.putValue(SHORT_DESCRIPTION, "Reset Diagram");
+ resetDiagramAction.putValue(SMALL_ICON, refreshIcon);
+ resetDiagramButton.setAction(resetDiagramAction);
+
+ Action zoomInAction = svgCanvas.new ZoomAction(1.2);
+ ZoomInAction.setDesignAction(zoomInAction);
+ zoomInAction.putValue(SHORT_DESCRIPTION, "Zoom In");
+ zoomInAction.putValue(SMALL_ICON, zoomInIcon);
+ zoomInButton.setAction(zoomInAction);
+
+ Action zoomOutAction = svgCanvas.new ZoomAction(1 / 1.2);
+ ZoomOutAction.setDesignAction(zoomOutAction);
+ zoomOutAction.putValue(SHORT_DESCRIPTION, "Zoom Out");
+ zoomOutAction.putValue(SMALL_ICON, zoomOutIcon);
+ zoomOutButton.setAction(zoomOutAction);
+
+ diagramActionsMap.put(workflow, new Action[] { resetDiagramAction,
+ zoomInAction, zoomOutAction });
+
+ toolBar.add(resetDiagramButton);
+ toolBar.add(zoomInButton);
+ toolBar.add(zoomOutButton);
+
+ toolBar.addSeparator();
+
+ ButtonGroup nodeTypeGroup = new ButtonGroup();
+
+ JToggleButton noPorts = new JToggleButton();
+ JToggleButton allPorts = new JToggleButton();
+ JToggleButton blobs = new JToggleButton();
+ nodeTypeGroup.add(noPorts);
+ nodeTypeGroup.add(allPorts);
+ nodeTypeGroup.add(blobs);
+
+ if (portStyle.equals(PortStyle.NONE))
+ noPorts.setSelected(true);
+ else if (portStyle.equals(PortStyle.ALL))
+ allPorts.setSelected(true);
+ else
+ blobs.setSelected(true);
+
+ noPorts.setAction(new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ graphController.setPortStyle(PortStyle.NONE);
+ graphController.redraw();
+ }
+ });
+ noPorts.getAction().putValue(SHORT_DESCRIPTION,
+ "Display no service ports");
+ noPorts.getAction().putValue(SMALL_ICON, noportIcon);
+ noPorts.setFocusPainted(false);
+
+ allPorts.setAction(new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ graphController.setPortStyle(PortStyle.ALL);
+ graphController.redraw();
+ }
+ });
+ allPorts.getAction().putValue(SHORT_DESCRIPTION,
+ "Display all service ports");
+ allPorts.getAction().putValue(SMALL_ICON, allportIcon);
+ allPorts.setFocusPainted(false);
+
+ blobs.setAction(new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ graphController.setPortStyle(PortStyle.BLOB);
+ graphController.redraw();
+ }
+ });
+ blobs.getAction().putValue(SHORT_DESCRIPTION,
+ "Display services as circles");
+ blobs.getAction().putValue(SMALL_ICON, blobIcon);
+ blobs.setFocusPainted(false);
+
+ toolBar.add(noPorts);
+ toolBar.add(allPorts);
+ toolBar.add(blobs);
+
+ toolBar.addSeparator();
+
+ ButtonGroup alignmentGroup = new ButtonGroup();
+
+ JToggleButton vertical = new JToggleButton();
+ JToggleButton horizontal = new JToggleButton();
+ alignmentGroup.add(vertical);
+ alignmentGroup.add(horizontal);
+
+ if (alignment.equals(Alignment.VERTICAL)) {
+ vertical.setSelected(true);
+ } else {
+ horizontal.setSelected(true);
+ }
+
+ vertical.setAction(new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ graphController.setAlignment(Alignment.VERTICAL);
+ graphController.redraw();
+ }
+ });
+ vertical.getAction().putValue(SHORT_DESCRIPTION,
+ "Align services vertically");
+ vertical.getAction().putValue(SMALL_ICON, verticalIcon);
+ vertical.setFocusPainted(false);
+
+ horizontal.setAction(new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ graphController.setAlignment(Alignment.HORIZONTAL);
+ graphController.redraw();
+ }
+
+ });
+ horizontal.getAction().putValue(SHORT_DESCRIPTION,
+ "Align services horizontally");
+ horizontal.getAction().putValue(SMALL_ICON, horizontalIcon);
+ horizontal.setFocusPainted(false);
+
+ toolBar.add(vertical);
+ toolBar.add(horizontal);
+
+ toolBar.addSeparator();
+
+ JToggleButton expandNested = new JToggleButton();
+ expandNested.setSelected(true);
+
+ expandNested.setAction(new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ graphController.setExpandNestedDataflows(!graphController
+ .expandNestedDataflows());
+ graphController.redraw();
+ }
+ });
+ expandNested.getAction().putValue(SHORT_DESCRIPTION,
+ "Expand Nested Workflows");
+ expandNested.getAction().putValue(SMALL_ICON, expandNestedIcon);
+ expandNested.setFocusPainted(false);
+ toolBar.add(expandNested);
+
+ return toolBar;
+ }
+
+ /**
+ * Sets the Workflow to display in the graph view.
+ *
+ * @param workflow
+ */
+ private void setWorkflow(Workflow workflow) {
+ this.workflow = workflow;
+ if (!diagramPanelMap.containsKey(workflow))
+ addWorkflow(workflow);
+ graphController = graphControllerMap.get(workflow);
+ diagramPanel = diagramPanelMap.get(workflow);
+ Action[] actions = diagramActionsMap.get(workflow);
+ if (actions != null && actions.length == 3) {
+ ResetDiagramAction.setDesignAction(actions[0]);
+ ZoomInAction.setDesignAction(actions[1]);
+ ZoomOutAction.setDesignAction(actions[2]);
+ }
+ cardLayout.show(this, String.valueOf(diagramPanel.hashCode()));
+ graphController.redraw();
+ }
+
+ private void addWorkflow(Workflow workflow) {
+ JPanel newDiagramPanel = createDiagramPanel(workflow);
+ add(newDiagramPanel, String.valueOf(newDiagramPanel.hashCode()));
+ diagramPanelMap.put(workflow, newDiagramPanel);
+ if (!workflowsMap.containsKey(workflow.getParent()))
+ workflowsMap.put(workflow.getParent(), new HashSet<Workflow>());
+ workflowsMap.get(workflow.getParent()).add(workflow);
+ }
+
+ private void removeWorkflow(Workflow workflow) {
+ JPanel panel = diagramPanelMap.remove(workflow);
+ if (panel != null)
+ remove(panel);
+ SVGGraphController removedController = graphControllerMap.remove(workflow);
+ if (removedController != null)
+ removedController.shutdown();
+ diagramActionsMap.remove(workflow);
+ Set<Workflow> workflows = workflowsMap.get(workflow.getParent());
+ if (workflows != null)
+ workflows.remove(workflow);
+ }
+
+ public GraphController getGraphController(Workflow workflow) {
+ return graphControllerMap.get(workflow);
+ }
+
+ private class EditManagerObserver extends
+ SwingAwareObserver<EditManagerEvent> {
+ @Override
+ public void notifySwing(Observable<EditManagerEvent> sender,
+ EditManagerEvent message) {
+ if (!(message instanceof AbstractDataflowEditEvent))
+ return;
+ AbstractDataflowEditEvent dataflowEditEvent = (AbstractDataflowEditEvent) message;
+ if (dataflowEditEvent.getDataFlow() != workflow.getParent())
+ return;
+
+ boolean animationEnabled = Boolean
+ .parseBoolean(graphViewConfiguration
+ .getProperty(ANIMATION_ENABLED));
+ int animationSpeed = (animationEnabled ? Integer
+ .parseInt(graphViewConfiguration
+ .getProperty(ANIMATION_SPEED)) : 0);
+ boolean animationSettingChanged = (animationEnabled != (graphController
+ .getAnimationSpeed() != 0));
+
+ if (graphController.isDotMissing() || animationSettingChanged) {
+ removeWorkflow(workflow);
+ setWorkflow(workflow);
+ } else {
+ if (animationSpeed != graphController.getAnimationSpeed())
+ graphController.setAnimationSpeed(animationSpeed);
+ graphController.redraw();
+ }
+ }
+ }
+
+ private class FileManagerObserver extends SwingAwareObserver<FileManagerEvent> {
+ @Override
+ public void notifySwing(Observable<FileManagerEvent> sender, final FileManagerEvent message) {
+ if (!(message instanceof ClosedDataflowEvent))
+ return;
+ ClosedDataflowEvent closedDataflowEvent = (ClosedDataflowEvent) message;
+
+ WorkflowBundle workflowBundle = closedDataflowEvent.getDataflow();
+ if (workflowsMap.containsKey(workflowBundle))
+ for (Workflow workflow : workflowsMap.remove(workflowBundle))
+ removeWorkflow(workflow);
+ }
+ }
+
+ private class SelectionManagerObserver extends
+ SwingAwareObserver<SelectionManagerEvent> {
+ @Override
+ public void notifySwing(Observable<SelectionManagerEvent> sender,
+ SelectionManagerEvent message) {
+ if (message instanceof WorkflowSelectionEvent)
+ setWorkflow(selectionManager.getSelectedWorkflow());
+ else if (message instanceof WorkflowBundleSelectionEvent)
+ setWorkflow(selectionManager.getSelectedWorkflow());
+ }
+ }
+
+ private class MySvgScrollPane extends JSVGScrollPane {
+ private static final long serialVersionUID = -1539947450704269879L;
+
+ public MySvgScrollPane(JSVGCanvas canvas) {
+ super(canvas);
+ }
+
+ @Override
+ public void reset() {
+ super.resizeScrollBars();
+ super.reset();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/GraphViewComponentFactory.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/GraphViewComponentFactory.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/GraphViewComponentFactory.java
new file mode 100644
index 0000000..3b0cff4
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/GraphViewComponentFactory.java
@@ -0,0 +1,99 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph;
+
+import javax.swing.ImageIcon;
+
+import org.apache.taverna.commons.services.ServiceRegistry;
+
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI;
+import org.apache.taverna.workbench.ui.zaria.UIComponentSPI;
+import org.apache.taverna.workbench.views.graph.config.GraphViewConfiguration;
+
+/**
+ * @author David Withers
+ */
+public class GraphViewComponentFactory implements UIComponentFactorySPI {
+ private EditManager editManager;
+ private FileManager fileManager;
+ private MenuManager menuManager;
+ private SelectionManager selectionManager;
+ private ColourManager colourManager;
+ private WorkbenchConfiguration workbenchConfiguration;
+ private GraphViewConfiguration graphViewConfiguration;
+ private ServiceRegistry serviceRegistry;
+
+ @Override
+ public UIComponentSPI getComponent() {
+ return new GraphViewComponent(colourManager, editManager, fileManager,
+ menuManager, graphViewConfiguration, workbenchConfiguration,
+ selectionManager, serviceRegistry);
+ }
+
+ @Override
+ public ImageIcon getIcon() {
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return "Graph View";
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setMenuManager(MenuManager menuManager) {
+ this.menuManager = menuManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setColourManager(ColourManager colourManager) {
+ this.colourManager = colourManager;
+ }
+
+ public void setWorkbenchConfiguration(
+ WorkbenchConfiguration workbenchConfiguration) {
+ this.workbenchConfiguration = workbenchConfiguration;
+ }
+
+ public void setGraphViewConfiguration(
+ GraphViewConfiguration graphViewConfiguration) {
+ this.graphViewConfiguration = graphViewConfiguration;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/AddWFInputAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/AddWFInputAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/AddWFInputAction.java
new file mode 100644
index 0000000..b702393
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/AddWFInputAction.java
@@ -0,0 +1,68 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.actions;
+
+import static java.awt.event.InputEvent.ALT_DOWN_MASK;
+import static java.awt.event.InputEvent.SHIFT_DOWN_MASK;
+import static java.awt.event.KeyEvent.VK_I;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.inputIcon;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.workbench.design.actions.AddDataflowInputAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * An action that adds a workflow input.
+ *
+ * @author Alex Nenadic
+ * @author Alan R Williams
+ */
+@SuppressWarnings("serial")
+public class AddWFInputAction extends AbstractAction implements
+ DesignOnlyAction {
+ private final EditManager editManager;
+ private final SelectionManager selectionManager;
+
+ public AddWFInputAction(EditManager editManager,
+ SelectionManager selectionManager) {
+ super();
+ this.editManager = editManager;
+ this.selectionManager = selectionManager;
+ putValue(SMALL_ICON, inputIcon);
+ putValue(NAME, "Workflow input port");
+ putValue(SHORT_DESCRIPTION, "Workflow input port");
+ putValue(ACCELERATOR_KEY,
+ getKeyStroke(VK_I, SHIFT_DOWN_MASK | ALT_DOWN_MASK));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Workflow workflow = selectionManager.getSelectedWorkflow();
+ new AddDataflowInputAction(workflow, null, editManager,
+ selectionManager).actionPerformed(e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/AddWFOutputAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/AddWFOutputAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/AddWFOutputAction.java
new file mode 100644
index 0000000..8f8eaeb
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/AddWFOutputAction.java
@@ -0,0 +1,68 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.actions;
+
+import static java.awt.event.InputEvent.ALT_DOWN_MASK;
+import static java.awt.event.InputEvent.SHIFT_DOWN_MASK;
+import static java.awt.event.KeyEvent.VK_O;
+import static javax.swing.KeyStroke.getKeyStroke;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.workbench.design.actions.AddDataflowOutputAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * An action that adds a workflow output.
+ *
+ * @author Alex Nenadic
+ * @author Alan R Williams
+ */
+@SuppressWarnings("serial")
+public class AddWFOutputAction extends AbstractAction implements
+ DesignOnlyAction {
+ private final EditManager editManager;
+ private final SelectionManager selectionManager;
+
+ public AddWFOutputAction(EditManager editManager,
+ SelectionManager selectionManager) {
+ super();
+ this.editManager = editManager;
+ this.selectionManager = selectionManager;
+ putValue(SMALL_ICON, WorkbenchIcons.outputIcon);
+ putValue(NAME, "Workflow output port");
+ putValue(SHORT_DESCRIPTION, "Workflow output port");
+ putValue(ACCELERATOR_KEY,
+ getKeyStroke(VK_O, SHIFT_DOWN_MASK | ALT_DOWN_MASK));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Workflow workflow = selectionManager.getSelectedWorkflow();
+ new AddDataflowOutputAction(workflow, null, editManager,
+ selectionManager).actionPerformed(e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/DeleteGraphComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/DeleteGraphComponentAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/DeleteGraphComponentAction.java
new file mode 100644
index 0000000..a25b4bc
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/DeleteGraphComponentAction.java
@@ -0,0 +1,179 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.actions;
+
+import static java.awt.event.KeyEvent.VK_DELETE;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.deleteIcon;
+
+import java.awt.event.ActionEvent;
+import java.util.Set;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.lang.observer.SwingAwareObserver;
+import org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.workbench.design.actions.RemoveConditionAction;
+import org.apache.taverna.workbench.design.actions.RemoveDataflowInputPortAction;
+import org.apache.taverna.workbench.design.actions.RemoveDataflowOutputPortAction;
+import org.apache.taverna.workbench.design.actions.RemoveDatalinkAction;
+import org.apache.taverna.workbench.design.actions.RemoveProcessorAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.DataflowSelectionModel;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.selection.events.DataflowSelectionMessage;
+import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
+import org.apache.taverna.workbench.selection.events.WorkflowBundleSelectionEvent;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.ControlLink;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+
+/**
+ * An action that deletes the selected graph component.
+ *
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class DeleteGraphComponentAction extends AbstractAction implements DesignOnlyAction {
+ /** Current workflow's selection model event observer.*/
+ private Observer<DataflowSelectionMessage> workflowSelectionObserver = new DataflowSelectionObserver();
+
+ private final EditManager editManager;
+ private final SelectionManager selectionManager;
+
+ public DeleteGraphComponentAction(EditManager editManager, final SelectionManager selectionManager) {
+ super();
+ this.editManager = editManager;
+ this.selectionManager = selectionManager;
+ putValue(SMALL_ICON, deleteIcon);
+ putValue(NAME, "Delete");
+ putValue(SHORT_DESCRIPTION, "Delete selected component");
+ putValue(ACCELERATOR_KEY, getKeyStroke(VK_DELETE, 0));
+ setEnabled(false);
+
+ selectionManager.addObserver(new SelectionManagerObserver());
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ WorkflowBundle workflowBundle = selectionManager
+ .getSelectedWorkflowBundle();
+ DataflowSelectionModel dataFlowSelectionModel = selectionManager
+ .getDataflowSelectionModel(workflowBundle);
+ // Get all selected components
+ Set<Object> selectedWFComponents = dataFlowSelectionModel.getSelection();
+ for (Object selectedWFComponent : selectedWFComponents)
+ if (selectedWFComponent instanceof Processor) {
+ Processor processor = (Processor) selectedWFComponent;
+ new RemoveProcessorAction(processor.getParent(), processor,
+ null, editManager, selectionManager).actionPerformed(e);
+ } else if (selectedWFComponent instanceof DataLink) {
+ DataLink dataLink = (DataLink) selectedWFComponent;
+ new RemoveDatalinkAction(dataLink.getParent(), dataLink, null,
+ editManager, selectionManager).actionPerformed(e);
+ } else if (selectedWFComponent instanceof InputWorkflowPort) {
+ InputWorkflowPort port = (InputWorkflowPort) selectedWFComponent;
+ new RemoveDataflowInputPortAction(port.getParent(), port, null,
+ editManager, selectionManager).actionPerformed(e);
+ } else if (selectedWFComponent instanceof OutputWorkflowPort) {
+ OutputWorkflowPort port = (OutputWorkflowPort) selectedWFComponent;
+ new RemoveDataflowOutputPortAction(port.getParent(), port,
+ null, editManager, selectionManager).actionPerformed(e);
+ } else if (selectedWFComponent instanceof ControlLink) {
+ ControlLink controlLink = (ControlLink) selectedWFComponent;
+ new RemoveConditionAction(controlLink.getParent(), controlLink,
+ null, editManager, selectionManager).actionPerformed(e);
+ }
+ }
+
+ /**
+ * Check if action should be enabled or disabled and update its status.
+ */
+ public void updateStatus(WorkflowBundle selectionWorkflowBundle) {
+ if (selectionWorkflowBundle != null) {
+ DataflowSelectionModel selectionModel = selectionManager
+ .getDataflowSelectionModel(selectionWorkflowBundle);
+ Set<Object> selection = selectionModel.getSelection();
+ if (!selection.isEmpty()) {
+ // Take the first selected item - we only support single selections anyway
+ Object selected = selection.toArray()[0];
+ if ((selected instanceof Processor)
+ || (selected instanceof InputWorkflowPort)
+ || (selected instanceof OutputWorkflowPort)
+ || (selected instanceof DataLink)
+ || (selected instanceof ControlLink)) {
+ setEnabled(true);
+ return;
+ }
+ }
+ }
+ setEnabled(false);
+ }
+
+ /**
+ * Observes events on workflow Selection Manager, i.e. when a workflow node
+ * is selected in the graph view, and enables/disables this action
+ * accordingly.
+ */
+ private final class DataflowSelectionObserver extends
+ SwingAwareObserver<DataflowSelectionMessage> {
+ @Override
+ public void notifySwing(Observable<DataflowSelectionMessage> sender,
+ DataflowSelectionMessage message) {
+ updateStatus(selectionManager.getSelectedWorkflowBundle());
+ }
+ }
+
+ private final class SelectionManagerObserver extends
+ SwingAwareObserver<SelectionManagerEvent> {
+ @Override
+ public void notifySwing(Observable<SelectionManagerEvent> sender,
+ SelectionManagerEvent message) {
+ if (!(message instanceof WorkflowBundleSelectionEvent))
+ return;
+ WorkflowBundleSelectionEvent workflowBundleSelectionEvent = (WorkflowBundleSelectionEvent) message;
+ WorkflowBundle oldFlow = workflowBundleSelectionEvent
+ .getPreviouslySelectedWorkflowBundle();
+ WorkflowBundle newFlow = workflowBundleSelectionEvent
+ .getSelectedWorkflowBundle();
+
+ /*
+ * Remove the workflow selection model listener from the previous
+ * (if any) and add to the new workflow (if any)
+ */
+ if (oldFlow != null)
+ selectionManager.getDataflowSelectionModel(oldFlow)
+ .removeObserver(workflowSelectionObserver);
+
+ // Update the buttons status as current dataflow has changed
+ updateStatus(newFlow);
+
+ if (newFlow != null)
+ selectionManager.getDataflowSelectionModel(newFlow)
+ .addObserver(workflowSelectionObserver);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/RenameWFInputOutputProcessorAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/RenameWFInputOutputProcessorAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/RenameWFInputOutputProcessorAction.java
new file mode 100644
index 0000000..5c01a0b
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/actions/RenameWFInputOutputProcessorAction.java
@@ -0,0 +1,183 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.actions;
+
+import static java.awt.event.KeyEvent.VK_F2;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.KeyStroke.getKeyStroke;
+
+import java.awt.event.ActionEvent;
+import java.util.Set;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.lang.observer.SwingAwareObserver;
+import org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.workbench.design.actions.EditDataflowInputPortAction;
+import org.apache.taverna.workbench.design.actions.EditDataflowOutputPortAction;
+import org.apache.taverna.workbench.design.actions.RenameProcessorAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+import org.apache.taverna.workbench.selection.DataflowSelectionModel;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.selection.events.DataflowSelectionMessage;
+import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
+import org.apache.taverna.workbench.selection.events.WorkflowBundleSelectionEvent;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+
+/**
+ * An action that allows user to rename workflow input, output or
+ * processor, in case one of these is currently selected in the Graph View.
+ *
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class RenameWFInputOutputProcessorAction extends AbstractAction implements DesignOnlyAction {
+ /** Current workflow's selection model event observer.*/
+ private Observer<DataflowSelectionMessage> workflowSelectionObserver = new DataflowSelectionObserver();
+
+ private final EditManager editManager;
+ private final SelectionManager selectionManager;
+
+ public RenameWFInputOutputProcessorAction(EditManager editManager,
+ final SelectionManager selectionManager) {
+ super();
+ this.editManager = editManager;
+ this.selectionManager = selectionManager;
+ putValue(SMALL_ICON, WorkbenchIcons.renameIcon);
+ putValue(NAME, "Rename");
+ putValue(SHORT_DESCRIPTION, "Rename inputs, outputs or services");
+ putValue(ACCELERATOR_KEY, getKeyStroke(VK_F2, 0));
+ setEnabled(false);
+
+ selectionManager.addObserver(new SelectionManagerObserver());
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ WorkflowBundle workflowBundle = selectionManager
+ .getSelectedWorkflowBundle();
+ DataflowSelectionModel dataFlowSelectionModel = selectionManager
+ .getDataflowSelectionModel(workflowBundle);
+ // Get selected port
+ Set<Object> selectedWFComponents = dataFlowSelectionModel
+ .getSelection();
+ if (selectedWFComponents.size() > 1) {
+ showMessageDialog(
+ null,
+ "Only one workflow component should be selected for this action.",
+ "Warning", WARNING_MESSAGE);
+ } else {
+ Object selectedWFComponent = selectedWFComponents.toArray()[0];
+ if (selectedWFComponent instanceof InputWorkflowPort) {
+ InputWorkflowPort port = (InputWorkflowPort) selectedWFComponent;
+ new EditDataflowInputPortAction(port.getParent(), port, null,
+ editManager, selectionManager).actionPerformed(e);
+ } else if (selectedWFComponent instanceof OutputWorkflowPort) {
+ OutputWorkflowPort port = (OutputWorkflowPort) selectedWFComponent;
+ new EditDataflowOutputPortAction(port.getParent(), port, null,
+ editManager, selectionManager).actionPerformed(e);
+ } else if (selectedWFComponent instanceof Processor) {
+ Processor processor = (Processor) selectedWFComponent;
+ new RenameProcessorAction(processor.getParent(), processor,
+ null, editManager, selectionManager).actionPerformed(e);
+ } else { // should not happen as the button will be disabled otherwise, but ...
+ showMessageDialog(
+ null,
+ "This action does not apply for the selected component.",
+ "Warning", WARNING_MESSAGE);
+ }
+ }
+ }
+
+ /**
+ * Check if action should be enabled or disabled and update its status.
+ */
+ public void updateStatus() {
+ WorkflowBundle workflowBundle = selectionManager
+ .getSelectedWorkflowBundle();
+ DataflowSelectionModel selectionModel = selectionManager
+ .getDataflowSelectionModel(workflowBundle);
+
+ // List of all selected objects in the graph view
+ Set<Object> selection = selectionModel.getSelection();
+
+ if (!selection.isEmpty()) {
+ // Take the first selected item - we only support single selections anyway
+ Object selected = selection.toArray()[0];
+ if ((selected instanceof Processor)
+ || (selected instanceof InputWorkflowPort)
+ || (selected instanceof OutputWorkflowPort)) {
+ setEnabled(true);
+ return;
+ }
+ }
+ setEnabled(false);
+ }
+
+ /**
+ * Observes events on workflow Selection Manager, i.e. when a workflow node
+ * is selected in the graph view, and enables/disables this action
+ * accordingly.
+ */
+ private final class DataflowSelectionObserver extends
+ SwingAwareObserver<DataflowSelectionMessage> {
+ @Override
+ public void notifySwing(Observable<DataflowSelectionMessage> sender,
+ DataflowSelectionMessage message) {
+ updateStatus();
+ }
+ }
+
+ private final class SelectionManagerObserver extends
+ SwingAwareObserver<SelectionManagerEvent> {
+ @Override
+ public void notifySwing(Observable<SelectionManagerEvent> sender,
+ SelectionManagerEvent message) {
+ if (!(message instanceof WorkflowBundleSelectionEvent))
+ return;
+ WorkflowBundleSelectionEvent workflowBundleSelectionEvent = (WorkflowBundleSelectionEvent) message;
+ WorkflowBundle oldFlow = workflowBundleSelectionEvent
+ .getPreviouslySelectedWorkflowBundle();
+ WorkflowBundle newFlow = workflowBundleSelectionEvent
+ .getSelectedWorkflowBundle();
+ // Update the buttons status as current dataflow has changed
+ updateStatus();
+
+ /*
+ * Remove the workflow selection model listener from the previous
+ * (if any) and add to the new workflow (if any)
+ */
+ if (oldFlow != null)
+ selectionManager.getDataflowSelectionModel(oldFlow)
+ .removeObserver(workflowSelectionObserver);
+
+ if (newFlow != null)
+ selectionManager.getDataflowSelectionModel(newFlow)
+ .addObserver(workflowSelectionObserver);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/config/GraphViewConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/config/GraphViewConfiguration.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/config/GraphViewConfiguration.java
new file mode 100644
index 0000000..1b03c58
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/config/GraphViewConfiguration.java
@@ -0,0 +1,79 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.config;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import uk.org.taverna.configuration.AbstractConfigurable;
+import uk.org.taverna.configuration.ConfigurationManager;
+
+import org.apache.taverna.workbench.models.graph.Graph.Alignment;
+import org.apache.taverna.workbench.models.graph.GraphController.PortStyle;
+
+/**
+ * Configuration for the GraphViewComponent.
+ *
+ * @author David Withers
+ */
+public class GraphViewConfiguration extends AbstractConfigurable {
+ public static final String PORT_STYLE = "portStyle";
+ public static final String ALIGNMENT = "alignment";
+ public static final String ANIMATION_ENABLED = "animationEnabled";
+ public static final String ANIMATION_SPEED = "animationSpeed";
+
+ private Map<String, String> defaultPropertyMap;
+
+ public GraphViewConfiguration(ConfigurationManager configurationManager) {
+ super(configurationManager);
+ }
+
+ @Override
+ public String getCategory() {
+ return "general";
+ }
+
+ @Override
+ public Map<String, String> getDefaultPropertyMap() {
+ if (defaultPropertyMap == null) {
+ defaultPropertyMap = new HashMap<>();
+ defaultPropertyMap.put(PORT_STYLE, PortStyle.NONE.toString());
+ defaultPropertyMap.put(ALIGNMENT, Alignment.VERTICAL.toString());
+ defaultPropertyMap.put(ANIMATION_ENABLED, "false");
+ defaultPropertyMap.put(ANIMATION_SPEED, "800");
+ }
+ return defaultPropertyMap;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "Diagram";
+ }
+
+ @Override
+ public String getFilePrefix() {
+ return "Diagram";
+ }
+
+ @Override
+ public String getUUID() {
+ return "3686BA31-449F-4147-A8AC-0C3F63AFC68F";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/config/GraphViewConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/config/GraphViewConfigurationPanel.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/config/GraphViewConfigurationPanel.java
new file mode 100644
index 0000000..3e24645
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/config/GraphViewConfigurationPanel.java
@@ -0,0 +1,359 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.config;
+
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.NORTHWEST;
+import static java.awt.GridBagConstraints.RELATIVE;
+import static java.awt.GridBagConstraints.REMAINDER;
+import static java.awt.GridBagConstraints.WEST;
+import static javax.swing.SwingConstants.LEFT;
+import static org.apache.taverna.workbench.helper.Helper.showHelp;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.allportIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.blobIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.horizontalIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.noportIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.verticalIcon;
+import static org.apache.taverna.workbench.views.graph.config.GraphViewConfiguration.ALIGNMENT;
+import static org.apache.taverna.workbench.views.graph.config.GraphViewConfiguration.ANIMATION_ENABLED;
+import static org.apache.taverna.workbench.views.graph.config.GraphViewConfiguration.ANIMATION_SPEED;
+import static org.apache.taverna.workbench.views.graph.config.GraphViewConfiguration.PORT_STYLE;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.Hashtable;
+
+import javax.swing.AbstractAction;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JSlider;
+import javax.swing.JTextArea;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.workbench.models.graph.Graph.Alignment;
+import org.apache.taverna.workbench.models.graph.GraphController.PortStyle;
+
+/**
+ * UI for GraphViewConfiguration.
+ *
+ * @author David Withers
+ */
+public class GraphViewConfigurationPanel extends JPanel {
+ private static final long serialVersionUID = 3779779432230124131L;
+ private static final int ANIMATION_SPEED_MIN = 100;
+ private static final int ANIMATION_SPEED_MAX = 3100;
+
+ private GraphViewConfiguration configuration;
+ private JRadioButton noPorts;
+ private JRadioButton allPorts;
+ private JRadioButton blobs;
+ private JRadioButton vertical;
+ private JRadioButton horizontal;
+ private JCheckBox animation;
+ private JLabel animationSpeedLabel;
+ private JSlider animationSpeedSlider;
+
+ public GraphViewConfigurationPanel(GraphViewConfiguration configuration) {
+ this.configuration = configuration;
+ GridBagLayout gridbag = new GridBagLayout();
+ GridBagConstraints c = new GridBagConstraints();
+ setLayout(gridbag);
+
+ // Title describing what kind of settings we are configuring here
+ JTextArea descriptionText = new JTextArea(
+ "Default settings for the workflow diagram");
+ descriptionText.setLineWrap(true);
+ descriptionText.setWrapStyleWord(true);
+ descriptionText.setEditable(false);
+ descriptionText.setFocusable(false);
+ descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
+
+ JLabel defaultLayoutLabel = new JLabel("Service display");
+
+ noPorts = new JRadioButton();
+ allPorts = new JRadioButton();
+ blobs = new JRadioButton();
+
+ JLabel noPortsLabel = new JLabel("Name only", noportIcon, LEFT);
+ JLabel allPortsLabel = new JLabel("Name and ports", allportIcon, LEFT);
+ JLabel blobsLabel = new JLabel("No text", blobIcon, LEFT);
+
+ ButtonGroup buttonGroup = new ButtonGroup();
+ buttonGroup.add(noPorts);
+ buttonGroup.add(allPorts);
+ buttonGroup.add(blobs);
+
+ JLabel defaultAlignmentLabel = new JLabel("Diagram alignment");
+
+ vertical = new JRadioButton();
+ horizontal = new JRadioButton();
+
+ JLabel verticalLabel = new JLabel("Vertical", verticalIcon, LEFT);
+ JLabel horizontalLabel = new JLabel("Horizontal", horizontalIcon, LEFT);
+
+ ButtonGroup alignmentButtonGroup = new ButtonGroup();
+ alignmentButtonGroup.add(horizontal);
+ alignmentButtonGroup.add(vertical);
+
+ animation = new JCheckBox("Enable animation");
+
+ animationSpeedLabel = new JLabel("Animation speed");
+
+ animationSpeedSlider = new JSlider(ANIMATION_SPEED_MIN,
+ ANIMATION_SPEED_MAX);
+ animationSpeedSlider.setMajorTickSpacing(500);
+ animationSpeedSlider.setMinorTickSpacing(100);
+ animationSpeedSlider.setPaintTicks(true);
+ animationSpeedSlider.setPaintLabels(true);
+ animationSpeedSlider.setInverted(true);
+ animationSpeedSlider.setSnapToTicks(true);
+
+ Hashtable<Integer, JLabel> labelTable = new Hashtable<>();
+ labelTable.put(new Integer(ANIMATION_SPEED_MIN), new JLabel("Fast"));
+ labelTable.put(new Integer(
+ ((ANIMATION_SPEED_MAX - ANIMATION_SPEED_MIN) / 2)
+ + ANIMATION_SPEED_MIN), new JLabel("Medium"));
+ labelTable.put(new Integer(ANIMATION_SPEED_MAX), new JLabel("Slow"));
+ animationSpeedSlider.setLabelTable(labelTable);
+
+ animation.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ boolean animationEnabled = animation.isSelected();
+ animationSpeedLabel.setEnabled(animationEnabled);
+ animationSpeedSlider.setEnabled(animationEnabled);
+ }
+ });
+
+ // Set current configuration values
+ setFields(configuration);
+
+ c.anchor = WEST;
+ c.gridx = 0;
+ c.gridwidth = REMAINDER;
+ c.weightx = 1d;
+ c.weighty = 0d;
+ c.fill = HORIZONTAL;
+
+ add(descriptionText, c);
+
+ c.insets = new Insets(10, 0, 10, 0);
+ add(defaultLayoutLabel, c);
+
+ c.insets = new Insets(0, 20, 0, 0);
+ c.gridwidth = 1;
+ c.weightx = 0d;
+ add(noPorts, c);
+ c.insets = new Insets(0, 5, 0, 0);
+ c.gridx = RELATIVE;
+ add(noPortsLabel, c);
+
+ c.insets = new Insets(0, 10, 0, 0);
+ add(allPorts, c);
+ c.insets = new Insets(0, 5, 0, 0);
+ add(allPortsLabel, c);
+
+ c.insets = new Insets(0, 10, 0, 0);
+ add(blobs, c);
+ c.insets = new Insets(0, 5, 0, 0);
+ c.gridwidth = REMAINDER;
+ c.weightx = 1d;
+ add(blobsLabel, c);
+
+ // alignment
+ c.insets = new Insets(20, 0, 10, 0);
+ c.gridx = 0;
+ add(defaultAlignmentLabel, c);
+
+ c.insets = new Insets(0, 20, 0, 0);
+ c.gridx = 0;
+ c.gridwidth = 1;
+ c.weightx = 0d;
+ add(vertical, c);
+ c.insets = new Insets(0, 5, 0, 0);
+ c.gridx = RELATIVE;
+ add(verticalLabel, c);
+
+ c.insets = new Insets(0, 10, 0, 0);
+ add(horizontal, c);
+ c.insets = new Insets(0, 5, 0, 0);
+ c.gridwidth = REMAINDER;
+ c.weightx = 1d;
+ add(horizontalLabel, c);
+
+ // animation
+ c.gridx = 0;
+ c.gridwidth = REMAINDER;
+ c.insets = new Insets(20, 0, 10, 0);
+ add(animation, c);
+
+ c.insets = new Insets(0, 20, 0, 0);
+ add(animationSpeedLabel, c);
+
+ c.insets = new Insets(0, 20, 10, 30);
+ c.anchor = NORTHWEST;
+ c.weighty = 0d;
+ add(animationSpeedSlider, c);
+
+ // Buttons
+ c.gridx = 0;
+ c.insets = new Insets(0, 20, 10, 30);
+ c.anchor = NORTHWEST;
+ c.weighty = 1d;
+ add(createButtonPanel(), c);
+ }
+
+ /**
+ * Create the panel with the buttons.
+ */
+ @SuppressWarnings("serial")
+ private JPanel createButtonPanel() {
+ final JPanel panel = new JPanel();
+
+ /**
+ * The helpButton shows help about the current component
+ */
+ JButton helpButton = new JButton(new AbstractAction("Help") {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ showHelp(panel);
+ }
+ });
+ panel.add(helpButton);
+
+ /**
+ * The resetButton changes the property values shown to those
+ * corresponding to the configuration currently applied.
+ */
+ JButton resetButton = new JButton(new AbstractAction("Reset") {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ setFields(configuration);
+ }
+ });
+ panel.add(resetButton);
+
+ /**
+ * The applyButton applies the shown field values to the
+ * {@link HttpProxyConfiguration} and saves them for future.
+ */
+ JButton applyButton = new JButton(new AbstractAction("Apply") {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ applySettings();
+ setFields(configuration);
+ }
+ });
+ panel.add(applyButton);
+
+ return panel;
+ }
+
+ /**
+ * Save the currently set field values to the {@link GraphViewConfiguration}
+ * . Also apply those values to the currently running Taverna.
+ */
+ private void applySettings() {
+ // Service display
+ if (noPorts.isSelected()) {
+ configuration.setProperty(PORT_STYLE, PortStyle.NONE.toString());
+ } else if (allPorts.isSelected()) {
+ configuration.setProperty(PORT_STYLE, PortStyle.ALL.toString());
+ } else if (blobs.isSelected()) {
+ configuration.setProperty(PORT_STYLE, PortStyle.BLOB.toString());
+ }
+
+ // Diagram alignment
+ if (vertical.isSelected()) {
+ configuration.setProperty(ALIGNMENT, Alignment.VERTICAL.toString());
+ } else if (horizontal.isSelected()) {
+ configuration.setProperty(ALIGNMENT,
+ Alignment.HORIZONTAL.toString());
+ }
+
+ // Animation and its speed
+ if (animation.isSelected()) {
+ configuration.setProperty(ANIMATION_ENABLED, String.valueOf(true));
+ } else {
+ configuration.setProperty(ANIMATION_ENABLED, String.valueOf(false));
+ }
+ int speed = animationSpeedSlider.getValue();
+ configuration.setProperty(ANIMATION_SPEED, String.valueOf(speed));
+ }
+
+ /**
+ * Set the shown configuration field values to those currently in use (i.e.
+ * last saved configuration).
+ */
+ private void setFields(GraphViewConfiguration configurable) {
+ PortStyle portStyle = PortStyle.valueOf(configurable
+ .getProperty(PORT_STYLE));
+ if (portStyle.equals(PortStyle.NONE)) {
+ noPorts.setSelected(true);
+ } else if (portStyle.equals(PortStyle.ALL)) {
+ allPorts.setSelected(true);
+ } else {
+ blobs.setSelected(true);
+ }
+
+ Alignment alignment = Alignment.valueOf(configurable
+ .getProperty(ALIGNMENT));
+ if (alignment.equals(Alignment.VERTICAL)) {
+ vertical.setSelected(true);
+ } else {
+ horizontal.setSelected(true);
+ }
+
+ boolean animationEnabled = Boolean.parseBoolean(configurable
+ .getProperty(ANIMATION_ENABLED));
+ animation.setSelected(animationEnabled);
+
+ Integer animationSpeed = Integer.valueOf(configurable
+ .getProperty(ANIMATION_SPEED));
+ if (animationSpeed > ANIMATION_SPEED_MAX) {
+ animationSpeed = ANIMATION_SPEED_MAX;
+ } else if (animationSpeed < ANIMATION_SPEED_MIN) {
+ animationSpeed = ANIMATION_SPEED_MIN;
+ }
+ animationSpeedSlider.setValue(animationSpeed);
+ animationSpeedSlider.setEnabled(animationEnabled);
+
+ animationSpeedLabel.setEnabled(animationEnabled);
+ }
+
+ // for testing only
+ public static void main(String[] args) {
+ JDialog dialog = new JDialog();
+ dialog.add(new GraphViewConfigurationPanel(null));
+ dialog.setModal(true);
+ dialog.setSize(500, 400);
+ dialog.setVisible(true);
+ System.exit(0);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/config/GraphViewConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/config/GraphViewConfigurationUIFactory.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/config/GraphViewConfigurationUIFactory.java
new file mode 100644
index 0000000..770b79c
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/config/GraphViewConfigurationUIFactory.java
@@ -0,0 +1,54 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.config;
+
+import javax.swing.JPanel;
+
+import uk.org.taverna.configuration.Configurable;
+import uk.org.taverna.configuration.ConfigurationUIFactory;
+
+/**
+ * ConfigurationFactory for the GraphViewConfiguration.
+ *
+ * @author David Withers
+ */
+public class GraphViewConfigurationUIFactory implements ConfigurationUIFactory {
+ private GraphViewConfiguration graphViewConfiguration;
+
+ @Override
+ public boolean canHandle(String uuid) {
+ return uuid.equals(getConfigurable().getUUID());
+ }
+
+ @Override
+ public JPanel getConfigurationPanel() {
+ return new GraphViewConfigurationPanel(graphViewConfiguration);
+ }
+
+ @Override
+ public Configurable getConfigurable() {
+ return graphViewConfiguration;
+ }
+
+ public void setGraphViewConfiguration(
+ GraphViewConfiguration graphViewConfiguration) {
+ this.graphViewConfiguration = graphViewConfiguration;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/AddWFInputMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/AddWFInputMenuAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/AddWFInputMenuAction.java
new file mode 100644
index 0000000..cad5986
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/AddWFInputMenuAction.java
@@ -0,0 +1,59 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static org.apache.taverna.workbench.views.graph.menu.InsertMenu.INSERT;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.views.graph.actions.AddWFInputAction;
+
+/**
+ * @author Alex Nenadic
+ */
+public class AddWFInputMenuAction extends AbstractMenuAction {
+ private static final URI ADD_WF_INPUT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddWFInput");
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public AddWFInputMenuAction() {
+ super(INSERT, 10, ADD_WF_INPUT_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new AddWFInputAction(editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/AddWFOutputMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/AddWFOutputMenuAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/AddWFOutputMenuAction.java
new file mode 100644
index 0000000..1aeb495
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/AddWFOutputMenuAction.java
@@ -0,0 +1,59 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static org.apache.taverna.workbench.views.graph.menu.InsertMenu.INSERT;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.views.graph.actions.AddWFOutputAction;
+
+/**
+ * @author Alex Nenadic
+ */
+public class AddWFOutputMenuAction extends AbstractMenuAction {
+ private static final URI ADD_WF_OUTPUT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddWFOutput");
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public AddWFOutputMenuAction() {
+ super(INSERT, 20, ADD_WF_OUTPUT_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new AddWFOutputAction(editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java
new file mode 100644
index 0000000..243350e
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java
@@ -0,0 +1,60 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static org.apache.taverna.workbench.views.graph.menu.GraphDeleteMenuSection.GRAPH_DELETE_MENU_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.views.graph.actions.DeleteGraphComponentAction;
+
+/**
+ * @author Alex Nenadic
+ * @author Alan R Williams
+ */
+public class DeleteGraphComponentMenuAction extends AbstractMenuAction {
+ private static final URI DELETE_GRAPH_COMPONENT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuDeleteGraphComponent");
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public DeleteGraphComponentMenuAction() {
+ super(GRAPH_DELETE_MENU_SECTION, 10, DELETE_GRAPH_COMPONENT_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new DeleteGraphComponentAction(editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DiagramMenu.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DiagramMenu.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DiagramMenu.java
new file mode 100644
index 0000000..0b1497b
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DiagramMenu.java
@@ -0,0 +1,43 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static java.awt.event.KeyEvent.VK_V;
+import static javax.swing.Action.MNEMONIC_KEY;
+import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenu;
+
+public class DiagramMenu extends AbstractMenu {
+ public static final URI DIAGRAM = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#diagram");
+
+ public DiagramMenu() {
+ super(DEFAULT_MENU_BAR, 65, DIAGRAM, "View");
+ }
+
+ public static DummyAction makeAction() {
+ DummyAction action = new DummyAction("View");
+ action.putValue(MNEMONIC_KEY, VK_V);
+ return action;
+ }
+}
[02/11] incubator-taverna-workbench git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DiagramSaveMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DiagramSaveMenuSection.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DiagramSaveMenuSection.java
new file mode 100644
index 0000000..fa806eb
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DiagramSaveMenuSection.java
@@ -0,0 +1,38 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static org.apache.taverna.workbench.views.graph.menu.DiagramMenu.DIAGRAM;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+/**
+ * @author Alex Nenadic
+ */
+public class DiagramSaveMenuSection extends AbstractMenuSection {
+ public static final URI DIAGRAM_SAVE_MENU_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#diagramSaveMenuSection");
+
+ public DiagramSaveMenuSection() {
+ super(DIAGRAM, 40, DIAGRAM_SAVE_MENU_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DiagramZoomMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DiagramZoomMenuSection.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DiagramZoomMenuSection.java
new file mode 100644
index 0000000..dd71f82
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/DiagramZoomMenuSection.java
@@ -0,0 +1,39 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static org.apache.taverna.workbench.views.graph.menu.DiagramMenu.DIAGRAM;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+/**
+ * @author Alex Nenadic
+ * @author Alan R Williams
+ */
+public class DiagramZoomMenuSection extends AbstractMenuSection {
+ public static final URI DIAGRAM_ZOOM_MENU_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#diagramZoomMenuSection");
+
+ public DiagramZoomMenuSection() {
+ super(DIAGRAM, 20, DIAGRAM_ZOOM_MENU_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphCopyMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphCopyMenuSection.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphCopyMenuSection.java
new file mode 100644
index 0000000..6f68e68
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphCopyMenuSection.java
@@ -0,0 +1,38 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static org.apache.taverna.workbench.views.graph.menu.GraphMenuSection.GRAPH_MENU_SECTION;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+/**
+ * ???
+ */
+public class GraphCopyMenuSection extends AbstractMenuSection {
+ public static final URI GRAPH_COPY_MENU_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphCopyMenuSection");
+
+ public GraphCopyMenuSection() {
+ super(GRAPH_MENU_SECTION, 15, GRAPH_COPY_MENU_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphDeleteMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphDeleteMenuSection.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphDeleteMenuSection.java
new file mode 100644
index 0000000..bad51fa
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphDeleteMenuSection.java
@@ -0,0 +1,38 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static org.apache.taverna.workbench.views.graph.menu.GraphMenuSection.GRAPH_MENU_SECTION;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+/**
+ * @author Alex Nenadic
+ */
+public class GraphDeleteMenuSection extends AbstractMenuSection {
+ public static final URI GRAPH_DELETE_MENU_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphDeleteMenuSection");
+
+ public GraphDeleteMenuSection() {
+ super(GRAPH_MENU_SECTION, 30, GRAPH_DELETE_MENU_SECTION);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphDetailsMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphDetailsMenuSection.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphDetailsMenuSection.java
new file mode 100644
index 0000000..cd261bb
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphDetailsMenuSection.java
@@ -0,0 +1,39 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static org.apache.taverna.workbench.views.graph.menu.GraphMenuSection.GRAPH_MENU_SECTION;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+/**
+ * @author Alex Nenadic
+ * @author Alan R Williams
+ */
+public class GraphDetailsMenuSection extends AbstractMenuSection {
+ public static final URI GRAPH_DETAILS_MENU_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphDetailsMenuSection");
+
+ public GraphDetailsMenuSection() {
+ super(GRAPH_MENU_SECTION, 25, GRAPH_DETAILS_MENU_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphEditMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphEditMenuSection.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphEditMenuSection.java
new file mode 100644
index 0000000..231c728
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphEditMenuSection.java
@@ -0,0 +1,38 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static org.apache.taverna.workbench.views.graph.menu.GraphMenuSection.GRAPH_MENU_SECTION;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+/**
+ * @author Alex Nenadic
+ */
+public class GraphEditMenuSection extends AbstractMenuSection {
+ public static final URI GRAPH_EDIT_MENU_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphEditMenuSection");
+
+ public GraphEditMenuSection() {
+ super(GRAPH_MENU_SECTION, 20, GRAPH_EDIT_MENU_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphMenuSection.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphMenuSection.java
new file mode 100644
index 0000000..a042e13
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/GraphMenuSection.java
@@ -0,0 +1,38 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+/**
+ * @author Alex Nenadic
+ */
+public class GraphMenuSection extends AbstractMenuSection {
+ public static final URI GRAPH_MENU_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuSection");
+ public static final URI EDIT_MENU_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#edit");
+
+ public GraphMenuSection() {
+ super(EDIT_MENU_URI, 20, GRAPH_MENU_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/InsertMenu.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/InsertMenu.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/InsertMenu.java
new file mode 100644
index 0000000..b44c808
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/InsertMenu.java
@@ -0,0 +1,46 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static java.awt.event.KeyEvent.VK_I;
+import static javax.swing.Action.MNEMONIC_KEY;
+import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenu;
+
+/**
+ * @author alanrw
+ */
+public class InsertMenu extends AbstractMenu {
+ public static final URI INSERT = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#insert");
+
+ public InsertMenu() {
+ super(DEFAULT_MENU_BAR, 64, INSERT, makeAction());
+ }
+
+ public static DummyAction makeAction() {
+ DummyAction action = new DummyAction("Insert");
+ action.putValue(MNEMONIC_KEY, VK_I);
+ return action;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java
new file mode 100644
index 0000000..e3c9a7b
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java
@@ -0,0 +1,61 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static org.apache.taverna.workbench.views.graph.menu.GraphDetailsMenuSection.GRAPH_DETAILS_MENU_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.views.graph.actions.RenameWFInputOutputProcessorAction;
+
+/**
+ * @author Alex Nenadic
+ */
+public class RenameWFInputOutputProcessorMenuAction extends AbstractMenuAction {
+ private static final URI RENAME_WF_INPUT_OUTPUT_PROCESSOR_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuRenameWFInputOutputProcessor");
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public RenameWFInputOutputProcessorMenuAction() {
+ super(GRAPH_DETAILS_MENU_SECTION, 30,
+ RENAME_WF_INPUT_OUTPUT_PROCESSOR_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new RenameWFInputOutputProcessorAction(editManager,
+ selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ResetDiagramAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ResetDiagramAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ResetDiagramAction.java
new file mode 100644
index 0000000..77d3f1c
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ResetDiagramAction.java
@@ -0,0 +1,63 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.KeyEvent.VK_0;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.refreshIcon;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.DesignOrResultsAction;
+
+@SuppressWarnings("serial")
+public class ResetDiagramAction extends AbstractAction implements
+ DesignOrResultsAction {
+ private static Action designAction = null;
+ @SuppressWarnings("unused")
+ private static Action resultsAction = null;
+
+ public static void setResultsAction(Action resultsAction) {
+ ResetDiagramAction.resultsAction = resultsAction;
+ }
+
+ public static void setDesignAction(Action designAction) {
+ ResetDiagramAction.designAction = designAction;
+ }
+
+ public ResetDiagramAction() {
+ super("Reset diagram", refreshIcon);
+ putValue(
+ ACCELERATOR_KEY,
+ getKeyStroke(VK_0, getDefaultToolkit().getMenuShortcutKeyMask()));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+// if (isWorkflowPerspective() && (designAction != null))
+ designAction.actionPerformed(e);
+// else if (isResultsPerspective() && (resultsAction != null))
+// resultsAction.actionPerformed(e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ResetDiagramMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ResetDiagramMenuAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ResetDiagramMenuAction.java
new file mode 100644
index 0000000..377b539
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ResetDiagramMenuAction.java
@@ -0,0 +1,49 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static org.apache.taverna.workbench.views.graph.menu.DiagramZoomMenuSection.DIAGRAM_ZOOM_MENU_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+
+/**
+ * An action that zooms a diagram image
+ *
+ * @author Alex Nenadic
+ * @author Tom Oinn
+ * @author Alan R Williams
+ */
+public class ResetDiagramMenuAction extends AbstractMenuAction {
+ public static final URI RESET_DIAGRAM_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#diagramMenuResetDiagram");
+
+ public ResetDiagramMenuAction() {
+ super(DIAGRAM_ZOOM_MENU_SECTION, 5, RESET_DIAGRAM_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ResetDiagramAction();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/SaveGraphImageSubMenu.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/SaveGraphImageSubMenu.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/SaveGraphImageSubMenu.java
new file mode 100644
index 0000000..408c32d
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/SaveGraphImageSubMenu.java
@@ -0,0 +1,314 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static javax.swing.JFileChooser.APPROVE_OPTION;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.YES_NO_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.taverna.workbench.views.graph.menu.DiagramSaveMenuSection.DIAGRAM_SAVE_MENU_SECTION;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URI;
+import java.net.URL;
+import java.util.prefs.Preferences;
+
+import javax.swing.AbstractAction;
+import javax.swing.ImageIcon;
+import javax.swing.JFileChooser;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+
+import org.apache.taverna.lang.io.StreamCopier;
+import org.apache.taverna.lang.io.StreamDevourer;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.SwingAwareObserver;
+import org.apache.taverna.lang.ui.ExtensionFileFilter;
+import org.apache.taverna.ui.menu.AbstractMenuCustom;
+import org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+import org.apache.taverna.workbench.models.graph.DotWriter;
+import org.apache.taverna.workbench.models.graph.GraphController;
+import org.apache.taverna.workbench.models.graph.svg.SVGUtil;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.selection.events.PerspectiveSelectionEvent;
+import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
+import org.apache.taverna.workbench.views.graph.GraphViewComponent;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * An action that saves graph diagram image.
+ *
+ * @author Alex Nenadic
+ * @author Tom Oinn
+ */
+public class SaveGraphImageSubMenu extends AbstractMenuCustom {
+ private static final Logger logger = Logger
+ .getLogger(SaveGraphImageSubMenu.class);
+ private static final String[] saveTypes = { "dot", "png", "svg", "ps",
+ "ps2" };
+ private static final String[] saveExtensions = { "dot", "png", "svg", "ps",
+ "ps" };
+ private static final String[] saveTypeNames = { "dot text", "PNG bitmap",
+ "scalable vector graphics", "postscript", "postscript for PDF" };
+ public static final URI SAVE_GRAPH_IMAGE_MENU_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuSaveGraphImage");
+
+ private JMenu saveDiagramMenu;
+ private FileManager fileManager;
+ private SelectionManager selectionManager;
+ private WorkbenchConfiguration workbenchConfiguration;
+ private GraphViewComponent graphViewComponent;
+
+ public SaveGraphImageSubMenu() {
+ super(DIAGRAM_SAVE_MENU_SECTION, 70, SAVE_GRAPH_IMAGE_MENU_URI);
+ }
+
+ @Override
+ protected Component createCustomComponent() {
+ saveDiagramMenu = new JMenu("Export diagram");
+ saveDiagramMenu
+ .setToolTipText("Open this menu to export the diagram in various formats");
+ for (int i = 0; i < saveTypes.length; i++) {
+ String type = saveTypes[i];
+ String extension = saveExtensions[i];
+ ImageIcon icon = new ImageIcon(
+ WorkbenchIcons.class.getResource("graph/saveAs"
+ + type.toUpperCase() + ".png"));
+ JMenuItem item = new JMenuItem(new DotInvoker("Export as "
+ + saveTypeNames[i], icon, type, extension));
+ saveDiagramMenu.add(item);
+ }
+ return saveDiagramMenu;
+ }
+
+ @SuppressWarnings("serial")
+ class DotInvoker extends AbstractAction implements DesignOnlyAction {
+ String type = "dot";
+ String extension = "dot";
+
+ public DotInvoker(String name, ImageIcon icon, String type,
+ String extension) {
+ super(name, icon);
+ this.type = type;
+ this.extension = extension;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Workflow workflow = selectionManager.getSelectedWorkflow();
+ if (workflow == null) {
+ showMessageDialog(null, "Cannot export an empty diagram.",
+ "Warning", WARNING_MESSAGE);
+ return;
+ }
+
+ File file = saveDialogue(null, workflow, extension,
+ "Export workflow diagram");
+ if (file == null)
+ // User cancelled
+ return;
+
+ try {
+ GraphController graphController = graphViewComponent
+ .getGraphController(workflow);
+
+ if (type.equals("dot")) {
+ // Just write out the dot text, no processing required
+ PrintWriter out = new PrintWriter(new FileWriter(file));
+ DotWriter dotWriter = new DotWriter(out);
+ dotWriter.writeGraph(graphController.generateGraph());
+ out.flush();
+ out.close();
+ } else {
+ String dotLocation = (String) workbenchConfiguration
+ .getProperty("taverna.dotlocation");
+ if (dotLocation == null)
+ dotLocation = "dot";
+ logger.debug("GraphViewComponent: Invoking dot...");
+ Process dotProcess = Runtime.getRuntime().exec(
+ new String[] { dotLocation, "-T" + type });
+
+ FileOutputStream fos = new FileOutputStream(file);
+
+ StringWriter stringWriter = new StringWriter();
+ DotWriter dotWriter = new DotWriter(stringWriter);
+ dotWriter.writeGraph(graphController.generateGraph());
+
+ OutputStream dotOut = dotProcess.getOutputStream();
+ dotOut.write(SVGUtil.getDot(stringWriter.toString(),
+ workbenchConfiguration).getBytes());
+ dotOut.flush();
+ dotOut.close();
+ new StreamDevourer(dotProcess.getErrorStream()).start();
+ new StreamCopier(dotProcess.getInputStream(), fos).start();
+ }
+ } catch (Exception ex) {
+ logger.warn("GraphViewComponent: Could not export diagram to " + file, ex);
+ showMessageDialog(null,
+ "Problem saving diagram : \n" + ex.getMessage(),
+ "Error!", ERROR_MESSAGE);
+ }
+ }
+ }
+
+ /**
+ * Pop up a save dialogue relating to the given workflow. This method can be
+ * used, for example, for saving the workflow diagram as .png, and will use
+ * the existing workflow title as a base for suggesting a filename.
+ *
+ * @param parentComponent
+ * Parent component for dialogue window
+ * @param model
+ * Workflow to save
+ * @param extension
+ * Extension for filename, such as "jpg"
+ * @param windowTitle
+ * Title for dialogue box, such as "Save workflow diagram"
+ * @return File instance for the selected abstract filename, or null if the
+ * dialogue was cancelled.
+ */
+ private File saveDialogue(Component parentComponent, Workflow workflow,
+ String extension, String windowTitle) {
+ JFileChooser fc = new JFileChooser();
+ Preferences prefs = Preferences
+ .userNodeForPackage(SaveGraphImageSubMenu.class);
+ String curDir = prefs
+ .get("currentDir", System.getProperty("user.home"));
+ String suggestedFileName = "";
+ // Get the source the workflow was loaded from - can be File, URL, or InputStream
+ Object source = fileManager.getDataflowSource(workflow.getParent());
+ if (source instanceof File) {
+ suggestedFileName = ((File) source).getName();
+ // remove the file extension
+ suggestedFileName = suggestedFileName.substring(0,
+ suggestedFileName.lastIndexOf("."));
+ } else if (source instanceof URL) {
+ suggestedFileName = ((URL) source).getPath();
+ // remove the file extension
+ suggestedFileName = suggestedFileName.substring(0,
+ suggestedFileName.lastIndexOf("."));
+ } else {
+ // We cannot suggest the file name if workflow was read from an InputStream
+ }
+
+ fc.setDialogTitle(windowTitle);
+ fc.resetChoosableFileFilters();
+ fc.setFileFilter(new ExtensionFileFilter(new String[] { extension }));
+ if (suggestedFileName.isEmpty())
+ // No file suggestion, just the directory
+ fc.setCurrentDirectory(new File(curDir));
+ else
+ // Suggest a filename from the workflow file name
+ fc.setSelectedFile(new File(curDir, suggestedFileName + "." + extension));
+
+ while (true) {
+ if (fc.showSaveDialog(parentComponent) != APPROVE_OPTION) {
+ logger.info("GraphViewComponent: Aborting diagram export to "
+ + suggestedFileName);
+ return null;
+ }
+
+ File file = fixExtension(fc.getSelectedFile(), extension);
+ logger.debug("GraphViewComponent: Selected " + file + " as export target");
+ prefs.put("currentDir", fc.getCurrentDirectory().toString());
+
+ // If file doesn't exist, we may write it! (Well, probably...)
+ if (!file.exists())
+ return file;
+
+ // Ask the user if they want to overwrite the file
+ String msg = file.getAbsolutePath()
+ + " already exists. Do you want to overwrite it?";
+ if (showConfirmDialog(null, msg, "File already exists",
+ YES_NO_OPTION) == JOptionPane.YES_OPTION)
+ return file;
+ }
+ }
+
+ /**
+ * Make sure given File has the given extension. If it has no extension,
+ * a new File instance will be returned. Otherwise, the passed instance is
+ * returned unchanged.
+ *
+ * @param file
+ * File which extension is to be checked
+ * @param extension
+ * Extension desired, example: "xml"
+ * @return file parameter if the extension was OK, or a new File instance
+ * with the correct extension
+ */
+ private File fixExtension(File file, String extension) {
+ if (file.getName().endsWith("." + extension))
+ return file;
+ // Append the extension (keep the existing one)
+ String name = file.getName();
+ return new File(file.getParent(), name + "." + extension);
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setWorkbenchConfiguration(
+ WorkbenchConfiguration workbenchConfiguration) {
+ this.workbenchConfiguration = workbenchConfiguration;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setGraphViewComponent(GraphViewComponent graphViewComponent) {
+ this.graphViewComponent = graphViewComponent;
+ }
+
+ private static final String DESIGN_PERSPECTIVE_ID = "net.sf.taverna.t2.ui.perspectives.design.DesignPerspective";
+
+ @SuppressWarnings("unused")
+ private final class SelectionManagerObserver extends
+ SwingAwareObserver<SelectionManagerEvent> {
+ @Override
+ public void notifySwing(Observable<SelectionManagerEvent> sender,
+ SelectionManagerEvent message) {
+ if (!(message instanceof PerspectiveSelectionEvent))
+ return;
+ PerspectiveSelectionEvent event = (PerspectiveSelectionEvent) message;
+
+ saveDiagramMenu.setEnabled((DESIGN_PERSPECTIVE_ID.equals(event
+ .getSelectedPerspective().getID())));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomInAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomInAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomInAction.java
new file mode 100644
index 0000000..f190167
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomInAction.java
@@ -0,0 +1,71 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.KeyEvent.VK_EQUALS;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.zoomInIcon;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.DesignOrResultsAction;
+
+import org.apache.log4j.Logger;
+
+@SuppressWarnings("serial")
+public class ZoomInAction extends AbstractAction implements
+ DesignOrResultsAction {
+ @SuppressWarnings("unused")
+ private static Logger logger = Logger.getLogger(ZoomInAction.class);
+ private static Action designAction = null;
+ @SuppressWarnings("unused")
+ private static Action resultsAction = null;
+
+ public static void setResultsAction(Action resultsAction) {
+ ZoomInAction.resultsAction = resultsAction;
+ }
+
+ public static void setDesignAction(Action designAction) {
+ ZoomInAction.designAction = designAction;
+ }
+
+ ZoomInAction() {
+ super("Zoom in", zoomInIcon);
+ putValue(
+ ACCELERATOR_KEY,
+ getKeyStroke(VK_EQUALS, getDefaultToolkit()
+ .getMenuShortcutKeyMask()));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+// if (isWorkflowPerspective()) {
+// if (designAction != null)
+ designAction.actionPerformed(e);
+// else
+// logger.error("ZoomInAction.designAction is null");
+// } else if (isResultsPerspective() && (resultsAction != null))
+// resultsAction.actionPerformed(e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomInMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomInMenuAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomInMenuAction.java
new file mode 100644
index 0000000..de78e66
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomInMenuAction.java
@@ -0,0 +1,49 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static org.apache.taverna.workbench.views.graph.menu.DiagramZoomMenuSection.DIAGRAM_ZOOM_MENU_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+
+/**
+ * An action that zooms a diagram image
+ *
+ * @author Alex Nenadic
+ * @author Tom Oinn
+ * @author Alan R Williams
+ */
+public class ZoomInMenuAction extends AbstractMenuAction {
+ public static final URI ZOOM_IN_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#diagramMenuZoomIn");
+
+ public ZoomInMenuAction() {
+ super(DIAGRAM_ZOOM_MENU_SECTION, 10, ZOOM_IN_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ZoomInAction();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomOutAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomOutAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomOutAction.java
new file mode 100644
index 0000000..ca3a30c
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomOutAction.java
@@ -0,0 +1,64 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.KeyEvent.VK_MINUS;
+import static javax.swing.KeyStroke.getKeyStroke;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.DesignOrResultsAction;
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+
+@SuppressWarnings("serial")
+public class ZoomOutAction extends AbstractAction implements
+ DesignOrResultsAction {
+ private static Action designAction = null;
+ @SuppressWarnings("unused")
+ private static Action resultsAction = null;
+
+ public static void setResultsAction(Action resultsAction) {
+ ZoomOutAction.resultsAction = resultsAction;
+ }
+
+ public static void setDesignAction(Action designAction) {
+ ZoomOutAction.designAction = designAction;
+ }
+
+ ZoomOutAction() {
+ super("Zoom out", WorkbenchIcons.zoomOutIcon);
+ putValue(
+ ACCELERATOR_KEY,
+ getKeyStroke(VK_MINUS, getDefaultToolkit()
+ .getMenuShortcutKeyMask()));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+// if (isWorkflowPerspective() && (designAction != null))
+ designAction.actionPerformed(e);
+// else if (isResultsPerspective() && (resultsAction != null))
+// resultsAction.actionPerformed(e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomOutMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomOutMenuAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomOutMenuAction.java
new file mode 100644
index 0000000..f776c6d
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/menu/ZoomOutMenuAction.java
@@ -0,0 +1,49 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.menu;
+
+import static org.apache.taverna.workbench.views.graph.menu.DiagramZoomMenuSection.DIAGRAM_ZOOM_MENU_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+
+/**
+ * An action that zooms a diagram image
+ *
+ * @author Alex Nenadic
+ * @author Tom Oinn
+ * @author Alan R Williams
+ */
+public class ZoomOutMenuAction extends AbstractMenuAction {
+ public static final URI ZOOM_OUT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#diagramMenuZoomOut");
+
+ public ZoomOutMenuAction() {
+ super(DIAGRAM_ZOOM_MENU_SECTION, 20, ZOOM_OUT_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ZoomOutAction();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/AddWFInputToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/AddWFInputToolbarAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/AddWFInputToolbarAction.java
new file mode 100644
index 0000000..ec8a125
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/AddWFInputToolbarAction.java
@@ -0,0 +1,59 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.toolbar;
+
+import static org.apache.taverna.workbench.views.graph.toolbar.GraphEditToolbarSection.GRAPH_EDIT_TOOLBAR_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.views.graph.actions.AddWFInputAction;
+
+/**
+ * @author Alex Nenadic
+ */
+public class AddWFInputToolbarAction extends AbstractMenuAction {
+ private static final URI ADD_WF_INPUT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphToolbarAddWFInput");
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public AddWFInputToolbarAction() {
+ super(GRAPH_EDIT_TOOLBAR_SECTION, 10, ADD_WF_INPUT_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new AddWFInputAction(editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java
new file mode 100644
index 0000000..d31ce18
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java
@@ -0,0 +1,59 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.toolbar;
+
+import static org.apache.taverna.workbench.views.graph.toolbar.GraphEditToolbarSection.GRAPH_EDIT_TOOLBAR_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.views.graph.actions.AddWFOutputAction;
+
+/**
+ * @author Alex Nenadic
+ */
+public class AddWFOutputToolbarAction extends AbstractMenuAction {
+ private static final URI ADD_WF_OUTPUT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphToolbarAddWFOutput");
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public AddWFOutputToolbarAction() {
+ super(GRAPH_EDIT_TOOLBAR_SECTION, 20, ADD_WF_OUTPUT_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new AddWFOutputAction(editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java
new file mode 100644
index 0000000..5736ca3
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java
@@ -0,0 +1,59 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.toolbar;
+
+import static org.apache.taverna.workbench.views.graph.toolbar.GraphDeleteToolbarSection.GRAPH_DELETE_TOOLBAR_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.views.graph.actions.DeleteGraphComponentAction;
+
+/**
+ * @author Alex Nenadic
+ */
+public class DeleteGraphComponentToolbarAction extends AbstractMenuAction {
+ private static final URI DELETE_GRAPH_COMPONENT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphToolbarDeleteGraphComponent");
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public DeleteGraphComponentToolbarAction() {
+ super(GRAPH_DELETE_TOOLBAR_SECTION, 10, DELETE_GRAPH_COMPONENT_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new DeleteGraphComponentAction(editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/GraphDeleteToolbarSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/GraphDeleteToolbarSection.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/GraphDeleteToolbarSection.java
new file mode 100644
index 0000000..2a68c00
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/GraphDeleteToolbarSection.java
@@ -0,0 +1,38 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.toolbar;
+
+import static org.apache.taverna.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+/**
+ * @author Alex Nenadic
+ */
+public class GraphDeleteToolbarSection extends AbstractMenuSection {
+ public static final URI GRAPH_DELETE_TOOLBAR_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphDeleteToolbarSection");
+
+ public GraphDeleteToolbarSection() {
+ super(DEFAULT_TOOL_BAR, 80, GRAPH_DELETE_TOOLBAR_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/GraphEditToolbarSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/GraphEditToolbarSection.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/GraphEditToolbarSection.java
new file mode 100644
index 0000000..3b86c77
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/GraphEditToolbarSection.java
@@ -0,0 +1,38 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.toolbar;
+
+import static org.apache.taverna.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+/**
+ * @author Alex Nenadic
+ */
+public class GraphEditToolbarSection extends AbstractMenuSection {
+ public static final URI GRAPH_EDIT_TOOLBAR_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphEditToolbarSection");
+
+ public GraphEditToolbarSection() {
+ super(DEFAULT_TOOL_BAR, 30, GRAPH_EDIT_TOOLBAR_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/RenameWFInputOutputProcessorToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/RenameWFInputOutputProcessorToolbarAction.java b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/RenameWFInputOutputProcessorToolbarAction.java
new file mode 100644
index 0000000..1676b96
--- /dev/null
+++ b/taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/toolbar/RenameWFInputOutputProcessorToolbarAction.java
@@ -0,0 +1,62 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.views.graph.toolbar;
+
+import static org.apache.taverna.workbench.views.graph.toolbar.GraphEditToolbarSection.GRAPH_EDIT_TOOLBAR_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.views.graph.actions.RenameWFInputOutputProcessorAction;
+
+/**
+ * @author Alex Nenadic
+ */
+public class RenameWFInputOutputProcessorToolbarAction extends
+ AbstractMenuAction {
+ private static final URI RENAME_WF_INPUT_OUTPUT_PROCESSOR_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphToolbarRenameWFInputOutputProcessor");
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public RenameWFInputOutputProcessorToolbarAction() {
+ super(GRAPH_EDIT_TOOLBAR_SECTION, 30,
+ RENAME_WF_INPUT_OUTPUT_PROCESSOR_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new RenameWFInputOutputProcessorAction(editManager,
+ selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
index 226078d..baa6700 100644
--- a/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
+++ b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -1,29 +1,29 @@
-net.sf.taverna.t2.workbench.views.graph.toolbar.GraphEditToolbarSection
-net.sf.taverna.t2.workbench.views.graph.toolbar.GraphDeleteToolbarSection
-net.sf.taverna.t2.workbench.views.graph.toolbar.GraphSaveToolbarSection
-net.sf.taverna.t2.workbench.views.graph.toolbar.AddWFInputToolbarAction
-net.sf.taverna.t2.workbench.views.graph.toolbar.AddWFOutputToolbarAction
-net.sf.taverna.t2.workbench.views.graph.toolbar.RenameWFInputOutputProcessorToolbarAction
-net.sf.taverna.t2.workbench.views.graph.toolbar.DeleteGraphComponentToolbarAction
-net.sf.taverna.t2.workbench.views.graph.toolbar.SaveGraphImageToolbarAction
+org.apache.taverna.workbench.views.graph.toolbar.GraphEditToolbarSection
+org.apache.taverna.workbench.views.graph.toolbar.GraphDeleteToolbarSection
+org.apache.taverna.workbench.views.graph.toolbar.GraphSaveToolbarSection
+org.apache.taverna.workbench.views.graph.toolbar.AddWFInputToolbarAction
+org.apache.taverna.workbench.views.graph.toolbar.AddWFOutputToolbarAction
+org.apache.taverna.workbench.views.graph.toolbar.RenameWFInputOutputProcessorToolbarAction
+org.apache.taverna.workbench.views.graph.toolbar.DeleteGraphComponentToolbarAction
+org.apache.taverna.workbench.views.graph.toolbar.SaveGraphImageToolbarAction
-net.sf.taverna.t2.workbench.views.graph.menu.DiagramMenu
-net.sf.taverna.t2.workbench.views.graph.menu.DiagramSaveMenuSection
-net.sf.taverna.t2.workbench.views.graph.menu.DiagramZoomMenuSection
+org.apache.taverna.workbench.views.graph.menu.DiagramMenu
+org.apache.taverna.workbench.views.graph.menu.DiagramSaveMenuSection
+org.apache.taverna.workbench.views.graph.menu.DiagramZoomMenuSection
-net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection
-net.sf.taverna.t2.workbench.views.graph.menu.GraphCopyMenuSection
-net.sf.taverna.t2.workbench.views.graph.menu.GraphEditMenuSection
-net.sf.taverna.t2.workbench.views.graph.menu.GraphDeleteMenuSection
-net.sf.taverna.t2.workbench.views.graph.menu.GraphDetailsMenuSection
+org.apache.taverna.workbench.views.graph.menu.GraphMenuSection
+org.apache.taverna.workbench.views.graph.menu.GraphCopyMenuSection
+org.apache.taverna.workbench.views.graph.menu.GraphEditMenuSection
+org.apache.taverna.workbench.views.graph.menu.GraphDeleteMenuSection
+org.apache.taverna.workbench.views.graph.menu.GraphDetailsMenuSection
-net.sf.taverna.t2.workbench.views.graph.menu.InsertMenu
+org.apache.taverna.workbench.views.graph.menu.InsertMenu
-net.sf.taverna.t2.workbench.views.graph.menu.AddWFInputMenuAction
-net.sf.taverna.t2.workbench.views.graph.menu.AddWFOutputMenuAction
-net.sf.taverna.t2.workbench.views.graph.menu.RenameWFInputOutputProcessorMenuAction
-net.sf.taverna.t2.workbench.views.graph.menu.DeleteGraphComponentMenuAction
-net.sf.taverna.t2.workbench.views.graph.menu.SaveGraphImageSubMenu
-net.sf.taverna.t2.workbench.views.graph.menu.ZoomInMenuAction
-net.sf.taverna.t2.workbench.views.graph.menu.ZoomOutMenuAction
-net.sf.taverna.t2.workbench.views.graph.menu.ResetDiagramMenuAction
\ No newline at end of file
+org.apache.taverna.workbench.views.graph.menu.AddWFInputMenuAction
+org.apache.taverna.workbench.views.graph.menu.AddWFOutputMenuAction
+org.apache.taverna.workbench.views.graph.menu.RenameWFInputOutputProcessorMenuAction
+org.apache.taverna.workbench.views.graph.menu.DeleteGraphComponentMenuAction
+org.apache.taverna.workbench.views.graph.menu.SaveGraphImageSubMenu
+org.apache.taverna.workbench.views.graph.menu.ZoomInMenuAction
+org.apache.taverna.workbench.views.graph.menu.ZoomOutMenuAction
+org.apache.taverna.workbench.views.graph.menu.ResetDiagramMenuAction
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
index 70830ec..e4c56c8 100644
--- a/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
+++ b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
@@ -1 +1 @@
-net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfigurationUIFactory
+org.apache.taverna.workbench.views.graph.config.GraphViewConfigurationUIFactory
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
index 8086a8d..c25df17 100644
--- a/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
+++ b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
@@ -1 +1 @@
-net.sf.taverna.t2.workbench.views.graph.GraphViewComponentFactory
\ No newline at end of file
+org.apache.taverna.workbench.views.graph.GraphViewComponentFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentSPI
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentSPI b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentSPI
index 563c21d..efbb3be 100644
--- a/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentSPI
+++ b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentSPI
@@ -1 +1 @@
-net.sf.taverna.t2.workbench.views.graph.GraphViewComponent
+org.apache.taverna.workbench.views.graph.GraphViewComponent
[06/11] incubator-taverna-workbench git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenFromURLMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenFromURLMenuAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenFromURLMenuAction.java
new file mode 100644
index 0000000..d34767d
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenFromURLMenuAction.java
@@ -0,0 +1,47 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.menu;
+
+import static org.apache.taverna.workbench.file.impl.menu.FileOpenMenuSection.FILE_OPEN_SECTION_URI;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.impl.actions.OpenWorkflowFromURLAction;
+
+public class FileOpenFromURLMenuAction extends AbstractMenuAction {
+
+ private static final URI FILE_OPEN_FROM_URL_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#fileOpenURL");
+ private final FileManager fileManager;
+
+ public FileOpenFromURLMenuAction(FileManager fileManager) {
+ super(FILE_OPEN_SECTION_URI, 30, FILE_OPEN_FROM_URL_URI);
+ this.fileManager = fileManager;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new OpenWorkflowFromURLAction(null, fileManager);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenMenuAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenMenuAction.java
new file mode 100644
index 0000000..f7c84cb
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenMenuAction.java
@@ -0,0 +1,46 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.menu;
+
+import static org.apache.taverna.workbench.file.impl.menu.FileOpenMenuSection.FILE_OPEN_SECTION_URI;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.impl.actions.OpenWorkflowAction;
+
+public class FileOpenMenuAction extends AbstractMenuAction {
+ private static final URI FILE_OPEN_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#fileOpen");
+ private final FileManager fileManager;
+
+ public FileOpenMenuAction(FileManager fileManager) {
+ super(FILE_OPEN_SECTION_URI, 20, FILE_OPEN_URI);
+ this.fileManager = fileManager;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new OpenWorkflowAction(fileManager);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenMenuSection.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenMenuSection.java
new file mode 100644
index 0000000..ff8fefd
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenMenuSection.java
@@ -0,0 +1,35 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.menu;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+public class FileOpenMenuSection extends AbstractMenuSection {
+ public static final URI FILE_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#file");
+ public static final URI FILE_OPEN_SECTION_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#fileOpenSection");
+
+ public FileOpenMenuSection() {
+ super(FILE_URI, 20, FILE_OPEN_SECTION_URI);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenRecentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenRecentMenuAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenRecentMenuAction.java
new file mode 100644
index 0000000..0a959c3
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileOpenRecentMenuAction.java
@@ -0,0 +1,437 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.menu;
+
+import static java.awt.event.KeyEvent.VK_0;
+import static java.awt.event.KeyEvent.VK_R;
+import static javax.swing.Action.MNEMONIC_KEY;
+import static javax.swing.Action.NAME;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.SwingUtilities.invokeLater;
+import static org.apache.taverna.workbench.file.impl.menu.FileOpenMenuSection.FILE_OPEN_SECTION_URI;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.ui.menu.AbstractMenuCustom;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.events.AbstractDataflowEvent;
+import org.apache.taverna.workbench.file.events.ClosedDataflowEvent;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.file.events.OpenedDataflowEvent;
+import org.apache.taverna.workbench.file.events.SavedDataflowEvent;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+
+import org.apache.log4j.Logger;
+import org.jdom.Document;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
+
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+public class FileOpenRecentMenuAction extends AbstractMenuCustom implements
+ Observer<FileManagerEvent> {
+ public static final URI RECENT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#fileOpenRecent");
+ private static final String CONF = "conf";
+ private static Logger logger = Logger
+ .getLogger(FileOpenRecentMenuAction.class);
+ private static final String RECENT_WORKFLOWS_XML = "recentWorkflows.xml";
+ private static final int MAX_ITEMS = 10;
+
+ private FileManager fileManager;
+ private ApplicationConfiguration applicationConfiguration;
+ private JMenu menu;
+ private List<Recent> recents = new ArrayList<>();
+ private Thread loadRecentThread;
+
+ public FileOpenRecentMenuAction(FileManager fileManager) {
+ super(FILE_OPEN_SECTION_URI, 30, RECENT_URI);
+ this.fileManager = fileManager;
+ fileManager.addObserver(this);
+ }
+
+ @Override
+ public void notify(Observable<FileManagerEvent> sender,
+ FileManagerEvent message) throws Exception {
+ FileManager fileManager = (FileManager) sender;
+ if (message instanceof OpenedDataflowEvent
+ || message instanceof SavedDataflowEvent) {
+ AbstractDataflowEvent dataflowEvent = (AbstractDataflowEvent) message;
+ WorkflowBundle dataflow = dataflowEvent.getDataflow();
+ Object dataflowSource = fileManager.getDataflowSource(dataflow);
+ FileType dataflowType = fileManager.getDataflowType(dataflow);
+ addRecent(dataflowSource, dataflowType);
+ }
+ if (message instanceof ClosedDataflowEvent)
+ // Make sure enabled/disabled status is correct
+ updateRecentMenu();
+ }
+
+ public void updateRecentMenu() {
+ invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ updateRecentMenuGUI();
+ }
+ });
+ saveRecent();
+ }
+
+ protected void addRecent(Object dataflowSource, FileType dataflowType) {
+ if (dataflowSource == null)
+ return;
+ if (!(dataflowSource instanceof Serializable)) {
+ logger.warn("Can't serialize workflow source for 'Recent workflows': "
+ + dataflowSource);
+ return;
+ }
+ synchronized (recents) {
+ Recent recent = new Recent((Serializable) dataflowSource, dataflowType);
+ if (recents.contains(recent))
+ recents.remove(recent);
+ recents.add(0, recent); // Add to front
+ }
+ updateRecentMenu();
+ }
+
+ @Override
+ protected Component createCustomComponent() {
+ action = new DummyAction("Recent workflows");
+ action.putValue(MNEMONIC_KEY, VK_R);
+ menu = new JMenu(action);
+ // Disabled until we have loaded the recent workflows
+ menu.setEnabled(false);
+ loadRecentThread = new Thread("Loading recent workflow menu") {
+ // Avoid hanging GUI initialization while deserialising
+ @Override
+ public void run() {
+ loadRecent();
+ updateRecentMenu();
+ }
+ };
+ loadRecentThread.start();
+ return menu;
+ }
+
+ protected synchronized void loadRecent() {
+ File confDir = new File(applicationConfiguration.getApplicationHomeDir(), CONF);
+ confDir.mkdir();
+ File recentFile = new File(confDir, RECENT_WORKFLOWS_XML);
+ if (!recentFile.isFile())
+ return;
+ try {
+ loadRecent(recentFile);
+ } catch (JDOMException|IOException e) {
+ logger.warn("Could not read recent workflows from file "
+ + recentFile, e);
+ }
+ }
+
+ private void loadRecent(File recentFile) throws FileNotFoundException,
+ IOException, JDOMException {
+ SAXBuilder builder = new SAXBuilder();
+ @SuppressWarnings("unused")
+ Document document;
+ try (InputStream fileInputStream = new BufferedInputStream(
+ new FileInputStream(recentFile))) {
+ document = builder.build(fileInputStream);
+ }
+ synchronized (recents) {
+ recents.clear();
+ //RecentDeserializer deserialiser = new RecentDeserializer();
+ try {
+ // recents.addAll(deserialiser.deserializeRecent(document
+ // .getRootElement()));
+ } catch (Exception e) {
+ logger.warn("Could not read recent workflows from file "
+ + recentFile, e);
+ }
+ }
+ }
+
+ protected synchronized void saveRecent() {
+ File confDir = new File(applicationConfiguration.getApplicationHomeDir(), CONF);
+ confDir.mkdir();
+ File recentFile = new File(confDir, RECENT_WORKFLOWS_XML);
+
+ try {
+ saveRecent(recentFile);
+// } catch (JDOMException e) {
+// logger.warn("Could not generate XML for recent workflows to file "
+// + recentFile, e);
+ } catch (IOException e) {
+ logger.warn("Could not write recent workflows to file "
+ + recentFile, e);
+ }
+ }
+
+ private void saveRecent(File recentFile) throws FileNotFoundException,
+ IOException {
+ // RecentSerializer serializer = new RecentSerializer();
+ // XMLOutputter outputter = new XMLOutputter();
+
+ // Element serializedRecent;
+ synchronized (recents) {
+ if (recents.size() > MAX_ITEMS)
+ // Remove excess entries
+ recents.subList(MAX_ITEMS, recents.size()).clear();
+ // serializedRecent = serializer.serializeRecent(recents);
+ }
+ try (OutputStream outputStream = new BufferedOutputStream(
+ new FileOutputStream(recentFile))) {
+ // outputter.output(serializedRecent, outputStream);
+ }
+ }
+
+ protected void updateRecentMenuGUI() {
+ int items = 0;
+ menu.removeAll();
+ synchronized (recents) {
+ for (Recent recent : recents) {
+ if (++items >= MAX_ITEMS)
+ break;
+ OpenRecentAction openRecentAction = new OpenRecentAction(
+ recent, fileManager);
+ if (fileManager.getDataflowBySource(recent.getDataflowSource()) != null)
+ openRecentAction.setEnabled(false);
+ // else setEnabled(true)
+ JMenuItem menuItem = new JMenuItem(openRecentAction);
+ if (items < 10) {
+ openRecentAction.putValue(NAME, items + " "
+ + openRecentAction.getValue(NAME));
+ menuItem.setMnemonic(VK_0 + items);
+ }
+ menu.add(menuItem);
+ }
+ }
+ menu.setEnabled(items > 0);
+ menu.revalidate();
+ }
+
+ @SuppressWarnings("serial")
+ public static class OpenRecentAction extends AbstractAction implements
+ Runnable {
+ private final Recent recent;
+ private Component component = null;
+ private final FileManager fileManager;
+
+ public OpenRecentAction(Recent recent, FileManager fileManager) {
+ this.recent = recent;
+ this.fileManager = fileManager;
+ Serializable source = recent.getDataflowSource();
+ String name;
+ if (source instanceof File)
+ name = ((File) source).getAbsolutePath();
+ else
+ name = source.toString();
+ this.putValue(NAME, name);
+ this.putValue(SHORT_DESCRIPTION, "Open the workflow " + name);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ component = null;
+ if (e.getSource() instanceof Component)
+ component = (Component) e.getSource();
+ setEnabled(false);
+ new Thread(this, "Opening workflow from "
+ + recent.getDataflowSource()).start();
+ }
+
+ /**
+ * Opening workflow in separate thread
+ */
+ @Override
+ public void run() {
+ final Serializable source = recent.getDataflowSource();
+ try {
+ fileManager.openDataflow(recent.makefileType(), source);
+ } catch (OpenException ex) {
+ logger.warn("Failed to open the workflow from " + source
+ + " \n", ex);
+ showMessageDialog(component,
+ "Failed to open the workflow from url " + source
+ + " \n" + ex.getMessage(), "Error!",
+ ERROR_MESSAGE);
+ } finally {
+ setEnabled(true);
+ }
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static class Recent implements Serializable {
+ private final class RecentFileType extends FileType {
+ @Override
+ public String getMimeType() {
+ return mimeType;
+ }
+
+ @Override
+ public String getExtension() {
+ return extension;
+ }
+
+ @Override
+ public String getDescription() {
+ return "File type " + extension + " " + mimeType;
+ }
+ }
+
+ private Serializable dataflowSource;
+ private String mimeType;
+ private String extension;
+
+ public String getMimeType() {
+ return mimeType;
+ }
+
+ public void setMimeType(String mimeType) {
+ this.mimeType = mimeType;
+ }
+
+ public String getExtension() {
+ return extension;
+ }
+
+ public void setExtension(String extension) {
+ this.extension = extension;
+ }
+
+ public Recent() {
+ }
+
+ public FileType makefileType() {
+ if (mimeType == null && extension == null)
+ return null;
+ return new RecentFileType();
+ }
+
+ public Recent(Serializable dataflowSource, FileType dataflowType) {
+ setDataflowSource(dataflowSource);
+ if (dataflowType != null) {
+ setMimeType(dataflowType.getMimeType());
+ setExtension(dataflowType.getExtension());
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime
+ * result
+ + ((dataflowSource == null) ? 0 : dataflowSource.hashCode());
+ result = prime * result
+ + ((extension == null) ? 0 : extension.hashCode());
+ result = prime * result
+ + ((mimeType == null) ? 0 : mimeType.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj instanceof Recent))
+ return false;
+ Recent other = (Recent) obj;
+
+ if (dataflowSource == null) {
+ if (other.dataflowSource != null)
+ return false;
+ } else if (!dataflowSource.equals(other.dataflowSource))
+ return false;
+
+ if (extension == null) {
+ if (other.extension != null)
+ return false;
+ } else if (!extension.equals(other.extension))
+ return false;
+
+ if (mimeType == null) {
+ if (other.mimeType != null)
+ return false;
+ } else if (!mimeType.equals(other.mimeType))
+ return false;
+
+ return true;
+ }
+
+ public Serializable getDataflowSource() {
+ return dataflowSource;
+ }
+
+ public void setDataflowSource(Serializable dataflowSource) {
+ this.dataflowSource = dataflowSource;
+ }
+
+ @Override
+ public String toString() {
+ return getDataflowSource() + "";
+ }
+ }
+
+ // TODO find new serialization
+// protected static class RecentDeserializer extends AbstractXMLDeserializer {
+// public Collection<Recent> deserializeRecent(Element el) {
+// return (Collection<Recent>) super.createBean(el, getClass()
+// .getClassLoader());
+// }
+// }
+//
+// protected static class RecentSerializer extends AbstractXMLSerializer {
+// public Element serializeRecent(List<Recent> x) throws JDOMException,
+// IOException {
+// Element beanAsElement = super.beanAsElement(x);
+// return beanAsElement;
+// }
+// }
+
+ public void setApplicationConfiguration(
+ ApplicationConfiguration applicationConfiguration) {
+ this.applicationConfiguration = applicationConfiguration;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveAllMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveAllMenuAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveAllMenuAction.java
new file mode 100644
index 0000000..ef10c2c
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveAllMenuAction.java
@@ -0,0 +1,46 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.menu;
+
+import static org.apache.taverna.workbench.file.impl.menu.FileSaveMenuSection.FILE_SAVE_SECTION_URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.impl.actions.SaveAllWorkflowsAction;
+
+public class FileSaveAllMenuAction extends AbstractMenuAction {
+ private final EditManager editManager;
+ private final FileManager fileManager;
+
+ public FileSaveAllMenuAction(EditManager editManager,
+ FileManager fileManager) {
+ super(FILE_SAVE_SECTION_URI, 30);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new SaveAllWorkflowsAction(editManager, fileManager);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveAsMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveAsMenuAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveAsMenuAction.java
new file mode 100644
index 0000000..d868d42
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveAsMenuAction.java
@@ -0,0 +1,42 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.menu;
+
+import static org.apache.taverna.workbench.file.impl.menu.FileSaveMenuSection.FILE_SAVE_SECTION_URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.impl.actions.SaveWorkflowAsAction;
+
+public class FileSaveAsMenuAction extends AbstractMenuAction {
+ private final FileManager fileManager;
+
+ public FileSaveAsMenuAction(FileManager fileManager) {
+ super(FILE_SAVE_SECTION_URI, 20);
+ this.fileManager = fileManager;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new SaveWorkflowAsAction(fileManager);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveMenuAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveMenuAction.java
new file mode 100644
index 0000000..5f042c8
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveMenuAction.java
@@ -0,0 +1,45 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.menu;
+
+import static org.apache.taverna.workbench.file.impl.menu.FileSaveMenuSection.FILE_SAVE_SECTION_URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.impl.actions.SaveWorkflowAction;
+
+public class FileSaveMenuAction extends AbstractMenuAction {
+ private final EditManager editManager;
+ private final FileManager fileManager;
+
+ public FileSaveMenuAction(EditManager editManager, FileManager fileManager) {
+ super(FILE_SAVE_SECTION_URI, 10);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new SaveWorkflowAction(editManager, fileManager);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveMenuSection.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveMenuSection.java
new file mode 100644
index 0000000..4192ef5
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileSaveMenuSection.java
@@ -0,0 +1,35 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.menu;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+public class FileSaveMenuSection extends AbstractMenuSection {
+ public static final URI FILE_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#file");
+ public static final URI FILE_SAVE_SECTION_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#fileSaveSection");
+
+ public FileSaveMenuSection() {
+ super(FILE_URI, 40, FILE_SAVE_SECTION_URI);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/WorkflowsMenu.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/WorkflowsMenu.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/WorkflowsMenu.java
new file mode 100644
index 0000000..9219e94
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/WorkflowsMenu.java
@@ -0,0 +1,162 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.menu;
+
+import static java.awt.event.KeyEvent.VK_0;
+import static java.awt.event.KeyEvent.VK_W;
+import static javax.swing.Action.MNEMONIC_KEY;
+import static javax.swing.SwingUtilities.invokeLater;
+import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.ButtonGroup;
+import javax.swing.JMenu;
+import javax.swing.JRadioButtonMenuItem;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.ui.menu.AbstractMenuCustom;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.EditManager.AbstractDataflowEditEvent;
+import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.events.AbstractDataflowEvent;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+public class WorkflowsMenu extends AbstractMenuCustom {
+ private EditManagerObserver editManagerObserver = new EditManagerObserver();
+ private FileManager fileManager;
+ private FileManagerObserver fileManagerObserver = new FileManagerObserver();
+
+ private JMenu workflowsMenu;
+
+ public WorkflowsMenu(EditManager editManager, FileManager fileManager) {
+ super(DEFAULT_MENU_BAR, 900);
+ this.fileManager = fileManager;
+ fileManager.addObserver(fileManagerObserver);
+ editManager.addObserver(editManagerObserver);
+ }
+
+ @Override
+ protected Component createCustomComponent() {
+ DummyAction action = new DummyAction("Workflows");
+ action.putValue(MNEMONIC_KEY, VK_W);
+
+ workflowsMenu = new JMenu(action);
+
+ updateWorkflowsMenu();
+ return workflowsMenu;
+ }
+
+ public void updateWorkflowsMenu() {
+ invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ updateWorkflowsMenuUI();
+ }
+ });
+ }
+
+ protected void updateWorkflowsMenuUI() {
+ workflowsMenu.setEnabled(false);
+ workflowsMenu.removeAll();
+ ButtonGroup workflowsGroup = new ButtonGroup();
+
+ int i = 0;
+ WorkflowBundle currentDataflow = fileManager.getCurrentDataflow();
+ for (WorkflowBundle workflowBundle : fileManager.getOpenDataflows()) {
+ String name = fileManager.getDataflowName(workflowBundle);
+ if (fileManager.isDataflowChanged(workflowBundle))
+ name = "*" + name;
+ // A counter
+ name = ++i + " " + name;
+
+ SwitchWorkflowAction switchWorkflowAction = new SwitchWorkflowAction(
+ name, workflowBundle);
+ if (i < 10)
+ switchWorkflowAction.putValue(MNEMONIC_KEY, new Integer(VK_0
+ + i));
+
+ JRadioButtonMenuItem switchWorkflowMenuItem = new JRadioButtonMenuItem(
+ switchWorkflowAction);
+ workflowsGroup.add(switchWorkflowMenuItem);
+ if (workflowBundle.equals(currentDataflow))
+ switchWorkflowMenuItem.setSelected(true);
+ workflowsMenu.add(switchWorkflowMenuItem);
+ }
+ if (i == 0)
+ workflowsMenu.add(new NoWorkflowsOpen());
+ workflowsMenu.setEnabled(true);
+ workflowsMenu.revalidate();
+ }
+
+ private final class EditManagerObserver implements
+ Observer<EditManagerEvent> {
+ @Override
+ public void notify(Observable<EditManagerEvent> sender,
+ EditManagerEvent message) throws Exception {
+ if (message instanceof AbstractDataflowEditEvent)
+ updateWorkflowsMenu();
+ }
+ }
+
+ private final class FileManagerObserver implements
+ Observer<FileManagerEvent> {
+ @Override
+ public void notify(Observable<FileManagerEvent> sender,
+ FileManagerEvent message) throws Exception {
+ if (message instanceof AbstractDataflowEvent)
+ updateWorkflowsMenu();
+ // TODO: Don't rebuild whole menu
+ }
+ }
+
+ @SuppressWarnings("serial")
+ private final class NoWorkflowsOpen extends AbstractAction {
+ private NoWorkflowsOpen() {
+ super("No workflows open");
+ setEnabled(false);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ // No-op
+ }
+ }
+
+ @SuppressWarnings("serial")
+ private final class SwitchWorkflowAction extends AbstractAction {
+ private final WorkflowBundle workflowBundle;
+
+ private SwitchWorkflowAction(String name, WorkflowBundle workflowBundle) {
+ super(name);
+ this.workflowBundle = workflowBundle;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ fileManager.setCurrentDataflow(workflowBundle);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/CloseToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/CloseToolbarAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/CloseToolbarAction.java
new file mode 100644
index 0000000..d99d3d2
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/CloseToolbarAction.java
@@ -0,0 +1,54 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.toolbar;
+
+import static org.apache.taverna.workbench.file.impl.toolbar.FileToolbarMenuSection.FILE_TOOLBAR_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.impl.actions.CloseWorkflowAction;
+
+/**
+ * Action to close the current workflow.
+ *
+ * @author Alex Nenadic
+ */
+public class CloseToolbarAction extends AbstractMenuAction {
+ private static final URI FILE_CLOSE_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#fileToolbarClose");
+ private final EditManager editManager;
+ private final FileManager fileManager;
+
+ public CloseToolbarAction(EditManager editManager, FileManager fileManager) {
+ super(FILE_TOOLBAR_SECTION, 30, FILE_CLOSE_URI);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new CloseWorkflowAction(editManager, fileManager);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/FileToolbarMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/FileToolbarMenuSection.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/FileToolbarMenuSection.java
new file mode 100644
index 0000000..7b2b484
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/FileToolbarMenuSection.java
@@ -0,0 +1,35 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.toolbar;
+
+import static org.apache.taverna.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+public class FileToolbarMenuSection extends AbstractMenuSection {
+ public static final URI FILE_TOOLBAR_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#fileToolbarSection");
+
+ public FileToolbarMenuSection() {
+ super(DEFAULT_TOOL_BAR, 10, FILE_TOOLBAR_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/NewToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/NewToolbarAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/NewToolbarAction.java
new file mode 100644
index 0000000..a39e1ad
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/NewToolbarAction.java
@@ -0,0 +1,46 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.toolbar;
+
+import static org.apache.taverna.workbench.file.impl.toolbar.FileToolbarMenuSection.FILE_TOOLBAR_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.impl.actions.NewWorkflowAction;
+
+public class NewToolbarAction extends AbstractMenuAction {
+ private static final URI FILE_NEW_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#fileToolbarNew");
+ private final FileManager fileManager;
+
+ public NewToolbarAction(FileManager fileManager) {
+ super(FILE_TOOLBAR_SECTION, 10, FILE_NEW_URI);
+ this.fileManager = fileManager;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new NewWorkflowAction(fileManager);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/OpenToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/OpenToolbarAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/OpenToolbarAction.java
new file mode 100644
index 0000000..09b9f52
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/OpenToolbarAction.java
@@ -0,0 +1,46 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.toolbar;
+
+import static org.apache.taverna.workbench.file.impl.toolbar.FileToolbarMenuSection.FILE_TOOLBAR_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.impl.actions.OpenWorkflowAction;
+
+public class OpenToolbarAction extends AbstractMenuAction {
+ private static final URI FILE_OPEN_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#fileToolbarOpen");
+ private final FileManager fileManager;
+
+ public OpenToolbarAction(FileManager fileManager) {
+ super(FILE_TOOLBAR_SECTION, 20, FILE_OPEN_URI);
+ this.fileManager = fileManager;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new OpenWorkflowAction(fileManager);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/OpenWorkflowFromURLToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/OpenWorkflowFromURLToolbarAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/OpenWorkflowFromURLToolbarAction.java
new file mode 100644
index 0000000..cd4c91e
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/OpenWorkflowFromURLToolbarAction.java
@@ -0,0 +1,46 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.toolbar;
+
+import static org.apache.taverna.workbench.file.impl.toolbar.FileToolbarMenuSection.FILE_TOOLBAR_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.impl.actions.OpenWorkflowFromURLAction;
+
+public class OpenWorkflowFromURLToolbarAction extends AbstractMenuAction {
+ private static final URI FILE_OPEN_FROM_URL_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#fileToolbarOpenFromURL");
+ private final FileManager fileManager;
+
+ public OpenWorkflowFromURLToolbarAction(FileManager fileManager) {
+ super(FILE_TOOLBAR_SECTION, 25, FILE_OPEN_FROM_URL_URI);
+ this.fileManager = fileManager;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new OpenWorkflowFromURLAction(null, fileManager);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/SaveToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/SaveToolbarAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/SaveToolbarAction.java
new file mode 100644
index 0000000..fc06660
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/toolbar/SaveToolbarAction.java
@@ -0,0 +1,49 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.toolbar;
+
+import static org.apache.taverna.workbench.file.impl.toolbar.FileToolbarMenuSection.FILE_TOOLBAR_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.impl.actions.SaveWorkflowAction;
+
+public class SaveToolbarAction extends AbstractMenuAction {
+ private static final URI FILE_SAVE_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#fileToolbarSave");
+ private final EditManager editManager;
+ private final FileManager fileManager;
+
+ public SaveToolbarAction(EditManager editManager, FileManager fileManager) {
+ super(FILE_TOOLBAR_SECTION, 40, FILE_SAVE_URI);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new SaveWorkflowAction(editManager, fileManager);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
index 100915c..081aa6c 100644
--- a/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
+++ b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -1,20 +1,20 @@
-net.sf.taverna.t2.workbench.file.impl.menu.FileCloseMenuAction
-net.sf.taverna.t2.workbench.file.impl.menu.FileNewMenuAction
-net.sf.taverna.t2.workbench.file.impl.menu.FileOpenMenuAction
-net.sf.taverna.t2.workbench.file.impl.menu.FileOpenFromURLMenuAction
-net.sf.taverna.t2.workbench.file.impl.menu.FileOpenMenuSection
-net.sf.taverna.t2.workbench.file.impl.menu.FileOpenRecentMenuAction
-net.sf.taverna.t2.workbench.file.impl.menu.FileSaveMenuSection
-net.sf.taverna.t2.workbench.file.impl.menu.FileSaveMenuAction
-net.sf.taverna.t2.workbench.file.impl.menu.FileSaveAllMenuAction
-net.sf.taverna.t2.workbench.file.impl.menu.FileSaveAsMenuAction
+org.apache.taverna.workbench.file.impl.menu.FileCloseMenuAction
+org.apache.taverna.workbench.file.impl.menu.FileNewMenuAction
+org.apache.taverna.workbench.file.impl.menu.FileOpenMenuAction
+org.apache.taverna.workbench.file.impl.menu.FileOpenFromURLMenuAction
+org.apache.taverna.workbench.file.impl.menu.FileOpenMenuSection
+org.apache.taverna.workbench.file.impl.menu.FileOpenRecentMenuAction
+org.apache.taverna.workbench.file.impl.menu.FileSaveMenuSection
+org.apache.taverna.workbench.file.impl.menu.FileSaveMenuAction
+org.apache.taverna.workbench.file.impl.menu.FileSaveAllMenuAction
+org.apache.taverna.workbench.file.impl.menu.FileSaveAsMenuAction
-net.sf.taverna.t2.workbench.file.impl.menu.WorkflowsMenu
-net.sf.taverna.t2.workbench.file.impl.menu.FileCloseAllMenuAction
+org.apache.taverna.workbench.file.impl.menu.WorkflowsMenu
+org.apache.taverna.workbench.file.impl.menu.FileCloseAllMenuAction
-net.sf.taverna.t2.workbench.file.impl.toolbar.FileToolbarMenuSection
-net.sf.taverna.t2.workbench.file.impl.toolbar.NewToolbarAction
-net.sf.taverna.t2.workbench.file.impl.toolbar.OpenToolbarAction
-net.sf.taverna.t2.workbench.file.impl.toolbar.OpenWorkflowFromURLToolbarAction
-net.sf.taverna.t2.workbench.file.impl.toolbar.SaveToolbarAction
-net.sf.taverna.t2.workbench.file.impl.toolbar.CloseToolbarAction
+org.apache.taverna.workbench.file.impl.toolbar.FileToolbarMenuSection
+org.apache.taverna.workbench.file.impl.toolbar.NewToolbarAction
+org.apache.taverna.workbench.file.impl.toolbar.OpenToolbarAction
+org.apache.taverna.workbench.file.impl.toolbar.OpenWorkflowFromURLToolbarAction
+org.apache.taverna.workbench.file.impl.toolbar.SaveToolbarAction
+org.apache.taverna.workbench.file.impl.toolbar.CloseToolbarAction
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ShutdownSPI
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ShutdownSPI b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ShutdownSPI
index cc53d36..7ac50c7 100644
--- a/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ShutdownSPI
+++ b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ShutdownSPI
@@ -1 +1 @@
-net.sf.taverna.t2.workbench.file.impl.hooks.CloseWorkflowsOnShutdown
+org.apache.taverna.workbench.file.impl.hooks.CloseWorkflowsOnShutdown
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.DataflowPersistenceHandler
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.DataflowPersistenceHandler b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.DataflowPersistenceHandler
index cfd1c7a..664e774 100644
--- a/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.DataflowPersistenceHandler
+++ b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.DataflowPersistenceHandler
@@ -1,2 +1,2 @@
-net.sf.taverna.t2.workbench.file.impl.T2DataflowOpener
-net.sf.taverna.t2.workbench.file.impl.DataflowFromDataflowPersistenceHandler
\ No newline at end of file
+org.apache.taverna.workbench.file.impl.T2DataflowOpener
+org.apache.taverna.workbench.file.impl.DataflowFromDataflowPersistenceHandler
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.FileManager
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.FileManager b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.FileManager
index 656feeb..e7021d9 100644
--- a/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.FileManager
+++ b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.FileManager
@@ -1 +1 @@
-net.sf.taverna.t2.workbench.file.impl.FileManagerImpl
\ No newline at end of file
+org.apache.taverna.workbench.file.impl.FileManagerImpl
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/test/java/net/sf/taverna/t2/workbench/file/impl/FileManagerTest.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/test/java/net/sf/taverna/t2/workbench/file/impl/FileManagerTest.java b/taverna-file-impl/src/test/java/net/sf/taverna/t2/workbench/file/impl/FileManagerTest.java
deleted file mode 100644
index d31825a..0000000
--- a/taverna-file-impl/src/test/java/net/sf/taverna/t2/workbench/file/impl/FileManagerTest.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.workbench.edits.Edit;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.edits.impl.EditManagerImpl;
-import org.apache.taverna.workbench.file.DataflowInfo;
-import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.events.FileManagerEvent;
-import org.apache.taverna.workbench.file.events.SetCurrentDataflowEvent;
-import org.apache.taverna.workbench.file.exceptions.OpenException;
-import org.apache.taverna.workbench.file.exceptions.OverwriteException;
-import org.apache.taverna.workflow.edits.AddProcessorEdit;
-import org.apache.taverna.workflow.edits.RenameEdit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleReader;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleWriter;
-import org.apache.taverna.scufl2.rdfxml.RDFXMLReader;
-import org.apache.taverna.scufl2.rdfxml.RDFXMLWriter;
-import org.apache.taverna.scufl2.translator.t2flow.T2FlowReader;
-
-public class FileManagerTest {
-
- private static final WorkflowBundleFileType WF_BUNDLE_FILE_TYPE = new WorkflowBundleFileType();
- private static final T2FlowFileType T2_FLOW_FILE_TYPE = new T2FlowFileType();
-
- private static final String DUMMY_WORKFLOW_T2FLOW = "dummy-workflow.t2flow";
-
- private FileManagerImpl fileManager;
- private EditManager editManager;
-
- private FileManagerObserver fileManagerObserver= new FileManagerObserver();;
-
- @Test
- public void close() throws Exception {
- assertTrue("Non-empty set of open dataflows", fileManager
- .getOpenDataflows().isEmpty());
- WorkflowBundle dataflow = openDataflow();
- assertEquals("Unexpected list of open dataflows", Arrays
- .asList(dataflow), fileManager.getOpenDataflows());
- fileManager.closeDataflow(dataflow, true);
- assertNotSame(dataflow, fileManager.getOpenDataflows().get(0));
- assertTrue("Did not insert empty dataflow after close", fileManager
- .getOpenDataflows().get(0).getMainWorkflow().getProcessors().isEmpty());
- }
-
- @Test
- public void openRemovesEmptyDataflow() throws Exception {
- WorkflowBundle newDataflow = fileManager.newDataflow();
- assertEquals("Unexpected list of open dataflows", Arrays
- .asList(newDataflow), fileManager.getOpenDataflows());
- WorkflowBundle dataflow = openDataflow();
- // Should have removed newDataflow
- assertEquals("Unexpected list of open dataflows", Arrays
- .asList(dataflow), fileManager.getOpenDataflows());
- }
-
- @Test
- public void isChanged() throws Exception {
- WorkflowBundle dataflow = openDataflow();
- assertFalse("Dataflow should not have changed", fileManager
- .isDataflowChanged(dataflow));
-
- // Do a change
- Processor emptyProcessor = new Processor();
- Edit<Workflow> addProcessorEdit = new AddProcessorEdit(dataflow.getMainWorkflow(),
- emptyProcessor);
- editManager.doDataflowEdit(dataflow, addProcessorEdit);
- assertTrue("Dataflow should have changed", fileManager
- .isDataflowChanged(dataflow));
-
- // Save it with the change
- File dataflowFile = File.createTempFile("test", ".t2flow");
- dataflowFile.deleteOnExit();
- dataflowFile.delete();
-
- fileManager.saveDataflow(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, false);
- assertFalse("Dataflow should no longer be marked as changed",
- fileManager.isDataflowChanged(dataflow));
- }
-
- @Ignore("Undo support for ischanged not yet implemented")
- @Test
- public void isChangedWithUndo() throws Exception {
- WorkflowBundle dataflow = openDataflow();
- // Do a change
- Processor emptyProcessor = new Processor();
- Edit<Workflow> addProcessorEdit = new AddProcessorEdit(dataflow.getMainWorkflow(),
- emptyProcessor);
- editManager.doDataflowEdit(dataflow, addProcessorEdit);
- assertTrue("Dataflow should have changed", fileManager
- .isDataflowChanged(dataflow));
- editManager.undoDataflowEdit(dataflow);
- assertFalse(
- "Dataflow should no longer be marked as changed after undo",
- fileManager.isDataflowChanged(dataflow));
- editManager.redoDataflowEdit(dataflow);
- assertTrue("Dataflow should have changed after redo before save",
- fileManager.isDataflowChanged(dataflow));
-
- // Save it with the change
- File dataflowFile = File.createTempFile("test", ".t2flow");
- dataflowFile.deleteOnExit();
- dataflowFile.delete();
- fileManager.saveDataflow(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, false);
- assertFalse("Dataflow should no longer be marked as changed",
- fileManager.isDataflowChanged(dataflow));
-
- editManager.undoDataflowEdit(dataflow);
- assertTrue("Dataflow should have changed after undo", fileManager
- .isDataflowChanged(dataflow));
- fileManager.saveDataflow(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, false);
- editManager.redoDataflowEdit(dataflow);
- assertTrue("Dataflow should have changed after redo after save",
- fileManager.isDataflowChanged(dataflow));
- }
-
- @Test
- public void isListed() throws Exception {
- assertTrue("Non-empty set of open data flows", fileManager
- .getOpenDataflows().isEmpty());
- WorkflowBundle dataflow = openDataflow();
- assertEquals("Unexpected list of open dataflows", Arrays
- .asList(dataflow), fileManager.getOpenDataflows());
- }
-
- /**
- * Always uses a <strong>new</strong> file manager instead of the instance
- * one from {@link FileManager#getInstance()}.
- *
- * @see #getFileManagerInstance()
- *
- */
- @Before
- public void makeFileManager() {
- System.setProperty("java.awt.headless", "true");
- editManager = new EditManagerImpl();
- fileManager = new FileManagerImpl(editManager);
- fileManagerObserver = new FileManagerObserver();
- fileManager.addObserver(fileManagerObserver);
- WorkflowBundleIO workflowBundleIO = new WorkflowBundleIO();
- workflowBundleIO.setReaders(Arrays.<WorkflowBundleReader>asList(new RDFXMLReader(), new T2FlowReader()));
- workflowBundleIO.setWriters(Arrays.<WorkflowBundleWriter>asList(new RDFXMLWriter()));
- T2DataflowOpener t2DataflowOpener = new T2DataflowOpener();
- t2DataflowOpener.setWorkflowBundleIO(workflowBundleIO);
- WorkflowBundleOpener workflowBundleOpener = new WorkflowBundleOpener();
- workflowBundleOpener.setWorkflowBundleIO(workflowBundleIO);
- WorkflowBundleSaver workflowBundleSaver = new WorkflowBundleSaver();
- workflowBundleSaver.setWorkflowBundleIO(workflowBundleIO);
- DataflowPersistenceHandlerRegistry dataflowPersistenceHandlerRegistry = new DataflowPersistenceHandlerRegistry();
- dataflowPersistenceHandlerRegistry.setDataflowPersistenceHandlers(Arrays.asList(
- new DataflowPersistenceHandler[] {t2DataflowOpener, workflowBundleOpener, workflowBundleSaver}));
- dataflowPersistenceHandlerRegistry.updateColletions();
- fileManager.setDataflowPersistenceHandlerRegistry(dataflowPersistenceHandlerRegistry);
- }
-
- @Test
- public void open() throws Exception {
- assertTrue("ModelMapObserver already contained messages",
- fileManagerObserver.messages.isEmpty());
- WorkflowBundle dataflow = openDataflow();
- assertNotNull("Dataflow was not loaded", dataflow);
- assertEquals("Loaded dataflow was not set as current dataflow",
- dataflow, fileManager.getCurrentDataflow());
- assertFalse("ModelMapObserver did not contain message",
- fileManagerObserver.messages.isEmpty());
- assertEquals("ModelMapObserver contained unexpected messages", 2,
- fileManagerObserver.messages.size());
- FileManagerEvent event = fileManagerObserver.messages.get(0);
- assertTrue(event instanceof SetCurrentDataflowEvent);
- assertEquals(dataflow, ((SetCurrentDataflowEvent) event).getDataflow());
- }
-
- @Test
- public void openSilently() throws Exception {
- assertTrue("ModelMapObserver already contained messages",
- fileManagerObserver.messages.isEmpty());
- URL url = getClass().getResource(DUMMY_WORKFLOW_T2FLOW);
- DataflowInfo info = fileManager.openDataflowSilently(T2_FLOW_FILE_TYPE, url);
-
- WorkflowBundle dataflow = info.getDataflow();
- assertNotNull("Dataflow was not loaded", dataflow);
-
- assertNotSame("Loaded dataflow was set as current dataflow",
- dataflow, fileManager.getCurrentDataflow());
- assertTrue("ModelMapObserver contained unexpected messages",
- fileManagerObserver.messages.isEmpty());
- }
-
- @Test
- public void canSaveDataflow() throws Exception {
- WorkflowBundle savedDataflow = openDataflow();
- File dataflowFile = File.createTempFile("test", ".t2flow");
- dataflowFile.deleteOnExit();
- dataflowFile.delete();
- fileManager.saveDataflow(savedDataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, true);
- assertTrue(fileManager.canSaveWithoutDestination(savedDataflow));
- fileManager.saveDataflow(savedDataflow, true);
- fileManager.closeDataflow(savedDataflow, true);
-
- WorkflowBundle otherFlow = fileManager.openDataflow(WF_BUNDLE_FILE_TYPE, dataflowFile.toURI()
- .toURL());
- assertTrue(fileManager.canSaveWithoutDestination(otherFlow));
- }
-
- @Test
- public void save() throws Exception {
- WorkflowBundle savedDataflow = openDataflow();
- File dataflowFile = File.createTempFile("test", ".t2flow");
- dataflowFile.deleteOnExit();
- dataflowFile.delete();
- assertFalse("File should not exist", dataflowFile.isFile());
- fileManager.saveDataflow(savedDataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, false);
- assertTrue("File should exist", dataflowFile.isFile());
- WorkflowBundle loadedDataflow = fileManager.openDataflow(WF_BUNDLE_FILE_TYPE, dataflowFile.toURI()
- .toURL());
- assertNotSame("Dataflow was not reopened", savedDataflow,
- loadedDataflow);
- assertEquals("Unexpected number of processors in saved dataflow", 1,
- savedDataflow.getMainWorkflow().getProcessors().size());
- assertEquals("Unexpected number of processors in loaded dataflow", 1,
- loadedDataflow.getMainWorkflow().getProcessors().size());
-
- Processor savedProcessor = savedDataflow.getMainWorkflow().getProcessors().first();
- Processor loadedProcessor = loadedDataflow.getMainWorkflow().getProcessors().first();
- assertEquals("Loaded processor had wrong name", savedProcessor
- .getName(), loadedProcessor.getName());
-
- // TODO convert to scufl2
-// BeanshellActivity savedActivity = (BeanshellActivity) savedProcessor
-// .getActivityList().get(0);
-// BeanshellActivity loadedActivity = (BeanshellActivity) loadedProcessor
-// .getActivityList().get(0);
-// String savedScript = savedActivity.getConfiguration().getScript();
-// String loadedScript = loadedActivity.getConfiguration().getScript();
-// assertEquals("Unexpected saved script",
-// "String output = input + \"XXX\";", savedScript);
-// assertEquals("Loaded script did not matched saved script", savedScript,
-// loadedScript);
- }
-
- @Test
- public void saveSilent() throws Exception {
- assertTrue("ModelMapObserver contained unexpected messages",
- fileManagerObserver.messages.isEmpty());
-
- URL url = getClass().getResource(DUMMY_WORKFLOW_T2FLOW);
- DataflowInfo info = fileManager.openDataflowSilently(T2_FLOW_FILE_TYPE, url);
- WorkflowBundle dataflow = info.getDataflow();
- assertTrue("ModelMapObserver contained unexpected messages",
- fileManagerObserver.messages.isEmpty());
-
- File dataflowFile = File.createTempFile("test", ".t2flow");
- dataflowFile.deleteOnExit();
- dataflowFile.delete();
- assertFalse("File should not exist", dataflowFile.isFile());
-
- fileManager.saveDataflowSilently(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, false);
- assertTrue("File should exist", dataflowFile.isFile());
-
- assertTrue("ModelMapObserver contained unexpected messages",
- fileManagerObserver.messages.isEmpty());
-
- }
-
- @Test
- public void saveOverwriteAgain() throws Exception {
- WorkflowBundle dataflow = openDataflow();
- File dataflowFile = File.createTempFile("test", ".t2flow");
- dataflowFile.delete();
- dataflowFile.deleteOnExit();
- // File did NOT exist, should not fail
- fileManager.saveDataflow(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, true);
-
- Processor processor = dataflow.getMainWorkflow().getProcessors().first();
- Edit<Processor> renameEdit = new RenameEdit<Processor>(processor,
- processor.getName() + "-changed");
- editManager.doDataflowEdit(dataflow, renameEdit);
-
- // Last save was OURs, so should *not* fail - even if we now use
- // the specific saveDataflow() method
- fileManager.saveDataflow(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, true);
-
- //Thread.sleep(1500);
- WorkflowBundle otherFlow = openDataflow();
- // Saving another flow to same file should still fail
- try {
- fileManager.saveDataflow(otherFlow,WF_BUNDLE_FILE_TYPE, dataflowFile, true);
- fail("Should have thrown OverwriteException");
- } catch (OverwriteException ex) {
- // Expected
- }
- }
-
- @Test(expected = OverwriteException.class)
- public void saveOverwriteWarningFails() throws Exception {
- WorkflowBundle dataflow = openDataflow();
- File dataflowFile = File.createTempFile("test", ".t2flow");
- dataflowFile.deleteOnExit();
- // Should fail as file already exists
- fileManager.saveDataflow(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, true);
- }
-
- @Test
- public void saveOverwriteWarningWorks() throws Exception {
- WorkflowBundle dataflow = openDataflow();
- File dataflowFile = File.createTempFile("test", ".t2flow");
- dataflowFile.delete();
- dataflowFile.deleteOnExit();
- // File did NOT exist, should not fail
- fileManager.saveDataflow(dataflow, WF_BUNDLE_FILE_TYPE, dataflowFile, true);
- }
-
- @After
- public void stopListeningToModelMap() {
- fileManager.removeObserver(fileManagerObserver);
- }
-
- protected WorkflowBundle openDataflow() throws OpenException {
- URL url = getClass().getResource(DUMMY_WORKFLOW_T2FLOW);
- assertNotNull(url);
- WorkflowBundle dataflow = fileManager.openDataflow(T2_FLOW_FILE_TYPE, url);
- assertNotNull(dataflow);
- return dataflow;
- }
-
- private final class FileManagerObserver implements Observer<FileManagerEvent> {
- protected List<FileManagerEvent> messages = new ArrayList<FileManagerEvent>();
-
- @Override
- public void notify(Observable<FileManagerEvent> sender, FileManagerEvent message) throws Exception {
- messages.add(message);
- if (message instanceof SetCurrentDataflowEvent) {
- assertTrue("Dataflow was not listed as open when set current",
- fileManager.getOpenDataflows().contains(
- ((SetCurrentDataflowEvent) message).getDataflow()));
- }
- }
- }
-
-}
[08/11] incubator-taverna-workbench git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuAction.java
deleted file mode 100644
index cb7462e..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuAction.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.menu;
-
-import static net.sf.taverna.t2.workbench.file.impl.menu.FileSaveMenuSection.FILE_SAVE_SECTION_URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.actions.SaveWorkflowAction;
-
-public class FileSaveMenuAction extends AbstractMenuAction {
- private final EditManager editManager;
- private final FileManager fileManager;
-
- public FileSaveMenuAction(EditManager editManager, FileManager fileManager) {
- super(FILE_SAVE_SECTION_URI, 10);
- this.editManager = editManager;
- this.fileManager = fileManager;
- }
-
- @Override
- protected Action createAction() {
- return new SaveWorkflowAction(editManager, fileManager);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuSection.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuSection.java
deleted file mode 100644
index 7d63a68..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuSection.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.menu;
-
-import java.net.URI;
-
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-public class FileSaveMenuSection extends AbstractMenuSection {
- public static final URI FILE_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#file");
- public static final URI FILE_SAVE_SECTION_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#fileSaveSection");
-
- public FileSaveMenuSection() {
- super(FILE_URI, 40, FILE_SAVE_SECTION_URI);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/WorkflowsMenu.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/WorkflowsMenu.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/WorkflowsMenu.java
deleted file mode 100644
index 1ba6f45..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/WorkflowsMenu.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.menu;
-
-import static java.awt.event.KeyEvent.VK_0;
-import static java.awt.event.KeyEvent.VK_W;
-import static javax.swing.Action.MNEMONIC_KEY;
-import static javax.swing.SwingUtilities.invokeLater;
-import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.ButtonGroup;
-import javax.swing.JMenu;
-import javax.swing.JRadioButtonMenuItem;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.ui.menu.AbstractMenuCustom;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.edits.EditManager.AbstractDataflowEditEvent;
-import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.events.AbstractDataflowEvent;
-import org.apache.taverna.workbench.file.events.FileManagerEvent;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-public class WorkflowsMenu extends AbstractMenuCustom {
- private EditManagerObserver editManagerObserver = new EditManagerObserver();
- private FileManager fileManager;
- private FileManagerObserver fileManagerObserver = new FileManagerObserver();
-
- private JMenu workflowsMenu;
-
- public WorkflowsMenu(EditManager editManager, FileManager fileManager) {
- super(DEFAULT_MENU_BAR, 900);
- this.fileManager = fileManager;
- fileManager.addObserver(fileManagerObserver);
- editManager.addObserver(editManagerObserver);
- }
-
- @Override
- protected Component createCustomComponent() {
- DummyAction action = new DummyAction("Workflows");
- action.putValue(MNEMONIC_KEY, VK_W);
-
- workflowsMenu = new JMenu(action);
-
- updateWorkflowsMenu();
- return workflowsMenu;
- }
-
- public void updateWorkflowsMenu() {
- invokeLater(new Runnable() {
- @Override
- public void run() {
- updateWorkflowsMenuUI();
- }
- });
- }
-
- protected void updateWorkflowsMenuUI() {
- workflowsMenu.setEnabled(false);
- workflowsMenu.removeAll();
- ButtonGroup workflowsGroup = new ButtonGroup();
-
- int i = 0;
- WorkflowBundle currentDataflow = fileManager.getCurrentDataflow();
- for (WorkflowBundle workflowBundle : fileManager.getOpenDataflows()) {
- String name = fileManager.getDataflowName(workflowBundle);
- if (fileManager.isDataflowChanged(workflowBundle))
- name = "*" + name;
- // A counter
- name = ++i + " " + name;
-
- SwitchWorkflowAction switchWorkflowAction = new SwitchWorkflowAction(
- name, workflowBundle);
- if (i < 10)
- switchWorkflowAction.putValue(MNEMONIC_KEY, new Integer(VK_0
- + i));
-
- JRadioButtonMenuItem switchWorkflowMenuItem = new JRadioButtonMenuItem(
- switchWorkflowAction);
- workflowsGroup.add(switchWorkflowMenuItem);
- if (workflowBundle.equals(currentDataflow))
- switchWorkflowMenuItem.setSelected(true);
- workflowsMenu.add(switchWorkflowMenuItem);
- }
- if (i == 0)
- workflowsMenu.add(new NoWorkflowsOpen());
- workflowsMenu.setEnabled(true);
- workflowsMenu.revalidate();
- }
-
- private final class EditManagerObserver implements
- Observer<EditManagerEvent> {
- @Override
- public void notify(Observable<EditManagerEvent> sender,
- EditManagerEvent message) throws Exception {
- if (message instanceof AbstractDataflowEditEvent)
- updateWorkflowsMenu();
- }
- }
-
- private final class FileManagerObserver implements
- Observer<FileManagerEvent> {
- @Override
- public void notify(Observable<FileManagerEvent> sender,
- FileManagerEvent message) throws Exception {
- if (message instanceof AbstractDataflowEvent)
- updateWorkflowsMenu();
- // TODO: Don't rebuild whole menu
- }
- }
-
- @SuppressWarnings("serial")
- private final class NoWorkflowsOpen extends AbstractAction {
- private NoWorkflowsOpen() {
- super("No workflows open");
- setEnabled(false);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- // No-op
- }
- }
-
- @SuppressWarnings("serial")
- private final class SwitchWorkflowAction extends AbstractAction {
- private final WorkflowBundle workflowBundle;
-
- private SwitchWorkflowAction(String name, WorkflowBundle workflowBundle) {
- super(name);
- this.workflowBundle = workflowBundle;
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- fileManager.setCurrentDataflow(workflowBundle);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/CloseToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/CloseToolbarAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/CloseToolbarAction.java
deleted file mode 100644
index 19f3f59..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/CloseToolbarAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.toolbar;
-
-import static net.sf.taverna.t2.workbench.file.impl.toolbar.FileToolbarMenuSection.FILE_TOOLBAR_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.actions.CloseWorkflowAction;
-
-/**
- * Action to close the current workflow.
- *
- * @author Alex Nenadic
- */
-public class CloseToolbarAction extends AbstractMenuAction {
- private static final URI FILE_CLOSE_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#fileToolbarClose");
- private final EditManager editManager;
- private final FileManager fileManager;
-
- public CloseToolbarAction(EditManager editManager, FileManager fileManager) {
- super(FILE_TOOLBAR_SECTION, 30, FILE_CLOSE_URI);
- this.editManager = editManager;
- this.fileManager = fileManager;
- }
-
- @Override
- protected Action createAction() {
- return new CloseWorkflowAction(editManager, fileManager);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/FileToolbarMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/FileToolbarMenuSection.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/FileToolbarMenuSection.java
deleted file mode 100644
index 26bb7bb..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/FileToolbarMenuSection.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.toolbar;
-
-import static org.apache.taverna.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
-
-import java.net.URI;
-
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-public class FileToolbarMenuSection extends AbstractMenuSection {
- public static final URI FILE_TOOLBAR_SECTION = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#fileToolbarSection");
-
- public FileToolbarMenuSection() {
- super(DEFAULT_TOOL_BAR, 10, FILE_TOOLBAR_SECTION);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/NewToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/NewToolbarAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/NewToolbarAction.java
deleted file mode 100644
index b316459..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/NewToolbarAction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.toolbar;
-
-import static net.sf.taverna.t2.workbench.file.impl.toolbar.FileToolbarMenuSection.FILE_TOOLBAR_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.actions.NewWorkflowAction;
-
-public class NewToolbarAction extends AbstractMenuAction {
- private static final URI FILE_NEW_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#fileToolbarNew");
- private final FileManager fileManager;
-
- public NewToolbarAction(FileManager fileManager) {
- super(FILE_TOOLBAR_SECTION, 10, FILE_NEW_URI);
- this.fileManager = fileManager;
- }
-
- @Override
- protected Action createAction() {
- return new NewWorkflowAction(fileManager);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenToolbarAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenToolbarAction.java
deleted file mode 100644
index 0605e47..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenToolbarAction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.toolbar;
-
-import static net.sf.taverna.t2.workbench.file.impl.toolbar.FileToolbarMenuSection.FILE_TOOLBAR_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.actions.OpenWorkflowAction;
-
-public class OpenToolbarAction extends AbstractMenuAction {
- private static final URI FILE_OPEN_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#fileToolbarOpen");
- private final FileManager fileManager;
-
- public OpenToolbarAction(FileManager fileManager) {
- super(FILE_TOOLBAR_SECTION, 20, FILE_OPEN_URI);
- this.fileManager = fileManager;
- }
-
- @Override
- protected Action createAction() {
- return new OpenWorkflowAction(fileManager);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenWorkflowFromURLToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenWorkflowFromURLToolbarAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenWorkflowFromURLToolbarAction.java
deleted file mode 100644
index df7415e..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenWorkflowFromURLToolbarAction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.toolbar;
-
-import static net.sf.taverna.t2.workbench.file.impl.toolbar.FileToolbarMenuSection.FILE_TOOLBAR_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.actions.OpenWorkflowFromURLAction;
-
-public class OpenWorkflowFromURLToolbarAction extends AbstractMenuAction {
- private static final URI FILE_OPEN_FROM_URL_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#fileToolbarOpenFromURL");
- private final FileManager fileManager;
-
- public OpenWorkflowFromURLToolbarAction(FileManager fileManager) {
- super(FILE_TOOLBAR_SECTION, 25, FILE_OPEN_FROM_URL_URI);
- this.fileManager = fileManager;
- }
-
- @Override
- protected Action createAction() {
- return new OpenWorkflowFromURLAction(null, fileManager);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/SaveToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/SaveToolbarAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/SaveToolbarAction.java
deleted file mode 100644
index df3046d..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/SaveToolbarAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.toolbar;
-
-import static net.sf.taverna.t2.workbench.file.impl.toolbar.FileToolbarMenuSection.FILE_TOOLBAR_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.actions.SaveWorkflowAction;
-
-public class SaveToolbarAction extends AbstractMenuAction {
- private static final URI FILE_SAVE_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#fileToolbarSave");
- private final EditManager editManager;
- private final FileManager fileManager;
-
- public SaveToolbarAction(EditManager editManager, FileManager fileManager) {
- super(FILE_TOOLBAR_SECTION, 40, FILE_SAVE_URI);
- this.editManager = editManager;
- this.fileManager = fileManager;
- }
-
- @Override
- protected Action createAction() {
- return new SaveWorkflowAction(editManager, fileManager);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/DataflowFromDataflowPersistenceHandler.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/DataflowFromDataflowPersistenceHandler.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/DataflowFromDataflowPersistenceHandler.java
new file mode 100644
index 0000000..89f308f
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/DataflowFromDataflowPersistenceHandler.java
@@ -0,0 +1,65 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * @author alanrw
+ */
+public class DataflowFromDataflowPersistenceHandler extends
+ AbstractDataflowPersistenceHandler implements
+ DataflowPersistenceHandler {
+ private static final WorkflowBundleFileType WORKFLOW_BUNDLE_FILE_TYPE = new WorkflowBundleFileType();
+
+ @Override
+ public DataflowInfo openDataflow(FileType fileType, Object source)
+ throws OpenException {
+ if (!getOpenFileTypes().contains(fileType))
+ throw new IllegalArgumentException("Unsupported file type "
+ + fileType);
+
+ WorkflowBundle workflowBundle = (WorkflowBundle) source;
+ Date lastModified = null;
+ Object canonicalSource = null;
+ return new DataflowInfo(WORKFLOW_BUNDLE_FILE_TYPE, canonicalSource,
+ workflowBundle, lastModified);
+ }
+
+ @Override
+ public List<FileType> getOpenFileTypes() {
+ return Arrays.<FileType> asList(WORKFLOW_BUNDLE_FILE_TYPE);
+ }
+
+ @Override
+ public List<Class<?>> getOpenSourceTypes() {
+ return Arrays.<Class<?>> asList(Workflow.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/DataflowPersistenceHandlerRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/DataflowPersistenceHandlerRegistry.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/DataflowPersistenceHandlerRegistry.java
new file mode 100644
index 0000000..0026154
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/DataflowPersistenceHandlerRegistry.java
@@ -0,0 +1,237 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import static org.apache.commons.collections.map.LazyMap.decorate;
+import static org.apache.commons.lang.ClassUtils.getAllInterfaces;
+import static org.apache.commons.lang.ClassUtils.getAllSuperclasses;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileType;
+
+import org.apache.commons.collections.Factory;
+
+// TODO: Cache lookups / build one massive structure
+public class DataflowPersistenceHandlerRegistry {
+ private static final MapFactory MAP_FACTORY = new MapFactory();
+ private static final SetFactory SET_FACTORY = new SetFactory();
+
+ @SuppressWarnings("unchecked")
+ protected static List<Class<?>> findAllParentClasses(
+ final Class<?> sourceClass) {
+ List<Class<?>> superClasses = new ArrayList<>();
+ superClasses.add(sourceClass);
+ superClasses.addAll(getAllSuperclasses(sourceClass));
+ superClasses.addAll(getAllInterfaces(sourceClass));
+ return superClasses;
+ }
+
+ private Map<Class<?>, Set<DataflowPersistenceHandler>> openClassToHandlers;
+ private Map<Class<?>, Set<FileType>> openClassToTypes;
+ private Map<FileType, Map<Class<?>, Set<DataflowPersistenceHandler>>> openFileClassToHandler;
+ private Map<FileType, Set<DataflowPersistenceHandler>> openFileToHandler;
+ private Map<Class<?>, Set<DataflowPersistenceHandler>> saveClassToHandlers;
+ private Map<Class<?>, Set<FileType>> saveClassToTypes;
+ private Map<FileType, Map<Class<?>, Set<DataflowPersistenceHandler>>> saveFileClassToHandler;
+ private Map<FileType, Set<DataflowPersistenceHandler>> saveFileToHandler;
+
+ private List<DataflowPersistenceHandler> dataflowPersistenceHandlers;
+
+ public DataflowPersistenceHandlerRegistry() {
+ }
+
+ public Set<FileType> getOpenFileTypes() {
+ return getOpenFileClassToHandler().keySet();
+ }
+
+ public Set<FileType> getOpenFileTypesFor(Class<?> sourceClass) {
+ Set<FileType> fileTypes = new LinkedHashSet<>();
+ for (Class<?> candidateClass : findAllParentClasses(sourceClass))
+ fileTypes.addAll(getOpenClassToTypes().get(candidateClass));
+ return fileTypes;
+ }
+
+ public Set<DataflowPersistenceHandler> getOpenHandlersFor(
+ Class<? extends Object> sourceClass) {
+ Set<DataflowPersistenceHandler> handlers = new LinkedHashSet<>();
+ for (Class<?> candidateClass : findAllParentClasses(sourceClass))
+ handlers.addAll(getOpenClassToHandlers().get(candidateClass));
+ return handlers;
+ }
+
+ public Set<DataflowPersistenceHandler> getOpenHandlersFor(
+ FileType fileType, Class<? extends Object> sourceClass) {
+ Set<DataflowPersistenceHandler> handlers = new LinkedHashSet<>();
+ for (Class<?> candidateClass : findAllParentClasses(sourceClass))
+ handlers.addAll(getOpenFileClassToHandler().get(fileType).get(
+ candidateClass));
+ return handlers;
+ }
+
+ public Set<DataflowPersistenceHandler> getOpenHandlersForType(
+ FileType fileType) {
+ return getOpenFileToHandler().get(fileType);
+ }
+
+ public synchronized Set<DataflowPersistenceHandler> getOpenHandlersForType(
+ FileType fileType, Class<?> sourceClass) {
+ Set<DataflowPersistenceHandler> handlers = new LinkedHashSet<>();
+ for (Class<?> candidateClass : findAllParentClasses(sourceClass))
+ handlers.addAll(getOpenFileClassToHandler().get(fileType).get(
+ candidateClass));
+ return handlers;
+ }
+
+ public Set<FileType> getSaveFileTypes() {
+ return getSaveFileClassToHandler().keySet();
+ }
+
+ public Set<FileType> getSaveFileTypesFor(Class<?> destinationClass) {
+ Set<FileType> fileTypes = new LinkedHashSet<>();
+ for (Class<?> candidateClass : findAllParentClasses(destinationClass))
+ fileTypes.addAll(getSaveClassToTypes().get(candidateClass));
+ return fileTypes;
+ }
+
+ public Set<DataflowPersistenceHandler> getSaveHandlersFor(
+ Class<? extends Object> destinationClass) {
+ Set<DataflowPersistenceHandler> handlers = new LinkedHashSet<>();
+ for (Class<?> candidateClass : findAllParentClasses(destinationClass))
+ handlers.addAll(getSaveClassToHandlers().get(candidateClass));
+ return handlers;
+ }
+
+ public Set<DataflowPersistenceHandler> getSaveHandlersForType(
+ FileType fileType, Class<?> destinationClass) {
+ Set<DataflowPersistenceHandler> handlers = new LinkedHashSet<>();
+ for (Class<?> candidateClass : findAllParentClasses(destinationClass))
+ handlers.addAll(getSaveFileClassToHandler().get(fileType).get(
+ candidateClass));
+ return handlers;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ private synchronized void createCollections() {
+ openFileClassToHandler = decorate(new HashMap(), MAP_FACTORY);
+ openFileToHandler = decorate(new HashMap(), SET_FACTORY);
+ openClassToTypes = decorate(new HashMap(), SET_FACTORY);
+ openClassToHandlers = decorate(new HashMap(), SET_FACTORY);
+
+ saveFileClassToHandler = decorate(new HashMap(), MAP_FACTORY);
+ saveFileToHandler = decorate(new HashMap(), SET_FACTORY);
+ saveClassToTypes = decorate(new HashMap(), SET_FACTORY);
+ saveClassToHandlers = decorate(new HashMap(), SET_FACTORY);
+ }
+
+ private Map<Class<?>, Set<DataflowPersistenceHandler>> getOpenClassToHandlers() {
+ return openClassToHandlers;
+ }
+
+ private synchronized Map<Class<?>, Set<FileType>> getOpenClassToTypes() {
+ return openClassToTypes;
+ }
+
+ private synchronized Map<FileType, Map<Class<?>, Set<DataflowPersistenceHandler>>> getOpenFileClassToHandler() {
+ return openFileClassToHandler;
+ }
+
+ private Map<FileType, Set<DataflowPersistenceHandler>> getOpenFileToHandler() {
+ return openFileToHandler;
+ }
+
+ private Map<Class<?>, Set<DataflowPersistenceHandler>> getSaveClassToHandlers() {
+ return saveClassToHandlers;
+ }
+
+ private synchronized Map<Class<?>, Set<FileType>> getSaveClassToTypes() {
+ return saveClassToTypes;
+ }
+
+ private synchronized Map<FileType, Map<Class<?>, Set<DataflowPersistenceHandler>>> getSaveFileClassToHandler() {
+ return saveFileClassToHandler;
+ }
+
+ /**
+ * Bind method for SpringDM.
+ *
+ * @param service
+ * @param properties
+ */
+ public void update(Object service, Map<?, ?> properties) {
+ if (dataflowPersistenceHandlers != null)
+ updateColletions();
+ }
+
+ public synchronized void updateColletions() {
+ createCollections();
+ for (DataflowPersistenceHandler handler : dataflowPersistenceHandlers) {
+ for (FileType openFileType : handler.getOpenFileTypes()) {
+ Set<DataflowPersistenceHandler> set = openFileToHandler
+ .get(openFileType);
+ set.add(handler);
+ for (Class<?> openClass : handler.getOpenSourceTypes()) {
+ openFileClassToHandler.get(openFileType).get(openClass)
+ .add(handler);
+ openClassToTypes.get(openClass).add(openFileType);
+ }
+ }
+ for (Class<?> openClass : handler.getOpenSourceTypes())
+ openClassToHandlers.get(openClass).add(handler);
+
+ for (FileType saveFileType : handler.getSaveFileTypes()) {
+ saveFileToHandler.get(saveFileType).add(handler);
+ for (Class<?> saveClass : handler.getSaveDestinationTypes()) {
+ saveFileClassToHandler.get(saveFileType).get(saveClass)
+ .add(handler);
+ saveClassToTypes.get(saveClass).add(saveFileType);
+ }
+ }
+ for (Class<?> openClass : handler.getSaveDestinationTypes())
+ saveClassToHandlers.get(openClass).add(handler);
+ }
+ }
+
+ public void setDataflowPersistenceHandlers(
+ List<DataflowPersistenceHandler> dataflowPersistenceHandlers) {
+ this.dataflowPersistenceHandlers = dataflowPersistenceHandlers;
+ }
+
+ private static class MapFactory implements Factory {
+ @Override
+ @SuppressWarnings("rawtypes")
+ public Object create() {
+ return decorate(new HashMap(), SET_FACTORY);
+ }
+ }
+
+ private static class SetFactory implements Factory {
+ @Override
+ public Object create() {
+ return new LinkedHashSet<Object>();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/FileDataflowInfo.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/FileDataflowInfo.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/FileDataflowInfo.java
new file mode 100644
index 0000000..c9e7ae5
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/FileDataflowInfo.java
@@ -0,0 +1,66 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * Information about an open dataflow that was opened from or saved to a
+ * {@link File}.
+ *
+ * @see DataflowInfo
+ * @see FileManager
+ * @author Stian Soiland-Reyes
+ */
+public class FileDataflowInfo extends DataflowInfo {
+ private static Logger logger = Logger.getLogger(FileDataflowInfo.class);
+
+ public FileDataflowInfo(FileType fileType, File source,
+ WorkflowBundle workflowBundle) {
+ super(fileType, canonicalFile(source), workflowBundle,
+ lastModifiedFile(source));
+ }
+
+ protected static Date lastModifiedFile(File file) {
+ long lastModifiedLong = file.lastModified();
+ if (lastModifiedLong == 0)
+ return null;
+ return new Date(lastModifiedLong);
+ }
+
+ public static File canonicalFile(File file) {
+ try {
+ return file.getCanonicalFile();
+ } catch (IOException e) {
+ logger.warn("Could not find canonical file for " + file);
+ return file;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/FileManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/FileManagerImpl.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/FileManagerImpl.java
new file mode 100644
index 0000000..c22341e
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/FileManagerImpl.java
@@ -0,0 +1,600 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import static java.awt.GraphicsEnvironment.isHeadless;
+import static java.util.Collections.singleton;
+import static javax.swing.SwingUtilities.invokeAndWait;
+import static javax.swing.SwingUtilities.isEventDispatchThread;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.swing.filechooser.FileFilter;
+
+import org.apache.taverna.lang.observer.MultiCaster;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.EditManager.AbstractDataflowEditEvent;
+import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.events.ClosedDataflowEvent;
+import org.apache.taverna.workbench.file.events.ClosingDataflowEvent;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.file.events.OpenedDataflowEvent;
+import org.apache.taverna.workbench.file.events.SavedDataflowEvent;
+import org.apache.taverna.workbench.file.events.SetCurrentDataflowEvent;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.file.exceptions.OverwriteException;
+import org.apache.taverna.workbench.file.exceptions.SaveException;
+import org.apache.taverna.workbench.file.exceptions.UnsavedException;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+/**
+ * Implementation of {@link FileManager}
+ *
+ * @author Stian Soiland-Reyes
+ */
+public class FileManagerImpl implements FileManager {
+ private static Logger logger = Logger.getLogger(FileManagerImpl.class);
+ private static int nameIndex = 1;
+
+ /**
+ * The last blank workflowBundle created using #newDataflow() until it has
+ * been changed - when this variable will be set to null again. Used to
+ * automatically close unmodified blank workflowBundles on open.
+ */
+ private WorkflowBundle blankWorkflowBundle = null;
+ @SuppressWarnings("unused")
+ private EditManager editManager;
+ private EditManagerObserver editManagerObserver = new EditManagerObserver();
+ protected MultiCaster<FileManagerEvent> observers = new MultiCaster<>(this);
+ /**
+ * Ordered list of open WorkflowBundle
+ */
+ private LinkedHashMap<WorkflowBundle, OpenDataflowInfo> openDataflowInfos = new LinkedHashMap<>();
+ private DataflowPersistenceHandlerRegistry dataflowPersistenceHandlerRegistry;
+ private Scufl2Tools scufl2Tools = new Scufl2Tools();
+ private WorkflowBundle currentWorkflowBundle;
+
+ public DataflowPersistenceHandlerRegistry getPersistanceHandlerRegistry() {
+ return dataflowPersistenceHandlerRegistry;
+ }
+
+ public FileManagerImpl(EditManager editManager) {
+ this.editManager = editManager;
+ editManager.addObserver(editManagerObserver);
+ }
+
+ /**
+ * Add an observer to be notified of {@link FileManagerEvent}s, such as
+ * {@link OpenedDataflowEvent} and {@link SavedDataflowEvent}.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void addObserver(Observer<FileManagerEvent> observer) {
+ observers.addObserver(observer);
+ }
+
+ @Override
+ public boolean canSaveWithoutDestination(WorkflowBundle workflowBundle) {
+ OpenDataflowInfo dataflowInfo = getOpenDataflowInfo(workflowBundle);
+ if (dataflowInfo.getSource() == null)
+ return false;
+ Set<?> handlers = getPersistanceHandlerRegistry()
+ .getSaveHandlersForType(
+ dataflowInfo.getFileType(),
+ dataflowInfo.getDataflowInfo().getCanonicalSource()
+ .getClass());
+ return !handlers.isEmpty();
+ }
+
+ @Override
+ public boolean closeDataflow(WorkflowBundle workflowBundle,
+ boolean failOnUnsaved) throws UnsavedException {
+ if (workflowBundle == null)
+ throw new NullPointerException("Dataflow can't be null");
+ ClosingDataflowEvent message = new ClosingDataflowEvent(workflowBundle);
+ observers.notify(message);
+ if (message.isAbortClose())
+ return false;
+ if ((failOnUnsaved && getOpenDataflowInfo(workflowBundle).isChanged()))
+ throw new UnsavedException(workflowBundle);
+ if (workflowBundle.equals(getCurrentDataflow())) {
+ // We'll need to change current workflowBundle
+ // Find best candidate to the left or right
+ List<WorkflowBundle> workflowBundles = getOpenDataflows();
+ int openIndex = workflowBundles.indexOf(workflowBundle);
+ if (openIndex == -1)
+ throw new IllegalArgumentException("Workflow was not opened "
+ + workflowBundle);
+
+ if (openIndex > 0)
+ setCurrentDataflow(workflowBundles.get(openIndex - 1));
+ else if (openIndex == 0 && workflowBundles.size() > 1)
+ setCurrentDataflow(workflowBundles.get(1));
+ else
+ // If it was the last one, start a new, empty workflowBundle
+ newDataflow();
+ }
+ if (workflowBundle == blankWorkflowBundle)
+ blankWorkflowBundle = null;
+ openDataflowInfos.remove(workflowBundle);
+ observers.notify(new ClosedDataflowEvent(workflowBundle));
+ return true;
+ }
+
+ @Override
+ public WorkflowBundle getCurrentDataflow() {
+ return currentWorkflowBundle;
+ }
+
+ @Override
+ public WorkflowBundle getDataflowBySource(Object source) {
+ for (Entry<WorkflowBundle, OpenDataflowInfo> infoEntry : openDataflowInfos
+ .entrySet()) {
+ OpenDataflowInfo info = infoEntry.getValue();
+ if (source.equals(info.getSource()))
+ return infoEntry.getKey();
+ }
+ // Not found
+ return null;
+ }
+
+ @Override
+ public String getDataflowName(WorkflowBundle workflowBundle) {
+ Object source = null;
+ if (isDataflowOpen(workflowBundle))
+ source = getDataflowSource(workflowBundle);
+ // Fallback
+ String name;
+ Workflow workflow = workflowBundle.getMainWorkflow();
+ if (workflow != null)
+ name = workflow.getName();
+ else
+ name = workflowBundle.getName();
+ if (source == null)
+ return name;
+ if (source instanceof File)
+ return ((File) source).getAbsolutePath();
+ else if (source instanceof URL)
+ return source.toString();
+
+ // Check if it has implemented a toString() method
+ Method toStringMethod = null;
+ Method toStringMethodFromObject = null;
+ try {
+ toStringMethod = source.getClass().getMethod("toString");
+ toStringMethodFromObject = Object.class.getMethod("toString");
+ } catch (Exception e) {
+ throw new IllegalStateException(
+ "Source did not implement Object.toString() " + source);
+ }
+ if (!toStringMethod.equals(toStringMethodFromObject))
+ return source.toString();
+ return name;
+ }
+
+ @Override
+ public String getDefaultWorkflowName() {
+ return "Workflow" + (nameIndex++);
+ }
+
+ @Override
+ public Object getDataflowSource(WorkflowBundle workflowBundle) {
+ return getOpenDataflowInfo(workflowBundle).getSource();
+ }
+
+ @Override
+ public FileType getDataflowType(WorkflowBundle workflowBundle) {
+ return getOpenDataflowInfo(workflowBundle).getFileType();
+ }
+
+ @Override
+ public List<Observer<FileManagerEvent>> getObservers() {
+ return observers.getObservers();
+ }
+
+ /**
+ * Get the {@link OpenDataflowInfo} for the given WorkflowBundle
+ *
+ * @throws NullPointerException
+ * if the WorkflowBundle was <code>null</code>
+ * @throws IllegalArgumentException
+ * if the WorkflowBundle was not open.
+ * @param workflowBundle
+ * WorkflowBundle which information is to be found
+ * @return The {@link OpenDataflowInfo} describing the WorkflowBundle
+ */
+ protected synchronized OpenDataflowInfo getOpenDataflowInfo(
+ WorkflowBundle workflowBundle) {
+ if (workflowBundle == null)
+ throw new NullPointerException("Dataflow can't be null");
+ OpenDataflowInfo info = openDataflowInfos.get(workflowBundle);
+ if (info == null)
+ throw new IllegalArgumentException("Workflow was not opened "
+ + workflowBundle);
+ return info;
+ }
+
+ @Override
+ public List<WorkflowBundle> getOpenDataflows() {
+ return new ArrayList<>(openDataflowInfos.keySet());
+ }
+
+ @Override
+ public List<FileFilter> getOpenFileFilters() {
+ List<FileFilter> fileFilters = new ArrayList<>();
+
+ Set<FileType> fileTypes = getPersistanceHandlerRegistry()
+ .getOpenFileTypes();
+ if (!fileTypes.isEmpty())
+ fileFilters.add(new MultipleFileTypes(fileTypes,
+ "All supported workflows"));
+ for (FileType fileType : fileTypes)
+ fileFilters.add(new FileTypeFileFilter(fileType));
+ return fileFilters;
+ }
+
+ @Override
+ public List<FileFilter> getOpenFileFilters(Class<?> sourceClass) {
+ List<FileFilter> fileFilters = new ArrayList<>();
+ for (FileType fileType : getPersistanceHandlerRegistry()
+ .getOpenFileTypesFor(sourceClass))
+ fileFilters.add(new FileTypeFileFilter(fileType));
+ return fileFilters;
+ }
+
+ @Override
+ public List<FileFilter> getSaveFileFilters() {
+ List<FileFilter> fileFilters = new ArrayList<>();
+ for (FileType fileType : getPersistanceHandlerRegistry()
+ .getSaveFileTypes())
+ fileFilters.add(new FileTypeFileFilter(fileType));
+ return fileFilters;
+ }
+
+ @Override
+ public List<FileFilter> getSaveFileFilters(Class<?> destinationClass) {
+ List<FileFilter> fileFilters = new ArrayList<>();
+ for (FileType fileType : getPersistanceHandlerRegistry()
+ .getSaveFileTypesFor(destinationClass))
+ fileFilters.add(new FileTypeFileFilter(fileType));
+ return fileFilters;
+ }
+
+ @Override
+ public boolean isDataflowChanged(WorkflowBundle workflowBundle) {
+ return getOpenDataflowInfo(workflowBundle).isChanged();
+ }
+
+ @Override
+ public boolean isDataflowOpen(WorkflowBundle workflowBundle) {
+ return openDataflowInfos.containsKey(workflowBundle);
+ }
+
+ @Override
+ public WorkflowBundle newDataflow() {
+ WorkflowBundle workflowBundle = new WorkflowBundle();
+ workflowBundle.setMainWorkflow(new Workflow());
+ workflowBundle.getMainWorkflow().setName(getDefaultWorkflowName());
+ workflowBundle.setMainProfile(new Profile());
+ scufl2Tools.setParents(workflowBundle);
+ blankWorkflowBundle = null;
+ openDataflowInternal(workflowBundle);
+ blankWorkflowBundle = workflowBundle;
+ observers.notify(new OpenedDataflowEvent(workflowBundle));
+ return workflowBundle;
+ }
+
+ @Override
+ public void openDataflow(WorkflowBundle workflowBundle) {
+ openDataflowInternal(workflowBundle);
+ observers.notify(new OpenedDataflowEvent(workflowBundle));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public WorkflowBundle openDataflow(FileType fileType, Object source)
+ throws OpenException {
+ if (isHeadless())
+ return performOpenDataflow(fileType, source);
+
+ OpenDataflowRunnable r = new OpenDataflowRunnable(this, fileType,
+ source);
+ if (isEventDispatchThread()) {
+ r.run();
+ } else
+ try {
+ invokeAndWait(r);
+ } catch (InterruptedException | InvocationTargetException e) {
+ throw new OpenException("Opening was interrupted", e);
+ }
+ OpenException thrownException = r.getException();
+ if (thrownException != null)
+ throw thrownException;
+ return r.getDataflow();
+ }
+
+ public WorkflowBundle performOpenDataflow(FileType fileType, Object source)
+ throws OpenException {
+ DataflowInfo dataflowInfo;
+ WorkflowBundle workflowBundle;
+ dataflowInfo = openDataflowSilently(fileType, source);
+ workflowBundle = dataflowInfo.getDataflow();
+ openDataflowInternal(workflowBundle);
+ getOpenDataflowInfo(workflowBundle).setOpenedFrom(dataflowInfo);
+ observers.notify(new OpenedDataflowEvent(workflowBundle));
+ return workflowBundle;
+ }
+
+ @Override
+ public DataflowInfo openDataflowSilently(FileType fileType, Object source)
+ throws OpenException {
+ Set<DataflowPersistenceHandler> handlers;
+ Class<? extends Object> sourceClass = source.getClass();
+
+ boolean unknownFileType = (fileType == null);
+ if (unknownFileType)
+ handlers = getPersistanceHandlerRegistry().getOpenHandlersFor(
+ sourceClass);
+ else
+ handlers = getPersistanceHandlerRegistry().getOpenHandlersFor(
+ fileType, sourceClass);
+ if (handlers.isEmpty())
+ throw new OpenException("Unsupported file type or class "
+ + fileType + " " + sourceClass);
+
+ Throwable lastException = null;
+ for (DataflowPersistenceHandler handler : handlers) {
+ Collection<FileType> fileTypes;
+ if (unknownFileType)
+ fileTypes = handler.getOpenFileTypes();
+ else
+ fileTypes = singleton(fileType);
+ for (FileType candidateFileType : fileTypes) {
+ if (unknownFileType && (source instanceof File))
+ /*
+ * If source is file but fileType was not explicitly set
+ * from the open workflow dialog - check the file extension
+ * and decide which handler to use based on that (so that we
+ * do not loop though all handlers)
+ */
+ if (!((File) source).getPath().endsWith(
+ candidateFileType.getExtension()))
+ continue;
+
+ try {
+ DataflowInfo openDataflow = handler.openDataflow(
+ candidateFileType, source);
+ WorkflowBundle workflowBundle = openDataflow.getDataflow();
+ logger.info("Loaded workflow: " + workflowBundle.getName()
+ + " " + workflowBundle.getGlobalBaseURI()
+ + " from " + source + " using " + handler);
+ return openDataflow;
+ } catch (OpenException ex) {
+ logger.warn("Could not open workflow " + source + " using "
+ + handler + " of type " + candidateFileType);
+ lastException = ex;
+ }
+ }
+ }
+ throw new OpenException("Could not open workflow " + source + "\n",
+ lastException);
+ }
+
+ /**
+ * Mark the WorkflowBundle as opened, and close the blank WorkflowBundle if
+ * needed.
+ *
+ * @param workflowBundle
+ * WorkflowBundle that has been opened
+ */
+ protected void openDataflowInternal(WorkflowBundle workflowBundle) {
+ if (workflowBundle == null)
+ throw new NullPointerException("Dataflow can't be null");
+ if (isDataflowOpen(workflowBundle))
+ throw new IllegalArgumentException("Workflow is already open: "
+ + workflowBundle);
+
+ openDataflowInfos.put(workflowBundle, new OpenDataflowInfo());
+ setCurrentDataflow(workflowBundle);
+ if (openDataflowInfos.size() == 2 && blankWorkflowBundle != null)
+ /*
+ * Behave like a word processor and close the blank WorkflowBundle
+ * when another workflow has been opened
+ */
+ try {
+ closeDataflow(blankWorkflowBundle, true);
+ } catch (UnsavedException e) {
+ logger.error("Blank workflow was modified "
+ + "and could not be closed");
+ }
+ }
+
+ @Override
+ public void removeObserver(Observer<FileManagerEvent> observer) {
+ observers.removeObserver(observer);
+ }
+
+ @Override
+ public void saveDataflow(WorkflowBundle workflowBundle,
+ boolean failOnOverwrite) throws SaveException {
+ if (workflowBundle == null)
+ throw new NullPointerException("Dataflow can't be null");
+ OpenDataflowInfo lastSave = getOpenDataflowInfo(workflowBundle);
+ if (lastSave.getSource() == null)
+ throw new SaveException("Can't save without source "
+ + workflowBundle);
+ saveDataflow(workflowBundle, lastSave.getFileType(),
+ lastSave.getSource(), failOnOverwrite);
+ }
+
+ @Override
+ public void saveDataflow(WorkflowBundle workflowBundle, FileType fileType,
+ Object destination, boolean failOnOverwrite) throws SaveException {
+ DataflowInfo savedDataflow = saveDataflowSilently(workflowBundle,
+ fileType, destination, failOnOverwrite);
+ getOpenDataflowInfo(workflowBundle).setSavedTo(savedDataflow);
+ observers.notify(new SavedDataflowEvent(workflowBundle));
+ }
+
+ @Override
+ public DataflowInfo saveDataflowSilently(WorkflowBundle workflowBundle,
+ FileType fileType, Object destination, boolean failOnOverwrite)
+ throws SaveException, OverwriteException {
+ Set<DataflowPersistenceHandler> handlers;
+
+ Class<? extends Object> destinationClass = destination.getClass();
+ if (fileType != null)
+ handlers = getPersistanceHandlerRegistry().getSaveHandlersForType(
+ fileType, destinationClass);
+ else
+ handlers = getPersistanceHandlerRegistry().getSaveHandlersFor(
+ destinationClass);
+
+ SaveException lastException = null;
+ for (DataflowPersistenceHandler handler : handlers) {
+ if (failOnOverwrite) {
+ OpenDataflowInfo openDataflowInfo = getOpenDataflowInfo(workflowBundle);
+ if (handler.wouldOverwriteDataflow(workflowBundle, fileType,
+ destination, openDataflowInfo.getDataflowInfo()))
+ throw new OverwriteException(destination);
+ }
+ try {
+ DataflowInfo savedDataflow = handler.saveDataflow(
+ workflowBundle, fileType, destination);
+ savedDataflow.getDataflow();
+ logger.info("Saved workflow: " + workflowBundle.getName() + " "
+ + workflowBundle.getGlobalBaseURI() + " to "
+ + savedDataflow.getCanonicalSource() + " using "
+ + handler);
+ return savedDataflow;
+ } catch (SaveException ex) {
+ logger.warn("Could not save to " + destination + " using "
+ + handler);
+ lastException = ex;
+ }
+ }
+
+ if (lastException == null)
+ throw new SaveException("Unsupported file type or class "
+ + fileType + " " + destinationClass);
+ throw new SaveException("Could not save to " + destination + ":\n"
+ + lastException.getLocalizedMessage(), lastException);
+ }
+
+ @Override
+ public void setCurrentDataflow(WorkflowBundle workflowBundle) {
+ setCurrentDataflow(workflowBundle, false);
+ }
+
+ @Override
+ public void setCurrentDataflow(WorkflowBundle workflowBundle,
+ boolean openIfNeeded) {
+ currentWorkflowBundle = workflowBundle;
+ if (!isDataflowOpen(workflowBundle)) {
+ if (!openIfNeeded)
+ throw new IllegalArgumentException("Workflow is not open: "
+ + workflowBundle);
+ openDataflow(workflowBundle);
+ return;
+ }
+ observers.notify(new SetCurrentDataflowEvent(workflowBundle));
+ }
+
+ @Override
+ public void setDataflowChanged(WorkflowBundle workflowBundle,
+ boolean isChanged) {
+ getOpenDataflowInfo(workflowBundle).setIsChanged(isChanged);
+ if (blankWorkflowBundle == workflowBundle)
+ blankWorkflowBundle = null;
+ }
+
+ @Override
+ public Object getCanonical(Object source) throws IllegalArgumentException,
+ URISyntaxException, IOException {
+ Object canonicalSource = source;
+
+ if (source instanceof URL) {
+ URL url = ((URL) source);
+ if (url.getProtocol().equalsIgnoreCase("file"))
+ canonicalSource = new File(url.toURI());
+ }
+
+ if (canonicalSource instanceof File)
+ canonicalSource = ((File) canonicalSource).getCanonicalFile();
+ return canonicalSource;
+ }
+
+ public void setDataflowPersistenceHandlerRegistry(
+ DataflowPersistenceHandlerRegistry dataflowPersistenceHandlerRegistry) {
+ this.dataflowPersistenceHandlerRegistry = dataflowPersistenceHandlerRegistry;
+ }
+
+ /**
+ * Observe the {@link EditManager} for changes to open workflowBundles. A
+ * change of an open workflow would set it as changed using
+ * {@link FileManagerImpl#setDataflowChanged(Dataflow, boolean)}.
+ *
+ * @author Stian Soiland-Reyes
+ *
+ */
+ private final class EditManagerObserver implements
+ Observer<EditManagerEvent> {
+ @Override
+ public void notify(Observable<EditManagerEvent> sender,
+ EditManagerEvent message) throws Exception {
+ if (message instanceof AbstractDataflowEditEvent) {
+ AbstractDataflowEditEvent dataflowEdit = (AbstractDataflowEditEvent) message;
+ WorkflowBundle workflowBundle = dataflowEdit.getDataFlow();
+ /**
+ * TODO: on undo/redo - keep last event or similar to determine
+ * if workflow was saved before. See
+ * FileManagerTest#isChangedWithUndo().
+ */
+ setDataflowChanged(workflowBundle, true);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/FileTypeFileFilter.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/FileTypeFileFilter.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/FileTypeFileFilter.java
new file mode 100644
index 0000000..0d87dc1
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/FileTypeFileFilter.java
@@ -0,0 +1,54 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import java.io.File;
+
+import javax.swing.filechooser.FileFilter;
+
+import org.apache.taverna.workbench.file.FileType;
+
+public class FileTypeFileFilter extends FileFilter {
+ private final FileType fileType;
+
+ public FileTypeFileFilter(FileType fileType) {
+ this.fileType = fileType;
+ }
+
+ @Override
+ public String getDescription() {
+ return fileType.getDescription();
+ }
+
+ @Override
+ public boolean accept(File file) {
+ if (file.isDirectory())
+ // Don't grey out directories
+ return true;
+ if (fileType.getExtension() == null)
+ return false;
+ return file.getName().toLowerCase()
+ .endsWith("." + fileType.getExtension());
+ }
+
+ public FileType getFileType() {
+ return fileType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/MultipleFileTypes.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/MultipleFileTypes.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/MultipleFileTypes.java
new file mode 100644
index 0000000..410b600
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/MultipleFileTypes.java
@@ -0,0 +1,57 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import java.io.File;
+import java.util.Set;
+
+import javax.swing.filechooser.FileFilter;
+
+import org.apache.taverna.workbench.file.FileType;
+
+public class MultipleFileTypes extends FileFilter {
+ private String description;
+ private final Set<FileType> fileTypes;
+
+ public MultipleFileTypes(Set<FileType> fileTypes, String description) {
+ this.fileTypes = fileTypes;
+ this.description = description;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ @Override
+ public boolean accept(File file) {
+ if (file.isDirectory())
+ return true;
+
+ String lowerFileName = file.getName().toLowerCase();
+ for (FileType fileType : fileTypes) {
+ if (fileType.getExtension() == null)
+ continue;
+ if (lowerFileName.endsWith(fileType.getExtension()))
+ return true;
+ }
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowInProgressDialog.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowInProgressDialog.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowInProgressDialog.java
new file mode 100644
index 0000000..6a30517
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowInProgressDialog.java
@@ -0,0 +1,86 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import static java.awt.BorderLayout.CENTER;
+import static org.apache.taverna.workbench.MainWindow.getMainWindow;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.workingIcon;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+
+/**
+ * Dialog that is popped up while we are opening a workflow.
+ *
+ * @author Alex Nenadic
+ * @author Alan R Williams
+ */
+@SuppressWarnings("serial")
+public class OpenDataflowInProgressDialog extends HelpEnabledDialog {
+ private boolean userCancelled = false;
+
+ public OpenDataflowInProgressDialog() {
+ super(getMainWindow(), "Opening workflow", true);
+ setResizable(false);
+ setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setBorder(new EmptyBorder(10,10,10,10));
+
+ JPanel textPanel = new JPanel();
+ JLabel text = new JLabel(workingIcon);
+ text.setText("Opening workflow...");
+ text.setBorder(new EmptyBorder(10,0,10,0));
+ textPanel.add(text);
+ panel.add(textPanel, CENTER);
+
+/*
+ * Cancellation does not work when opening
+
+ // Cancel button
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ userCancelled = true;
+ setVisible(false);
+ dispose();
+ }
+ });
+ JPanel cancelButtonPanel = new JPanel();
+ cancelButtonPanel.add(cancelButton);
+ panel.add(cancelButtonPanel, BorderLayout.SOUTH);
+*/
+ setContentPane(panel);
+ setPreferredSize(new Dimension(300, 100));
+
+ pack();
+ }
+
+ public boolean hasUserCancelled() {
+ return userCancelled;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowInfo.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowInfo.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowInfo.java
new file mode 100644
index 0000000..f3e722d
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowInfo.java
@@ -0,0 +1,92 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import java.util.Date;
+
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.FileType;
+
+/**
+ * Information about an open dataflow.
+ *
+ * @author Stian Soiland-Reyes
+ */
+public class OpenDataflowInfo {
+ private DataflowInfo dataflowInfo;
+ private boolean isChanged;
+ private Date openedAt;
+
+ public OpenDataflowInfo() {
+ }
+
+ public FileType getFileType() {
+ if (dataflowInfo == null)
+ return null;
+ return dataflowInfo.getFileType();
+ }
+
+ public Date getLastModified() {
+ if (dataflowInfo == null)
+ return null;
+ return dataflowInfo.getLastModified();
+ }
+
+ public Date getOpenedAtDate() {
+ return openedAt;
+ }
+
+ public Object getSource() {
+ if (dataflowInfo == null)
+ return null;
+ return dataflowInfo.getCanonicalSource();
+ }
+
+ public boolean isChanged() {
+ return isChanged;
+ }
+
+ public void setIsChanged(boolean isChanged) {
+ this.isChanged = isChanged;
+ }
+
+ public synchronized void setOpenedFrom(DataflowInfo dataflowInfo) {
+ setDataflowInfo(dataflowInfo);
+ setOpenedAt(new Date());
+ setIsChanged(false);
+ }
+
+ public synchronized void setSavedTo(DataflowInfo dataflowInfo) {
+ setDataflowInfo(dataflowInfo);
+ setIsChanged(false);
+ }
+
+ private void setDataflowInfo(DataflowInfo dataflowInfo) {
+ this.dataflowInfo = dataflowInfo;
+ }
+
+ private void setOpenedAt(Date openedAt) {
+ this.openedAt = openedAt;
+ }
+
+ public DataflowInfo getDataflowInfo() {
+ return dataflowInfo;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowRunnable.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowRunnable.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowRunnable.java
new file mode 100644
index 0000000..fabd953
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowRunnable.java
@@ -0,0 +1,87 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import static java.lang.Thread.sleep;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.ui.SwingWorkerCompletionWaiter;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @author alanrw
+ */
+public class OpenDataflowRunnable implements Runnable {
+ private final FileManagerImpl fileManager;
+ private final FileType fileType;
+ private final Object source;
+ private WorkflowBundle dataflow;
+ private OpenException e;
+
+ public OpenDataflowRunnable(FileManagerImpl fileManager, FileType fileType,
+ Object source) {
+ this.fileManager = fileManager;
+ this.fileType = fileType;
+ this.source = source;
+ }
+
+ @Override
+ public void run() {
+ OpenDataflowSwingWorker openDataflowSwingWorker = new OpenDataflowSwingWorker(
+ fileType, source, fileManager);
+ OpenDataflowInProgressDialog dialog = new OpenDataflowInProgressDialog();
+ openDataflowSwingWorker
+ .addPropertyChangeListener(new SwingWorkerCompletionWaiter(
+ dialog));
+ openDataflowSwingWorker.execute();
+
+ /*
+ * Give a chance to the SwingWorker to finish so we do not have to
+ * display the dialog
+ */
+ try {
+ sleep(500);
+ } catch (InterruptedException e) {
+ this.e = new OpenException("Opening was interrupted");
+ }
+ if (!openDataflowSwingWorker.isDone())
+ dialog.setVisible(true); // this will block the GUI
+ boolean userCancelled = dialog.hasUserCancelled(); // see if user cancelled the dialog
+
+ if (userCancelled) {
+ // Stop the OpenDataflowSwingWorker if it is still working
+ openDataflowSwingWorker.cancel(true);
+ dataflow = null;
+ this.e = new OpenException("Opening was cancelled");
+ // exit
+ return;
+ }
+ dataflow = openDataflowSwingWorker.getDataflow();
+ this.e = openDataflowSwingWorker.getException();
+ }
+
+ public WorkflowBundle getDataflow() {
+ return dataflow;
+ }
+
+ public OpenException getException() {
+ return this.e;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowSwingWorker.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowSwingWorker.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowSwingWorker.java
new file mode 100644
index 0000000..c458f16
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/OpenDataflowSwingWorker.java
@@ -0,0 +1,66 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import javax.swing.SwingWorker;
+
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+public class OpenDataflowSwingWorker extends
+ SwingWorker<WorkflowBundle, Object> {
+ @SuppressWarnings("unused")
+ private Logger logger = Logger.getLogger(OpenDataflowSwingWorker.class);
+ private FileType fileType;
+ private Object source;
+ private FileManagerImpl fileManagerImpl;
+ private WorkflowBundle workflowBundle;
+ private OpenException e = null;
+
+ public OpenDataflowSwingWorker(FileType fileType, Object source,
+ FileManagerImpl fileManagerImpl) {
+ this.fileType = fileType;
+ this.source = source;
+ this.fileManagerImpl = fileManagerImpl;
+ }
+
+ @Override
+ protected WorkflowBundle doInBackground() throws Exception {
+ try {
+ workflowBundle = fileManagerImpl.performOpenDataflow(fileType,
+ source);
+ } catch (OpenException e) {
+ this.e = e;
+ }
+ return workflowBundle;
+ }
+
+ public WorkflowBundle getDataflow() {
+ return workflowBundle;
+ }
+
+ public OpenException getException() {
+ return e;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/T2DataflowOpener.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/T2DataflowOpener.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/T2DataflowOpener.java
new file mode 100644
index 0000000..6923443
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/T2DataflowOpener.java
@@ -0,0 +1,143 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.ReaderException;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+
+public class T2DataflowOpener extends AbstractDataflowPersistenceHandler
+ implements DataflowPersistenceHandler {
+ private static final T2FlowFileType T2_FLOW_FILE_TYPE = new T2FlowFileType();
+ private static Logger logger = Logger.getLogger(T2DataflowOpener.class);
+
+ private WorkflowBundleIO workflowBundleIO;
+
+ @SuppressWarnings("resource")
+ @Override
+ public DataflowInfo openDataflow(FileType fileType, Object source)
+ throws OpenException {
+ if (!getOpenFileTypes().contains(fileType))
+ throw new OpenException("Unsupported file type "
+ + fileType);
+ InputStream inputStream;
+ Date lastModified = null;
+ Object canonicalSource = source;
+ if (source instanceof InputStream)
+ inputStream = (InputStream) source;
+ else if (source instanceof File)
+ try {
+ inputStream = new FileInputStream((File) source);
+ } catch (FileNotFoundException e) {
+ throw new OpenException("Could not open file " + source + ":\n" + e.getLocalizedMessage(), e);
+ }
+ else if (source instanceof URL) {
+ URL url = ((URL) source);
+ try {
+ URLConnection connection = url.openConnection();
+ connection.setRequestProperty("Accept", "text/xml");
+ inputStream = connection.getInputStream();
+ if (connection.getLastModified() != 0)
+ lastModified = new Date(connection.getLastModified());
+ } catch (IOException e) {
+ throw new OpenException("Could not open connection to URL "
+ + source+ ":\n" + e.getLocalizedMessage(), e);
+ }
+ try {
+ if (url.getProtocol().equalsIgnoreCase("file"))
+ canonicalSource = new File(url.toURI());
+ } catch (URISyntaxException e) {
+ logger.warn("Invalid file URI created from " + url);
+ }
+ } else {
+ throw new OpenException("Unsupported source type "
+ + source.getClass());
+ }
+
+ final WorkflowBundle workflowBundle;
+ try {
+ workflowBundle = openDataflowStream(inputStream);
+ } finally {
+ try {
+ if (!(source instanceof InputStream))
+ // We created the stream, we'll close it
+ inputStream.close();
+ } catch (IOException ex) {
+ logger.warn("Could not close inputstream " + inputStream, ex);
+ }
+ }
+ if (canonicalSource instanceof File)
+ return new FileDataflowInfo(T2_FLOW_FILE_TYPE,
+ (File) canonicalSource, workflowBundle);
+ return new DataflowInfo(T2_FLOW_FILE_TYPE, canonicalSource,
+ workflowBundle, lastModified);
+ }
+
+ protected WorkflowBundle openDataflowStream(InputStream workflowXMLstream)
+ throws OpenException {
+ WorkflowBundle workflowBundle;
+ try {
+ workflowBundle = workflowBundleIO.readBundle(workflowXMLstream, null);
+ } catch (ReaderException e) {
+ throw new OpenException("Could not read the workflow", e);
+ } catch (IOException e) {
+ throw new OpenException("Could not open the workflow file for parsing", e);
+ } catch (Exception e) {
+ throw new OpenException("Error while opening workflow", e);
+ }
+
+ return workflowBundle;
+ }
+
+ @Override
+ public List<FileType> getOpenFileTypes() {
+ return Arrays.<FileType> asList(new T2FlowFileType());
+ }
+
+ @Override
+ public List<Class<?>> getOpenSourceTypes() {
+ return Arrays.<Class<?>> asList(InputStream.class, URL.class,
+ File.class);
+ }
+
+ public void setWorkflowBundleIO(WorkflowBundleIO workflowBundleIO) {
+ this.workflowBundleIO = workflowBundleIO;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/T2FileFilter.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/T2FileFilter.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/T2FileFilter.java
new file mode 100644
index 0000000..5d379f2
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/T2FileFilter.java
@@ -0,0 +1,36 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import java.io.File;
+
+import javax.swing.filechooser.FileFilter;
+
+public class T2FileFilter extends FileFilter {
+ @Override
+ public boolean accept(final File file) {
+ return file.getName().toLowerCase().endsWith(".t2flow");
+ }
+
+ @Override
+ public String getDescription() {
+ return "Taverna 2 workflows";
+ }
+}
[07/11] incubator-taverna-workbench git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/T2FlowFileType.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/T2FlowFileType.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/T2FlowFileType.java
new file mode 100644
index 0000000..bfd170b
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/T2FlowFileType.java
@@ -0,0 +1,41 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import org.apache.taverna.workbench.file.FileType;
+
+public class T2FlowFileType extends FileType {
+ public static final String APPLICATION_VND_TAVERNA_T2FLOW_XML = "application/vnd.taverna.t2flow+xml";
+
+ @Override
+ public String getDescription() {
+ return "Taverna 2 workflow";
+ }
+
+ @Override
+ public String getExtension() {
+ return "t2flow";
+ }
+
+ @Override
+ public String getMimeType() {
+ return APPLICATION_VND_TAVERNA_T2FLOW_XML;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleFileFilter.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleFileFilter.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleFileFilter.java
new file mode 100644
index 0000000..0442589
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleFileFilter.java
@@ -0,0 +1,36 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import java.io.File;
+
+import javax.swing.filechooser.FileFilter;
+
+public class WorkflowBundleFileFilter extends FileFilter {
+ @Override
+ public boolean accept(final File file) {
+ return file.getName().toLowerCase().endsWith(".wfbundle");
+ }
+
+ @Override
+ public String getDescription() {
+ return "Taverna 3 workflows";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleFileType.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleFileType.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleFileType.java
new file mode 100644
index 0000000..a64fb0d
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleFileType.java
@@ -0,0 +1,41 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import org.apache.taverna.workbench.file.FileType;
+
+public class WorkflowBundleFileType extends FileType {
+ public static final String APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE = "application/vnd.taverna.scufl2.workflow-bundle";
+
+ @Override
+ public String getDescription() {
+ return "Taverna 3 workflow";
+ }
+
+ @Override
+ public String getExtension() {
+ return "wfbundle";
+ }
+
+ @Override
+ public String getMimeType() {
+ return APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleOpener.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleOpener.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleOpener.java
new file mode 100644
index 0000000..d85e4ad
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleOpener.java
@@ -0,0 +1,142 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.ReaderException;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+
+public class WorkflowBundleOpener extends AbstractDataflowPersistenceHandler
+ implements DataflowPersistenceHandler {
+ private static final WorkflowBundleFileType WF_BUNDLE_FILE_TYPE = new WorkflowBundleFileType();
+ private static Logger logger = Logger.getLogger(WorkflowBundleOpener.class);
+ private WorkflowBundleIO workflowBundleIO;
+
+ @SuppressWarnings("resource")
+ @Override
+ public DataflowInfo openDataflow(FileType fileType, Object source)
+ throws OpenException {
+ if (!getOpenFileTypes().contains(fileType))
+ throw new OpenException("Unsupported file type " + fileType);
+ InputStream inputStream;
+ Date lastModified = null;
+ Object canonicalSource = source;
+ if (source instanceof InputStream) {
+ inputStream = (InputStream) source;
+ } else if (source instanceof File) {
+ try {
+ inputStream = new FileInputStream((File) source);
+ } catch (FileNotFoundException e) {
+ throw new OpenException("Could not open file " + source + ":\n"
+ + e.getLocalizedMessage(), e);
+ }
+ } else if (source instanceof URL) {
+ URL url = ((URL) source);
+ try {
+ URLConnection connection = url.openConnection();
+ connection.setRequestProperty("Accept", "application/zip");
+ inputStream = connection.getInputStream();
+ if (connection.getLastModified() != 0)
+ lastModified = new Date(connection.getLastModified());
+ } catch (IOException e) {
+ throw new OpenException("Could not open connection to URL "
+ + source + ":\n" + e.getLocalizedMessage(), e);
+ }
+ try {
+ if (url.getProtocol().equalsIgnoreCase("file"))
+ canonicalSource = new File(url.toURI());
+ } catch (URISyntaxException e) {
+ logger.warn("Invalid file URI created from " + url);
+ }
+ } else
+ throw new OpenException("Unsupported source type "
+ + source.getClass());
+
+ final WorkflowBundle workflowBundle;
+ try {
+ workflowBundle = openDataflowStream(inputStream);
+ } finally {
+ // We created the stream, we'll close it
+ try {
+ if (!(source instanceof InputStream))
+ inputStream.close();
+ } catch (IOException ex) {
+ logger.warn("Could not close inputstream " + inputStream, ex);
+ }
+ }
+ if (canonicalSource instanceof File)
+ return new FileDataflowInfo(WF_BUNDLE_FILE_TYPE,
+ (File) canonicalSource, workflowBundle);
+ return new DataflowInfo(WF_BUNDLE_FILE_TYPE, canonicalSource,
+ workflowBundle, lastModified);
+ }
+
+ protected WorkflowBundle openDataflowStream(InputStream inputStream)
+ throws OpenException {
+ WorkflowBundle workflowBundle;
+ try {
+ workflowBundle = workflowBundleIO.readBundle(inputStream, null);
+ } catch (ReaderException e) {
+ throw new OpenException("Could not read the workflow", e);
+ } catch (IOException e) {
+ throw new OpenException("Could not open the workflow for parsing",
+ e);
+ } catch (Exception e) {
+ throw new OpenException("Error while opening workflow", e);
+ }
+
+ return workflowBundle;
+ }
+
+ @Override
+ public List<FileType> getOpenFileTypes() {
+ return Arrays.<FileType> asList(WF_BUNDLE_FILE_TYPE);
+ }
+
+ @Override
+ public List<Class<?>> getOpenSourceTypes() {
+ return Arrays.<Class<?>> asList(InputStream.class, URL.class,
+ File.class);
+ }
+
+ public void setWorkflowBundleIO(WorkflowBundleIO workflowBundleIO) {
+ this.workflowBundleIO = workflowBundleIO;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleSaver.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleSaver.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleSaver.java
new file mode 100644
index 0000000..89043be
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/WorkflowBundleSaver.java
@@ -0,0 +1,144 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl;
+
+import static org.apache.taverna.workbench.file.impl.WorkflowBundleFileType.APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.SaveException;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+
+public class WorkflowBundleSaver extends AbstractDataflowPersistenceHandler
+ implements DataflowPersistenceHandler {
+ private static final WorkflowBundleFileType WF_BUNDLE_FILE_TYPE = new WorkflowBundleFileType();
+ private static Logger logger = Logger.getLogger(WorkflowBundleSaver.class);
+ private WorkflowBundleIO workflowBundleIO;
+
+ @Override
+ public DataflowInfo saveDataflow(WorkflowBundle workflowBundle, FileType fileType,
+ Object destination) throws SaveException {
+ if (!getSaveFileTypes().contains(fileType))
+ throw new IllegalArgumentException("Unsupported file type "
+ + fileType);
+ OutputStream outStream;
+ if (destination instanceof File)
+ try {
+ outStream = new FileOutputStream((File) destination);
+ } catch (FileNotFoundException e) {
+ throw new SaveException("Can't create workflow file "
+ + destination + ":\n" + e.getLocalizedMessage(), e);
+ }
+ else if (destination instanceof OutputStream)
+ outStream = (OutputStream) destination;
+ else
+ throw new SaveException("Unsupported destination type "
+ + destination.getClass());
+
+ try {
+ saveDataflowToStream(workflowBundle, outStream);
+ } finally {
+ try {
+ // Only close if we opened the stream
+ if (!(destination instanceof OutputStream))
+ outStream.close();
+ } catch (IOException e) {
+ logger.warn("Could not close stream", e);
+ }
+ }
+
+ if (destination instanceof File)
+ return new FileDataflowInfo(WF_BUNDLE_FILE_TYPE, (File) destination,
+ workflowBundle);
+ return new DataflowInfo(WF_BUNDLE_FILE_TYPE, destination, workflowBundle);
+ }
+
+ protected void saveDataflowToStream(WorkflowBundle workflowBundle,
+ OutputStream fileOutStream) throws SaveException {
+ try {
+ workflowBundleIO.writeBundle(workflowBundle, fileOutStream,
+ APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
+ } catch (Exception e) {
+ throw new SaveException("Can't write workflow:\n"
+ + e.getLocalizedMessage(), e);
+ }
+ }
+
+ @Override
+ public List<FileType> getSaveFileTypes() {
+ return Arrays.<FileType> asList(WF_BUNDLE_FILE_TYPE);
+ }
+
+ @Override
+ public List<Class<?>> getSaveDestinationTypes() {
+ return Arrays.<Class<?>> asList(File.class, OutputStream.class);
+ }
+
+ @Override
+ public boolean wouldOverwriteDataflow(WorkflowBundle workflowBundle, FileType fileType,
+ Object destination, DataflowInfo lastDataflowInfo) {
+ if (!getSaveFileTypes().contains(fileType))
+ throw new IllegalArgumentException("Unsupported file type "
+ + fileType);
+ if (!(destination instanceof File))
+ return false;
+
+ File file;
+ try {
+ file = ((File) destination).getCanonicalFile();
+ } catch (IOException e) {
+ return false;
+ }
+ if (!file.exists())
+ return false;
+ if (lastDataflowInfo == null)
+ return true;
+ Object lastDestination = lastDataflowInfo.getCanonicalSource();
+ if (!(lastDestination instanceof File))
+ return true;
+ File lastFile = (File) lastDestination;
+ if (!lastFile.getAbsoluteFile().equals(file))
+ return true;
+
+ Date lastModified = new Date(file.lastModified());
+ if (lastModified.equals(lastDataflowInfo.getLastModified()))
+ return false;
+ return true;
+ }
+
+ public void setWorkflowBundleIO(WorkflowBundleIO workflowBundleIO) {
+ this.workflowBundleIO = workflowBundleIO;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/CloseAllWorkflowsAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/CloseAllWorkflowsAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/CloseAllWorkflowsAction.java
new file mode 100644
index 0000000..eb88068
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/CloseAllWorkflowsAction.java
@@ -0,0 +1,84 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.actions;
+
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.InputEvent.SHIFT_DOWN_MASK;
+import static java.awt.event.KeyEvent.VK_L;
+import static java.awt.event.KeyEvent.VK_W;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.closeAllIcon;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.util.Collections;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+@SuppressWarnings("serial")
+public class CloseAllWorkflowsAction extends AbstractAction {
+ @SuppressWarnings("unused")
+ private static Logger logger = Logger.getLogger(CloseWorkflowAction.class);
+ private static final String CLOSE_ALL_WORKFLOWS = "Close all workflows";
+ private FileManager fileManager;
+ private CloseWorkflowAction closeWorkflowAction;
+
+ public CloseAllWorkflowsAction(EditManager editManager, FileManager fileManager) {
+ super(CLOSE_ALL_WORKFLOWS, closeAllIcon);
+ this.fileManager = fileManager;
+ closeWorkflowAction = new CloseWorkflowAction(editManager, fileManager);
+ putValue(
+ ACCELERATOR_KEY,
+ getKeyStroke(VK_W, getDefaultToolkit().getMenuShortcutKeyMask()
+ | SHIFT_DOWN_MASK));
+ putValue(MNEMONIC_KEY, VK_L);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ Component parentComponent = null;
+ if (event.getSource() instanceof Component)
+ parentComponent = (Component) event.getSource();
+ closeAllWorkflows(parentComponent);
+ }
+
+ public boolean closeAllWorkflows(Component parentComponent) {
+ // Close in reverse so we can save nested workflows first
+ List<WorkflowBundle> workflowBundles = fileManager.getOpenDataflows();
+
+ Collections.reverse(workflowBundles);
+
+ for (WorkflowBundle workflowBundle : workflowBundles) {
+ boolean success = closeWorkflowAction.closeWorkflow(
+ parentComponent, workflowBundle);
+ if (!success)
+ return false;
+ }
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/CloseWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/CloseWorkflowAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/CloseWorkflowAction.java
new file mode 100644
index 0000000..091a652
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/CloseWorkflowAction.java
@@ -0,0 +1,106 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.actions;
+
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.KeyEvent.VK_C;
+import static java.awt.event.KeyEvent.VK_W;
+import static javax.swing.JOptionPane.CANCEL_OPTION;
+import static javax.swing.JOptionPane.NO_OPTION;
+import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
+import static javax.swing.JOptionPane.YES_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.closeIcon;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.exceptions.UnsavedException;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+@SuppressWarnings("serial")
+public class CloseWorkflowAction extends AbstractAction {
+ private static Logger logger = Logger.getLogger(CloseWorkflowAction.class);
+ private static final String CLOSE_WORKFLOW = "Close workflow";
+ private final SaveWorkflowAction saveWorkflowAction;
+ private FileManager fileManager;
+
+ public CloseWorkflowAction(EditManager editManager, FileManager fileManager) {
+ super(CLOSE_WORKFLOW, closeIcon);
+ this.fileManager = fileManager;
+ saveWorkflowAction = new SaveWorkflowAction(editManager, fileManager);
+ putValue(
+ ACCELERATOR_KEY,
+ getKeyStroke(VK_W, getDefaultToolkit().getMenuShortcutKeyMask()));
+ putValue(MNEMONIC_KEY, VK_C);
+
+ }
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Component parentComponent = null;
+ if (e.getSource() instanceof Component)
+ parentComponent = (Component) e.getSource();
+ closeWorkflow(parentComponent, fileManager.getCurrentDataflow());
+ }
+
+ public boolean closeWorkflow(Component parentComponent, WorkflowBundle workflowBundle) {
+ if (workflowBundle == null) {
+ logger.warn("Attempted to close a null workflow");
+ return false;
+ }
+
+ try {
+ return fileManager.closeDataflow(workflowBundle, true);
+ } catch (UnsavedException e1) {
+ fileManager.setCurrentDataflow(workflowBundle);
+ String msg = "Do you want to save changes before closing the workflow "
+ + fileManager.getDataflowName(workflowBundle) + "?";
+ switch (showConfirmDialog(parentComponent, msg, "Save workflow?",
+ YES_NO_CANCEL_OPTION)) {
+ case NO_OPTION:
+ try {
+ fileManager.closeDataflow(workflowBundle, false);
+ return true;
+ } catch (UnsavedException e2) {
+ logger.error("Unexpected UnsavedException while "
+ + "closing workflow", e2);
+ return false;
+ }
+ case YES_OPTION:
+ boolean saved = saveWorkflowAction.saveDataflow(
+ parentComponent, workflowBundle);
+ if (!saved)
+ return false;
+ return closeWorkflow(parentComponent, workflowBundle);
+ case CANCEL_OPTION:
+ default:
+ return false;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/NewWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/NewWorkflowAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/NewWorkflowAction.java
new file mode 100644
index 0000000..deb0926
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/NewWorkflowAction.java
@@ -0,0 +1,57 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.actions;
+
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.KeyEvent.VK_N;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.newIcon;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.workbench.file.FileManager;
+
+import org.apache.log4j.Logger;
+
+@SuppressWarnings("serial")
+public class NewWorkflowAction extends AbstractAction {
+ @SuppressWarnings("unused")
+ private static Logger logger = Logger.getLogger(NewWorkflowAction.class);
+ private static final String NEW_WORKFLOW = "New workflow";
+ private FileManager fileManager;
+
+ public NewWorkflowAction(FileManager fileManager) {
+ super(NEW_WORKFLOW, newIcon);
+ this.fileManager = fileManager;
+ putValue(SHORT_DESCRIPTION, NEW_WORKFLOW);
+ putValue(MNEMONIC_KEY, KeyEvent.VK_N);
+ putValue(
+ ACCELERATOR_KEY,
+ getKeyStroke(VK_N, getDefaultToolkit().getMenuShortcutKeyMask()));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ fileManager.newDataflow();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/OpenNestedWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/OpenNestedWorkflowAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/OpenNestedWorkflowAction.java
new file mode 100644
index 0000000..2e2124d
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/OpenNestedWorkflowAction.java
@@ -0,0 +1,75 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.actions;
+
+import java.awt.Component;
+import java.io.File;
+
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * An action for opening a nested workflow from a file.
+ *
+ * @author Alex Nenadic
+ */
+public class OpenNestedWorkflowAction extends OpenWorkflowAction {
+ private static final long serialVersionUID = -5398423684000142379L;
+ private static Logger logger = Logger
+ .getLogger(OpenNestedWorkflowAction.class);
+
+ public OpenNestedWorkflowAction(FileManager fileManager) {
+ super(fileManager);
+ }
+
+ /**
+ * Opens a nested workflow from a file (should be one file even though the
+ * method takes a list of files - this is because it overrides the
+ * {@link OpenWorkflowAction#openWorkflows(Component, File[], FileType, OpenCallback)
+ * openWorkflows(...)} method).
+ */
+ @Override
+ public void openWorkflows(final Component parentComponent, File[] files,
+ FileType fileType, OpenCallback openCallback) {
+ ErrorLoggingOpenCallbackWrapper callback = new ErrorLoggingOpenCallbackWrapper(
+ openCallback);
+ for (File file : files)
+ try {
+ callback.aboutToOpenDataflow(file);
+ WorkflowBundle workflowBundle = fileManager.openDataflow(
+ fileType, file);
+ callback.openedDataflow(file, workflowBundle);
+ } catch (final RuntimeException ex) {
+ logger.warn("Could not open workflow from " + file, ex);
+ if (!callback.couldNotOpenDataflow(file, ex))
+ showErrorMessage(parentComponent, file, ex);
+ } catch (final OpenException ex) {
+ logger.warn("Could not open workflow from " + file, ex);
+ if (!callback.couldNotOpenDataflow(file, ex))
+ showErrorMessage(parentComponent, file, ex);
+ return;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/OpenWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/OpenWorkflowAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/OpenWorkflowAction.java
new file mode 100644
index 0000000..3a7560a
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/OpenWorkflowAction.java
@@ -0,0 +1,394 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.actions;
+
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.KeyEvent.VK_O;
+import static java.util.prefs.Preferences.userNodeForPackage;
+import static javax.swing.JFileChooser.APPROVE_OPTION;
+import static javax.swing.JOptionPane.CANCEL_OPTION;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.QUESTION_MESSAGE;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
+import static javax.swing.JOptionPane.YES_OPTION;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.JOptionPane.showOptionDialog;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static javax.swing.SwingUtilities.invokeLater;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.openIcon;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+import java.util.prefs.Preferences;
+
+import javax.swing.AbstractAction;
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.file.impl.FileTypeFileFilter;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * An action for opening a workflow from a file. All file types exposed by the
+ * {@link FileManager} as compatible with the {@link File} type are supported.
+ *
+ * @author Stian Soiland-Reyes
+ */
+public class OpenWorkflowAction extends AbstractAction {
+ private static final long serialVersionUID = 103237694130052153L;
+ private static Logger logger = Logger.getLogger(OpenWorkflowAction.class);
+ private static final String OPEN_WORKFLOW = "Open workflow...";
+
+ public final OpenCallback DUMMY_OPEN_CALLBACK = new OpenCallbackAdapter();
+ protected FileManager fileManager;
+
+ public OpenWorkflowAction(FileManager fileManager) {
+ super(OPEN_WORKFLOW, openIcon);
+ this.fileManager = fileManager;
+ putValue(
+ ACCELERATOR_KEY,
+ getKeyStroke(VK_O, getDefaultToolkit().getMenuShortcutKeyMask()));
+ putValue(MNEMONIC_KEY, VK_O);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ final Component parentComponent;
+ if (e.getSource() instanceof Component)
+ parentComponent = (Component) e.getSource();
+ else
+ parentComponent = null;
+ openWorkflows(parentComponent);
+ }
+
+ /**
+ * Pop up an Open-dialogue to select one or more workflow files to open.
+ * <p>
+ * Note that the file opening occurs in a separate thread. If you want to
+ * check if the file was opened or not, which workflow was opened, etc, use
+ * {@link #openWorkflows(Component, OpenCallback)} instead.
+ *
+ * @see #openWorkflows(Component, OpenCallback)
+ * @param parentComponent
+ * The UI parent component to use for pop up dialogues
+ *
+ * @return <code>false</code> if no files were selected or the dialogue was
+ * cancelled, or <code>true</code> if the process of opening one or
+ * more files has been started.
+ */
+ public void openWorkflows(Component parentComponent) {
+ openWorkflows(parentComponent, DUMMY_OPEN_CALLBACK);
+ }
+
+ /**
+ * Open an array of workflow files.
+ *
+ * @param parentComponent
+ * Parent component for UI dialogues
+ * @param files
+ * Array of files to be opened
+ * @param fileType
+ * {@link FileType} of the files that are to be opened, for
+ * instance
+ * {@link org.apache.taverna.workbench.file.impl.T2FlowFileType},
+ * or <code>null</code> to guess.
+ * @param openCallback
+ * An {@link OpenCallback} to be invoked during and after opening
+ * the file. Use {@link OpenWorkflowAction#DUMMY_OPEN_CALLBACK}
+ * if no callback is needed.
+ */
+ public void openWorkflows(final Component parentComponent, File[] files,
+ FileType fileType, OpenCallback openCallback) {
+ ErrorLoggingOpenCallbackWrapper callback = new ErrorLoggingOpenCallbackWrapper(
+ openCallback);
+ for (File file : files)
+ try {
+ Object canonicalSource = fileManager.getCanonical(file);
+ WorkflowBundle alreadyOpen = fileManager.getDataflowBySource(canonicalSource);
+ if (alreadyOpen != null) {
+ /*
+ * The workflow from the same source is already opened - ask
+ * the user if they want to switch to it or open another
+ * copy...
+ */
+
+ Object[] options = { "Switch to opened", "Open new copy",
+ "Cancel" };
+ switch (showOptionDialog(
+ null,
+ "The workflow from the same location is already opened.\n"
+ + "Do you want to switch to it or open a new copy?",
+ "File Manager Alert", YES_NO_CANCEL_OPTION,
+ QUESTION_MESSAGE, null, options, // the titles of buttons
+ options[0])) { // default button title
+ case YES_OPTION:
+ fileManager.setCurrentDataflow(alreadyOpen);
+ return;
+ case CANCEL_OPTION:
+ // do nothing
+ return;
+ }
+ // else open the workflow as usual
+ }
+
+ callback.aboutToOpenDataflow(file);
+ WorkflowBundle workflowBundle = fileManager.openDataflow(fileType, file);
+ callback.openedDataflow(file, workflowBundle);
+ } catch (RuntimeException ex) {
+ logger.warn("Failed to open workflow from " + file, ex);
+ if (!callback.couldNotOpenDataflow(file, ex))
+ showErrorMessage(parentComponent, file, ex);
+ } catch (Exception ex) {
+ logger.warn("Failed to open workflow from " + file, ex);
+ if (!callback.couldNotOpenDataflow(file, ex))
+ showErrorMessage(parentComponent, file, ex);
+ return;
+ }
+ }
+
+ /**
+ * Pop up an Open-dialogue to select one or more workflow files to open.
+ *
+ * @param parentComponent
+ * The UI parent component to use for pop up dialogues
+ * @param openCallback
+ * An {@link OpenCallback} to be called during the file opening.
+ * The callback will be invoked for each file that has been
+ * opened, as file opening happens in a separate thread that
+ * might execute after the return of this method.
+ * @return <code>false</code> if no files were selected or the dialogue was
+ * cancelled, or <code>true</code> if the process of opening one or
+ * more files has been started.
+ */
+ public boolean openWorkflows(final Component parentComponent,
+ OpenCallback openCallback) {
+ JFileChooser fileChooser = new JFileChooser();
+ Preferences prefs = userNodeForPackage(getClass());
+ String curDir = prefs
+ .get("currentDir", System.getProperty("user.home"));
+ fileChooser.setDialogTitle(OPEN_WORKFLOW);
+
+ fileChooser.resetChoosableFileFilters();
+ fileChooser.setAcceptAllFileFilterUsed(false);
+ List<FileFilter> fileFilters = fileManager.getOpenFileFilters();
+ if (fileFilters.isEmpty()) {
+ logger.warn("No file types found for opening workflow");
+ showMessageDialog(parentComponent,
+ "No file types found for opening workflow.", "Error",
+ ERROR_MESSAGE);
+ return false;
+ }
+ for (FileFilter fileFilter : fileFilters)
+ fileChooser.addChoosableFileFilter(fileFilter);
+ fileChooser.setFileFilter(fileFilters.get(0));
+ fileChooser.setCurrentDirectory(new File(curDir));
+ fileChooser.setMultiSelectionEnabled(true);
+
+ int returnVal = fileChooser.showOpenDialog(parentComponent);
+ if (returnVal == APPROVE_OPTION) {
+ prefs.put("currentDir", fileChooser.getCurrentDirectory()
+ .toString());
+ final File[] selectedFiles = fileChooser.getSelectedFiles();
+ if (selectedFiles.length == 0) {
+ logger.warn("No files selected");
+ return false;
+ }
+ FileFilter fileFilter = fileChooser.getFileFilter();
+ FileType fileType;
+ if (fileFilter instanceof FileTypeFileFilter)
+ fileType = ((FileTypeFileFilter) fileChooser.getFileFilter())
+ .getFileType();
+ else
+ // Unknown filetype, try all of them
+ fileType = null;
+ new FileOpenerThread(parentComponent, selectedFiles, fileType,
+ openCallback).start();
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Show an error message if a file could not be opened
+ *
+ * @param parentComponent
+ * @param file
+ * @param throwable
+ */
+ protected void showErrorMessage(final Component parentComponent,
+ final File file, final Throwable throwable) {
+ invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ Throwable cause = throwable;
+ while (cause.getCause() != null)
+ cause = cause.getCause();
+ showMessageDialog(
+ parentComponent,
+ "Failed to open workflow from " + file + ": \n"
+ + cause.getMessage(), "Warning",
+ WARNING_MESSAGE);
+ }
+ });
+
+ }
+
+ /**
+ * Callback interface for openWorkflows().
+ * <p>
+ * The callback will be invoked during the invocation of
+ * {@link OpenWorkflowAction#openWorkflows(Component, OpenCallback)} and
+ * {@link OpenWorkflowAction#openWorkflows(Component, File[], FileType, OpenCallback)}
+ * as file opening happens in a separate thread.
+ *
+ * @author Stian Soiland-Reyes
+ */
+ public interface OpenCallback {
+ /**
+ * Called before a workflowBundle is to be opened from the given file
+ *
+ * @param file
+ * File which workflowBundle is to be opened
+ */
+ void aboutToOpenDataflow(File file);
+
+ /**
+ * Called if an exception happened while attempting to open the
+ * workflowBundle.
+ *
+ * @param file
+ * File which was attempted to be opened
+ * @param ex
+ * An {@link OpenException} or a {@link RuntimeException}.
+ * @return <code>true</code> if the error has been handled, or
+ * <code>false</code>3 if a UI warning dialogue is to be opened.
+ */
+ boolean couldNotOpenDataflow(File file, Exception ex);
+
+ /**
+ * Called when a workflowBundle has been successfully opened. The workflowBundle
+ * will be registered in {@link FileManager#getOpenDataflows()}.
+ *
+ * @param file
+ * File from which workflowBundle was opened
+ * @param workflowBundle
+ * WorkflowBundle that was opened
+ */
+ void openedDataflow(File file, WorkflowBundle workflowBundle);
+ }
+
+ /**
+ * Adapter for {@link OpenCallback}
+ *
+ * @author Stian Soiland-Reyes
+ */
+ public static class OpenCallbackAdapter implements OpenCallback {
+ @Override
+ public void aboutToOpenDataflow(File file) {
+ }
+
+ @Override
+ public boolean couldNotOpenDataflow(File file, Exception ex) {
+ return false;
+ }
+
+ @Override
+ public void openedDataflow(File file, WorkflowBundle workflowBundle) {
+ }
+ }
+
+ private final class FileOpenerThread extends Thread {
+ private final File[] files;
+ private final FileType fileType;
+ private final OpenCallback openCallback;
+ private final Component parentComponent;
+
+ private FileOpenerThread(Component parentComponent,
+ File[] selectedFiles, FileType fileType,
+ OpenCallback openCallback) {
+ super("Opening workflows(s) " + Arrays.asList(selectedFiles));
+ this.parentComponent = parentComponent;
+ this.files = selectedFiles;
+ this.fileType = fileType;
+ this.openCallback = openCallback;
+ }
+
+ @Override
+ public void run() {
+ openWorkflows(parentComponent, files, fileType, openCallback);
+ }
+ }
+
+ /**
+ * A wrapper for {@link OpenCallback} implementations that logs exceptions
+ * thrown without disrupting the caller of the callback.
+ *
+ * @author Stian Soiland-Reyes
+ */
+ protected class ErrorLoggingOpenCallbackWrapper implements OpenCallback {
+ private final OpenCallback wrapped;
+
+ public ErrorLoggingOpenCallbackWrapper(OpenCallback wrapped) {
+ this.wrapped = wrapped;
+ }
+
+ @Override
+ public void aboutToOpenDataflow(File file) {
+ try {
+ wrapped.aboutToOpenDataflow(file);
+ } catch (RuntimeException wrapperEx) {
+ logger.warn("Failed OpenCallback " + wrapped
+ + ".aboutToOpenDataflow(File)", wrapperEx);
+ }
+ }
+
+ @Override
+ public boolean couldNotOpenDataflow(File file, Exception ex) {
+ try {
+ return wrapped.couldNotOpenDataflow(file, ex);
+ } catch (RuntimeException wrapperEx) {
+ logger.warn("Failed OpenCallback " + wrapped
+ + ".couldNotOpenDataflow(File, Exception)", wrapperEx);
+ return false;
+ }
+ }
+
+ @Override
+ public void openedDataflow(File file, WorkflowBundle workflowBundle) {
+ try {
+ wrapped.openedDataflow(file, workflowBundle);
+ } catch (RuntimeException wrapperEx) {
+ logger.warn("Failed OpenCallback " + wrapped
+ + ".openedDataflow(File, Dataflow)", wrapperEx);
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/OpenWorkflowFromURLAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/OpenWorkflowFromURLAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/OpenWorkflowFromURLAction.java
new file mode 100644
index 0000000..3c1a4cc
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/OpenWorkflowFromURLAction.java
@@ -0,0 +1,138 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.actions;
+
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.KeyEvent.VK_L;
+import static javax.swing.JOptionPane.CANCEL_OPTION;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.QUESTION_MESSAGE;
+import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
+import static javax.swing.JOptionPane.YES_OPTION;
+import static javax.swing.JOptionPane.showInputDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.JOptionPane.showOptionDialog;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.openurlIcon;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.net.URL;
+import java.util.prefs.Preferences;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.workbench.file.FileManager;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * An action for opening a workflow from a url.
+ *
+ * @author David Withers
+ */
+public class OpenWorkflowFromURLAction extends AbstractAction {
+ private static final long serialVersionUID = 1474356457949961974L;
+ private static Logger logger = Logger
+ .getLogger(OpenWorkflowFromURLAction.class);
+ private static Preferences prefs = Preferences
+ .userNodeForPackage(OpenWorkflowFromURLAction.class);
+ private static final String PREF_CURRENT_URL = "currentUrl";
+ private static final String ACTION_NAME = "Open workflow location...";
+ private static final String ACTION_DESCRIPTION = "Open a workflow from the web into a new workflow";
+
+ private Component component;
+ private FileManager fileManager;
+
+ public OpenWorkflowFromURLAction(final Component component,
+ FileManager fileManager) {
+ this.component = component;
+ this.fileManager = fileManager;
+ putValue(SMALL_ICON, openurlIcon);
+ putValue(NAME, ACTION_NAME);
+ putValue(SHORT_DESCRIPTION, ACTION_DESCRIPTION);
+ putValue(MNEMONIC_KEY, VK_L);
+ putValue(
+ ACCELERATOR_KEY,
+ getKeyStroke(VK_L, getDefaultToolkit().getMenuShortcutKeyMask()));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String currentUrl = prefs.get(PREF_CURRENT_URL, "http://");
+
+ final String url = (String) showInputDialog(component,
+ "Enter the URL of a workflow definition to load",
+ "Workflow URL", QUESTION_MESSAGE, null, null, currentUrl);
+ if (url != null)
+ new Thread("OpenWorkflowFromURLAction") {
+ @Override
+ public void run() {
+ openFromURL(url);
+ }
+ }.start();
+ }
+
+ private void openFromURL(String urlString) {
+ try {
+ URL url = new URL(urlString);
+
+ Object canonicalSource = fileManager.getCanonical(url);
+ WorkflowBundle alreadyOpen = fileManager
+ .getDataflowBySource(canonicalSource);
+ if (alreadyOpen != null) {
+ /*
+ * The workflow from the same source is already opened - ask the
+ * user if they want to switch to it or open another copy.
+ */
+
+ Object[] options = { "Switch to opened", "Open new copy",
+ "Cancel" };
+ int iSelected = showOptionDialog(
+ null,
+ "The workflow from the same location is already opened.\n"
+ + "Do you want to switch to it or open a new copy?",
+ "File Manager Alert", YES_NO_CANCEL_OPTION,
+ QUESTION_MESSAGE, null, options, // the titles of buttons
+ options[0]); // default button title
+
+ if (iSelected == YES_OPTION) {
+ fileManager.setCurrentDataflow(alreadyOpen);
+ return;
+ } else if (iSelected == CANCEL_OPTION) {
+ // do nothing
+ return;
+ }
+ // else open the workflow as usual
+ }
+
+ fileManager.openDataflow(null, url);
+ prefs.put(PREF_CURRENT_URL, urlString);
+ } catch (Exception ex) {
+ logger.warn("Failed to open the workflow from url " + urlString
+ + " \n", ex);
+ showMessageDialog(component,
+ "Failed to open the workflow from url " + urlString + " \n"
+ + ex.getMessage(), "Error!", ERROR_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/PasswordInput.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/PasswordInput.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/PasswordInput.java
new file mode 100644
index 0000000..61e80e6
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/PasswordInput.java
@@ -0,0 +1,220 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.actions;
+
+import static java.awt.EventQueue.invokeLater;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPasswordField;
+import javax.swing.JTextField;
+
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.log4j.Logger;
+
+/**
+ * Simple dialogue to handle username/password input for workflow URL requiring
+ * http authentication.
+ *
+ * @author Stuart Owen
+ * @author Stian Soiland-Reyes
+ * @author Alan R Williams
+ */
+@SuppressWarnings("serial")
+public class PasswordInput extends HelpEnabledDialog {
+ private static Logger logger = Logger.getLogger(PasswordInput.class);
+
+ private String password = null;
+ private String username = null;
+ private URL url = null;
+ private int tryCount = 0;
+ private final static int MAX_TRIES = 3;
+
+ private JButton cancelButton;
+ private JLabel jLabel1;
+ private JLabel jLabel2;
+ private JLabel messageLabel;
+ private JButton okButton;
+ private JPasswordField passwordTextField;
+ private JLabel urlLabel;
+ private JTextField usernameTextField;
+
+ public void setUrl(URL url) {
+ this.url = url;
+ urlLabel.setText(url.toExternalForm());
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public PasswordInput(JFrame parent) {
+ super(parent, "Authorization", true, null);
+ initComponents();
+ }
+
+ /** Creates new form PasswordInput */
+ public PasswordInput() {
+ super((JFrame) null, "Authorization", true, null);
+ initComponents();
+ }
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ private void initComponents() {
+ usernameTextField = new javax.swing.JTextField();
+ cancelButton = new javax.swing.JButton();
+ okButton = new javax.swing.JButton();
+ passwordTextField = new javax.swing.JPasswordField();
+ jLabel1 = new javax.swing.JLabel();
+ jLabel2 = new javax.swing.JLabel();
+ messageLabel = new javax.swing.JLabel();
+ urlLabel = new javax.swing.JLabel();
+
+ getContentPane().setLayout(null);
+
+ setModal(true);
+ // setResizable(false);
+ getContentPane().add(usernameTextField);
+ usernameTextField.setBounds(20, 80, 280, 22);
+
+ cancelButton.setText("Cancel");
+ cancelButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent evt) {
+ cancelButtonActionPerformed(evt);
+ }
+ });
+
+ getContentPane().add(cancelButton);
+ cancelButton.setBounds(230, 160, 75, 29);
+
+ okButton.setText("OK");
+ okButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent evt) {
+ okButtonActionPerformed(evt);
+ }
+ });
+
+ getContentPane().add(okButton);
+ okButton.setBounds(150, 160, 75, 29);
+
+ getContentPane().add(passwordTextField);
+ passwordTextField.setBounds(20, 130, 280, 22);
+
+ jLabel1.setText("Username");
+ getContentPane().add(jLabel1);
+ jLabel1.setBounds(20, 60, 70, 16);
+
+ jLabel2.setText("Password");
+ getContentPane().add(jLabel2);
+ jLabel2.setBounds(20, 110, 70, 16);
+
+ messageLabel.setText("A username and password is required for:");
+ getContentPane().add(messageLabel);
+ messageLabel.setBounds(20, 10, 270, 20);
+
+ urlLabel.setText("service");
+ getContentPane().add(urlLabel);
+ urlLabel.setBounds(20, 30, 270, 16);
+
+ pack();
+ }
+
+ private void okButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
+ String password = String.valueOf(passwordTextField.getPassword());
+ String username = usernameTextField.getText();
+ HttpURLConnection connection;
+ try {
+ connection = (HttpURLConnection) url.openConnection();
+ String userPassword = username + ":" + password;
+ /*
+ * Note: non-latin1 support for basic auth is fragile/unsupported
+ * and must be MIME-encoded (RFC2047) according to
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=41489
+ */
+ byte[] encoded = Base64.encodeBase64(userPassword
+ .getBytes("latin1"));
+ connection.setRequestProperty("Authorization", "Basic "
+ + new String(encoded, "ascii"));
+ connection.setRequestProperty("Accept", "text/xml");
+ int code = connection.getResponseCode();
+
+ /*
+ * NB: myExperiment gives a 500 response for an invalid
+ * username/password
+ */
+ if (code == 401 || code == 500) {
+ tryCount++;
+ showMessageDialog(this, "The username and password failed",
+ "Invalid username or password", ERROR_MESSAGE);
+ if (tryCount >= MAX_TRIES) { // close after 3 attempts.
+ this.password = null;
+ this.username = null;
+ this.setVisible(false);
+ }
+ } else {
+ this.username = username;
+ this.password = password;
+ this.setVisible(false);
+ }
+ } catch (IOException ex) {
+ logger.error("Could not get password", ex);
+ }
+ }
+
+ private void cancelButtonActionPerformed(ActionEvent evt) {
+ this.password = null;
+ this.username = null;
+ this.setVisible(false);
+ }
+
+ /**
+ * @param args
+ * the command line arguments
+ */
+ public static void main(String args[]) {
+ invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ new PasswordInput().setVisible(true);
+ }
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/SaveAllWorkflowsAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/SaveAllWorkflowsAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/SaveAllWorkflowsAction.java
new file mode 100644
index 0000000..b58b99f
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/SaveAllWorkflowsAction.java
@@ -0,0 +1,103 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.actions;
+
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.InputEvent.SHIFT_DOWN_MASK;
+import static java.awt.event.KeyEvent.VK_A;
+import static java.awt.event.KeyEvent.VK_S;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.saveAllIcon;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.util.Collections;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+@SuppressWarnings("serial")
+public class SaveAllWorkflowsAction extends AbstractAction {
+ private final class FileManagerObserver implements
+ Observer<FileManagerEvent> {
+ @Override
+ public void notify(Observable<FileManagerEvent> sender,
+ FileManagerEvent message) throws Exception {
+ updateEnabled();
+ }
+ }
+
+ @SuppressWarnings("unused")
+ private static Logger logger = Logger
+ .getLogger(SaveAllWorkflowsAction.class);
+ private static final String SAVE_ALL_WORKFLOWS = "Save all workflows";
+
+ private final SaveWorkflowAction saveWorkflowAction;
+ private FileManager fileManager;
+ private FileManagerObserver fileManagerObserver = new FileManagerObserver();
+
+ public SaveAllWorkflowsAction(EditManager editManager,
+ FileManager fileManager) {
+ super(SAVE_ALL_WORKFLOWS, saveAllIcon);
+ this.fileManager = fileManager;
+ saveWorkflowAction = new SaveWorkflowAction(editManager, fileManager);
+ putValue(
+ ACCELERATOR_KEY,
+ getKeyStroke(VK_S, getDefaultToolkit().getMenuShortcutKeyMask()
+ | SHIFT_DOWN_MASK));
+ putValue(MNEMONIC_KEY, VK_A);
+
+ fileManager.addObserver(fileManagerObserver);
+ updateEnabled();
+ }
+
+ public void updateEnabled() {
+ setEnabled(!(fileManager.getOpenDataflows().isEmpty()));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent ev) {
+ Component parentComponent = null;
+ if (ev.getSource() instanceof Component)
+ parentComponent = (Component) ev.getSource();
+ saveAllDataflows(parentComponent);
+ }
+
+ public void saveAllDataflows(Component parentComponent) {
+ // Save in reverse so we save nested workflows first
+ List<WorkflowBundle> workflowBundles = fileManager.getOpenDataflows();
+ Collections.reverse(workflowBundles);
+
+ for (WorkflowBundle workflowBundle : workflowBundles)
+ if (!saveWorkflowAction.saveDataflow(parentComponent,
+ workflowBundle))
+ break;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/SaveWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/SaveWorkflowAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/SaveWorkflowAction.java
new file mode 100644
index 0000000..2cf2775
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/SaveWorkflowAction.java
@@ -0,0 +1,174 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.actions;
+
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.KeyEvent.VK_S;
+import static javax.swing.JOptionPane.NO_OPTION;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
+import static javax.swing.JOptionPane.YES_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.saveIcon;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.EditManager.AbstractDataflowEditEvent;
+import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.file.events.SavedDataflowEvent;
+import org.apache.taverna.workbench.file.events.SetCurrentDataflowEvent;
+import org.apache.taverna.workbench.file.exceptions.OverwriteException;
+import org.apache.taverna.workbench.file.exceptions.SaveException;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+@SuppressWarnings("serial")
+public class SaveWorkflowAction extends AbstractAction {
+ private static Logger logger = Logger.getLogger(SaveWorkflowAction.class);
+ private static final String SAVE_WORKFLOW = "Save workflow";
+
+ private final SaveWorkflowAsAction saveWorkflowAsAction;
+ private EditManagerObserver editManagerObserver = new EditManagerObserver();
+ private FileManager fileManager;
+ private FileManagerObserver fileManagerObserver = new FileManagerObserver();
+
+ public SaveWorkflowAction(EditManager editManager, FileManager fileManager) {
+ super(SAVE_WORKFLOW, saveIcon);
+ this.fileManager = fileManager;
+ saveWorkflowAsAction = new SaveWorkflowAsAction(fileManager);
+ putValue(
+ ACCELERATOR_KEY,
+ getKeyStroke(VK_S, getDefaultToolkit().getMenuShortcutKeyMask()));
+ putValue(MNEMONIC_KEY, VK_S);
+ editManager.addObserver(editManagerObserver);
+ fileManager.addObserver(fileManagerObserver);
+ updateEnabledStatus(fileManager.getCurrentDataflow());
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent ev) {
+ Component parentComponent = null;
+ if (ev.getSource() instanceof Component)
+ parentComponent = (Component) ev.getSource();
+ saveCurrentDataflow(parentComponent);
+ }
+
+ public boolean saveCurrentDataflow(Component parentComponent) {
+ WorkflowBundle workflowBundle = fileManager.getCurrentDataflow();
+ return saveDataflow(parentComponent, workflowBundle);
+ }
+
+ public boolean saveDataflow(Component parentComponent,
+ WorkflowBundle workflowBundle) {
+ if (!fileManager.canSaveWithoutDestination(workflowBundle))
+ return saveWorkflowAsAction.saveDataflow(parentComponent,
+ workflowBundle);
+
+ try {
+ try {
+ fileManager.saveDataflow(workflowBundle, true);
+ Object workflowBundleSource = fileManager
+ .getDataflowSource(workflowBundle);
+ logger.info("Saved workflow " + workflowBundle + " to "
+ + workflowBundleSource);
+ return true;
+ } catch (OverwriteException ex) {
+ Object workflowBundleSource = fileManager
+ .getDataflowSource(workflowBundle);
+ logger.info("Workflow was changed on source: "
+ + workflowBundleSource);
+ fileManager.setCurrentDataflow(workflowBundle);
+ String msg = "Workflow destination " + workflowBundleSource
+ + " has been changed from elsewhere, "
+ + "are you sure you want to overwrite?";
+ int ret = showConfirmDialog(parentComponent, msg,
+ "Workflow changed", YES_NO_CANCEL_OPTION);
+ if (ret == YES_OPTION) {
+ fileManager.saveDataflow(workflowBundle, false);
+ logger.info("Saved workflow " + workflowBundle
+ + " by overwriting " + workflowBundleSource);
+ return true;
+ } else if (ret == NO_OPTION) {
+ // Pop up Save As instead to choose another name
+ return saveWorkflowAsAction.saveDataflow(parentComponent,
+ workflowBundle);
+ } else {
+ logger.info("Aborted overwrite of " + workflowBundleSource);
+ return false;
+ }
+ }
+ } catch (SaveException ex) {
+ logger.warn("Could not save workflow " + workflowBundle, ex);
+ showMessageDialog(parentComponent, "Could not save workflow: \n\n"
+ + ex.getMessage(), "Warning", WARNING_MESSAGE);
+ return false;
+ } catch (RuntimeException ex) {
+ logger.warn("Could not save workflow " + workflowBundle, ex);
+ showMessageDialog(parentComponent, "Could not save workflow: \n\n"
+ + ex.getMessage(), "Warning", WARNING_MESSAGE);
+ return false;
+ }
+ }
+
+ protected void updateEnabledStatus(WorkflowBundle workflowBundle) {
+ setEnabled(workflowBundle != null
+ && fileManager.isDataflowChanged(workflowBundle));
+ }
+
+ private final class EditManagerObserver implements
+ Observer<EditManagerEvent> {
+ @Override
+ public void notify(Observable<EditManagerEvent> sender,
+ EditManagerEvent message) throws Exception {
+ if (message instanceof AbstractDataflowEditEvent) {
+ WorkflowBundle workflowBundle = ((AbstractDataflowEditEvent) message)
+ .getDataFlow();
+ if (workflowBundle == fileManager.getCurrentDataflow())
+ updateEnabledStatus(workflowBundle);
+ }
+ }
+ }
+
+ private final class FileManagerObserver implements
+ Observer<FileManagerEvent> {
+ @Override
+ public void notify(Observable<FileManagerEvent> sender,
+ FileManagerEvent message) throws Exception {
+ if (message instanceof SavedDataflowEvent)
+ updateEnabledStatus(((SavedDataflowEvent) message)
+ .getDataflow());
+ else if (message instanceof SetCurrentDataflowEvent)
+ updateEnabledStatus(((SetCurrentDataflowEvent) message)
+ .getDataflow());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/SaveWorkflowAsAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/SaveWorkflowAsAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/SaveWorkflowAsAction.java
new file mode 100644
index 0000000..b42fe1c
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/actions/SaveWorkflowAsAction.java
@@ -0,0 +1,218 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.actions;
+
+import static java.awt.event.KeyEvent.VK_F6;
+import static java.awt.event.KeyEvent.VK_S;
+import static javax.swing.JFileChooser.APPROVE_OPTION;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.NO_OPTION;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
+import static javax.swing.JOptionPane.YES_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.saveAsIcon;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.net.URL;
+import java.util.List;
+import java.util.prefs.Preferences;
+
+import javax.swing.AbstractAction;
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.file.events.SetCurrentDataflowEvent;
+import org.apache.taverna.workbench.file.exceptions.OverwriteException;
+import org.apache.taverna.workbench.file.exceptions.SaveException;
+import org.apache.taverna.workbench.file.impl.FileTypeFileFilter;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+@SuppressWarnings("serial")
+public class SaveWorkflowAsAction extends AbstractAction {
+ private static final String SAVE_WORKFLOW_AS = "Save workflow as...";
+ private static final String PREF_CURRENT_DIR = "currentDir";
+ private static Logger logger = Logger.getLogger(SaveWorkflowAsAction.class);
+ private FileManager fileManager;
+
+ public SaveWorkflowAsAction(FileManager fileManager) {
+ super(SAVE_WORKFLOW_AS, saveAsIcon);
+ this.fileManager = fileManager;
+ fileManager.addObserver(new FileManagerObserver());
+ putValue(ACCELERATOR_KEY, getKeyStroke(VK_F6, 0));
+ putValue(MNEMONIC_KEY, VK_S);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Component parentComponent = null;
+ if (e.getSource() instanceof Component)
+ parentComponent = (Component) e.getSource();
+ WorkflowBundle workflowBundle = fileManager.getCurrentDataflow();
+ if (workflowBundle == null) {
+ showMessageDialog(parentComponent, "No workflow open yet",
+ "No workflow to save", ERROR_MESSAGE);
+ return;
+ }
+ saveCurrentDataflow(parentComponent);
+ }
+
+ public boolean saveCurrentDataflow(Component parentComponent) {
+ WorkflowBundle workflowBundle = fileManager.getCurrentDataflow();
+ return saveDataflow(parentComponent, workflowBundle);
+ }
+
+ private String determineFileName(final WorkflowBundle workflowBundle) {
+ String result;
+ Object source = fileManager.getDataflowSource(workflowBundle);
+ String fileName = null;
+ if (source instanceof File)
+ fileName = ((File) source).getName();
+ else if (source instanceof URL)
+ fileName = ((URL) source).getPath();
+
+ if (fileName != null) {
+ int lastIndex = fileName.lastIndexOf(".");
+ if (lastIndex > 0)
+ fileName = fileName.substring(0, fileName.lastIndexOf("."));
+ result = fileName;
+ } else {
+ Workflow mainWorkflow = workflowBundle.getMainWorkflow();
+ if (mainWorkflow != null)
+ result = mainWorkflow.getName();
+ else
+ result = workflowBundle.getName();
+ }
+ return result;
+ }
+
+ public boolean saveDataflow(Component parentComponent, WorkflowBundle workflowBundle) {
+ fileManager.setCurrentDataflow(workflowBundle);
+ JFileChooser fileChooser = new JFileChooser();
+ Preferences prefs = Preferences.userNodeForPackage(getClass());
+ String curDir = prefs
+ .get(PREF_CURRENT_DIR, System.getProperty("user.home"));
+ fileChooser.setDialogTitle(SAVE_WORKFLOW_AS);
+
+ fileChooser.resetChoosableFileFilters();
+ fileChooser.setAcceptAllFileFilterUsed(false);
+
+ List<FileFilter> fileFilters = fileManager
+ .getSaveFileFilters(File.class);
+ if (fileFilters.isEmpty()) {
+ logger.warn("No file types found for saving workflow "
+ + workflowBundle);
+ showMessageDialog(parentComponent,
+ "No file types found for saving workflow.", "Error",
+ ERROR_MESSAGE);
+ return false;
+ }
+ for (FileFilter fileFilter : fileFilters)
+ fileChooser.addChoosableFileFilter(fileFilter);
+ fileChooser.setFileFilter(fileFilters.get(0));
+ fileChooser.setCurrentDirectory(new File(curDir));
+
+ File possibleName = new File(determineFileName(workflowBundle));
+ boolean tryAgain = true;
+ while (tryAgain) {
+ tryAgain = false;
+ fileChooser.setSelectedFile(possibleName);
+ int returnVal = fileChooser.showSaveDialog(parentComponent);
+ if (returnVal == APPROVE_OPTION) {
+ prefs.put(PREF_CURRENT_DIR, fileChooser.getCurrentDirectory()
+ .toString());
+ File file = fileChooser.getSelectedFile();
+ FileTypeFileFilter fileFilter = (FileTypeFileFilter) fileChooser
+ .getFileFilter();
+ FileType fileType = fileFilter.getFileType();
+ String extension = "." + fileType.getExtension();
+ if (!file.getName().toLowerCase().endsWith(extension)) {
+ String newName = file.getName() + extension;
+ file = new File(file.getParentFile(), newName);
+ }
+
+ // TODO: Open in separate thread to avoid hanging UI
+ try {
+ try {
+ fileManager.saveDataflow(workflowBundle, fileType,
+ file, true);
+ logger.info("Saved workflow " + workflowBundle + " to "
+ + file);
+ return true;
+ } catch (OverwriteException ex) {
+ logger.info("File already exists: " + file);
+ String msg = "Are you sure you want to overwrite existing file "
+ + file + "?";
+ int ret = showConfirmDialog(parentComponent, msg,
+ "File already exists", YES_NO_CANCEL_OPTION);
+ if (ret == YES_OPTION) {
+ fileManager.saveDataflow(workflowBundle, fileType,
+ file, false);
+ logger.info("Saved workflow " + workflowBundle
+ + " by overwriting " + file);
+ return true;
+ } else if (ret == NO_OPTION) {
+ tryAgain = true;
+ continue;
+ } else {
+ logger.info("Aborted overwrite of " + file);
+ return false;
+ }
+ }
+ } catch (SaveException ex) {
+ logger.warn("Could not save workflow to " + file, ex);
+ showMessageDialog(parentComponent,
+ "Could not save workflow to " + file + ": \n\n"
+ + ex.getMessage(), "Warning",
+ WARNING_MESSAGE);
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
+ protected void updateEnabledStatus(WorkflowBundle workflowBundle) {
+ setEnabled(workflowBundle != null);
+ }
+
+ private final class FileManagerObserver implements Observer<FileManagerEvent> {
+ @Override
+ public void notify(Observable<FileManagerEvent> sender,
+ FileManagerEvent message) throws Exception {
+ if (message instanceof SetCurrentDataflowEvent)
+ updateEnabledStatus(((SetCurrentDataflowEvent) message)
+ .getDataflow());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/hooks/CloseWorkflowsOnShutdown.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/hooks/CloseWorkflowsOnShutdown.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/hooks/CloseWorkflowsOnShutdown.java
new file mode 100644
index 0000000..4e495a2
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/hooks/CloseWorkflowsOnShutdown.java
@@ -0,0 +1,55 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.hooks;
+
+import org.apache.taverna.workbench.ShutdownSPI;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.impl.actions.CloseAllWorkflowsAction;
+
+/**
+ * Close open workflows (and ask the user if she wants to save changes) on
+ * shutdown.
+ *
+ * @author Stian Soiland-Reyes
+ */
+public class CloseWorkflowsOnShutdown implements ShutdownSPI {
+ private CloseAllWorkflowsAction closeAllWorkflowsAction;
+
+ public CloseWorkflowsOnShutdown(EditManager editManager,
+ FileManager fileManager) {
+ closeAllWorkflowsAction = new CloseAllWorkflowsAction(editManager,
+ fileManager);
+ }
+
+ @Override
+ public int positionHint() {
+ /*
+ * Quite early, we don't want to do various clean-up in case the user
+ * clicks Cancel
+ */
+ return 50;
+ }
+
+ @Override
+ public boolean shutdown() {
+ return closeAllWorkflowsAction.closeAllWorkflows(null);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileCloseAllMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileCloseAllMenuAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileCloseAllMenuAction.java
new file mode 100644
index 0000000..6449ba7
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileCloseAllMenuAction.java
@@ -0,0 +1,50 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.menu;
+
+import static org.apache.taverna.workbench.file.impl.menu.FileOpenMenuSection.FILE_URI;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.impl.actions.CloseAllWorkflowsAction;
+
+public class FileCloseAllMenuAction extends AbstractMenuAction {
+ private static final URI FILE_CLOSE_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#fileCloseAll");
+ private final EditManager editManager;
+ private final FileManager fileManager;
+
+ public FileCloseAllMenuAction(EditManager editManager,
+ FileManager fileManager) {
+ super(FILE_URI, 39, FILE_CLOSE_URI);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new CloseAllWorkflowsAction(editManager, fileManager);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileCloseMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileCloseMenuAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileCloseMenuAction.java
new file mode 100644
index 0000000..8579c2e
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileCloseMenuAction.java
@@ -0,0 +1,49 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.menu;
+
+import static org.apache.taverna.workbench.file.impl.menu.FileOpenMenuSection.FILE_URI;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.impl.actions.CloseWorkflowAction;
+
+public class FileCloseMenuAction extends AbstractMenuAction {
+ private static final URI FILE_CLOSE_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#fileClose");
+ private final EditManager editManager;
+ private final FileManager fileManager;
+
+ public FileCloseMenuAction(EditManager editManager, FileManager fileManager) {
+ super(FILE_URI, 30, FILE_CLOSE_URI);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new CloseWorkflowAction(editManager, fileManager);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileNewMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileNewMenuAction.java b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileNewMenuAction.java
new file mode 100644
index 0000000..691729b
--- /dev/null
+++ b/taverna-file-impl/src/main/java/org/apache/taverna/workbench/file/impl/menu/FileNewMenuAction.java
@@ -0,0 +1,46 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.file.impl.menu;
+
+import static org.apache.taverna.workbench.file.impl.menu.FileOpenMenuSection.FILE_OPEN_SECTION_URI;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.impl.actions.NewWorkflowAction;
+
+public class FileNewMenuAction extends AbstractMenuAction {
+ private static final URI FILE_NEW_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#fileNew");
+ private final FileManager fileManager;
+
+ public FileNewMenuAction(FileManager fileManager) {
+ super(FILE_OPEN_SECTION_URI, 10, FILE_NEW_URI);
+ this.fileManager = fileManager;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new NewWorkflowAction(fileManager);
+ }
+}
[09/11] incubator-taverna-workbench git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowAction.java
deleted file mode 100644
index 39f0e97..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowAction.java
+++ /dev/null
@@ -1,395 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.actions;
-
-import static java.awt.Toolkit.getDefaultToolkit;
-import static java.awt.event.KeyEvent.VK_O;
-import static java.util.prefs.Preferences.userNodeForPackage;
-import static javax.swing.JFileChooser.APPROVE_OPTION;
-import static javax.swing.JOptionPane.CANCEL_OPTION;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.QUESTION_MESSAGE;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
-import static javax.swing.JOptionPane.YES_OPTION;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.JOptionPane.showOptionDialog;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static javax.swing.SwingUtilities.invokeLater;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.openIcon;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-import java.util.prefs.Preferences;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.filechooser.FileFilter;
-
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.exceptions.OpenException;
-import net.sf.taverna.t2.workbench.file.impl.FileTypeFileFilter;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * An action for opening a workflow from a file. All file types exposed by the
- * {@link FileManager} as compatible with the {@link File} type are supported.
- *
- * @author Stian Soiland-Reyes
- */
-public class OpenWorkflowAction extends AbstractAction {
- private static final long serialVersionUID = 103237694130052153L;
- private static Logger logger = Logger.getLogger(OpenWorkflowAction.class);
- private static final String OPEN_WORKFLOW = "Open workflow...";
-
- public final OpenCallback DUMMY_OPEN_CALLBACK = new OpenCallbackAdapter();
- protected FileManager fileManager;
-
- public OpenWorkflowAction(FileManager fileManager) {
- super(OPEN_WORKFLOW, openIcon);
- this.fileManager = fileManager;
- putValue(
- ACCELERATOR_KEY,
- getKeyStroke(VK_O, getDefaultToolkit().getMenuShortcutKeyMask()));
- putValue(MNEMONIC_KEY, VK_O);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- final Component parentComponent;
- if (e.getSource() instanceof Component)
- parentComponent = (Component) e.getSource();
- else
- parentComponent = null;
- openWorkflows(parentComponent);
- }
-
- /**
- * Pop up an Open-dialogue to select one or more workflow files to open.
- * <p>
- * Note that the file opening occurs in a separate thread. If you want to
- * check if the file was opened or not, which workflow was opened, etc, use
- * {@link #openWorkflows(Component, OpenCallback)} instead.
- *
- * @see #openWorkflows(Component, OpenCallback)
- * @param parentComponent
- * The UI parent component to use for pop up dialogues
- *
- * @return <code>false</code> if no files were selected or the dialogue was
- * cancelled, or <code>true</code> if the process of opening one or
- * more files has been started.
- */
- public void openWorkflows(Component parentComponent) {
- openWorkflows(parentComponent, DUMMY_OPEN_CALLBACK);
- }
-
- /**
- * Open an array of workflow files.
- *
- * @param parentComponent
- * Parent component for UI dialogues
- * @param files
- * Array of files to be opened
- * @param fileType
- * {@link FileType} of the files that are to be opened, for
- * instance
- * {@link net.sf.taverna.t2.workbench.file.impl.T2FlowFileType},
- * or <code>null</code> to guess.
- * @param openCallback
- * An {@link OpenCallback} to be invoked during and after opening
- * the file. Use {@link OpenWorkflowAction#DUMMY_OPEN_CALLBACK}
- * if no callback is needed.
- */
- public void openWorkflows(final Component parentComponent, File[] files,
- FileType fileType, OpenCallback openCallback) {
- ErrorLoggingOpenCallbackWrapper callback = new ErrorLoggingOpenCallbackWrapper(
- openCallback);
- for (File file : files)
- try {
- Object canonicalSource = fileManager.getCanonical(file);
- WorkflowBundle alreadyOpen = fileManager.getDataflowBySource(canonicalSource);
- if (alreadyOpen != null) {
- /*
- * The workflow from the same source is already opened - ask
- * the user if they want to switch to it or open another
- * copy...
- */
-
- Object[] options = { "Switch to opened", "Open new copy",
- "Cancel" };
- switch (showOptionDialog(
- null,
- "The workflow from the same location is already opened.\n"
- + "Do you want to switch to it or open a new copy?",
- "File Manager Alert", YES_NO_CANCEL_OPTION,
- QUESTION_MESSAGE, null, options, // the titles of buttons
- options[0])) { // default button title
- case YES_OPTION:
- fileManager.setCurrentDataflow(alreadyOpen);
- return;
- case CANCEL_OPTION:
- // do nothing
- return;
- }
- // else open the workflow as usual
- }
-
- callback.aboutToOpenDataflow(file);
- WorkflowBundle workflowBundle = fileManager.openDataflow(fileType, file);
- callback.openedDataflow(file, workflowBundle);
- } catch (RuntimeException ex) {
- logger.warn("Failed to open workflow from " + file, ex);
- if (!callback.couldNotOpenDataflow(file, ex))
- showErrorMessage(parentComponent, file, ex);
- } catch (Exception ex) {
- logger.warn("Failed to open workflow from " + file, ex);
- if (!callback.couldNotOpenDataflow(file, ex))
- showErrorMessage(parentComponent, file, ex);
- return;
- }
- }
-
- /**
- * Pop up an Open-dialogue to select one or more workflow files to open.
- *
- * @param parentComponent
- * The UI parent component to use for pop up dialogues
- * @param openCallback
- * An {@link OpenCallback} to be called during the file opening.
- * The callback will be invoked for each file that has been
- * opened, as file opening happens in a separate thread that
- * might execute after the return of this method.
- * @return <code>false</code> if no files were selected or the dialogue was
- * cancelled, or <code>true</code> if the process of opening one or
- * more files has been started.
- */
- public boolean openWorkflows(final Component parentComponent,
- OpenCallback openCallback) {
- JFileChooser fileChooser = new JFileChooser();
- Preferences prefs = userNodeForPackage(getClass());
- String curDir = prefs
- .get("currentDir", System.getProperty("user.home"));
- fileChooser.setDialogTitle(OPEN_WORKFLOW);
-
- fileChooser.resetChoosableFileFilters();
- fileChooser.setAcceptAllFileFilterUsed(false);
- List<FileFilter> fileFilters = fileManager.getOpenFileFilters();
- if (fileFilters.isEmpty()) {
- logger.warn("No file types found for opening workflow");
- showMessageDialog(parentComponent,
- "No file types found for opening workflow.", "Error",
- ERROR_MESSAGE);
- return false;
- }
- for (FileFilter fileFilter : fileFilters)
- fileChooser.addChoosableFileFilter(fileFilter);
- fileChooser.setFileFilter(fileFilters.get(0));
- fileChooser.setCurrentDirectory(new File(curDir));
- fileChooser.setMultiSelectionEnabled(true);
-
- int returnVal = fileChooser.showOpenDialog(parentComponent);
- if (returnVal == APPROVE_OPTION) {
- prefs.put("currentDir", fileChooser.getCurrentDirectory()
- .toString());
- final File[] selectedFiles = fileChooser.getSelectedFiles();
- if (selectedFiles.length == 0) {
- logger.warn("No files selected");
- return false;
- }
- FileFilter fileFilter = fileChooser.getFileFilter();
- FileType fileType;
- if (fileFilter instanceof FileTypeFileFilter)
- fileType = ((FileTypeFileFilter) fileChooser.getFileFilter())
- .getFileType();
- else
- // Unknown filetype, try all of them
- fileType = null;
- new FileOpenerThread(parentComponent, selectedFiles, fileType,
- openCallback).start();
- return true;
- }
- return false;
- }
-
- /**
- * Show an error message if a file could not be opened
- *
- * @param parentComponent
- * @param file
- * @param throwable
- */
- protected void showErrorMessage(final Component parentComponent,
- final File file, final Throwable throwable) {
- invokeLater(new Runnable() {
- @Override
- public void run() {
- Throwable cause = throwable;
- while (cause.getCause() != null)
- cause = cause.getCause();
- showMessageDialog(
- parentComponent,
- "Failed to open workflow from " + file + ": \n"
- + cause.getMessage(), "Warning",
- WARNING_MESSAGE);
- }
- });
-
- }
-
- /**
- * Callback interface for openWorkflows().
- * <p>
- * The callback will be invoked during the invocation of
- * {@link OpenWorkflowAction#openWorkflows(Component, OpenCallback)} and
- * {@link OpenWorkflowAction#openWorkflows(Component, File[], FileType, OpenCallback)}
- * as file opening happens in a separate thread.
- *
- * @author Stian Soiland-Reyes
- */
- public interface OpenCallback {
- /**
- * Called before a workflowBundle is to be opened from the given file
- *
- * @param file
- * File which workflowBundle is to be opened
- */
- void aboutToOpenDataflow(File file);
-
- /**
- * Called if an exception happened while attempting to open the
- * workflowBundle.
- *
- * @param file
- * File which was attempted to be opened
- * @param ex
- * An {@link OpenException} or a {@link RuntimeException}.
- * @return <code>true</code> if the error has been handled, or
- * <code>false</code>3 if a UI warning dialogue is to be opened.
- */
- boolean couldNotOpenDataflow(File file, Exception ex);
-
- /**
- * Called when a workflowBundle has been successfully opened. The workflowBundle
- * will be registered in {@link FileManager#getOpenDataflows()}.
- *
- * @param file
- * File from which workflowBundle was opened
- * @param workflowBundle
- * WorkflowBundle that was opened
- */
- void openedDataflow(File file, WorkflowBundle workflowBundle);
- }
-
- /**
- * Adapter for {@link OpenCallback}
- *
- * @author Stian Soiland-Reyes
- */
- public static class OpenCallbackAdapter implements OpenCallback {
- @Override
- public void aboutToOpenDataflow(File file) {
- }
-
- @Override
- public boolean couldNotOpenDataflow(File file, Exception ex) {
- return false;
- }
-
- @Override
- public void openedDataflow(File file, WorkflowBundle workflowBundle) {
- }
- }
-
- private final class FileOpenerThread extends Thread {
- private final File[] files;
- private final FileType fileType;
- private final OpenCallback openCallback;
- private final Component parentComponent;
-
- private FileOpenerThread(Component parentComponent,
- File[] selectedFiles, FileType fileType,
- OpenCallback openCallback) {
- super("Opening workflows(s) " + Arrays.asList(selectedFiles));
- this.parentComponent = parentComponent;
- this.files = selectedFiles;
- this.fileType = fileType;
- this.openCallback = openCallback;
- }
-
- @Override
- public void run() {
- openWorkflows(parentComponent, files, fileType, openCallback);
- }
- }
-
- /**
- * A wrapper for {@link OpenCallback} implementations that logs exceptions
- * thrown without disrupting the caller of the callback.
- *
- * @author Stian Soiland-Reyes
- */
- protected class ErrorLoggingOpenCallbackWrapper implements OpenCallback {
- private final OpenCallback wrapped;
-
- public ErrorLoggingOpenCallbackWrapper(OpenCallback wrapped) {
- this.wrapped = wrapped;
- }
-
- @Override
- public void aboutToOpenDataflow(File file) {
- try {
- wrapped.aboutToOpenDataflow(file);
- } catch (RuntimeException wrapperEx) {
- logger.warn("Failed OpenCallback " + wrapped
- + ".aboutToOpenDataflow(File)", wrapperEx);
- }
- }
-
- @Override
- public boolean couldNotOpenDataflow(File file, Exception ex) {
- try {
- return wrapped.couldNotOpenDataflow(file, ex);
- } catch (RuntimeException wrapperEx) {
- logger.warn("Failed OpenCallback " + wrapped
- + ".couldNotOpenDataflow(File, Exception)", wrapperEx);
- return false;
- }
- }
-
- @Override
- public void openedDataflow(File file, WorkflowBundle workflowBundle) {
- try {
- wrapped.openedDataflow(file, workflowBundle);
- } catch (RuntimeException wrapperEx) {
- logger.warn("Failed OpenCallback " + wrapped
- + ".openedDataflow(File, Dataflow)", wrapperEx);
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowFromURLAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowFromURLAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowFromURLAction.java
deleted file mode 100644
index 83efa74..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowFromURLAction.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2008 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.actions;
-
-import static java.awt.Toolkit.getDefaultToolkit;
-import static java.awt.event.KeyEvent.VK_L;
-import static javax.swing.JOptionPane.CANCEL_OPTION;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.QUESTION_MESSAGE;
-import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
-import static javax.swing.JOptionPane.YES_OPTION;
-import static javax.swing.JOptionPane.showInputDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.JOptionPane.showOptionDialog;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.openurlIcon;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.net.URL;
-import java.util.prefs.Preferences;
-
-import javax.swing.AbstractAction;
-
-import org.apache.taverna.workbench.file.FileManager;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * An action for opening a workflow from a url.
- *
- * @author David Withers
- */
-public class OpenWorkflowFromURLAction extends AbstractAction {
- private static final long serialVersionUID = 1474356457949961974L;
- private static Logger logger = Logger
- .getLogger(OpenWorkflowFromURLAction.class);
- private static Preferences prefs = Preferences
- .userNodeForPackage(OpenWorkflowFromURLAction.class);
- private static final String PREF_CURRENT_URL = "currentUrl";
- private static final String ACTION_NAME = "Open workflow location...";
- private static final String ACTION_DESCRIPTION = "Open a workflow from the web into a new workflow";
-
- private Component component;
- private FileManager fileManager;
-
- public OpenWorkflowFromURLAction(final Component component,
- FileManager fileManager) {
- this.component = component;
- this.fileManager = fileManager;
- putValue(SMALL_ICON, openurlIcon);
- putValue(NAME, ACTION_NAME);
- putValue(SHORT_DESCRIPTION, ACTION_DESCRIPTION);
- putValue(MNEMONIC_KEY, VK_L);
- putValue(
- ACCELERATOR_KEY,
- getKeyStroke(VK_L, getDefaultToolkit().getMenuShortcutKeyMask()));
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- String currentUrl = prefs.get(PREF_CURRENT_URL, "http://");
-
- final String url = (String) showInputDialog(component,
- "Enter the URL of a workflow definition to load",
- "Workflow URL", QUESTION_MESSAGE, null, null, currentUrl);
- if (url != null)
- new Thread("OpenWorkflowFromURLAction") {
- @Override
- public void run() {
- openFromURL(url);
- }
- }.start();
- }
-
- private void openFromURL(String urlString) {
- try {
- URL url = new URL(urlString);
-
- Object canonicalSource = fileManager.getCanonical(url);
- WorkflowBundle alreadyOpen = fileManager
- .getDataflowBySource(canonicalSource);
- if (alreadyOpen != null) {
- /*
- * The workflow from the same source is already opened - ask the
- * user if they want to switch to it or open another copy.
- */
-
- Object[] options = { "Switch to opened", "Open new copy",
- "Cancel" };
- int iSelected = showOptionDialog(
- null,
- "The workflow from the same location is already opened.\n"
- + "Do you want to switch to it or open a new copy?",
- "File Manager Alert", YES_NO_CANCEL_OPTION,
- QUESTION_MESSAGE, null, options, // the titles of buttons
- options[0]); // default button title
-
- if (iSelected == YES_OPTION) {
- fileManager.setCurrentDataflow(alreadyOpen);
- return;
- } else if (iSelected == CANCEL_OPTION) {
- // do nothing
- return;
- }
- // else open the workflow as usual
- }
-
- fileManager.openDataflow(null, url);
- prefs.put(PREF_CURRENT_URL, urlString);
- } catch (Exception ex) {
- logger.warn("Failed to open the workflow from url " + urlString
- + " \n", ex);
- showMessageDialog(component,
- "Failed to open the workflow from url " + urlString + " \n"
- + ex.getMessage(), "Error!", ERROR_MESSAGE);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/PasswordInput.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/PasswordInput.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/PasswordInput.java
deleted file mode 100644
index c4fdc0f..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/PasswordInput.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.actions;
-
-import static java.awt.EventQueue.invokeLater;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPasswordField;
-import javax.swing.JTextField;
-
-import org.apache.taverna.workbench.helper.HelpEnabledDialog;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.log4j.Logger;
-
-/**
- * Simple dialogue to handle username/password input for workflow URL requiring
- * http authentication.
- *
- * @author Stuart Owen
- * @author Stian Soiland-Reyes
- * @author Alan R Williams
- */
-@SuppressWarnings("serial")
-public class PasswordInput extends HelpEnabledDialog {
- private static Logger logger = Logger.getLogger(PasswordInput.class);
-
- private String password = null;
- private String username = null;
- private URL url = null;
- private int tryCount = 0;
- private final static int MAX_TRIES = 3;
-
- private JButton cancelButton;
- private JLabel jLabel1;
- private JLabel jLabel2;
- private JLabel messageLabel;
- private JButton okButton;
- private JPasswordField passwordTextField;
- private JLabel urlLabel;
- private JTextField usernameTextField;
-
- public void setUrl(URL url) {
- this.url = url;
- urlLabel.setText(url.toExternalForm());
- }
-
- public String getPassword() {
- return password;
- }
-
- public String getUsername() {
- return username;
- }
-
- public PasswordInput(JFrame parent) {
- super(parent, "Authorization", true, null);
- initComponents();
- }
-
- /** Creates new form PasswordInput */
- public PasswordInput() {
- super((JFrame) null, "Authorization", true, null);
- initComponents();
- }
-
- /**
- * This method is called from within the constructor to initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is always
- * regenerated by the Form Editor.
- */
- private void initComponents() {
- usernameTextField = new javax.swing.JTextField();
- cancelButton = new javax.swing.JButton();
- okButton = new javax.swing.JButton();
- passwordTextField = new javax.swing.JPasswordField();
- jLabel1 = new javax.swing.JLabel();
- jLabel2 = new javax.swing.JLabel();
- messageLabel = new javax.swing.JLabel();
- urlLabel = new javax.swing.JLabel();
-
- getContentPane().setLayout(null);
-
- setModal(true);
- // setResizable(false);
- getContentPane().add(usernameTextField);
- usernameTextField.setBounds(20, 80, 280, 22);
-
- cancelButton.setText("Cancel");
- cancelButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent evt) {
- cancelButtonActionPerformed(evt);
- }
- });
-
- getContentPane().add(cancelButton);
- cancelButton.setBounds(230, 160, 75, 29);
-
- okButton.setText("OK");
- okButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent evt) {
- okButtonActionPerformed(evt);
- }
- });
-
- getContentPane().add(okButton);
- okButton.setBounds(150, 160, 75, 29);
-
- getContentPane().add(passwordTextField);
- passwordTextField.setBounds(20, 130, 280, 22);
-
- jLabel1.setText("Username");
- getContentPane().add(jLabel1);
- jLabel1.setBounds(20, 60, 70, 16);
-
- jLabel2.setText("Password");
- getContentPane().add(jLabel2);
- jLabel2.setBounds(20, 110, 70, 16);
-
- messageLabel.setText("A username and password is required for:");
- getContentPane().add(messageLabel);
- messageLabel.setBounds(20, 10, 270, 20);
-
- urlLabel.setText("service");
- getContentPane().add(urlLabel);
- urlLabel.setBounds(20, 30, 270, 16);
-
- pack();
- }
-
- private void okButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
- String password = String.valueOf(passwordTextField.getPassword());
- String username = usernameTextField.getText();
- HttpURLConnection connection;
- try {
- connection = (HttpURLConnection) url.openConnection();
- String userPassword = username + ":" + password;
- /*
- * Note: non-latin1 support for basic auth is fragile/unsupported
- * and must be MIME-encoded (RFC2047) according to
- * https://bugzilla.mozilla.org/show_bug.cgi?id=41489
- */
- byte[] encoded = Base64.encodeBase64(userPassword
- .getBytes("latin1"));
- connection.setRequestProperty("Authorization", "Basic "
- + new String(encoded, "ascii"));
- connection.setRequestProperty("Accept", "text/xml");
- int code = connection.getResponseCode();
-
- /*
- * NB: myExperiment gives a 500 response for an invalid
- * username/password
- */
- if (code == 401 || code == 500) {
- tryCount++;
- showMessageDialog(this, "The username and password failed",
- "Invalid username or password", ERROR_MESSAGE);
- if (tryCount >= MAX_TRIES) { // close after 3 attempts.
- this.password = null;
- this.username = null;
- this.setVisible(false);
- }
- } else {
- this.username = username;
- this.password = password;
- this.setVisible(false);
- }
- } catch (IOException ex) {
- logger.error("Could not get password", ex);
- }
- }
-
- private void cancelButtonActionPerformed(ActionEvent evt) {
- this.password = null;
- this.username = null;
- this.setVisible(false);
- }
-
- /**
- * @param args
- * the command line arguments
- */
- public static void main(String args[]) {
- invokeLater(new Runnable() {
- @Override
- public void run() {
- new PasswordInput().setVisible(true);
- }
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveAllWorkflowsAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveAllWorkflowsAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveAllWorkflowsAction.java
deleted file mode 100644
index 1bd8a7a..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveAllWorkflowsAction.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.actions;
-
-import static java.awt.Toolkit.getDefaultToolkit;
-import static java.awt.event.InputEvent.SHIFT_DOWN_MASK;
-import static java.awt.event.KeyEvent.VK_A;
-import static java.awt.event.KeyEvent.VK_S;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.saveAllIcon;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.util.Collections;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.events.FileManagerEvent;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-@SuppressWarnings("serial")
-public class SaveAllWorkflowsAction extends AbstractAction {
- private final class FileManagerObserver implements
- Observer<FileManagerEvent> {
- @Override
- public void notify(Observable<FileManagerEvent> sender,
- FileManagerEvent message) throws Exception {
- updateEnabled();
- }
- }
-
- @SuppressWarnings("unused")
- private static Logger logger = Logger
- .getLogger(SaveAllWorkflowsAction.class);
- private static final String SAVE_ALL_WORKFLOWS = "Save all workflows";
-
- private final SaveWorkflowAction saveWorkflowAction;
- private FileManager fileManager;
- private FileManagerObserver fileManagerObserver = new FileManagerObserver();
-
- public SaveAllWorkflowsAction(EditManager editManager,
- FileManager fileManager) {
- super(SAVE_ALL_WORKFLOWS, saveAllIcon);
- this.fileManager = fileManager;
- saveWorkflowAction = new SaveWorkflowAction(editManager, fileManager);
- putValue(
- ACCELERATOR_KEY,
- getKeyStroke(VK_S, getDefaultToolkit().getMenuShortcutKeyMask()
- | SHIFT_DOWN_MASK));
- putValue(MNEMONIC_KEY, VK_A);
-
- fileManager.addObserver(fileManagerObserver);
- updateEnabled();
- }
-
- public void updateEnabled() {
- setEnabled(!(fileManager.getOpenDataflows().isEmpty()));
- }
-
- @Override
- public void actionPerformed(ActionEvent ev) {
- Component parentComponent = null;
- if (ev.getSource() instanceof Component)
- parentComponent = (Component) ev.getSource();
- saveAllDataflows(parentComponent);
- }
-
- public void saveAllDataflows(Component parentComponent) {
- // Save in reverse so we save nested workflows first
- List<WorkflowBundle> workflowBundles = fileManager.getOpenDataflows();
- Collections.reverse(workflowBundles);
-
- for (WorkflowBundle workflowBundle : workflowBundles)
- if (!saveWorkflowAction.saveDataflow(parentComponent,
- workflowBundle))
- break;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAction.java
deleted file mode 100644
index f4291e7..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAction.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.actions;
-
-import static java.awt.Toolkit.getDefaultToolkit;
-import static java.awt.event.KeyEvent.VK_S;
-import static javax.swing.JOptionPane.NO_OPTION;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
-import static javax.swing.JOptionPane.YES_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.saveIcon;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.edits.EditManager.AbstractDataflowEditEvent;
-import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.events.FileManagerEvent;
-import org.apache.taverna.workbench.file.events.SavedDataflowEvent;
-import org.apache.taverna.workbench.file.events.SetCurrentDataflowEvent;
-import org.apache.taverna.workbench.file.exceptions.OverwriteException;
-import org.apache.taverna.workbench.file.exceptions.SaveException;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-@SuppressWarnings("serial")
-public class SaveWorkflowAction extends AbstractAction {
- private static Logger logger = Logger.getLogger(SaveWorkflowAction.class);
- private static final String SAVE_WORKFLOW = "Save workflow";
-
- private final SaveWorkflowAsAction saveWorkflowAsAction;
- private EditManagerObserver editManagerObserver = new EditManagerObserver();
- private FileManager fileManager;
- private FileManagerObserver fileManagerObserver = new FileManagerObserver();
-
- public SaveWorkflowAction(EditManager editManager, FileManager fileManager) {
- super(SAVE_WORKFLOW, saveIcon);
- this.fileManager = fileManager;
- saveWorkflowAsAction = new SaveWorkflowAsAction(fileManager);
- putValue(
- ACCELERATOR_KEY,
- getKeyStroke(VK_S, getDefaultToolkit().getMenuShortcutKeyMask()));
- putValue(MNEMONIC_KEY, VK_S);
- editManager.addObserver(editManagerObserver);
- fileManager.addObserver(fileManagerObserver);
- updateEnabledStatus(fileManager.getCurrentDataflow());
- }
-
- @Override
- public void actionPerformed(ActionEvent ev) {
- Component parentComponent = null;
- if (ev.getSource() instanceof Component)
- parentComponent = (Component) ev.getSource();
- saveCurrentDataflow(parentComponent);
- }
-
- public boolean saveCurrentDataflow(Component parentComponent) {
- WorkflowBundle workflowBundle = fileManager.getCurrentDataflow();
- return saveDataflow(parentComponent, workflowBundle);
- }
-
- public boolean saveDataflow(Component parentComponent,
- WorkflowBundle workflowBundle) {
- if (!fileManager.canSaveWithoutDestination(workflowBundle))
- return saveWorkflowAsAction.saveDataflow(parentComponent,
- workflowBundle);
-
- try {
- try {
- fileManager.saveDataflow(workflowBundle, true);
- Object workflowBundleSource = fileManager
- .getDataflowSource(workflowBundle);
- logger.info("Saved workflow " + workflowBundle + " to "
- + workflowBundleSource);
- return true;
- } catch (OverwriteException ex) {
- Object workflowBundleSource = fileManager
- .getDataflowSource(workflowBundle);
- logger.info("Workflow was changed on source: "
- + workflowBundleSource);
- fileManager.setCurrentDataflow(workflowBundle);
- String msg = "Workflow destination " + workflowBundleSource
- + " has been changed from elsewhere, "
- + "are you sure you want to overwrite?";
- int ret = showConfirmDialog(parentComponent, msg,
- "Workflow changed", YES_NO_CANCEL_OPTION);
- if (ret == YES_OPTION) {
- fileManager.saveDataflow(workflowBundle, false);
- logger.info("Saved workflow " + workflowBundle
- + " by overwriting " + workflowBundleSource);
- return true;
- } else if (ret == NO_OPTION) {
- // Pop up Save As instead to choose another name
- return saveWorkflowAsAction.saveDataflow(parentComponent,
- workflowBundle);
- } else {
- logger.info("Aborted overwrite of " + workflowBundleSource);
- return false;
- }
- }
- } catch (SaveException ex) {
- logger.warn("Could not save workflow " + workflowBundle, ex);
- showMessageDialog(parentComponent, "Could not save workflow: \n\n"
- + ex.getMessage(), "Warning", WARNING_MESSAGE);
- return false;
- } catch (RuntimeException ex) {
- logger.warn("Could not save workflow " + workflowBundle, ex);
- showMessageDialog(parentComponent, "Could not save workflow: \n\n"
- + ex.getMessage(), "Warning", WARNING_MESSAGE);
- return false;
- }
- }
-
- protected void updateEnabledStatus(WorkflowBundle workflowBundle) {
- setEnabled(workflowBundle != null
- && fileManager.isDataflowChanged(workflowBundle));
- }
-
- private final class EditManagerObserver implements
- Observer<EditManagerEvent> {
- @Override
- public void notify(Observable<EditManagerEvent> sender,
- EditManagerEvent message) throws Exception {
- if (message instanceof AbstractDataflowEditEvent) {
- WorkflowBundle workflowBundle = ((AbstractDataflowEditEvent) message)
- .getDataFlow();
- if (workflowBundle == fileManager.getCurrentDataflow())
- updateEnabledStatus(workflowBundle);
- }
- }
- }
-
- private final class FileManagerObserver implements
- Observer<FileManagerEvent> {
- @Override
- public void notify(Observable<FileManagerEvent> sender,
- FileManagerEvent message) throws Exception {
- if (message instanceof SavedDataflowEvent)
- updateEnabledStatus(((SavedDataflowEvent) message)
- .getDataflow());
- else if (message instanceof SetCurrentDataflowEvent)
- updateEnabledStatus(((SetCurrentDataflowEvent) message)
- .getDataflow());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAsAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAsAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAsAction.java
deleted file mode 100644
index 8833e16..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAsAction.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.actions;
-
-import static java.awt.event.KeyEvent.VK_F6;
-import static java.awt.event.KeyEvent.VK_S;
-import static javax.swing.JFileChooser.APPROVE_OPTION;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.NO_OPTION;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
-import static javax.swing.JOptionPane.YES_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static org.apache.taverna.workbench.icons.WorkbenchIcons.saveAsIcon;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.net.URL;
-import java.util.List;
-import java.util.prefs.Preferences;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.filechooser.FileFilter;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.events.FileManagerEvent;
-import org.apache.taverna.workbench.file.events.SetCurrentDataflowEvent;
-import org.apache.taverna.workbench.file.exceptions.OverwriteException;
-import org.apache.taverna.workbench.file.exceptions.SaveException;
-import net.sf.taverna.t2.workbench.file.impl.FileTypeFileFilter;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-@SuppressWarnings("serial")
-public class SaveWorkflowAsAction extends AbstractAction {
- private static final String SAVE_WORKFLOW_AS = "Save workflow as...";
- private static final String PREF_CURRENT_DIR = "currentDir";
- private static Logger logger = Logger.getLogger(SaveWorkflowAsAction.class);
- private FileManager fileManager;
-
- public SaveWorkflowAsAction(FileManager fileManager) {
- super(SAVE_WORKFLOW_AS, saveAsIcon);
- this.fileManager = fileManager;
- fileManager.addObserver(new FileManagerObserver());
- putValue(ACCELERATOR_KEY, getKeyStroke(VK_F6, 0));
- putValue(MNEMONIC_KEY, VK_S);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- Component parentComponent = null;
- if (e.getSource() instanceof Component)
- parentComponent = (Component) e.getSource();
- WorkflowBundle workflowBundle = fileManager.getCurrentDataflow();
- if (workflowBundle == null) {
- showMessageDialog(parentComponent, "No workflow open yet",
- "No workflow to save", ERROR_MESSAGE);
- return;
- }
- saveCurrentDataflow(parentComponent);
- }
-
- public boolean saveCurrentDataflow(Component parentComponent) {
- WorkflowBundle workflowBundle = fileManager.getCurrentDataflow();
- return saveDataflow(parentComponent, workflowBundle);
- }
-
- private String determineFileName(final WorkflowBundle workflowBundle) {
- String result;
- Object source = fileManager.getDataflowSource(workflowBundle);
- String fileName = null;
- if (source instanceof File)
- fileName = ((File) source).getName();
- else if (source instanceof URL)
- fileName = ((URL) source).getPath();
-
- if (fileName != null) {
- int lastIndex = fileName.lastIndexOf(".");
- if (lastIndex > 0)
- fileName = fileName.substring(0, fileName.lastIndexOf("."));
- result = fileName;
- } else {
- Workflow mainWorkflow = workflowBundle.getMainWorkflow();
- if (mainWorkflow != null)
- result = mainWorkflow.getName();
- else
- result = workflowBundle.getName();
- }
- return result;
- }
-
- public boolean saveDataflow(Component parentComponent, WorkflowBundle workflowBundle) {
- fileManager.setCurrentDataflow(workflowBundle);
- JFileChooser fileChooser = new JFileChooser();
- Preferences prefs = Preferences.userNodeForPackage(getClass());
- String curDir = prefs
- .get(PREF_CURRENT_DIR, System.getProperty("user.home"));
- fileChooser.setDialogTitle(SAVE_WORKFLOW_AS);
-
- fileChooser.resetChoosableFileFilters();
- fileChooser.setAcceptAllFileFilterUsed(false);
-
- List<FileFilter> fileFilters = fileManager
- .getSaveFileFilters(File.class);
- if (fileFilters.isEmpty()) {
- logger.warn("No file types found for saving workflow "
- + workflowBundle);
- showMessageDialog(parentComponent,
- "No file types found for saving workflow.", "Error",
- ERROR_MESSAGE);
- return false;
- }
- for (FileFilter fileFilter : fileFilters)
- fileChooser.addChoosableFileFilter(fileFilter);
- fileChooser.setFileFilter(fileFilters.get(0));
- fileChooser.setCurrentDirectory(new File(curDir));
-
- File possibleName = new File(determineFileName(workflowBundle));
- boolean tryAgain = true;
- while (tryAgain) {
- tryAgain = false;
- fileChooser.setSelectedFile(possibleName);
- int returnVal = fileChooser.showSaveDialog(parentComponent);
- if (returnVal == APPROVE_OPTION) {
- prefs.put(PREF_CURRENT_DIR, fileChooser.getCurrentDirectory()
- .toString());
- File file = fileChooser.getSelectedFile();
- FileTypeFileFilter fileFilter = (FileTypeFileFilter) fileChooser
- .getFileFilter();
- FileType fileType = fileFilter.getFileType();
- String extension = "." + fileType.getExtension();
- if (!file.getName().toLowerCase().endsWith(extension)) {
- String newName = file.getName() + extension;
- file = new File(file.getParentFile(), newName);
- }
-
- // TODO: Open in separate thread to avoid hanging UI
- try {
- try {
- fileManager.saveDataflow(workflowBundle, fileType,
- file, true);
- logger.info("Saved workflow " + workflowBundle + " to "
- + file);
- return true;
- } catch (OverwriteException ex) {
- logger.info("File already exists: " + file);
- String msg = "Are you sure you want to overwrite existing file "
- + file + "?";
- int ret = showConfirmDialog(parentComponent, msg,
- "File already exists", YES_NO_CANCEL_OPTION);
- if (ret == YES_OPTION) {
- fileManager.saveDataflow(workflowBundle, fileType,
- file, false);
- logger.info("Saved workflow " + workflowBundle
- + " by overwriting " + file);
- return true;
- } else if (ret == NO_OPTION) {
- tryAgain = true;
- continue;
- } else {
- logger.info("Aborted overwrite of " + file);
- return false;
- }
- }
- } catch (SaveException ex) {
- logger.warn("Could not save workflow to " + file, ex);
- showMessageDialog(parentComponent,
- "Could not save workflow to " + file + ": \n\n"
- + ex.getMessage(), "Warning",
- WARNING_MESSAGE);
- return false;
- }
- }
- }
- return false;
- }
-
- protected void updateEnabledStatus(WorkflowBundle workflowBundle) {
- setEnabled(workflowBundle != null);
- }
-
- private final class FileManagerObserver implements Observer<FileManagerEvent> {
- @Override
- public void notify(Observable<FileManagerEvent> sender,
- FileManagerEvent message) throws Exception {
- if (message instanceof SetCurrentDataflowEvent)
- updateEnabledStatus(((SetCurrentDataflowEvent) message)
- .getDataflow());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/hooks/CloseWorkflowsOnShutdown.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/hooks/CloseWorkflowsOnShutdown.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/hooks/CloseWorkflowsOnShutdown.java
deleted file mode 100644
index 99d326a..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/hooks/CloseWorkflowsOnShutdown.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2010 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.hooks;
-
-import org.apache.taverna.workbench.ShutdownSPI;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.actions.CloseAllWorkflowsAction;
-
-/**
- * Close open workflows (and ask the user if she wants to save changes) on
- * shutdown.
- *
- * @author Stian Soiland-Reyes
- */
-public class CloseWorkflowsOnShutdown implements ShutdownSPI {
- private CloseAllWorkflowsAction closeAllWorkflowsAction;
-
- public CloseWorkflowsOnShutdown(EditManager editManager,
- FileManager fileManager) {
- closeAllWorkflowsAction = new CloseAllWorkflowsAction(editManager,
- fileManager);
- }
-
- @Override
- public int positionHint() {
- /*
- * Quite early, we don't want to do various clean-up in case the user
- * clicks Cancel
- */
- return 50;
- }
-
- @Override
- public boolean shutdown() {
- return closeAllWorkflowsAction.closeAllWorkflows(null);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseAllMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseAllMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseAllMenuAction.java
deleted file mode 100644
index 68aade2..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseAllMenuAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.menu;
-
-import static net.sf.taverna.t2.workbench.file.impl.menu.FileOpenMenuSection.FILE_URI;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.actions.CloseAllWorkflowsAction;
-
-public class FileCloseAllMenuAction extends AbstractMenuAction {
- private static final URI FILE_CLOSE_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#fileCloseAll");
- private final EditManager editManager;
- private final FileManager fileManager;
-
- public FileCloseAllMenuAction(EditManager editManager,
- FileManager fileManager) {
- super(FILE_URI, 39, FILE_CLOSE_URI);
- this.editManager = editManager;
- this.fileManager = fileManager;
- }
-
- @Override
- protected Action createAction() {
- return new CloseAllWorkflowsAction(editManager, fileManager);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseMenuAction.java
deleted file mode 100644
index 1af3d07..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseMenuAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.menu;
-
-import static net.sf.taverna.t2.workbench.file.impl.menu.FileOpenMenuSection.FILE_URI;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.actions.CloseWorkflowAction;
-
-public class FileCloseMenuAction extends AbstractMenuAction {
- private static final URI FILE_CLOSE_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#fileClose");
- private final EditManager editManager;
- private final FileManager fileManager;
-
- public FileCloseMenuAction(EditManager editManager, FileManager fileManager) {
- super(FILE_URI, 30, FILE_CLOSE_URI);
- this.editManager = editManager;
- this.fileManager = fileManager;
- }
-
- @Override
- protected Action createAction() {
- return new CloseWorkflowAction(editManager, fileManager);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileNewMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileNewMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileNewMenuAction.java
deleted file mode 100644
index 5a3cd2f..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileNewMenuAction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.menu;
-
-import static net.sf.taverna.t2.workbench.file.impl.menu.FileOpenMenuSection.FILE_OPEN_SECTION_URI;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.actions.NewWorkflowAction;
-
-public class FileNewMenuAction extends AbstractMenuAction {
- private static final URI FILE_NEW_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#fileNew");
- private final FileManager fileManager;
-
- public FileNewMenuAction(FileManager fileManager) {
- super(FILE_OPEN_SECTION_URI, 10, FILE_NEW_URI);
- this.fileManager = fileManager;
- }
-
- @Override
- protected Action createAction() {
- return new NewWorkflowAction(fileManager);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenFromURLMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenFromURLMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenFromURLMenuAction.java
deleted file mode 100644
index 7dc3bbc..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenFromURLMenuAction.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.menu;
-
-import static net.sf.taverna.t2.workbench.file.impl.menu.FileOpenMenuSection.FILE_OPEN_SECTION_URI;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.actions.OpenWorkflowFromURLAction;
-
-public class FileOpenFromURLMenuAction extends AbstractMenuAction {
-
- private static final URI FILE_OPEN_FROM_URL_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#fileOpenURL");
- private final FileManager fileManager;
-
- public FileOpenFromURLMenuAction(FileManager fileManager) {
- super(FILE_OPEN_SECTION_URI, 30, FILE_OPEN_FROM_URL_URI);
- this.fileManager = fileManager;
- }
-
- @Override
- protected Action createAction() {
- return new OpenWorkflowFromURLAction(null, fileManager);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuAction.java
deleted file mode 100644
index d3c26ed..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuAction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.menu;
-
-import static net.sf.taverna.t2.workbench.file.impl.menu.FileOpenMenuSection.FILE_OPEN_SECTION_URI;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.actions.OpenWorkflowAction;
-
-public class FileOpenMenuAction extends AbstractMenuAction {
- private static final URI FILE_OPEN_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#fileOpen");
- private final FileManager fileManager;
-
- public FileOpenMenuAction(FileManager fileManager) {
- super(FILE_OPEN_SECTION_URI, 20, FILE_OPEN_URI);
- this.fileManager = fileManager;
- }
-
- @Override
- protected Action createAction() {
- return new OpenWorkflowAction(fileManager);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuSection.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuSection.java
deleted file mode 100644
index 73bfa2b..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuSection.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.menu;
-
-import java.net.URI;
-
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-public class FileOpenMenuSection extends AbstractMenuSection {
- public static final URI FILE_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#file");
- public static final URI FILE_OPEN_SECTION_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#fileOpenSection");
-
- public FileOpenMenuSection() {
- super(FILE_URI, 20, FILE_OPEN_SECTION_URI);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenRecentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenRecentMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenRecentMenuAction.java
deleted file mode 100644
index 3c49adf..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenRecentMenuAction.java
+++ /dev/null
@@ -1,418 +0,0 @@
-package net.sf.taverna.t2.workbench.file.impl.menu;
-
-import static java.awt.event.KeyEvent.VK_0;
-import static java.awt.event.KeyEvent.VK_R;
-import static javax.swing.Action.MNEMONIC_KEY;
-import static javax.swing.Action.NAME;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.SwingUtilities.invokeLater;
-import static net.sf.taverna.t2.workbench.file.impl.menu.FileOpenMenuSection.FILE_OPEN_SECTION_URI;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.ui.menu.AbstractMenuCustom;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.events.AbstractDataflowEvent;
-import org.apache.taverna.workbench.file.events.ClosedDataflowEvent;
-import org.apache.taverna.workbench.file.events.FileManagerEvent;
-import org.apache.taverna.workbench.file.events.OpenedDataflowEvent;
-import org.apache.taverna.workbench.file.events.SavedDataflowEvent;
-import org.apache.taverna.workbench.file.exceptions.OpenException;
-
-import org.apache.log4j.Logger;
-import org.jdom.Document;
-import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
-
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-public class FileOpenRecentMenuAction extends AbstractMenuCustom implements
- Observer<FileManagerEvent> {
- public static final URI RECENT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#fileOpenRecent");
- private static final String CONF = "conf";
- private static Logger logger = Logger
- .getLogger(FileOpenRecentMenuAction.class);
- private static final String RECENT_WORKFLOWS_XML = "recentWorkflows.xml";
- private static final int MAX_ITEMS = 10;
-
- private FileManager fileManager;
- private ApplicationConfiguration applicationConfiguration;
- private JMenu menu;
- private List<Recent> recents = new ArrayList<>();
- private Thread loadRecentThread;
-
- public FileOpenRecentMenuAction(FileManager fileManager) {
- super(FILE_OPEN_SECTION_URI, 30, RECENT_URI);
- this.fileManager = fileManager;
- fileManager.addObserver(this);
- }
-
- @Override
- public void notify(Observable<FileManagerEvent> sender,
- FileManagerEvent message) throws Exception {
- FileManager fileManager = (FileManager) sender;
- if (message instanceof OpenedDataflowEvent
- || message instanceof SavedDataflowEvent) {
- AbstractDataflowEvent dataflowEvent = (AbstractDataflowEvent) message;
- WorkflowBundle dataflow = dataflowEvent.getDataflow();
- Object dataflowSource = fileManager.getDataflowSource(dataflow);
- FileType dataflowType = fileManager.getDataflowType(dataflow);
- addRecent(dataflowSource, dataflowType);
- }
- if (message instanceof ClosedDataflowEvent)
- // Make sure enabled/disabled status is correct
- updateRecentMenu();
- }
-
- public void updateRecentMenu() {
- invokeLater(new Runnable() {
- @Override
- public void run() {
- updateRecentMenuGUI();
- }
- });
- saveRecent();
- }
-
- protected void addRecent(Object dataflowSource, FileType dataflowType) {
- if (dataflowSource == null)
- return;
- if (!(dataflowSource instanceof Serializable)) {
- logger.warn("Can't serialize workflow source for 'Recent workflows': "
- + dataflowSource);
- return;
- }
- synchronized (recents) {
- Recent recent = new Recent((Serializable) dataflowSource, dataflowType);
- if (recents.contains(recent))
- recents.remove(recent);
- recents.add(0, recent); // Add to front
- }
- updateRecentMenu();
- }
-
- @Override
- protected Component createCustomComponent() {
- action = new DummyAction("Recent workflows");
- action.putValue(MNEMONIC_KEY, VK_R);
- menu = new JMenu(action);
- // Disabled until we have loaded the recent workflows
- menu.setEnabled(false);
- loadRecentThread = new Thread("Loading recent workflow menu") {
- // Avoid hanging GUI initialization while deserialising
- @Override
- public void run() {
- loadRecent();
- updateRecentMenu();
- }
- };
- loadRecentThread.start();
- return menu;
- }
-
- protected synchronized void loadRecent() {
- File confDir = new File(applicationConfiguration.getApplicationHomeDir(), CONF);
- confDir.mkdir();
- File recentFile = new File(confDir, RECENT_WORKFLOWS_XML);
- if (!recentFile.isFile())
- return;
- try {
- loadRecent(recentFile);
- } catch (JDOMException|IOException e) {
- logger.warn("Could not read recent workflows from file "
- + recentFile, e);
- }
- }
-
- private void loadRecent(File recentFile) throws FileNotFoundException,
- IOException, JDOMException {
- SAXBuilder builder = new SAXBuilder();
- @SuppressWarnings("unused")
- Document document;
- try (InputStream fileInputStream = new BufferedInputStream(
- new FileInputStream(recentFile))) {
- document = builder.build(fileInputStream);
- }
- synchronized (recents) {
- recents.clear();
- //RecentDeserializer deserialiser = new RecentDeserializer();
- try {
- // recents.addAll(deserialiser.deserializeRecent(document
- // .getRootElement()));
- } catch (Exception e) {
- logger.warn("Could not read recent workflows from file "
- + recentFile, e);
- }
- }
- }
-
- protected synchronized void saveRecent() {
- File confDir = new File(applicationConfiguration.getApplicationHomeDir(), CONF);
- confDir.mkdir();
- File recentFile = new File(confDir, RECENT_WORKFLOWS_XML);
-
- try {
- saveRecent(recentFile);
-// } catch (JDOMException e) {
-// logger.warn("Could not generate XML for recent workflows to file "
-// + recentFile, e);
- } catch (IOException e) {
- logger.warn("Could not write recent workflows to file "
- + recentFile, e);
- }
- }
-
- private void saveRecent(File recentFile) throws FileNotFoundException,
- IOException {
- // RecentSerializer serializer = new RecentSerializer();
- // XMLOutputter outputter = new XMLOutputter();
-
- // Element serializedRecent;
- synchronized (recents) {
- if (recents.size() > MAX_ITEMS)
- // Remove excess entries
- recents.subList(MAX_ITEMS, recents.size()).clear();
- // serializedRecent = serializer.serializeRecent(recents);
- }
- try (OutputStream outputStream = new BufferedOutputStream(
- new FileOutputStream(recentFile))) {
- // outputter.output(serializedRecent, outputStream);
- }
- }
-
- protected void updateRecentMenuGUI() {
- int items = 0;
- menu.removeAll();
- synchronized (recents) {
- for (Recent recent : recents) {
- if (++items >= MAX_ITEMS)
- break;
- OpenRecentAction openRecentAction = new OpenRecentAction(
- recent, fileManager);
- if (fileManager.getDataflowBySource(recent.getDataflowSource()) != null)
- openRecentAction.setEnabled(false);
- // else setEnabled(true)
- JMenuItem menuItem = new JMenuItem(openRecentAction);
- if (items < 10) {
- openRecentAction.putValue(NAME, items + " "
- + openRecentAction.getValue(NAME));
- menuItem.setMnemonic(VK_0 + items);
- }
- menu.add(menuItem);
- }
- }
- menu.setEnabled(items > 0);
- menu.revalidate();
- }
-
- @SuppressWarnings("serial")
- public static class OpenRecentAction extends AbstractAction implements
- Runnable {
- private final Recent recent;
- private Component component = null;
- private final FileManager fileManager;
-
- public OpenRecentAction(Recent recent, FileManager fileManager) {
- this.recent = recent;
- this.fileManager = fileManager;
- Serializable source = recent.getDataflowSource();
- String name;
- if (source instanceof File)
- name = ((File) source).getAbsolutePath();
- else
- name = source.toString();
- this.putValue(NAME, name);
- this.putValue(SHORT_DESCRIPTION, "Open the workflow " + name);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- component = null;
- if (e.getSource() instanceof Component)
- component = (Component) e.getSource();
- setEnabled(false);
- new Thread(this, "Opening workflow from "
- + recent.getDataflowSource()).start();
- }
-
- /**
- * Opening workflow in separate thread
- */
- @Override
- public void run() {
- final Serializable source = recent.getDataflowSource();
- try {
- fileManager.openDataflow(recent.makefileType(), source);
- } catch (OpenException ex) {
- logger.warn("Failed to open the workflow from " + source
- + " \n", ex);
- showMessageDialog(component,
- "Failed to open the workflow from url " + source
- + " \n" + ex.getMessage(), "Error!",
- ERROR_MESSAGE);
- } finally {
- setEnabled(true);
- }
- }
- }
-
- @SuppressWarnings("serial")
- public static class Recent implements Serializable {
- private final class RecentFileType extends FileType {
- @Override
- public String getMimeType() {
- return mimeType;
- }
-
- @Override
- public String getExtension() {
- return extension;
- }
-
- @Override
- public String getDescription() {
- return "File type " + extension + " " + mimeType;
- }
- }
-
- private Serializable dataflowSource;
- private String mimeType;
- private String extension;
-
- public String getMimeType() {
- return mimeType;
- }
-
- public void setMimeType(String mimeType) {
- this.mimeType = mimeType;
- }
-
- public String getExtension() {
- return extension;
- }
-
- public void setExtension(String extension) {
- this.extension = extension;
- }
-
- public Recent() {
- }
-
- public FileType makefileType() {
- if (mimeType == null && extension == null)
- return null;
- return new RecentFileType();
- }
-
- public Recent(Serializable dataflowSource, FileType dataflowType) {
- setDataflowSource(dataflowSource);
- if (dataflowType != null) {
- setMimeType(dataflowType.getMimeType());
- setExtension(dataflowType.getExtension());
- }
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime
- * result
- + ((dataflowSource == null) ? 0 : dataflowSource.hashCode());
- result = prime * result
- + ((extension == null) ? 0 : extension.hashCode());
- result = prime * result
- + ((mimeType == null) ? 0 : mimeType.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (!(obj instanceof Recent))
- return false;
- Recent other = (Recent) obj;
-
- if (dataflowSource == null) {
- if (other.dataflowSource != null)
- return false;
- } else if (!dataflowSource.equals(other.dataflowSource))
- return false;
-
- if (extension == null) {
- if (other.extension != null)
- return false;
- } else if (!extension.equals(other.extension))
- return false;
-
- if (mimeType == null) {
- if (other.mimeType != null)
- return false;
- } else if (!mimeType.equals(other.mimeType))
- return false;
-
- return true;
- }
-
- public Serializable getDataflowSource() {
- return dataflowSource;
- }
-
- public void setDataflowSource(Serializable dataflowSource) {
- this.dataflowSource = dataflowSource;
- }
-
- @Override
- public String toString() {
- return getDataflowSource() + "";
- }
- }
-
- // TODO find new serialization
-// protected static class RecentDeserializer extends AbstractXMLDeserializer {
-// public Collection<Recent> deserializeRecent(Element el) {
-// return (Collection<Recent>) super.createBean(el, getClass()
-// .getClassLoader());
-// }
-// }
-//
-// protected static class RecentSerializer extends AbstractXMLSerializer {
-// public Element serializeRecent(List<Recent> x) throws JDOMException,
-// IOException {
-// Element beanAsElement = super.beanAsElement(x);
-// return beanAsElement;
-// }
-// }
-
- public void setApplicationConfiguration(
- ApplicationConfiguration applicationConfiguration) {
- this.applicationConfiguration = applicationConfiguration;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAllMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAllMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAllMenuAction.java
deleted file mode 100644
index 4b1f3b8..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAllMenuAction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.menu;
-
-import static net.sf.taverna.t2.workbench.file.impl.menu.FileSaveMenuSection.FILE_SAVE_SECTION_URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.actions.SaveAllWorkflowsAction;
-
-public class FileSaveAllMenuAction extends AbstractMenuAction {
- private final EditManager editManager;
- private final FileManager fileManager;
-
- public FileSaveAllMenuAction(EditManager editManager,
- FileManager fileManager) {
- super(FILE_SAVE_SECTION_URI, 30);
- this.editManager = editManager;
- this.fileManager = fileManager;
- }
-
- @Override
- protected Action createAction() {
- return new SaveAllWorkflowsAction(editManager, fileManager);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/bf8a7ea2/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAsMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAsMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAsMenuAction.java
deleted file mode 100644
index 2459870..0000000
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAsMenuAction.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program 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 (at your option) any later version.
- *
- * This program 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. 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 program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workbench.file.impl.menu;
-
-import static net.sf.taverna.t2.workbench.file.impl.menu.FileSaveMenuSection.FILE_SAVE_SECTION_URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.impl.actions.SaveWorkflowAsAction;
-
-public class FileSaveAsMenuAction extends AbstractMenuAction {
- private final FileManager fileManager;
-
- public FileSaveAsMenuAction(FileManager fileManager) {
- super(FILE_SAVE_SECTION_URI, 20);
- this.fileManager = fileManager;
- }
-
- @Override
- protected Action createAction() {
- return new SaveWorkflowAsAction(fileManager);
- }
-}