|
From: <pat...@us...> - 2010-10-19 22:08:31
|
Revision: 1143
http://cishell.svn.sourceforge.net/cishell/?rev=1143&view=rev
Author: pataphil
Date: 2010-10-19 22:08:25 +0000 (Tue, 19 Oct 2010)
Log Message:
-----------
* mutateParameters can now throw AllParametersMutatedOutException if the AlgorithmFactory wishes to not present the user with any input options.
* Reviewed by Micah.
Modified Paths:
--------------
trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java
Added Paths:
-----------
trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AllParametersMutatedOutException.java
Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2010-10-04 21:57:32 UTC (rev 1142)
+++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2010-10-19 22:08:25 UTC (rev 1143)
@@ -31,6 +31,7 @@
import org.cishell.framework.algorithm.AlgorithmExecutionException;
import org.cishell.framework.algorithm.AlgorithmFactory;
import org.cishell.framework.algorithm.AlgorithmProperty;
+import org.cishell.framework.algorithm.AllParametersMutatedOutException;
import org.cishell.framework.algorithm.DataValidator;
import org.cishell.framework.algorithm.ParameterMutator;
import org.cishell.framework.algorithm.ProgressMonitor;
@@ -373,16 +374,22 @@
if ((factory instanceof ParameterMutator) && (provider != null)) {
try {
- ObjectClassDefinition ocd = provider.getObjectClassDefinition(metatypePID, null);
+ ObjectClassDefinition objectClassDefinition =
+ provider.getObjectClassDefinition(metatypePID, null);
- if (ocd == null) {
+ if (objectClassDefinition == null) {
logNullOCDWarning(pid, metatypePID);
}
- ocd = ((ParameterMutator) factory).mutateParameters(data, ocd);
+ try {
+ objectClassDefinition =
+ ((ParameterMutator) factory).mutateParameters(data, objectClassDefinition);
- if (ocd != null) {
- provider = new BasicMetaTypeProvider(ocd);
+ if (objectClassDefinition != null) {
+ provider = new BasicMetaTypeProvider(objectClassDefinition);
+ }
+ } catch (AllParametersMutatedOutException e) {
+ provider = null;
}
} catch (IllegalArgumentException e) {
log(LogService.LOG_DEBUG, pid + " has an invalid metatype id: " + metatypePID, e);
Added: trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AllParametersMutatedOutException.java
===================================================================
--- trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AllParametersMutatedOutException.java (rev 0)
+++ trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AllParametersMutatedOutException.java 2010-10-19 22:08:25 UTC (rev 1143)
@@ -0,0 +1,21 @@
+package org.cishell.framework.algorithm;
+
+public class AllParametersMutatedOutException extends RuntimeException {
+ private static final long serialVersionUID = 9017277008277139930L;
+
+ public AllParametersMutatedOutException(String message, Throwable exception) {
+ super(message, exception);
+ }
+
+ public AllParametersMutatedOutException(Throwable exception) {
+ super(exception);
+ }
+
+ public AllParametersMutatedOutException(String message) {
+ super(message);
+ }
+
+ public AllParametersMutatedOutException() {
+ this("Algorithm canceled by user.");
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|