Mercurial > hg > thermostat-tools-eclipse
changeset 137:2d1213657085
Add progress and cancellation support to export
author | Omair Majid <omajid@redhat.com> |
---|---|
date | Thu, 05 Jun 2014 12:32:42 -0400 |
parents | 31d0ab4467ad |
children | a9c281500b55 |
files | com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ExportPluginWizard.java |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ExportPluginWizard.java Thu Jun 05 11:53:06 2014 -0400 +++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ExportPluginWizard.java Thu Jun 05 12:32:42 2014 -0400 @@ -63,6 +63,8 @@ @Override protected IStatus run(IProgressMonitor monitor) { + monitor.beginTask("Exporting plugin", IProgressMonitor.UNKNOWN); + try { // mvn clean package new MavenRunner().run(project, "package"); @@ -71,6 +73,12 @@ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to run 'mvn clean package'", e); } + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + + monitor.worked(1); + final String distributionModuleName = project.getName() + "-distribution"; // TODO unzip and extract to thermostatLocation File projectDir = project.getLocation().toFile(); @@ -85,6 +93,13 @@ }); String zipFile = files[0]; + + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + + monitor.worked(1); + try { ZipFile pluginZip = new ZipFile(new File(distributionTargetDir, zipFile)); File installationDirectory = new File(targetLocation, "plugins"); @@ -95,6 +110,8 @@ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to install plugin in target location", e); } + monitor.worked(1); + return Status.OK_STATUS; } }