本文整理汇总了Java中com.intellij.execution.ui.ConsoleView.print方法的典型用法代码示例。如果您正苦于以下问题:Java ConsoleView.print方法的具体用法?Java ConsoleView.print怎么用?Java ConsoleView.print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.execution.ui.ConsoleView
的用法示例。
在下文中一共展示了ConsoleView.print方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printMessageToConsole
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
/**
* Prints the message to console
*/
private void printMessageToConsole(String line) {
final ConsoleView console = getConsole();
final LogFilterModel.MyProcessingResult processingResult = myLogFilterModel.processLine(line);
if (processingResult.isApplicable()) {
final Key key = processingResult.getKey();
if (key != null) {
ConsoleViewContentType type = ConsoleViewContentType.getConsoleViewType(key);
if (type != null) {
final String messagePrefix = processingResult.getMessagePrefix();
if (messagePrefix != null) {
String formattedPrefix = logFormatter.formatPrefix(messagePrefix);
if (console != null) {
console.print(formattedPrefix, type);
}
}
String formattedMessage = logFormatter.formatMessage(line);
if (console != null) {
console.print(formattedMessage + "\n", type);
}
}
}
}
}
示例2: actionPerformed
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
RunContentDescriptor descriptor = StopAction.getRecentlyStartedContentDescriptor(e.getDataContext());
ProcessHandler activeProcessHandler = descriptor != null ? descriptor.getProcessHandler() : null;
if (activeProcessHandler == null || activeProcessHandler.isProcessTerminated()) return;
try {
OutputStream input = activeProcessHandler.getProcessInput();
if (input != null) {
ConsoleView console = e.getData(LangDataKeys.CONSOLE_VIEW);
if (console != null) {
console.print("^D\n", ConsoleViewContentType.SYSTEM_OUTPUT);
}
input.close();
}
}
catch (IOException ignored) {
}
}
示例3: initConsoleUi
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
@Override
protected ConsoleView initConsoleUi() {
ConsoleView consoleView = super.initConsoleUi();
String avdHome = System.getenv("ANDROID_SDK_HOME");
if (!StringUtil.isEmpty(avdHome)) {
consoleView.print(
"\n" +
"Note: The environment variable $ANDROID_SDK_HOME is set, and the emulator uses that variable to locate AVDs.\n" +
"This may result in the emulator failing to start if it cannot find the AVDs in the folder pointed to by the\n" +
"given environment variable.\n" +
"ANDROID_SDK_HOME=" + avdHome + "\n\n",
ConsoleViewContentType.NORMAL_OUTPUT);
}
return consoleView;
}
示例4: reportAdbLogMessage
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
private static void reportAdbLogMessage(Log.LogLevel logLevel, String tag, String message, @NotNull ConsoleView consoleView) {
if (message == null) {
return;
}
if (logLevel == null) {
logLevel = Log.LogLevel.INFO;
}
if (logLevel == Log.LogLevel.ERROR || logLevel == Log.LogLevel.ASSERT) {
AdbErrors.reportError(message, tag);
}
final ConsoleViewContentType contentType = toConsoleViewContentType(logLevel);
if (contentType == null) {
return;
}
final String fullMessage = tag != null ? tag + ": " + message : message;
consoleView.print(fullMessage + '\n', contentType);
}
示例5: initConsoleUi
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
protected ConsoleView initConsoleUi() {
ConsoleView consoleView = createConsoleView();
consoleView.print(myCommandLine.getCommandLineString() + '\n', ConsoleViewContentType.USER_INPUT);
consoleView.attachToProcess(myProcessHandler);
JPanel panel = new JPanel(new BorderLayout());
DefaultActionGroup toolbarActions = new DefaultActionGroup();
ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false);
panel.add(actionToolbar.getComponent(), BorderLayout.WEST);
panel.add(consoleView.getComponent(), BorderLayout.CENTER);
actionToolbar.setTargetComponent(panel);
toolbarActions.addAll(consoleView.createConsoleActions());
fillToolBarActions(toolbarActions);
panel.updateUI();
Executor defaultExecutor = DefaultRunExecutor.getRunExecutorInstance();
final RunContentDescriptor contentDescriptor = new RunContentDescriptor(consoleView, myProcessHandler, panel, myTitle);
showConsole(defaultExecutor, contentDescriptor);
myProcessHandler.addProcessListener(new ConsoleListener(myProject, defaultExecutor, myProcessHandler));
myProcessHandler.startNotify();
return consoleView;
}
示例6: updateConsoleWindow
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
public void updateConsoleWindow(
final String text,
final ConsoleViewContentType type,
final ConsoleView currentConsole
) {
currentConsole.print(text, type);
}
示例7: printMessageToConsole
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
public static void printMessageToConsole(@NotNull Project project, @NotNull String s,
@NotNull ConsoleViewContentType contentType) {
activateConsoleToolWindow(project);
final ConsoleView consoleView = project.getUserData(CONSOLE_VIEW_KEY);
if (consoleView != null) {
consoleView.print(s + '\n', contentType);
}
}
示例8: printWithHighlighting
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
public static void printWithHighlighting(@NotNull ConsoleView console, @NotNull String text, @NotNull SyntaxHighlighter highlighter) {
Lexer lexer = highlighter.getHighlightingLexer();
lexer.start(text, 0, text.length(), 0);
IElementType tokenType;
while ((tokenType = lexer.getTokenType()) != null) {
console.print(lexer.getTokenText(), getContentTypeForToken(tokenType, highlighter));
lexer.advance();
}
}
示例9: printAsFileType
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
public static void printAsFileType(@NotNull ConsoleView console, @NotNull String text, @NotNull FileType fileType) {
SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, null, null);
if (highlighter != null) {
printWithHighlighting(console, text, highlighter);
}
else {
console.print(text, ConsoleViewContentType.NORMAL_OUTPUT);
}
}
示例10: printMessageToConsole
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
private int printMessageToConsole(String line) {
final ConsoleView console = getConsoleNotNull();
if (myContentPreprocessor != null) {
List<LogFragment> fragments = myContentPreprocessor.parseLogLine(line + '\n');
for (LogFragment fragment : fragments) {
ConsoleViewContentType consoleViewType = ConsoleViewContentType.getConsoleViewType(fragment.getOutputType());
if (consoleViewType != null) {
String formattedText = myFormatter.formatMessage(fragment.getText());
console.print(formattedText, consoleViewType);
}
}
return line.length() + 1;
}
else {
final LogFilterModel.MyProcessingResult processingResult = myModel.processLine(line);
if (processingResult.isApplicable()) {
final Key key = processingResult.getKey();
if (key != null) {
ConsoleViewContentType type = ConsoleViewContentType.getConsoleViewType(key);
if (type != null) {
final String messagePrefix = processingResult.getMessagePrefix();
if (messagePrefix != null) {
String formattedPrefix = myFormatter.formatPrefix(messagePrefix);
console.print(formattedPrefix, type);
}
String formattedMessage = myFormatter.formatMessage(line);
console.print(formattedMessage + "\n", type);
return (messagePrefix != null ? messagePrefix.length() : 0) + line.length() + 1;
}
}
}
return 0;
}
}
示例11: printMessageToConsole
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
public static void printMessageToConsole(@NotNull Project project, @NotNull String s, @NotNull ConsoleViewContentType contentType) {
final ConsoleView consoleView = project.getUserData(CONSOLE_VIEW_KEY);
if (consoleView != null) {
consoleView.print(s + '\n', contentType);
}
}
示例12: fillAllConsolesWithTheSameContent
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
protected void fillAllConsolesWithTheSameContent(final String content) {
for (ConsoleView consoleView : consoleViewList) {
consoleView.print(content, ConsoleViewContentType.NORMAL_OUTPUT);
}
}
示例13: printStacktrace
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
public static void printStacktrace(final ConsoleView consoleView, final String unscrambledTrace) {
consoleView.clear();
consoleView.print(unscrambledTrace+"\n", ConsoleViewContentType.ERROR_OUTPUT);
consoleView.scrollTo(0);
}