/**********************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
// ------------------------------------------------------------------------
/** Sub-string to be echo'ed when running command in shell, used to indicate that the command has finished running */
- public final static String DONE_MARKUP_STRING = "--RSE:donedonedone:--"; //$NON-NLS-1$
+ public static final String DONE_MARKUP_STRING = "--RSE:donedonedone:--"; //$NON-NLS-1$
/** Sub-string to be echoed when running a command in shell. */
- public final static String BEGIN_END_TAG = "BEGIN-END-TAG:"; //$NON-NLS-1$
+ public static final String BEGIN_END_TAG = "BEGIN-END-TAG:"; //$NON-NLS-1$
/** Command delimiter for shell */
- public final static String CMD_DELIMITER = "\n"; //$NON-NLS-1$
+ public static final String CMD_DELIMITER = "\n"; //$NON-NLS-1$
/** Shell "echo" command */
- public final static String SHELL_ECHO_CMD = " echo "; //$NON-NLS-1$
+ public static final String SHELL_ECHO_CMD = " echo "; //$NON-NLS-1$
/** Default command separator */
- public final static char CMD_SEPARATOR = ';';
+ public static final char CMD_SEPARATOR = ';';
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ICommandShell#connect()
- */
+
@Override
public void connect() throws ExecutionException {
IShellService shellService = fProxy.getShellService();
fIsConnected = true;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ICommandShell#disconnect()
- */
@Override
public void disconnect() {
fIsConnected = false;
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ICommandShell#executeCommand(java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public ICommandResult executeCommand(String command, IProgressMonitor monitor) throws ExecutionException {
return executeCommand(command, monitor, true);
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ICommandShell#executeCommand(java.lang.String, org.eclipse.core.runtime.IProgressMonitor, boolean)
- */
@Override
public ICommandResult executeCommand(final String command, final IProgressMonitor monitor, final boolean checkReturnValue) throws ExecutionException {
if (fIsConnected) {
- FutureTask<CommandResult> future = new FutureTask<CommandResult>(new Callable<CommandResult>() {
+ FutureTask<CommandResult> future = new FutureTask<>(new Callable<CommandResult>() {
@Override
public CommandResult call() throws IOException, CancellationException {
- final ArrayList<String> result = new ArrayList<String>();
+ final ArrayList<String> result = new ArrayList<>();
synchronized (fHostShell) {
// Initialize return value which will be updated in isAliasEchoResult()
return true;
}
int index = line.indexOf(expected);
- if (index > 0) {
- if (line.indexOf(SHELL_ECHO_CMD) == -1) {
- return true;
- }
+ if ((index > 0) && (line.indexOf(SHELL_ECHO_CMD) == -1)) {
+ return true;
}
return false;