| 1 | /********************************************************************** |
| 2 | * Copyright (c) 2012 Ericsson |
| 3 | * |
| 4 | * All rights reserved. This program and the accompanying materials are |
| 5 | * made available under the terms of the Eclipse Public License v1.0 which |
| 6 | * accompanies this distribution, and is available at |
| 7 | * http://www.eclipse.org/legal/epl-v10.html |
| 8 | * |
| 9 | * Contributors: |
| 10 | * Bernd Hufmann - Initial API and implementation |
| 11 | **********************************************************************/ |
| 12 | package org.eclipse.linuxtools.internal.lttng2.stubs.shells; |
| 13 | |
| 14 | import org.eclipse.core.commands.ExecutionException; |
| 15 | import org.eclipse.core.runtime.IProgressMonitor; |
| 16 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.CommandResult; |
| 17 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandResult; |
| 18 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandShell; |
| 19 | |
| 20 | /** |
| 21 | * Command shell stub |
| 22 | */ |
| 23 | public class TestCommandShell implements ICommandShell { |
| 24 | |
| 25 | /** If the shell is connected */ |
| 26 | protected boolean fIsConnected = false; |
| 27 | |
| 28 | @Override |
| 29 | public void connect() throws ExecutionException { |
| 30 | fIsConnected = true; |
| 31 | } |
| 32 | |
| 33 | @Override |
| 34 | public void disconnect() { |
| 35 | fIsConnected = false; |
| 36 | } |
| 37 | |
| 38 | @Override |
| 39 | public ICommandResult executeCommand(String command, IProgressMonitor monitor) throws ExecutionException { |
| 40 | return executeCommand(command, monitor, true); |
| 41 | } |
| 42 | |
| 43 | @Override |
| 44 | public ICommandResult executeCommand(String command, IProgressMonitor monitor, boolean checkReturnValue) throws ExecutionException { |
| 45 | if (fIsConnected) { |
| 46 | |
| 47 | } |
| 48 | return new CommandResult(0, new String[0]); |
| 49 | } |
| 50 | } |