summaryrefslogtreecommitdiffstats
path: root/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ConsoleRunnable.java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ConsoleRunnable.java')
-rw-r--r--plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ConsoleRunnable.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ConsoleRunnable.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ConsoleRunnable.java
new file mode 100644
index 0000000..e5fe666
--- /dev/null
+++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ConsoleRunnable.java
@@ -0,0 +1,47 @@
1/*******************************************************************************
2 * Copyright (c) 2013 Intel Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ioana Grigoropol(Intel) - initial API and implementation
10 *******************************************************************************/
11package org.yocto.remote.utils;
12
13import org.eclipse.ui.IWorkbench;
14import org.eclipse.ui.IWorkbenchPage;
15import org.eclipse.ui.IWorkbenchWindow;
16import org.eclipse.ui.PlatformUI;
17import org.eclipse.ui.console.IConsoleConstants;
18import org.eclipse.ui.console.IConsoleView;
19import org.eclipse.ui.console.MessageConsole;
20
21public class ConsoleRunnable implements Runnable{
22 MessageConsole console;
23 ConsoleRunnable (MessageConsole console){
24 this.console = console;
25 }
26 @Override
27 public void run() {
28 IWorkbench wb = PlatformUI.getWorkbench();
29 if (wb == null)
30 return;
31 IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
32 if (win == null)
33 return;
34 IWorkbenchPage page = win.getActivePage();
35 if (page == null)
36 return;
37 String id = IConsoleConstants.ID_CONSOLE_VIEW;
38 try {
39 IConsoleView view = (IConsoleView) page.showView(id);
40 if (view == null)
41 return;
42 view.display(console);
43 } catch (Exception e) {
44 e.printStackTrace();
45 }
46 }
47} \ No newline at end of file