Changeset 291 for trunk/org.modelica.mdt.ui/src/org/modelica/mdt
- Timestamp:
- 02/05/06 15:03:38 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/org.modelica.mdt.ui/src/org/modelica/mdt/ui/wizards/NewProjectWizard.java
r288 r291 46 46 import org.modelica.mdt.ui.UIPlugin; 47 47 48 import org.eclipse.core.resources.IProject;49 48 import org.eclipse.core.resources.IResource; 49 import org.eclipse.core.resources.IWorkspaceRunnable; 50 50 import org.eclipse.core.resources.ResourcesPlugin; 51 import org.eclipse.core.runtime.CoreException; 52 import org.eclipse.core.runtime.IProgressMonitor; 51 53 import org.eclipse.core.runtime.IStatus; 52 54 import org.eclipse.jface.dialogs.DialogPage; 55 import org.eclipse.jface.dialogs.ErrorDialog; 53 56 import org.eclipse.jface.viewers.IStructuredSelection; 54 57 import org.eclipse.jface.wizard.Wizard; … … 150 153 } 151 154 155 private static void showProjectCreationError(IStatus status) 156 { 157 ErrorDialog.openError(null, "Error", "Could not create project", status); 158 } 152 159 153 160 @Override 154 161 public boolean performFinish() 155 162 { 156 IProject proj = 157 ModelicaCore.createProject(projectPage.projectName.getText(), 158 this.getContainer()); 163 /* 164 * run creation of the project operation inside 165 * an instance of IWorkspaceRunnable to batch the 166 * changes to the workspace 167 */ 168 try 169 { 170 IWorkspaceRunnable wr = new IWorkspaceRunnable() 171 { 172 public void run(IProgressMonitor monitor) throws CoreException 173 { 174 ModelicaCore.getModelicaRoot().createProject 175 (projectPage.projectName.getText()); 176 } 177 }; 178 ResourcesPlugin.getWorkspace().run(wr, null); 179 } 180 catch (CoreException e) 181 { 182 /* 183 * on error show the error dialog and don't 184 * close the new project wizard to give user a 185 * chance to correct the error and try again 186 */ 187 showProjectCreationError(e.getStatus()); 188 return false; 189 } 159 190 160 return proj != null;191 return true; 161 192 } 162 193
Note: See TracChangeset
for help on using the changeset viewer.