[yocto] [eclipse-poky][PATCH] plugins/cmake: Added warning dialog on missing cmake

Atanas Gegov atanas.gegov.oss at gmail.com
Fri Sep 13 04:40:23 PDT 2013


From: Atanas Gegov <atanas.gegov at bmw-carit.de>

If the system is not able to run the command
"cmake", the user is prompted with a MessageDialog
to check the correctness of the cmake
installation.
---
Hi,

this patch creates a MessageDialog to warn the user when the system was not able
to run "cmake". This happens if cmake is not installed on the build machine
(where the IDE itself is running).

Cheers,
Atanas

P.S: This patch applies on the current eclipse-poky master.

 .../managedbuilder/YoctoCMakeMessages.properties   |    2 ++
 .../managedbuilder/job/ExecuteConfigureJob.java    |   20 +++++++++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.properties b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.properties
index 82a5c79..55773ac 100644
--- a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.properties
+++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.properties
@@ -16,6 +16,8 @@ ExecuteConfigureJob.buildingMakefile=Building Makefile
 ExecuteConfigureJob.warning.aborted=Build of project has been aborted
 ExecuteConfigureJob.error.couldNotStart=Build of project could not be started
 ExecuteConfigureJob.error.buildFailed=Build of project failed
+ExecuteConfigureJob.cmakeWarning.dialogTitle=Unable to run command "cmake"
+ExecuteConfigureJob.cmakeWarning.dialogMessage=Please make sure that cmake is installed properly on this machine.
 
 # File generator
 YoctoCMakeMakefileGenerator.configureJob.name=Configuring project
diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/job/ExecuteConfigureJob.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/job/ExecuteConfigureJob.java
index 347843e..354d930 100644
--- a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/job/ExecuteConfigureJob.java
+++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/job/ExecuteConfigureJob.java
@@ -32,6 +32,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.console.IOConsoleOutputStream;
 import org.yocto.cmake.managedbuilder.Activator;
 import org.yocto.cmake.managedbuilder.YoctoCMakeMessages;
@@ -126,9 +128,21 @@ public class ExecuteConfigureJob extends Job {
 		try {
 			return buildProject(monitor, cos);
 		} catch (IOException e) {
-			return new Status(Status.ERROR,
-					Activator.PLUGIN_ID, Status.OK,
-					YoctoCMakeMessages.getString("ExecuteConfigureJob.error.couldNotStart"), e); //$NON-NLS-1$
+			if(e.getMessage().startsWith("Cannot run program \"cmake\"")) { //$NON-NLS-1$
+				Display.getDefault().asyncExec(new Runnable() {
+					@Override
+					public void run() {
+						MessageDialog.openWarning(null,
+								YoctoCMakeMessages.getString("ExecuteConfigureJob.cmakeWarning.dialogTitle"), //$NON-NLS-1$
+								YoctoCMakeMessages.getString("ExecuteConfigureJob.cmakeWarning.dialogMessage")); //$NON-NLS-1$
+					}
+				});
+				return Status.OK_STATUS;
+			} else {
+				return new Status(Status.ERROR,
+						Activator.PLUGIN_ID, Status.OK,
+						YoctoCMakeMessages.getString("ExecuteConfigureJob.error.couldNotStart"), e); //$NON-NLS-1$	
+			}
 		} catch (InterruptedException e) {
 			return new Status(Status.WARNING,
 					Activator.PLUGIN_ID,
-- 
1.7.9.5




More information about the yocto mailing list