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; }
public static Map<String, String> configureAppServerProperties(IProject project) throws CoreException { ILiferayRuntime runtime = null; try { runtime = ServerUtil.getLiferayRuntime(project); } catch (CoreException e1) { throw new CoreException(LiferayServerCorePlugin.createErrorStatus(e1)); } return configureAppServerProperties(runtime); }
public static IPath getPortalDir(IProject project) { try { IFacetedProject facetedProject = ProjectFacetsManager.create(project); org.eclipse.wst.common.project.facet.core.runtime.IRuntime runtime = facetedProject.getPrimaryRuntime(); if (runtime != null) { return ServerUtil.getPortalDir(runtime); } } catch (CoreException e) { LiferayServerCorePlugin.logError(e); } return null; }