org.eclipse.ui.ide.undo.CreateProjectOperation Java Examples

The following examples show how to use org.eclipse.ui.ide.undo.CreateProjectOperation. 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: CreateAppEngineWtpProject.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Override
public void execute(IProgressMonitor monitor) throws InvocationTargetException, CoreException {
  IWorkspace workspace = ResourcesPlugin.getWorkspace();
  IProject newProject = config.getProject();
  URI location = config.getEclipseProjectLocationUri();

  String name = newProject.getName();
  IProjectDescription description = workspace.newProjectDescription(name);
  description.setLocationURI(location);

  String operationLabel = getDescription();
  SubMonitor subMonitor = SubMonitor.convert(monitor, operationLabel, 120);
  CreateProjectOperation operation = new CreateProjectOperation(description, operationLabel);
  try {
    operation.execute(subMonitor.newChild(10), uiInfoAdapter);
    mostImportant = createAndConfigureProjectContent(newProject, config, subMonitor.newChild(80));
  } catch (ExecutionException ex) {
    throw new InvocationTargetException(ex);
  }

  IFacetedProject facetedProject = ProjectFacetsManager.create(
      newProject, true /* convertIfNecessary */, subMonitor.newChild(5));
  addAppEngineFacet(facetedProject, subMonitor.newChild(6));

  addAdditionalDependencies(newProject, config, subMonitor.newChild(20));

  fixTestSourceDirectorySettings(newProject, subMonitor.newChild(5));
}
 
Example #2
Source File: ProjectHelper.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
private IProject createProject( IProjectDescription projectDescription ) {
  String label = "Create project " + projectName;
  try {
    new CreateProjectOperation( projectDescription, label ).execute( newProgressMonitor(), null );
  } catch( ExecutionException ee ) {
    throw new RuntimeException( ee );
  }
  return ResourcesPlugin.getWorkspace().getRoot().getProject( projectName );
}