|
From: <pat...@us...> - 2010-05-28 19:41:45
|
Revision: 1070
http://cishell.svn.sourceforge.net/cishell/?rev=1070&view=rev
Author: pataphil
Date: 2010-05-28 19:41:39 +0000 (Fri, 28 May 2010)
Log Message:
-----------
* File Load algorithm now passes ProgressMonitor to wrapped validators if they implement ProgressTrackable.
Modified Paths:
--------------
trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java
trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileValidator.java
Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java 2010-05-28 19:40:20 UTC (rev 1069)
+++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java 2010-05-28 19:41:39 UTC (rev 1070)
@@ -69,7 +69,8 @@
return null;
} else {
- return FileValidator.validateFile(file, validator, this.ciShellContext, this.logger);
+ return FileValidator.validateFile(
+ file, validator, this.progressMonitor, this.ciShellContext, this.logger);
}
}
Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileValidator.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileValidator.java 2010-05-28 19:40:20 UTC (rev 1069)
+++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileValidator.java 2010-05-28 19:41:39 UTC (rev 1070)
@@ -1,10 +1,14 @@
package org.cishell.reference.gui.persistence.load;
import java.io.File;
+import java.util.Hashtable;
import org.cishell.framework.CIShellContext;
+import org.cishell.framework.algorithm.Algorithm;
import org.cishell.framework.algorithm.AlgorithmExecutionException;
import org.cishell.framework.algorithm.AlgorithmFactory;
+import org.cishell.framework.algorithm.ProgressMonitor;
+import org.cishell.framework.algorithm.ProgressTrackable;
import org.cishell.framework.data.BasicData;
import org.cishell.framework.data.Data;
import org.osgi.service.log.LogService;
@@ -13,24 +17,25 @@
public static Data[] validateFile(
File file,
AlgorithmFactory validator,
+ ProgressMonitor progressMonitor,
CIShellContext ciShellContext,
LogService logger) throws AlgorithmExecutionException {
Data[] validationData =
new Data[] { new BasicData(file.getPath(), String.class.getName()) };
- Data[] validatedData = validator.createAlgorithm(
- validationData, null, ciShellContext).execute();
+ Algorithm algorithm = validator.createAlgorithm(
+ validationData, new Hashtable<String, Object>(), ciShellContext);
+ if ((progressMonitor != null) && (algorithm instanceof ProgressTrackable)) {
+ ProgressTrackable progressTrackable = (ProgressTrackable)algorithm;
+ progressTrackable.setProgressMonitor(progressMonitor);
+ }
+
+ Data[] validatedData = algorithm.execute();
+
if (validatedData != null) {
logger.log(LogService.LOG_INFO, "Loaded: " + file.getPath());
}
return validatedData;
-// } catch (AlgorithmExecutionException e) {
-// String logMessage =
-// "An error occurred while attempting to load your file " +
-// "with the format you chose.";
-// this.logger.log(LogService.LOG_ERROR, logMessage, e);
-// this.thrownException = e;
-// }
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|