summaryrefslogtreecommitdiffstats
path: root/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandResponseHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandResponseHandler.java')
-rw-r--r--plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandResponseHandler.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandResponseHandler.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandResponseHandler.java
new file mode 100644
index 0000000..f02fbfa
--- /dev/null
+++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandResponseHandler.java
@@ -0,0 +1,44 @@
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.console.MessageConsole;
14import org.eclipse.ui.console.MessageConsoleStream;
15
16public class CommandResponseHandler implements ICommandResponseHandler {
17 private MessageConsoleStream consoleStream;
18 private Boolean errorOccured = false;
19
20 public CommandResponseHandler(MessageConsole console) {
21 try {
22 this.consoleStream = console.newMessageStream();
23 } catch (Exception e) {
24 e.printStackTrace();
25 }
26 }
27
28 public Boolean hasError() {
29 return errorOccured;
30 }
31
32 @Override
33 public void response(String line, boolean isError) {
34 try {
35 if (isError) {
36 errorOccured = true;
37 }
38 consoleStream.println(line);
39 } catch (Exception e) {
40 e.printStackTrace();
41 }
42 }
43
44} \ No newline at end of file