Пример #1
0
  public static IPath getPortalDir(
      org.eclipse.wst.common.project.facet.core.runtime.IRuntime facetRuntime) {
    ILiferayRuntime runtime =
        (ILiferayRuntime) getRuntimeAdapter(facetRuntime, ILiferayRuntime.class);

    return runtime != null ? runtime.getPortalDir() : null;
  }
Пример #2
0
  public static IStatus cssBuild(IProject project) throws CoreException {

    SDK sdk = SDKUtil.getSDK(project);

    if (sdk == null) {
      throw new CoreException(
          ThemeCore.createErrorStatus("No SDK for project configured. Could not build theme."));
    }

    ILiferayRuntime liferayRuntime = ServerUtil.getLiferayRuntime(project);

    if (liferayRuntime == null) {
      throw new CoreException(
          ThemeCore.createErrorStatus(
              "Could not get portal runtime for project.  Could not build theme."));
    }

    Map<String, String> appServerProperties = ServerUtil.configureAppServerProperties(project);

    IStatus status = sdk.compileThemePlugin(project, null, appServerProperties);

    if (!status.isOK()) {
      throw new CoreException(status);
    }

    IFolder docroot = CoreUtil.getDocroot(project);

    IFile lookAndFeelFile =
        docroot.getFile("WEB-INF/" + ILiferayConstants.LIFERAY_LOOK_AND_FEEL_XML_FILE);

    if (!lookAndFeelFile.exists()) {
      String id = project.getName().replaceAll(ISDKConstants.THEME_PLUGIN_PROJECT_SUFFIX, "");
      IFile propsFile =
          docroot.getFile("WEB-INF/" + ILiferayConstants.LIFERAY_PLUGIN_PACKAGE_PROPERTIES_FILE);
      String name = id;
      if (propsFile.exists()) {
        Properties props = new Properties();
        try {
          props.load(propsFile.getContents());
          String nameValue = props.getProperty("name");
          if (!CoreUtil.isNullOrEmpty(nameValue)) {
            name = nameValue;
          }
        } catch (IOException e) {
          ThemeCore.logError("Unable to load plugin package properties.", e);
        }
      }

      if (liferayRuntime != null) {
        ThemeDescriptorHelper.createDefaultFile(
            lookAndFeelFile, liferayRuntime.getPortalVersion() + "+", id, name);
      }
    }

    if (docroot != null && docroot.exists()) {
      docroot.refreshLocal(IResource.DEPTH_INFINITE, null);
    }

    return status;
  }
Пример #3
0
  public static Map<String, String> configureAppServerProperties(ILiferayRuntime appServer) {
    Map<String, String> properties = new HashMap<String, String>();

    String type = appServer.getAppServerType();

    String dir = appServer.getAppServerDir().toOSString();

    String deployDir = appServer.getDeployDir().toOSString();

    String libGlobalDir = appServer.getLibGlobalDir().toOSString();

    String portalDir = appServer.getPortalDir().toOSString();

    properties.put(ISDKConstants.PROPERTY_APP_SERVER_TYPE, type);
    properties.put(ISDKConstants.PROPERTY_APP_SERVER_DIR, dir);
    properties.put(ISDKConstants.PROPERTY_APP_SERVER_DEPLOY_DIR, deployDir);
    properties.put(ISDKConstants.PROPERTY_APP_SERVER_LIB_GLOBAL_DIR, libGlobalDir);
    properties.put(ISDKConstants.PROPERTY_APP_SERVER_PORTAL_DIR, portalDir);

    return properties;
  }