本文整理汇总了Java中org.eclipse.ui.console.IOConsoleOutputStream.write方法的典型用法代码示例。如果您正苦于以下问题:Java IOConsoleOutputStream.write方法的具体用法?Java IOConsoleOutputStream.write怎么用?Java IOConsoleOutputStream.write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.console.IOConsoleOutputStream
的用法示例。
在下文中一共展示了IOConsoleOutputStream.write方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.eclipse.ui.console.IOConsoleOutputStream; //导入方法依赖的package包/类
@Override
public void run() {
String message = getFormatter().format(record);
IOConsoleOutputStream outStream = console.newOutputStream();
if (record.getLevel() == Level.SEVERE) {
outStream.setColor(new Color(null, 255, 0, 0));
} else if (record.getLevel() == Level.WARNING) {
outStream.setColor(new Color(null, 250, 133, 50));
} else if (record.getLevel() == Level.FINER) {
outStream.setColor(new Color(null, 133, 200, 62));
} else {
outStream.setColor(new Color(null, 0, 0, 156));
}
try {
outStream.write(message);
outStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
示例2: write
import org.eclipse.ui.console.IOConsoleOutputStream; //导入方法依赖的package包/类
/**
* Writes a CF application log to the console. The content type of the
* application log is resolved first and a corresponding stream is fetched
* or created as part of streaming the log message to the console.
*/
public synchronized void write(CloudLog log) throws CoreException {
if (log == null) {
return;
}
IOConsoleOutputStream activeOutStream = getOutputStream(log.getLogType());
if (activeOutStream != null && log.getMessage() != null) {
try {
activeOutStream.write(log.getMessage());
}
catch (IOException e) {
throw CloudErrorUtil.toCoreException(e);
}
}
}
示例3: write
import org.eclipse.ui.console.IOConsoleOutputStream; //导入方法依赖的package包/类
/**
* Writes a loggregator application log to the console. The content type of
* the application log is resolved first and a corresponding stream is
* fetched or created as part of streaming the log message to the console.
*/
public synchronized void write(ApplicationLog appLog) throws CoreException {
if (appLog == null) {
return;
}
// Convert it to a CloudLog that contains the appropriate log content
// type
CloudLog log = getCloudlog(appLog);
IOConsoleOutputStream activeOutStream = getOutputStream(log.getLogType());
if (activeOutStream != null && log.getMessage() != null) {
try {
activeOutStream.write(log.getMessage());
}
catch (IOException e) {
throw CloudErrorUtil.toCoreException(e);
}
}
}
示例4: printMessage
import org.eclipse.ui.console.IOConsoleOutputStream; //导入方法依赖的package包/类
protected void printMessage(String message, Color c, int style) {
if (message != null) {
IOConsoleOutputStream outputStream = getOutputStream();
outputStream.setActivateOnWrite(true);
if (c != null) {
outputStream.setColor(c);
}
outputStream.setFontStyle(style);
try {
outputStream.write(message);
outputStream.flush();
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
示例5: write
import org.eclipse.ui.console.IOConsoleOutputStream; //导入方法依赖的package包/类
private static void write(String cmdLineToExe, IOConsoleOutputStream out, Object... args) {
try {
if (out != null) {
synchronized (lock) {
if (args != null) {
for (Object arg : args) {
if (arg instanceof String) {
cmdLineToExe += " " + arg;
} else if (arg instanceof String[]) {
String[] strings = (String[]) arg;
for (String string : strings) {
cmdLineToExe += " " + string;
}
}
}
}
out.write(cmdLineToExe + "\n");
}
}
} catch (IOException e) {
Log.log(e);
}
}
示例6: write
import org.eclipse.ui.console.IOConsoleOutputStream; //导入方法依赖的package包/类
public synchronized void write(CloudLog log) throws CoreException {
if (log == null || log.getMessage() == null) {
return;
}
IOConsoleOutputStream outStream = getOutputStream(log.getLogType());
if (outStream != null) {
try {
outStream.write(log.getMessage());
}
catch (IOException e) {
throw CloudErrorUtil.toCoreException(e);
}
}
}
示例7: write
import org.eclipse.ui.console.IOConsoleOutputStream; //导入方法依赖的package包/类
public synchronized String write(String content) throws CoreException {
IOConsoleOutputStream activeOutStream = getActiveOutputStream();
if (activeOutStream != null && content != null && content.length() > 0) {
try {
activeOutStream.write(content);
return content;
}
catch (IOException e) {
throw CloudErrorUtil.toCoreException(e);
}
}
return null;
}
示例8: write
import org.eclipse.ui.console.IOConsoleOutputStream; //导入方法依赖的package包/类
public synchronized void write(String message) {
if (message == null) {
return;
}
IOConsoleOutputStream outStream = getActiveOutputStream();
if (outStream != null) {
try {
outStream.write(message);
}
catch (IOException e) {
DockerFoundryPlugin.logError(e);
close();
}
}
}
示例9: writeTo
import org.eclipse.ui.console.IOConsoleOutputStream; //导入方法依赖的package包/类
private void writeTo(final IOConsoleOutputStream outputStream, final String message) {
try {
outputStream.write(message);
outputStream.flush();
} catch (final IOException e) {
// Do nothing
}
}
示例10: append
import org.eclipse.ui.console.IOConsoleOutputStream; //导入方法依赖的package包/类
@Override
protected void append(LoggingEvent logEvent) {
final String message = logEvent.getRenderedMessage();
final Level level = logEvent.getLevel();
final String streamId = getStreamId(level);
final Display display = Display.getDefault();
final Thread thread = display.getThread();
Thread _currentThread = Thread.currentThread();
final boolean uiThread = Objects.equal(thread, _currentThread);
final Runnable _function = new Runnable() {
@Override
public void run() {
try {
final IOConsole console = AntlrConsoleFactory.getConsole();
final IOConsoleOutputStream stream = console
.newOutputStream();
final ConsoleColorProvider colorProvider = new ConsoleColorProvider();
final Color color = colorProvider.getColor(streamId);
stream.setColor(color);
stream.setActivateOnWrite(true);
stream.write((message + "\n"));
stream.close();
} catch (Throwable ex) {
ex.printStackTrace();
}
}
};
final Runnable printTask = _function;
if (uiThread) {
printTask.run();
} else {
display.syncExec(printTask);
}
}
示例11: write
import org.eclipse.ui.console.IOConsoleOutputStream; //导入方法依赖的package包/类
/**
* OutputStream interface
*/
@Override
public void write(int b) throws IOException {
if (writeToConsole) {
IOConsoleOutputStream out = getOutputStream();
out.write(b);
}
}
示例12: doActionOnResource
import org.eclipse.ui.console.IOConsoleOutputStream; //导入方法依赖的package包/类
@Override
protected int doActionOnResource(IResource next, IProgressMonitor monitor) {
this.refresh = new ArrayList<IContainer>();
AbstractRunner runner = UniversalRunner.getRunner(natureUsed);
if (next instanceof IContainer) {
this.refresh.add((IContainer) next);
} else {
this.refresh.add(next.getParent());
}
String dir = next.getLocation().toOSString();
File workingDir = new File(dir);
if (!workingDir.exists()) {
Log.log("Received file that does not exist for 2to3: " + workingDir);
return 0;
}
if (!workingDir.isDirectory()) {
workingDir = workingDir.getParentFile();
if (!workingDir.isDirectory()) {
Log.log("Unable to find working dir for 2to3. Found invalid: " + workingDir);
return 0;
}
}
ArrayList<String> parametersWithResource = new ArrayList<String>(parameters);
parametersWithResource.add(0, dir);
Tuple<String, String> tup = runner.runCodeAndGetOutput(RUN_2_TO_3_CODE,
parametersWithResource.toArray(new String[0]), workingDir, monitor);
IOConsoleOutputStream out = MessageConsoles.getConsoleOutputStream("2To3", UIConstants.PY_INTERPRETER_ICON);
try {
out.write(tup.o1);
out.write("\n");
out.write(tup.o2);
} catch (IOException e) {
Log.log(e);
}
return 1;
}