本文整理汇总了Java中org.eclipse.debug.core.model.IStreamMonitor类的典型用法代码示例。如果您正苦于以下问题:Java IStreamMonitor类的具体用法?Java IStreamMonitor怎么用?Java IStreamMonitor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IStreamMonitor类属于org.eclipse.debug.core.model包,在下文中一共展示了IStreamMonitor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addAndNotifyStreamListener
import org.eclipse.debug.core.model.IStreamMonitor; //导入依赖的package包/类
/**
* Adds listener to monitor, and calls listener with any content monitor already has.
* NOTE: This methods synchronises on monitor while listener is called. Listener may
* not wait on any thread that waits for monitors monitor, what would result in dead-lock.
*/
public static void addAndNotifyStreamListener(IStreamMonitor monitor, IStreamListener listener) {
// Synchronise on monitor to prevent writes to stream while we are adding listener.
// It's weird to synchronise on monitor because that's a shared object, but that's
// what ProcessConsole does.
synchronized (monitor) {
String contents = monitor.getContents();
if (!contents.isEmpty()) {
// Call to unknown code while synchronising on monitor. This is dead-lock prone!
// Listener must not wait for other threads that are waiting in line to
// synchronise on monitor.
listener.streamAppended(contents, monitor);
}
monitor.addListener(listener);
}
}
示例2: streamAppended
import org.eclipse.debug.core.model.IStreamMonitor; //导入依赖的package包/类
public synchronized void streamAppended(String text, IStreamMonitor monitor)
{
// broadcast the message
for (int i = 0; i < listeners.length; i++)
{
if (listeners[i] != null)
{
try
{
listeners[i].appendText(text);
} catch (Exception e)
{
TLCActivator.logError("Error broadcasting the message", e);
}
}
}
}
示例3: streamAppended
import org.eclipse.debug.core.model.IStreamMonitor; //导入依赖的package包/类
public synchronized void streamAppended(String text, IStreamMonitor monitor)
{
// broadcast the message
for (int i = 0; i < listeners.length; i++)
{
if (listeners[i] != null)
{
try
{
listeners[i].appendText(text);
} catch (Exception e)
{
ProverUIActivator.getDefault().logError("Error broadcasting the message", e);
}
}
}
}
示例4: onAfterCodeServerStarted
import org.eclipse.debug.core.model.IStreamMonitor; //导入依赖的package包/类
private void onAfterCodeServerStarted(DebugEvent event) {
if (!(event.getSource() instanceof IProcess)) {
return;
}
IProcess runtimeProcess = (IProcess) event.getSource();
final ILaunch launch = runtimeProcess.getLaunch();
IProcess[] processes = launch.getProcesses();
final IProcess process = processes[0];
// Look for the links in the sdm console output
consoleStreamListenerCodeServer = new IStreamListener() {
@Override
public void streamAppended(String text, IStreamMonitor monitor) {
displayCodeServerUrlInDevMode(launch, text);
}
};
// Listen to Console output
streamMonitorCodeServer = process.getStreamsProxy().getOutputStreamMonitor();
streamMonitorCodeServer.addListener(consoleStreamListenerCodeServer);
}
示例5: getStreamsProxy
import org.eclipse.debug.core.model.IStreamMonitor; //导入依赖的package包/类
@Override
public IStreamsProxy getStreamsProxy() {
return new IStreamsProxy() {
@Override
public void write(String input) throws IOException {
}
@Override
public IStreamMonitor getErrorStreamMonitor() {
return errorStream;
}
@Override
public IStreamMonitor getOutputStreamMonitor() {
return outputStream;
}
};
}
示例6: streamAppended
import org.eclipse.debug.core.model.IStreamMonitor; //导入依赖的package包/类
@Override
public void streamAppended(String text, IStreamMonitor monitor) {
HybridCore.trace(text);
if(delegate != null){
delegate.streamAppended(text, monitor);
}
}
示例7: addMonListener
import org.eclipse.debug.core.model.IStreamMonitor; //导入依赖的package包/类
public void addMonListener(IConsole parserConsole, IStreamMonitor monitor, IStreamListener listener){
if (parserListeners==null){
MessageUI.error("BUG in addMonListener(): parserListeners=null - enable breakpoints");
System.out.println("BUG in addMonListener(): parserListeners=null");
return;
}
// synchronized (parserListeners){
parserListeners.put(parserConsole, new MonListener(monitor, listener)); // java.lang.NullPointerException
// }
}
示例8: streamAppended
import org.eclipse.debug.core.model.IStreamMonitor; //导入依赖的package包/类
@Override
public void streamAppended(String text, IStreamMonitor monitor) {
if (text.length() == 0 && !shell.isActive()) {
getSystemRegistry().fireEvent(
new SystemResourceChangeEvent(RemoteProcess.this, ISystemResourceChangeEvents.EVENT_COMMAND_SHELL_FINISHED, cmdSubSystem));
}
}
示例9: streamAppended
import org.eclipse.debug.core.model.IStreamMonitor; //导入依赖的package包/类
@Override
public void streamAppended(String text, IStreamMonitor monitor) {
}
示例10: getErrorStreamMonitor
import org.eclipse.debug.core.model.IStreamMonitor; //导入依赖的package包/类
@Override
public IStreamMonitor getErrorStreamMonitor() {
return errorMonitor;
}
示例11: getOutputStreamMonitor
import org.eclipse.debug.core.model.IStreamMonitor; //导入依赖的package包/类
@Override
public IStreamMonitor getOutputStreamMonitor() {
return outputMonitor;
}
示例12: setUpStreamListening
import org.eclipse.debug.core.model.IStreamMonitor; //导入依赖的package包/类
/**
* This method sets up the mechanism for listening to the error and output streams
* of the prover. It also sets the value of the field proverProcess.
*
* @param process
* @param monitor
*/
private void setUpStreamListening(Process process, IProgressMonitor monitor)
{
/*
* This code proceeds as follows. First, we wrap the java.lang.Process in an IProcess by calling
* DebugPlugin.newProcess(). An IProcess is an eclipse object with some
* convenience methods. Then we create a TLAPMBroadcastStreamListener and add it as
* a listener to the output and error streams of the IProcess.
*
* The code is wrapped in two synchronized blocks to avoid a race condition on the
* prover's output. The race condition can occur as follows. Calling DebugPlugin.newProcess()
* creates instances of IStreamMonitor to monitor the output and error streams
* of the prover. These monitors immediately start monitoring the streams and passing the
* text from the streams to registered listeners. This means that they can potentially read
* text from the prover's streams before the TLAPMBroadcastStreamListener is added as a listener.
* This text would be lost. To solve this, this thread locks access to the prover's output and error
* streams until after the TLAPMBroadcastStreamListener has been added as a listener.
*/
if (process != null)
{
synchronized (process.getInputStream())
{
synchronized (process.getErrorStream())
{
/*
* Calling DebugPlugin.newProcess()
* wraps the java.lang.Process in an IProcess with some
* convenience methods.
*/
proverProcess = DebugPlugin.newProcess(launch, process, getName());
/*
* Setup the broadcasting of the prover output stream.
* We pass in the progress monitor to allow listeners
* to report progress.
*/
listener = new TLAPMBroadcastStreamListener(module, this, monitor);
/*
* Send a string to the listener indicating
* that a new prover job is starting. This makes
* it easier to read the console.
*/
listener.streamAppended("---------------- New Prover Launch --------------\n", null);
IStreamMonitor esMonitor = proverProcess.getStreamsProxy().getErrorStreamMonitor();
IStreamMonitor osMonitor = proverProcess.getStreamsProxy().getOutputStreamMonitor();
esMonitor.addListener(listener);
osMonitor.addListener(listener);
/*
* The output from the prover can be long, so buffering it can lead to an
* OutOfMemoryError. The following code turns off buffering.
*/
if (esMonitor instanceof IFlushableStreamMonitor && osMonitor instanceof IFlushableStreamMonitor)
{
((IFlushableStreamMonitor) esMonitor).setBuffered(false);
((IFlushableStreamMonitor) osMonitor).setBuffered(false);
}
}
}
}
}
示例13: streamAppended
import org.eclipse.debug.core.model.IStreamMonitor; //导入依赖的package包/类
@Override
public void streamAppended(String text, IStreamMonitor monitor) {
TypeScriptCompilerHelper.processMessage(text, this);
}
示例14: getErrorStreamMonitor
import org.eclipse.debug.core.model.IStreamMonitor; //导入依赖的package包/类
@Override
public IStreamMonitor getErrorStreamMonitor() {
return this.error;
}
示例15: getOutputStreamMonitor
import org.eclipse.debug.core.model.IStreamMonitor; //导入依赖的package包/类
@Override
public IStreamMonitor getOutputStreamMonitor() {
return this.output;
}