当前位置: 首页>>代码示例>>Java>>正文


Java IStreamListener.streamAppended方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:wpilibsuite,项目名称:EclipsePlugins,代码行数:21,代码来源:AntLauncher.java

示例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);
			}
		}
 
开发者ID:RichardBirenheide,项目名称:brainfuck,代码行数:25,代码来源:BfProcess.java

示例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);
	}
}
 
开发者ID:eclipse,项目名称:thym,代码行数:21,代码来源:ExternalProcessUtility.java

示例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);
  }
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:29,代码来源:ConsolePseudoProcess.java

示例5: fireStreamAppend

import org.eclipse.debug.core.IStreamListener; //导入方法依赖的package包/类
private void fireStreamAppend(String text) {
    synchronized (listeners) {
        for (IStreamListener oneListener : listeners) {
            oneListener.streamAppended(text, this);
        }
    }
}
 
开发者ID:codenvy-legacy,项目名称:eclipse-plugin,代码行数:8,代码来源:StringBufferStreamMonitor.java

示例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);
	}

}
 
开发者ID:tsvetan-stoyanov,项目名称:launchpi,代码行数:28,代码来源:RemoteProcessStreamsProxy.java

示例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);
  }
}
 
开发者ID:monto-editor,项目名称:monto-eclipse,代码行数:7,代码来源:MontoStreamMonitor.java


注:本文中的org.eclipse.debug.core.IStreamListener.streamAppended方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。