diff options
author | ddunne | 2011-05-11 15:14:28 +0000 |
---|---|---|
committer | Ryan D. Brooks | 2011-05-11 15:14:28 +0000 |
commit | 2774d0b95e8104073e465c74fdc7f7b51562911f (patch) | |
tree | f60d15384497bb78dba59eea35c2157ed823b216 /plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core | |
parent | 98fa1f7061eb05ab8f6c7bfc0b868ec91862503e (diff) | |
download | org.eclipse.osee-2774d0b95e8104073e465c74fdc7f7b51562911f.tar.gz org.eclipse.osee-2774d0b95e8104073e465c74fdc7f7b51562911f.tar.xz org.eclipse.osee-2774d0b95e8104073e465c74fdc7f7b51562911f.zip |
feature: AtsDsl - Move XWidget validation logic out of XWidget UI
Diffstat (limited to 'plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core')
2 files changed, 62 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/IOseeXWidgetValidator.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/IOseeXWidgetValidator.java new file mode 100644 index 00000000000..4a9b3bf9546 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/IOseeXWidgetValidator.java @@ -0,0 +1,22 @@ +/* + * Created on May 9, 2011 + * + * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE + */ +package org.eclipse.osee.framework.skynet.core.validation; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; + +/** + * Provider to validate XWidget/IAttributeWidget entry against Artifact store model without use of XWidget UI + * + * @author Donald G. Dunne + */ +public interface IOseeXWidgetValidator { + + public boolean isProvider(String xWidgetName); + + public IStatus validate(Artifact artifact, String xWidgetName, String name); + +} diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/OseeXWidgetValidateManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/OseeXWidgetValidateManager.java new file mode 100644 index 00000000000..6518b623ec9 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/OseeXWidgetValidateManager.java @@ -0,0 +1,40 @@ +/* + * Created on May 9, 2011 + * + * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE + */ +package org.eclipse.osee.framework.skynet.core.validation; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.osee.framework.plugin.core.util.ExtensionDefinedObjects; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.framework.skynet.core.internal.Activator; + +/** + * @author Donald G. Dunne + */ +public class OseeXWidgetValidateManager { + private static final String EXTENSION_ELEMENT = "OseeXWidgetValidator"; + private static final String EXTENSION_ID = Activator.PLUGIN_ID + "." + EXTENSION_ELEMENT; + private static final String CLASS_NAME_ATTRIBUTE = "classname"; + public static OseeXWidgetValidateManager instance = new OseeXWidgetValidateManager(); + private static ExtensionDefinedObjects<IOseeXWidgetValidator> validators; + + private OseeXWidgetValidateManager() { + validators = + new ExtensionDefinedObjects<IOseeXWidgetValidator>(EXTENSION_ID, EXTENSION_ELEMENT, CLASS_NAME_ATTRIBUTE); + } + + public Collection<IStatus> validate(Artifact artifact, String xWidgetName, String name) { + List<IStatus> statuses = new ArrayList<IStatus>(); + for (IOseeXWidgetValidator validator : validators.getObjects()) { + if (validator.isProvider(xWidgetName)) { + statuses.add(validator.validate(artifact, xWidgetName, name)); + } + } + return statuses; + } +} |