Exemplo n.º 1
0
 /**
  * @param seamPath
  * @return
  */
 private static boolean seamExists(String seamPath) {
   SeamRuntime[] seamRuntimes = SeamRuntimeManager.getInstance().getRuntimes();
   for (SeamRuntime sr : seamRuntimes) {
     if (seamPath != null && seamPath.equals(sr.getHomeDir())) {
       return true;
     }
   }
   return false;
 }
 private boolean canTestProjectBeCreated() {
   if (isSeamProjectWizard()) {
     String seamRuntimeName = jBossSeamHomeEditor.getValueAsString();
     SeamRuntime seamRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(seamRuntimeName);
     if (seamRuntime != null) {
       // bootstrap folder was removed in Seam 2.3.0.Beta1 from WFK 2.0 ER4
       // See https://issues.jboss.org/browse/JBIDE-11611
       File bootstrap = new File(seamRuntime.getHomeDir(), "bootstrap");
       return bootstrap.exists();
     }
   }
   return false;
 }
        public java.util.Map<String, IStatus> validate(Object value, Object context) {
          Map<String, IStatus> errors = NO_ERRORS;

          if (value == null || "".equals(value)) { // $NON-NLS-1$
            errors =
                createErrormessage(
                    new Status(
                        IStatus.ERROR,
                        SeamCorePlugin.PLUGIN_ID,
                        SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_NOT_CONFIGURED));
          } else {
            SeamRuntime rt = SeamRuntimeManager.getInstance().findRuntimeByName(value.toString());
            if (rt == null) {
              errors =
                  createErrormessage(
                      new Status(
                          IStatus.ERROR,
                          SeamCorePlugin.PLUGIN_ID,
                          NLS.bind(
                              SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_CANNOT_BE_FOUND, value)));
            } else if (!new File(rt.getHomeDir()).exists()) {
              errors =
                  createErrormessage(
                      new Status(
                          IStatus.ERROR,
                          SeamCorePlugin.PLUGIN_ID,
                          NLS.bind(
                              SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_HOME_DIR_DOES_NOT_EXIST,
                              value)));
            } else if (!new File(rt.getSeamGenDir()).exists()) {
              errors =
                  createErrormessage(
                      new Status(
                          IStatus.ERROR,
                          SeamCorePlugin.PLUGIN_ID,
                          NLS.bind(
                              SeamCoreMessages
                                  .VALIDATOR_FACTORY_SEAM_RT_TEMPLATES_DIR_DOES_NOT_EXIST,
                              value)));
            } else if (!new File(rt.getSrcTemplatesDir()).exists()) {
              errors =
                  createErrormessage(
                      new Status(
                          IStatus.ERROR,
                          SeamCorePlugin.PLUGIN_ID,
                          NLS.bind(
                              SeamCoreMessages
                                  .VALIDATOR_FACTORY_SEAM_RT_SOURCE_TEMPLATES_DIR_DOES_NOT_EXIST,
                              value)));
            } else if (!new File(rt.getViewTemplatesDir()).exists()) {
              errors =
                  createErrormessage(
                      new Status(
                          IStatus.ERROR,
                          SeamCorePlugin.PLUGIN_ID,
                          NLS.bind(
                              SeamCoreMessages
                                  .VALIDATOR_FACTORY_SEAM_RT_VIE_TEMPLATE_DIR_DOES_NOT_EXIST,
                              value)));
              // } else if(!new
              // File(rt.getResourceTemplatesDir()).exists()) {
              // errors = createErrormessage(NLS.bind(
              // "Seam Runtime '{0)' resource templates directory doesn't exist for selected Seam
              // Web Project"
              // ,value));
            }
          }
          return errors;
        }
        public Map<String, IStatus> validate(Object value, Object context) {

          Map<String, IStatus> errors = NO_ERRORS;
          if (value == null || "".equals(value.toString().trim())) { // $NON-NLS-1$
            errors =
                createErrormessage(
                    ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
                    new Status(
                        IStatus.ERROR,
                        SeamCorePlugin.PLUGIN_ID,
                        SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RUNTIME_IS_NOT_SELECTED));
          } else {
            SeamRuntime rt = SeamRuntimeManager.getInstance().findRuntimeByName(value.toString());
            if (rt == null) {
              errors =
                  createErrormessage(
                      ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
                      new Status(
                          IStatus.ERROR,
                          SeamCorePlugin.PLUGIN_ID,
                          NLS.bind(
                              SeamCoreMessages.VALIDATOR_FACTORY_CANNOT_FIND_SEAM_RUNTIME, value)));
            } else if (!new File(rt.getHomeDir()).exists()) {
              errors =
                  createErrormessage(
                      ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
                      new Status(
                          IStatus.ERROR,
                          SeamCorePlugin.PLUGIN_ID,
                          NLS.bind(
                              SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_HOME_DIR_IS_MISSING,
                              value)));
            } else if (!new File(rt.getSeamGenDir()).exists()) {
              errors =
                  createErrormessage(
                      ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
                      new Status(
                          IStatus.ERROR,
                          SeamCorePlugin.PLUGIN_ID,
                          NLS.bind(
                              SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_TEMPLATES_DIR_IS_MISSING,
                              value)));
            } else if (!new File(rt.getSrcTemplatesDir()).exists()) {
              errors =
                  createErrormessage(
                      ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
                      new Status(
                          IStatus.ERROR,
                          SeamCorePlugin.PLUGIN_ID,
                          NLS.bind(
                              SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_SRC_DIR_IS_MISSING,
                              value)));
            } else if (!new File(rt.getViewTemplatesDir()).exists()) {
              errors =
                  createErrormessage(
                      ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
                      new Status(
                          IStatus.ERROR,
                          SeamCorePlugin.PLUGIN_ID,
                          NLS.bind(
                              SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_VIEW_DIR_IS_MISSING,
                              value)));
            } else if (!new File(rt.getResourceTemplatesDir()).exists()) {
              errors =
                  createErrormessage(
                      ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
                      new Status(
                          IStatus.ERROR,
                          SeamCorePlugin.PLUGIN_ID,
                          NLS.bind(
                              SeamCoreMessages.VALIDATOR_FACTORY_SEAM_RT_RESOURCES_DIR_IS_MISSING,
                              value)));
            }
          }
          return errors;
        }