private static JBTCustomHttpLaunchable getCustomLaunchable(IServer server, final IModule[] module)
      throws CoreException {
    IModule mod = module == null || module.length == 0 ? null : module[module.length - 1];
    IModuleArtifact artifact = null;
    if (mod != null) {
      IProject p = mod.getProject();
      if (p != null) {
        final IModuleArtifact[] moduleArtifacts = ServerPlugin.getModuleArtifacts(p);
        if (moduleArtifacts != null && moduleArtifacts.length > 0) {
          artifact = moduleArtifacts[0];
        }
      }
    }

    if (artifact == null) {
      // create a stub
      artifact =
          new IModuleArtifact() {
            public IModule getModule() {
              return module == null || module.length == 0 ? null : module[module.length - 1];
            }
          };
    }
    return getLaunchable(server, artifact);
  }
 private static JBTCustomHttpLaunchable getLaunchable(
     IServer server, IModuleArtifact moduleArtifact) throws CoreException {
   ILaunchableAdapter[] adapters = ServerPlugin.getLaunchableAdapters();
   IStatus lastStatus = null;
   if (adapters != null) {
     int size2 = adapters.length;
     for (int j = 0; j < size2; j++) {
       try {
         Object launchable2 = adapters[j].getLaunchable(server, moduleArtifact);
         if (launchable2 != null && launchable2 instanceof JBTCustomHttpLaunchable)
           return (JBTCustomHttpLaunchable) launchable2;
       } catch (CoreException ce) {
         lastStatus = ce.getStatus();
       }
     }
     if (lastStatus != null) throw new CoreException(lastStatus);
   }
   return null;
 }
  @Override
  protected Status compute() {
    Status retval = Status.createOkStatus();

    String serverName = op().getBundleName().content();

    if (CoreUtil.empty(serverName)) {
      retval = Status.createErrorStatus("The Server Name is empty. Please input one.");

      return retval;
    }

    if (ServerPlugin.isNameInUse(null, serverName)) {
      retval =
          Status.createErrorStatus(
              "The Server Name \""
                  + serverName
                  + "\"+ is already in use. Specify a different name.");

      return retval;
    }

    return retval;
  }