From: <mwl...@us...> - 2008-03-28 20:59:29
|
Revision: 745 http://cishell.svn.sourceforge.net/cishell/?rev=745&view=rev Author: mwlinnem Date: 2008-03-28 13:59:27 -0700 (Fri, 28 Mar 2008) Log Message: ----------- Fixed bug where we accidentally assumed an algorithm factory was a data validator. Modified Paths: -------------- branches/user_prefs/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java Modified: branches/user_prefs/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java =================================================================== --- branches/user_prefs/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2008-03-28 20:55:35 UTC (rev 744) +++ branches/user_prefs/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2008-03-28 20:59:27 UTC (rev 745) @@ -151,19 +151,24 @@ } protected boolean testDataValidityIfPossible(AlgorithmFactory algFactory, Data[] dataInQuestion) { - String validation = ((DataValidator) algFactory).validate(dataInQuestion); + if (algFactory instanceof DataValidator) { + String validation = ((DataValidator) algFactory).validate(dataInQuestion); - if (validation != null && validation.length() > 0) { - String label = (String) algFactoryRef.getProperty(LABEL); - if (label == null) { - label = "Algorithm"; + if (validation != null && validation.length() > 0) { + String label = (String) algFactoryRef.getProperty(LABEL); + if (label == null) { + label = "Algorithm"; + } + + builder.showError("Invalid Data", "The data given to \"" + label + "\" is incompatible for this reason: " + + validation, (String) null); + return false; } - - builder.showError("Invalid Data", "The data given to \"" + label + "\" is incompatible for this reason: " - + validation, (String) null); - return false; - } - return true; + return true; + } else { + //counts as valid if there is no validator available. + return true; + } } protected MetaTypeProvider obtainParameterSetupInfo(AlgorithmFactory algFactory, Data[] data) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |