private String getConfigInfoFromManifest(String configType, IPath portalDir) {
    File implJar = portalDir.append("/WEB-INF/lib/portal-impl.jar").toFile();

    String version = null;
    String serverInfo = null;

    if (implJar.exists()) {
      try (JarFile jar = new JarFile(implJar)) {
        Manifest manifest = jar.getManifest();

        Attributes attributes = manifest.getMainAttributes();

        version = attributes.getValue("Liferay-Portal-Version");
        serverInfo = attributes.getValue("Liferay-Portal-Server-Info");

        if (CoreUtil.compareVersions(Version.parseVersion(version), MANIFEST_VERSION_REQUIRED)
            < 0) {
          version = null;
          serverInfo = null;
        }
      } catch (IOException e) {
        LiferayServerCore.logError(e);
      }
    }

    if (configType.equals(CONFIG_TYPE_VERSION)) {
      return version;
    }

    if (configType.equals(CONFIG_TYPE_SERVER)) {
      return serverInfo;
    }

    return null;
  }
  public <T> T adapt(ILiferayProject liferayProject, Class<T> adapterType) {
    if (liferayProject instanceof LiferayMavenProject
        && IProjectBuilder.class.equals(adapterType)) {
      // only use this builder for versions of Liferay less than 6.2
      final LiferayMavenProject liferayMavenProject =
          LiferayMavenProject.class.cast(liferayProject);
      final String version = liferayMavenProject.getLiferayMavenPluginVersion();

      if (!CoreUtil.isNullOrEmpty(version)) {
        // we only need to match the first 2 characters
        final Matcher matcher = majorMinor.matcher(version);

        String matchedVersion = null;

        if (matcher.find() && matcher.groupCount() == 2) {
          matchedVersion = matcher.group(1) + "." + matcher.group(2) + ".0";
        }

        final Version portalVersion =
            new Version(matchedVersion != null ? matchedVersion : version);

        if (CoreUtil.compareVersions(portalVersion, ILiferayConstants.V620) < 0) {
          MavenUIProjectBuilder builder =
              new MavenUIProjectBuilder((LiferayMavenProject) liferayProject);

          return adapterType.cast(builder);
        }
      }
    }

    return null;
  }
  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;
  }
  @Override
  protected IStatus doAddNewPortlet(IDOMDocument document, IDataModel model) {
    IStatus status = Status.OK_STATUS;

    status = super.doAddNewPortlet(document, model);

    if (!status.isOK()) {
      return status;
    }

    final Version runtimeVersion = ServerUtil.getRuntimeVersion(project);

    // Runtime version should be equal or greater than 6.2.
    if (CoreUtil.compareVersions(runtimeVersion, ILiferayConstants.V620) >= 0) {
      final IFile descriptorFile = getDescriptorFile();

      if (descriptorFile != null) {
        DOMModelOperation op =
            new DOMModelEditOperation(descriptorFile) {

              @Override
              protected void createDefaultFile() {
                // Getting document from super( descriptorFile );
              }

              @Override
              protected IStatus doExecute(IDOMDocument document) {
                return updateVaadinLiferayPortletXMLTo62(document);
              }
            };

        return op.execute();
      }
    }

    return status;
  }