diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/Messages.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/Messages.java index c46d26709..6b6cc5540 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/Messages.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/Messages.java @@ -13,6 +13,9 @@ public class Messages extends NLS public static String NewProjectHandler_PathErrorTitle; public static String LanguageChange_ErrorTitle; public static String LanguageChange_ErrorMessage; + public static String ProjectCleanCommandHandler_RunningProjectCleanJobName; + public static String ProjectFullCleanCommandHandler_RunningFullcleanJobName; + public static String PythonCleanCommandHandler_RunningPythonCleanJobName; public static String UpdateEspIdfCommand_JobMsg; public static String UpdateEspIdfCommand_InstallToolsJobMsg; public static String UpdateEspIdfCommand_SuggestToOpenInstallToolsWizard; diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/ProjectCleanCommandHandler.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/ProjectCleanCommandHandler.java index ba3aca917..467e2db0d 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/ProjectCleanCommandHandler.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/ProjectCleanCommandHandler.java @@ -49,8 +49,8 @@ public Object execute(ExecutionEvent event) throws ExecutionException commands.add("clean"); //$NON-NLS-1$ Map envMap = new IDFEnvironmentVariables().getSystemEnvMap(); - console.println(commands.toString()); - console.print((runCommand(commands, pathToProject, envMap))); + runCommandInNewJob(Messages.ProjectCleanCommandHandler_RunningProjectCleanJobName, commands, pathToProject, + envMap); return event; } diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/ProjectFullCleanCommandHandler.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/ProjectFullCleanCommandHandler.java index 2ae672c40..22fe0e41d 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/ProjectFullCleanCommandHandler.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/ProjectFullCleanCommandHandler.java @@ -54,8 +54,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException } commands.add("fullclean"); //$NON-NLS-1$ Map envMap = new IDFEnvironmentVariables().getSystemEnvMap(); - console.println(commands.toString()); - console.print((runCommand(commands, pathToProject, envMap))); + runCommandInNewJob(Messages.ProjectFullCleanCommandHandler_RunningFullcleanJobName, commands, pathToProject, envMap); return event; } diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/PythonCleanCommandHandler.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/PythonCleanCommandHandler.java index a25e03776..3b6cb2843 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/PythonCleanCommandHandler.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/PythonCleanCommandHandler.java @@ -48,8 +48,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException } commands.add("python-clean"); //$NON-NLS-1$ Map envMap = new IDFEnvironmentVariables().getSystemEnvMap(); - console.println(commands.toString()); - console.print((runCommand(commands, pathToProject, envMap))); + runCommandInNewJob(Messages.PythonCleanCommandHandler_RunningPythonCleanJobName, commands, pathToProject, envMap); return event; } diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/messages.properties b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/messages.properties index 5090d5b06..f5d2316e8 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/messages.properties +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/messages.properties @@ -6,6 +6,9 @@ NewProjectHandler_CouldntFindTools=Could't find installed tools path for GIT and NewProjectHandler_MandatoryMsg=This is a mandatory step even if you've already installed the tools from the command line. Do you want to install the missing tools now? NewProjectHandler_NavigateToHelpMenu=Please navigate to menu `Help > ESP-IDF Tools Manager > Install Tools` to install and configure the required paths for creating and building the ESP-IDF projects. \n \n NewProjectHandler_PathErrorTitle=Path Error +ProjectCleanCommandHandler_RunningProjectCleanJobName=Running Project Clean... +ProjectFullCleanCommandHandler_RunningFullcleanJobName=Running fullclean... +PythonCleanCommandHandler_RunningPythonCleanJobName=Running python-clean command... UpdateEspIdfCommand_JobMsg=Updating ESP-IDF master... UpdateEspIdfCommand_InstallToolsJobMsg=Installing tools... UpdateEspIdfCommand_SuggestToOpenInstallToolsWizard = A new set of tools might be required to install. Do you want to open the Install Tools dialog? \ No newline at end of file diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java index 61451c697..a1dfa529c 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java @@ -14,10 +14,12 @@ import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.window.Window; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.console.MessageConsoleStream; @@ -161,7 +163,7 @@ protected IStatus runCommand(List arguments, MessageConsoleStream consol Map environment = new HashMap<>(System.getenv()); Logger.log(environment.toString()); - environment.put("PYTHONUNBUFFERED", "1"); + environment.put("PYTHONUNBUFFERED", "1"); //$NON-NLS-1$ //$NON-NLS-2$ if (gitExecutablePath != null) { @@ -216,7 +218,7 @@ private IStatus processData(Process process) return Status.OK_STATUS; } - return new Status(IStatus.ERROR, IDFCorePlugin.PLUGIN_ID, "Error"); + return new Status(IStatus.ERROR, IDFCorePlugin.PLUGIN_ID, "Error"); //$NON-NLS-1$ } catch (InterruptedException e) @@ -294,6 +296,23 @@ else if (!StringUtil.isEmpty(path2) && !path2.contains(gitDir)) // Git not found } } + protected void runCommandInNewJob(String jobName, List commandArgs, Path pathToProject, + Map envMap) + { + Job job = new Job(jobName) + { + + protected IStatus run(IProgressMonitor monitor) + { + console.println(String.format(Messages.AbstractToolsHandler_RunningCommandFormatString, + String.join(" ", commandArgs))); //$NON-NLS-1$ + console.println((runCommand(commandArgs, pathToProject, envMap))); + return Status.OK_STATUS; + } + }; + job.schedule(); + } + protected String getCommandString(List arguments) { StringBuilder builder = new StringBuilder(); diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/Messages.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/Messages.java index 6eee46609..09f8502c6 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/Messages.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/Messages.java @@ -10,6 +10,7 @@ public class Messages extends NLS { private static final String BUNDLE_NAME = "com.espressif.idf.ui.update.messages"; //$NON-NLS-1$ public static String AbstractToolsHandler_ExecutingMsg; + public static String AbstractToolsHandler_RunningCommandFormatString; public static String DirectorySelectionDialog_Browse; public static String DirectorySelectionDialog_CantbeEmpty; public static String DirectorySelectionDialog_CheckTools; diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/messages.properties b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/messages.properties index 03336ab14..94c6ac3de 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/messages.properties +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/messages.properties @@ -3,6 +3,7 @@ # Use is subject to license terms. ############################################################################### AbstractToolsHandler_ExecutingMsg=Executing +AbstractToolsHandler_RunningCommandFormatString=Running command: %s DirectorySelectionDialog_Browse=Browse... DirectorySelectionDialog_CantbeEmpty=Fields can't be empty\! DirectorySelectionDialog_CheckTools=Check Tools