From: Atanas Gegov <[email protected]>
The job executes the configure step of the project
using the "cmake" command. The output is
presented in a new console.
---
.../managedbuilder/job/ExecuteConfigureJob.java | 25 ++++++++++
.../cmake/managedbuilder/util/ConsoleUtility.java | 49 ++++++++++++++++++++
2 files changed, 74 insertions(+)
create mode 100644
plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/ConsoleUtility.java
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 ebed4bb..29e708e 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
@@ -92,6 +92,31 @@ public class ExecuteConfigureJob extends Job {
*/
@Override
protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask(
+
YoctoCMakeMessages.getString("ExecuteConfigureJob.runConfigure"), 20);
//$NON-NLS-1$
+
+ IOConsoleOutputStream cos =
+
ConsoleUtility.getConsoleOutput(YoctoCMakeMessages.getFormattedString("ExecuteConfigureJob.consoleName",
//$NON-NLS-1$
+ project.getName()));
+ monitor.worked(1);
+
+ 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$
+ } catch (InterruptedException e) {
+ return new Status(Status.WARNING,
+ Activator.PLUGIN_ID,
+
YoctoCMakeMessages.getString("ExecuteConfigureJob.warning.aborted"));
//$NON-NLS-1$
+ } finally {
+ try {
+ cos.close();
+ } catch (IOException e) {
+ cos = null;
+ }
+ }
}
private IStatus buildProject(IProgressMonitor monitor,
diff --git
a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/ConsoleUtility.java
b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/ConsoleUtility.java
new file mode 100644
index 0000000..9fb31e5
--- /dev/null
+++
b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/ConsoleUtility.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BMW Car IT GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BMW Car IT - initial API and implementation
+
*******************************************************************************/
+package org.yocto.cmake.managedbuilder.util;
+
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IOConsoleOutputStream;
+import org.eclipse.ui.console.MessageConsole;
+
+
+public class ConsoleUtility {
+
+ public static IOConsoleOutputStream getConsoleOutput(String
consoleName) {
+ return getConsole(consoleName).newOutputStream();
+ }
+
+ public static MessageConsole getConsole(String consoleName) {
+ MessageConsole foundConsole = findConsole(consoleName);
+ if (foundConsole != null) {
+ foundConsole.clearConsole();
+ } else {
+ foundConsole = new MessageConsole(consoleName, null);
+ ConsolePlugin.getDefault().
+ getConsoleManager().addConsoles(new IConsole[] {
foundConsole });
+ }
+
+ return foundConsole;
+ }
+
+ public static MessageConsole findConsole(String consoleName) {
+ IConsole[] consoles =
+
ConsolePlugin.getDefault().getConsoleManager().getConsoles();
+ for (IConsole console : consoles) {
+ if (console.getName().equals(consoleName)) {
+ return (MessageConsole) console;
+ }
+ }
+
+ return null;
+ }
+}
--
1.7.9.5
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto