public static final Status execute(final NewLiferayPluginProjectOp op, final ProgressMonitor pm) {
    final IProgressMonitor monitor = ProgressMonitorBridge.create(pm);

    monitor.beginTask(
        "Creating Liferay plugin project (this process may take several minutes)",
        100); //$NON-NLS-1$

    Status retval = null;

    try {
      final NewLiferayProjectProvider<NewLiferayPluginProjectOp> projectProvider =
          op.getProjectProvider().content(true);

      // IDE-1306  If the user types too quickly all the model changes may not have propagated
      final Path projectLocation = op.getLocation().content();
      updateLocation(op, projectLocation);

      final IStatus status = projectProvider.createNewProject(op, monitor);

      if (status.isOK()) {
        updateProjectPrefs(op);

        removeSampleCodeAndFiles(op);
      }

      retval = StatusBridge.create(status);
    } catch (Exception e) {
      final String msg = "Error creating Liferay plugin project."; // $NON-NLS-1$
      ProjectCore.logError(msg, e);

      return Status.createErrorStatus(msg + " Please see Eclipse error log for more details.", e);
    }

    return retval;
  }
  public static boolean canUseCustomLocation(NewLiferayPluginProjectOp op) {
    boolean retval = false;

    if (op.getProjectProvider().content(true).getShortName().equals("maven")) {
      retval = true;
    }

    return retval;
  }
  private static void updateProjectPrefs(final NewLiferayPluginProjectOp op) {
    try {
      final IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(ProjectCore.PLUGIN_ID);

      prefs.put(
          ProjectCore.PREF_DEFAULT_PLUGIN_PROJECT_BUILD_TYPE_OPTION,
          op.getProjectProvider().text());
      prefs.putBoolean(ProjectCore.PREF_INCLUDE_SAMPLE_CODE, op.getIncludeSampleCode().content());
      prefs.putBoolean(ProjectCore.PREF_CREATE_NEW_PORLET, op.getCreateNewPortlet().content());

      if ("maven".equalsIgnoreCase(op.getProjectProvider().text())) {
        prefs.put(ProjectCore.PREF_DEFAULT_PLUGIN_PROJECT_MAVEN_GROUPID, op.getGroupId().content());
      }

      prefs.flush();
    } catch (Exception e) {
      final String msg = "Error updating default project build type."; // $NON-NLS-1$
      ProjectCore.logError(msg, e);
    }
  }
  public static Set<String> getPossibleProfileIds(
      NewLiferayPluginProjectOp op, boolean includeNewProfiles) {
    final String activeProfilesValue = op.getActiveProfilesValue().content();

    final Path currentLocation = op.getLocation().content();

    final File param = currentLocation != null ? currentLocation.toFile() : null;

    final List<String> systemProfileIds =
        op.getProjectProvider().content().getData("profileIds", String.class, param);

    final ElementList<NewLiferayProfile> newLiferayProfiles = op.getNewLiferayProfiles();

    final Set<String> possibleProfileIds = new HashSet<String>();

    if (!CoreUtil.isNullOrEmpty(activeProfilesValue)) {
      final String[] vals = activeProfilesValue.split(",");

      if (!CoreUtil.isNullOrEmpty(vals)) {
        for (String val : vals) {
          if (!possibleProfileIds.contains(val) && !val.contains(StringPool.SPACE)) {
            possibleProfileIds.add(val);
          }
        }
      }
    }

    if (!CoreUtil.isNullOrEmpty(systemProfileIds)) {
      for (Object systemProfileId : systemProfileIds) {
        if (systemProfileId != null) {
          final String val = systemProfileId.toString();

          if (!possibleProfileIds.contains(val) && !val.contains(StringPool.SPACE)) {
            possibleProfileIds.add(val);
          }
        }
      }
    }

    if (includeNewProfiles) {
      for (NewLiferayProfile newLiferayProfile : newLiferayProfiles) {
        final String newId = newLiferayProfile.getId().content();

        if ((!CoreUtil.isNullOrEmpty(newId))
            && (!possibleProfileIds.contains(newId))
            && (!newId.contains(StringPool.SPACE))) {
          possibleProfileIds.add(newId);
        }
      }
    }

    return possibleProfileIds;
  }
  public static String getMavenParentPomVersion(
      NewLiferayPluginProjectOp op, String projectName, IPath path) {
    String retval = null;

    final File parentProjectDir = path.toFile();
    final IStatus locationStatus =
        op.getProjectProvider().content().validateProjectLocation(projectName, path);

    if (locationStatus.isOK() && parentProjectDir.exists() && parentProjectDir.list().length > 0) {
      List<String> version =
          op.getProjectProvider()
              .content()
              .getData("parentVersion", String.class, parentProjectDir);

      if (!version.isEmpty()) {
        retval = version.get(0);
      }
    }

    return retval;
  }
  public static String getProjectNameWithSuffix(final NewLiferayPluginProjectOp op) {
    final String projectName = op.getProjectName().content();

    String suffix = null;

    if (projectName != null) {
      if ("ant".equals(op.getProjectProvider().content(true).getShortName())) // $NON-NLS-1$
      {
        suffix = getPluginTypeSuffix(op.getPluginType().content(true));

        if (suffix != null) {
          // check if project name already contains suffix
          if (projectName.endsWith(suffix)) {
            suffix = null;
          }
        }
      }
    }

    return (projectName == null ? StringPool.EMPTY : projectName)
        + (suffix == null ? StringPool.EMPTY : suffix);
  }
  public static boolean supportsWebTypePlugin(NewLiferayPluginProjectOp op) {
    boolean retval = false;

    if (op.getProjectProvider().content(true).getShortName().equals("maven")) {
      retval = true;
    } else {
      SDK sdk = null;

      try {
        sdk = SDKUtil.getWorkspaceSDK();
      } catch (CoreException e) {
      }

      if (sdk == null) {
        final Path sdkLocation = op.getSdkLocation().content();

        if (sdkLocation != null) {
          sdk = SDKUtil.createSDKFromLocation(PathBridge.create(sdkLocation));
        }
      }

      if (sdk != null) {
        final Version version = new Version(sdk.getVersion());

        final boolean greaterThan700 =
            CoreUtil.compareVersions(version, ILiferayConstants.V700) >= 0;

        if (greaterThan700) {
          retval = true;
        }
      } else {
        retval = true;
      }
    }

    return retval;
  }