public void setupNewProject(IDataModel dataModel, IFacetedProjectWorkingCopy facetedProject) { ProjectUtil.setGenerateDD(dataModel, true); FacetDataModelMap map = (FacetDataModelMap) dataModel.getProperty(FACET_DM_MAP); IDataModel webFacetModel = map.getFacetDataModel(IJ2EEFacetConstants.DYNAMIC_WEB_FACET.getId()); webFacetModel.setStringProperty( IWebFacetInstallDataModelProperties.CONFIG_FOLDER, IPluginFacetConstants.PORTLET_PLUGIN_SDK_CONFIG_FOLDER); webFacetModel.setStringProperty( IWebFacetInstallDataModelProperties.SOURCE_FOLDER, IPluginFacetConstants.PORTLET_PLUGIN_SDK_SOURCE_FOLDER); IDataModel javaFacetModel = map.getFacetDataModel(JavaFacet.FACET.getId()); javaFacetModel.setStringProperty( IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME, IPluginFacetConstants.PORTLET_PLUGIN_SDK_SOURCE_FOLDER); javaFacetModel.setStringProperty( IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME, IPluginFacetConstants.PORTLET_PLUGIN_SDK_DEFAULT_OUTPUT_FOLDER); if (dataModel.isNestedModel(PLUGIN_FRAGMENT_DM)) { dataModel.removeNestedModel(PLUGIN_FRAGMENT_DM); } // need to allow portlet framework to do any additional configuration IPortletFramework portletFramework = (IPortletFramework) dataModel.getProperty(PORTLET_FRAMEWORK); portletFramework.configureNewProject(dataModel, facetedProject); }
protected IClasspathEntry createContextClasspathEntry(String context) { IClasspathEntry entry = null; IFile serviceJar = ProjectUtil.findServiceJarForContext(context); if (serviceJar.exists()) { IFolder docroot = CoreUtil.getDocroot(serviceJar.getProject()); IFolder serviceFolder = docroot.getFolder("WEB-INF/service"); entry = createClasspathEntry( serviceJar.getLocation(), serviceFolder.exists() ? serviceFolder.getLocation() : null); } if (entry == null) { IProject project = this.javaProject.getProject(); SDK sdk = SDKUtil.getSDK(project); IPath sdkLocation = sdk.getLocation(); String type = ProjectUtil.isPortletProject(project) ? "portlets" : ProjectUtil.isHookProject(project) ? "hooks" : ProjectUtil.isExtProject(project) ? "ext" : ""; IPath serviceJarPath = sdkLocation .append(type) .append(context) .append("docroot/WEB-INF/lib") .append(context + "-service.jar"); if (serviceJarPath.toFile().exists()) { IPath servicePath = serviceJarPath.removeLastSegments(2).append("service"); entry = createClasspathEntry( serviceJarPath, servicePath.toFile().exists() ? servicePath : null); } } return entry; }
/* * (non-Javadoc) * @see org.eclipse.sapphire.services.RelativePathService#roots() */ @Override public List<Path> roots() { List<Path> roots = new ArrayList<Path>(); IModelElement modelElement = context(IHook.class); IProject project = modelElement.adapt(IProject.class); IFolder[] folders = ProjectUtil.getSourceFolders(project); for (IFolder folder : folders) { roots.add(new Path(folder.getLocation().toPortableString())); } return roots; }
public static boolean isJSFProject(IProject project) { return ProjectUtil.hasFacet(project, JSFCorePlugin.JSF_FACET); }
private boolean isPartInLiferayProject() { SapphireEditor editor = this.getPart().nearest(SapphireEditor.class); return editor != null && ProjectUtil.isLiferayProject(editor.getProject()); }