List of usage examples for com.google.gwt.eclipse.core.nature GWTNature NATURE_ID
String NATURE_ID
To view the source code for com.google.gwt.eclipse.core.nature GWTNature NATURE_ID.
Click Source Link
From source file:com.google.gdt.eclipse.suite.wizards.WebAppProjectCreator.java
License:Open Source License
/** * Creates the project per the current configuration. Note that the caller * must have a workspace lock in order to successfully execute this method. */*from w w w . j a v a 2 s . com*/ * @throws BackingStoreException */ public void create(IProgressMonitor monitor) throws CoreException, MalformedURLException, SdkException, ClassNotFoundException, UnsupportedEncodingException, FileNotFoundException, BackingStoreException { boolean useGwt = natureIds.contains(GWTNature.NATURE_ID); boolean useGae = natureIds.contains(GaeNature.NATURE_ID); if (useGae) { createGaeProject(useGwt); } // TODO: Add code to update the progress monitor if (useGwt) { // Let GWT create the source files that we want, we will overwrite the // .project and .classpath files anyway IPath locationPath = URIUtil.toPath(locationURI); if (!isGenerateEmptyProject) { createGWTProject(monitor, packageName, locationPath.toOSString()); } else { // Add "empty" web.xml addFile(new Path(WebAppUtilities.DEFAULT_WAR_DIR_NAME + "/WEB-INF/web.xml"), ProjectResources.createWebXmlSource()); } IPath projDirPath = locationPath.append(projectName); // Wipe out the existing .project file projDirPath.append(".project").toFile().delete(); // Wipe out the existing .classpath file projDirPath.append(".classpath").toFile().delete(); // Wipe out the generated README. If we're using the legacy GWT project // creation tools, this will silently return false (the README isn't // there), but that's okay. projDirPath.append("README.txt").toFile().delete(); } IProject project = createProject(monitor); if (isGenerateEmptyProject) { IPath classSourcePath = new Path("src/" + packageName.replace('.', '/')); ResourceUtils.createFolderStructure(project, classSourcePath); } /* * Refresh contents; if this project was generated via GWT's WebAppCreator, * then these files would have been created directly on the file system * Although, this refresh should have been done via the project.open() call, * which is part of the createProject call above. */ project.refreshLocal(IResource.DEPTH_INFINITE, monitor); // Must be before createFiles(), which actually creates files from // fileInfos. if (isAppsMarketplaceSupported) { AppsMarketplaceProject.enableAppsMarketplace(project); if (generateAppsMarketplaceSampleApp()) { AppsMarketplaceProjectResources.createAppsMarketplaceMetadataAndSamples(packageName, fileInfos); } else { AppsMarketplaceProjectResources.createAppsMarketplaceMetadata(projectName, fileInfos); } } // Create files createFiles(project, monitor); // Set all of the natures on the project NatureUtils.addNatures(project, natureIds); // Create the java project IJavaProject javaProject = JavaCore.create(project); // Create a source folder and add it to the raw classpath IResource warFolder = project.findMember(WebAppUtilities.DEFAULT_WAR_DIR_NAME); boolean createWarFolders = (warFolder != null); IFolder srcFolder = createFolders(project, createWarFolders, monitor); if (createWarFolders) { // Set the WAR source/output directory to "/war" WebAppUtilities.setDefaultWarSettings(project); // Set the default output directory WebAppUtilities.setOutputLocationToWebInfClasses(javaProject, monitor); /* * Copy files into the web-inf lib folder. This code assumes that it is * running in a context that has a workspace lock. */ Sdk gwtSdk = getGWTSdk(); if (gwtSdk != null) { new GWTUpdateWebInfFolderCommand(javaProject, gwtSdk).execute(); } Sdk gaeSdk = getGaeSdk(); if (gaeSdk != null) { new AppEngineUpdateWebInfFolderCommand(javaProject, gaeSdk).execute(); } if (isAppsMarketplaceSupported) { new AppsMarketplaceUpdateWebInfFolderCommand(javaProject, new AppsMarketplaceSdk()).execute(); } } // Set the project migrator version of the project to the current version, // so it will get future migrations but not existing migrations GdtPreferences.setProjectMigratorVersion(project, ProjectMigrator.CURRENT_VERSION); if (useGae) { setGaeDefaults(javaProject); } setProjectClasspath(javaProject, srcFolder, monitor); // Update the web.xml and welcome page to support servlets created by both // Apps marketplace plugin. if (isAppsMarketplaceSupported && generateAppsMarketplaceSampleApp()) { AppsMarketplaceProjectResources.updateWelcomeFile(project, generateServletName(projectName), generateServletPath(projectName), monitor); AppsMarketplaceProjectResources.updateWebXml(project, packageName, monitor); AppsMarketplaceProjectResources.updateAppEngineWebxml(project, monitor); } if (useGae) { GaeProjectProperties.setIsUseSdkFromDefault(javaProject.getProject(), isUseGaeSdkFromDefault); // Update WEB-INF folder to get the latest datanucleus jars. new AppEngineUpdateWebInfFolderCommand(javaProject, getGaeSdk()).execute(); } createLaunchConfig(project); // Created a faceted project. This is long-running and hence run in a // separate job. jobSetupFacets(project); }
From source file:com.google.gdt.eclipse.suite.wizards.WebAppProjectCreator.java
License:Open Source License
private boolean generateAppsMarketplaceSampleApp() { boolean useGwt = natureIds.contains(GWTNature.NATURE_ID); boolean useGae = natureIds.contains(GaeNature.NATURE_ID); return !isGenerateEmptyProject && useGae && !useGwt; }// w w w . j ava 2s.co m