blob: e5fe6667f3e3c5f38d320bc640aba2ffdaa12032 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/*******************************************************************************
* Copyright (c) 2013 Intel Corporation.
* 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:
* Ioana Grigoropol(Intel) - initial API and implementation
*******************************************************************************/
package org.yocto.remote.utils;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.IConsoleConstants;
import org.eclipse.ui.console.IConsoleView;
import org.eclipse.ui.console.MessageConsole;
public class ConsoleRunnable implements Runnable{
MessageConsole console;
ConsoleRunnable (MessageConsole console){
this.console = console;
}
@Override
public void run() {
IWorkbench wb = PlatformUI.getWorkbench();
if (wb == null)
return;
IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
if (win == null)
return;
IWorkbenchPage page = win.getActivePage();
if (page == null)
return;
String id = IConsoleConstants.ID_CONSOLE_VIEW;
try {
IConsoleView view = (IConsoleView) page.showView(id);
if (view == null)
return;
view.display(console);
} catch (Exception e) {
e.printStackTrace();
}
}
}
|