Java Code Examples for org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathsBlock#createProject()

The following examples show how to use org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathsBlock#createProject() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebAppProjectCreator.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
protected IProject createProject(IProgressMonitor monitor) throws CoreException {
  IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
  IProject project = workspaceRoot.getProject(projectName);
  if (!project.exists()) {
    URI uri;
    if (isWorkspaceRootLocationURI(locationURI)) {
      // If you want to put a project in the workspace root then the location
      // needs to be null...
      uri = null;
    } else {
      // Non-default paths need to include the project name
      IPath path = URIUtil.toPath(locationURI).append(projectName);
      uri = URIUtil.toURI(path);
    }

    BuildPathsBlock.createProject(project, uri, monitor);
  }
  return project;
}
 
Example 2
Source File: ProjectTestUtilities.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a project with the specified name in the workspace.
 * 
 * @param projectName
 * @return new project
 * @throws CoreException
 */
public static IProject createProject(String projectName) throws CoreException {
  IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
  IProject project = workspaceRoot.getProject(projectName);
  if (project.exists()) {
    throw new IllegalStateException("Project " + projectName
        + " already exists in this workspace");
  }

  IProgressMonitor monitor = new NullProgressMonitor();
  BuildPathsBlock.createProject(project, project.getLocationURI(), monitor);
  return project;
}
 
Example 3
Source File: ProjectUtilities.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a project with the specified name in the workspace.
 *
 * @param projectName
 * @return new project
 * @throws CoreException
 */
public static IProject createProject(String projectName) throws CoreException {
  IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
  IProject project = workspaceRoot.getProject(projectName);
  if (project.exists()) {
    throw new IllegalStateException("Project " + projectName
        + " already exists in this workspace");
  }

  IProgressMonitor monitor = new NullProgressMonitor();
  BuildPathsBlock.createProject(project, project.getLocationURI(), monitor);
  return project;
}
 
Example 4
Source File: LoggedCreateTargetQueries.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void createJavaProject(IProject project) throws CoreException {
	if (!project.exists()) {
		BuildPathsBlock.createProject(project, null, new NullProgressMonitor());
		BuildPathsBlock.addJavaNature(project, new NullProgressMonitor());
	}
}
 
Example 5
Source File: JavaCapabilityConfigurationPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Helper method to create and open a IProject. The project location
 * is configured. No natures are added.
 *
 * @param project The handle of the project to create.
 * @param locationURI The location of the project or <code>null</code> to create the project in the workspace
 * @param monitor a progress monitor to report progress or <code>null</code> if
 *  progress reporting is not desired
 * @throws CoreException if the project couldn't be created
 * @see org.eclipse.core.resources.IProjectDescription#setLocationURI(java.net.URI)
 * @since 3.2
 */
public static void createProject(IProject project, URI locationURI, IProgressMonitor monitor) throws CoreException {
	BuildPathsBlock.createProject(project, locationURI, monitor);
}