Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/NewModelProjectWizard.java')
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/NewModelProjectWizard.java144
1 files changed, 72 insertions, 72 deletions
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/NewModelProjectWizard.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/NewModelProjectWizard.java
index 9fe53ff31..8fc7b5ac9 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/NewModelProjectWizard.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/NewModelProjectWizard.java
@@ -31,8 +31,8 @@ import org.eclipse.ui.internal.wizards.newresource.ResourceMessages;
public class NewModelProjectWizard extends Wizard implements INewWizard {
- private WizardNewProjectCreationPage mainPage;
-
+ private WizardNewProjectCreationPage mainPage;
+
public NewModelProjectWizard() {
super();
}
@@ -40,94 +40,94 @@ public class NewModelProjectWizard extends Wizard implements INewWizard {
public void addPages() {
super.addPages();
- mainPage = new WizardNewProjectCreationPage("basicNewProjectPage");//$NON-NLS-1$
- mainPage.setTitle(ResourceMessages.NewProject_title);
- mainPage.setDescription(ResourceMessages.NewProject_description);
- this.addPage(mainPage);
+ mainPage = new WizardNewProjectCreationPage("basicNewProjectPage");//$NON-NLS-1$
+ mainPage.setTitle(ResourceMessages.NewProject_title);
+ mainPage.setDescription(ResourceMessages.NewProject_description);
+ this.addPage(mainPage);
}
public boolean performFinish() {
- // get a project handle
- final IProject newProjectHandle = mainPage.getProjectHandle();
+ // get a project handle
+ final IProject newProjectHandle = mainPage.getProjectHandle();
- // get a project descriptor
- URI location = null;
- if (!mainPage.useDefaults()) {
+ // get a project descriptor
+ URI location = null;
+ if (!mainPage.useDefaults()) {
location = mainPage.getLocationURI();
}
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- final IProjectDescription description = workspace
- .newProjectDescription(newProjectHandle.getName());
- description.setLocationURI(location);
- description.setNatureIds(new String[] {ModelNature.NATURE_ID});
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ final IProjectDescription description = workspace
+ .newProjectDescription(newProjectHandle.getName());
+ description.setLocationURI(location);
+ description.setNatureIds(new String[] {ModelNature.NATURE_ID});
- // create the new project operation
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- protected void execute(IProgressMonitor monitor)
- throws CoreException {
- createProject(description, newProjectHandle, monitor);
- }
- };
+ // create the new project operation
+ WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+ protected void execute(IProgressMonitor monitor)
+ throws CoreException {
+ createProject(description, newProjectHandle, monitor);
+ }
+ };
- // run the new project creation operation
- try {
- getContainer().run(true, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- // ie.- one of the steps resulted in a core exception
- Throwable t = e.getTargetException();
- if (t instanceof CoreException) {
- ErrorDialog.openError(getShell(), null, null,
- ((CoreException) t).getStatus());
- } else {
- MessageDialog
- .openError(
- getShell(),
- "Error occurred",
- t.getMessage());
- }
- return false;
- }
+ // run the new project creation operation
+ try {
+ getContainer().run(true, true, op);
+ } catch (InterruptedException e) {
+ return false;
+ } catch (InvocationTargetException e) {
+ // ie.- one of the steps resulted in a core exception
+ Throwable t = e.getTargetException();
+ if (t instanceof CoreException) {
+ ErrorDialog.openError(getShell(), null, null,
+ ((CoreException) t).getStatus());
+ } else {
+ MessageDialog
+ .openError(
+ getShell(),
+ "Error occurred",
+ t.getMessage());
+ }
+ return false;
+ }
return true;
}
- /**
- * Creates a project resource given the project handle and description.
- *
- * @param description
- * the project description to create a project resource for
- * @param projectHandle
- * the project handle to create a project resource for
- * @param monitor
- * the progress monitor to show visual progress with
- *
- * @exception CoreException
- * if the operation fails
- * @exception OperationCanceledException
- * if the operation is canceled
- */
- void createProject(IProjectDescription description, IProject projectHandle,
- IProgressMonitor monitor) throws CoreException,
- OperationCanceledException {
- try {
- monitor.beginTask("", 2000);//$NON-NLS-1$
+ /**
+ * Creates a project resource given the project handle and description.
+ *
+ * @param description
+ * the project description to create a project resource for
+ * @param projectHandle
+ * the project handle to create a project resource for
+ * @param monitor
+ * the progress monitor to show visual progress with
+ *
+ * @exception CoreException
+ * if the operation fails
+ * @exception OperationCanceledException
+ * if the operation is canceled
+ */
+ void createProject(IProjectDescription description, IProject projectHandle,
+ IProgressMonitor monitor) throws CoreException,
+ OperationCanceledException {
+ try {
+ monitor.beginTask("", 2000);//$NON-NLS-1$
- projectHandle.create(description, SubMonitor.convert(monitor,
- 1000));
+ projectHandle.create(description, SubMonitor.convert(monitor,
+ 1000));
- if (monitor.isCanceled()) {
+ if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
- projectHandle.open(IResource.BACKGROUND_REFRESH, SubMonitor.convert(monitor, 1000));
+ projectHandle.open(IResource.BACKGROUND_REFRESH, SubMonitor.convert(monitor, 1000));
- } finally {
- monitor.done();
- }
- }
-
+ } finally {
+ monitor.done();
+ }
+ }
+
public void init(IWorkbench workbench, IStructuredSelection selection) {
// Nothing to do
}

Back to the top