/******************************************************************************* | |
* Copyright (c) 2011 Nokia and others. | |
* 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: | |
* Nokia - Initial API and implementation | |
*******************************************************************************/ | |
package org.eclipse.cdt.debug.edc.tests.tcfagent; | |
import org.eclipse.tm.tcf.core.Command; | |
import org.eclipse.tm.tcf.protocol.IChannel; | |
import org.eclipse.tm.tcf.protocol.IToken; | |
public class UnitTestDriverProxy implements IUnitTestDriver { | |
private final IChannel channel; | |
public UnitTestDriverProxy(IChannel channel) { | |
this.channel = channel; | |
} | |
/** | |
* Return service name, as it appears on the wire - a TCF name of the | |
* service. | |
*/ | |
public String getName() { | |
return NAME; | |
} | |
public IToken loggingWrite(String msg, final DoneWithNoReplyCommand done) { | |
return new Command(channel, this, COMMAND_LOGGING_WRITE, new Object[] { msg }) { | |
@Override | |
public void done(Exception error, Object[] args) { | |
if (error == null) { | |
assert args.length == 1; | |
error = toError(args[0]); | |
} | |
done.done(token, error); | |
} | |
}.token; | |
} | |
public IToken loggingWriteln(String msg, final DoneWithNoReplyCommand done) { | |
return new Command(channel, this, COMMAND_LOGGING_WRITELN, new Object[] { msg }) { | |
@Override | |
public void done(Exception error, Object[] args) { | |
if (error == null) { | |
assert args.length == 1; | |
error = toError(args[0]); | |
} | |
done.done(token, error); | |
} | |
}.token; | |
} | |
public IToken loggingDialog(String msg, final DoneWithNoReplyCommand done) { | |
return new Command(channel, this, COMMAND_LOGGING_DIALOG, new Object[] { msg }) { | |
@Override | |
public void done(Exception error, Object[] args) { | |
if (error == null) { | |
assert args.length == 1; | |
error = toError(args[0]); | |
} | |
done.done(token, error); | |
} | |
}.token; | |
} | |
} |