本文整理汇总了Java中org.eclipse.debug.core.IStreamListener.streamAppended方法的典型用法代码示例。如果您正苦于以下问题:Java IStreamListener.streamAppended方法的具体用法?Java IStreamListener.streamAppended怎么用?Java IStreamListener.streamAppended使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.debug.core.IStreamListener
的用法示例。
在下文中一共展示了IStreamListener.streamAppended方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addAndNotifyStreamListener
import org.eclipse.debug.core.IStreamListener; //导入方法依赖的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: flush
import org.eclipse.debug.core.IStreamListener; //导入方法依赖的package包/类
@Override
public synchronized void flush() throws IOException {
super.flush();
String cont;
try {
cont = this.toString(encoding);
}
catch (UnsupportedEncodingException ex) {
DbgActivator.getDefault().logError("Encoding problem", ex);
cont = this.toString();
}
String appended = cont.substring(flushLength);
flushLength = cont.length();
if (this.content != null) {
this.reset();
flushLength = 0;
}
// System.out.println(oldLength + ":" + this.toString() + ":" + appended + ":" + this.listeners.size());
for (IStreamListener l : this.listeners) {
l.streamAppended(appended, monitor);
}
}
示例3: setTracing
import org.eclipse.debug.core.IStreamListener; //导入方法依赖的package包/类
private void setTracing(String[] command, IStreamListener outStreamListener, IStreamListener errorStreamListener,
IProcess prcs) {
if(HybridCore.DEBUG){
HybridCore.trace("Creating TracingStreamListeners for " + Arrays.toString(command));
outStreamListener = new TracingStreamListener(outStreamListener);
errorStreamListener = new TracingStreamListener(outStreamListener);
}
if( outStreamListener != null ){
prcs.getStreamsProxy().getOutputStreamMonitor().addListener(outStreamListener);
//See bug 121454. Ensure that output to fast processes is processed
outStreamListener.streamAppended(prcs.getStreamsProxy().getOutputStreamMonitor().getContents(), null);
}
if( errorStreamListener != null ){
prcs.getStreamsProxy().getErrorStreamMonitor().addListener(errorStreamListener);
//See bug 121454. Ensure that output to fast processes is processed
errorStreamListener.streamAppended(prcs.getStreamsProxy().getErrorStreamMonitor().getContents(), null);
}
}
示例4: flush
import org.eclipse.debug.core.IStreamListener; //导入方法依赖的package包/类
@Override
public synchronized void flush() {
if (!isFlushing) {
return;
}
String text = writer.toString();
int lastLinePos;
final boolean flushOnlyFullLines = true;
if (flushOnlyFullLines) {
int pos = text.lastIndexOf('\n');
if (pos == -1) {
// No full line in the buffer.
return;
}
lastLinePos = pos + 1;
} else {
lastLinePos = text.length();
}
String readyText = text.substring(0, lastLinePos);
writer = new StringWriter();
if (lastLinePos != text.length()) {
String rest = text.substring(lastLinePos);
writer.append(rest);
}
for (IStreamListener listener : listeners) {
listener.streamAppended(readyText, this);
}
}
示例5: fireStreamAppend
import org.eclipse.debug.core.IStreamListener; //导入方法依赖的package包/类
private void fireStreamAppend(String text) {
synchronized (listeners) {
for (IStreamListener oneListener : listeners) {
oneListener.streamAppended(text, this);
}
}
}
示例6: shellOutputChanged
import org.eclipse.debug.core.IStreamListener; //导入方法依赖的package包/类
@Override
public void shellOutputChanged(IHostShellChangeEvent event) {
IHostOutput[] lines = event.getLines();
StringBuilder buf = new StringBuilder();
for (IHostOutput line : lines) {
String lineContent = line.getString();
if (lineContent.length() == 0) {
continue;
}
buf.append(lineContent);
buf.append(System.getProperty("line.separator"));
}
String newContent = null;
if (buf.length() != 0) {
newContent = buf.toString();
contents.append(newContent);
} else {
newContent = "";
}
for (Object listener : listeners.getListeners()) {
IStreamListener streamListener = (IStreamListener) listener;
streamListener.streamAppended(newContent, this);
}
}
示例7: fireEvent
import org.eclipse.debug.core.IStreamListener; //导入方法依赖的package包/类
protected void fireEvent(String newText) {
contentsBuffer.append(newText);
for (IStreamListener listener : listeners) {
listener.streamAppended(newText, this);
}
}