|
13 | 13 |
|
14 | 14 | import org.eclipse.core.resources.IProject; |
15 | 15 | import org.eclipse.core.resources.ResourcesPlugin; |
16 | | -import org.eclipse.core.runtime.NullProgressMonitor; |
| 16 | +import org.eclipse.core.runtime.IProgressMonitor; |
| 17 | +import org.eclipse.core.runtime.IStatus; |
| 18 | +import org.eclipse.core.runtime.Status; |
| 19 | +import org.eclipse.core.runtime.jobs.Job; |
17 | 20 | import org.eclipse.jface.viewers.ISelectionProvider; |
18 | 21 | import org.eclipse.jface.viewers.IStructuredSelection; |
19 | 22 | import org.eclipse.osgi.util.NLS; |
|
24 | 27 | import com.ibm.microclimate.core.internal.MCEclipseApplication; |
25 | 28 | import com.ibm.microclimate.core.internal.MCLogger; |
26 | 29 | import com.ibm.microclimate.core.internal.MCUtil; |
| 30 | +import com.ibm.microclimate.ui.MicroclimateUIPlugin; |
27 | 31 | import com.ibm.microclimate.ui.internal.messages.Messages; |
28 | 32 |
|
29 | 33 | /** |
@@ -63,17 +67,24 @@ public void run() { |
63 | 67 | } |
64 | 68 |
|
65 | 69 | if (MCUtil.openConfirmDialog(Messages.DeleteProjectTitle, NLS.bind(Messages.DeleteProjectMessage, app.name))) { |
66 | | - try { |
67 | | - app.mcConnection.requestProjectDelete(app.projectID); |
68 | | - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(app.name); |
69 | | - if (project != null && project.exists() && project.getLocation().toFile().equals(app.fullLocalPath.toFile())) { |
70 | | - project.delete(false, true, new NullProgressMonitor()); |
71 | | - } |
72 | | - } catch (Exception e) { |
73 | | - MCLogger.logError("An error occurred deleting the project: " + app.name + ", with id: " + app.projectID, e); |
74 | | - MCUtil.openDialog(true, Messages.DeleteProjectErrorTitle, |
75 | | - NLS.bind(Messages.DeleteProjectErrorMsg, new String[] {app.name, e.getMessage()})); |
76 | | - } |
| 70 | + Job job = new Job(NLS.bind(Messages.DeleteProjectJobTitle, app.name)) { |
| 71 | + @Override |
| 72 | + protected IStatus run(IProgressMonitor monitor) { |
| 73 | + try { |
| 74 | + app.mcConnection.requestProjectDelete(app.projectID); |
| 75 | + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(app.name); |
| 76 | + if (project != null && project.exists() && project.getLocation().toFile().equals(app.fullLocalPath.toFile())) { |
| 77 | + project.delete(false, true, monitor); |
| 78 | + } |
| 79 | + return Status.OK_STATUS; |
| 80 | + } catch (Exception e) { |
| 81 | + MCLogger.logError("An error occurred deleting the project: " + app.name + ", with id: " + app.projectID, e); |
| 82 | + return new Status(IStatus.ERROR, MicroclimateUIPlugin.PLUGIN_ID, NLS.bind(Messages.DeleteProjectErrorMsg, app.name), e); |
| 83 | + } |
| 84 | + } |
| 85 | + }; |
| 86 | + job.schedule(); |
| 87 | + |
77 | 88 | } |
78 | 89 | } |
79 | 90 | } |
0 commit comments