本文整理汇总了Java中com.intellij.execution.ui.ConsoleViewContentType类的典型用法代码示例。如果您正苦于以下问题:Java ConsoleViewContentType类的具体用法?Java ConsoleViewContentType怎么用?Java ConsoleViewContentType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConsoleViewContentType类属于com.intellij.execution.ui包,在下文中一共展示了ConsoleViewContentType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printMessageToConsole
import com.intellij.execution.ui.ConsoleViewContentType; //导入依赖的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: showTestResultsToolWindow
import com.intellij.execution.ui.ConsoleViewContentType; //导入依赖的package包/类
public static void showTestResultsToolWindow(@NotNull final Project project, @NotNull final String message) {
ApplicationManager.getApplication().invokeLater(() -> {
final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
ToolWindow window = toolWindowManager.getToolWindow(StudyTestResultsToolWindowFactoryKt.ID);
if (window == null) {
toolWindowManager.registerToolWindow(StudyTestResultsToolWindowFactoryKt.ID, true, ToolWindowAnchor.BOTTOM);
window = toolWindowManager.getToolWindow(StudyTestResultsToolWindowFactoryKt.ID);
new StudyTestResultsToolWindowFactory().createToolWindowContent(project, window);
}
final Content[] contents = window.getContentManager().getContents();
for (Content content : contents) {
final JComponent component = content.getComponent();
if (component instanceof ConsoleViewImpl) {
((ConsoleViewImpl)component).clear();
((ConsoleViewImpl)component).print(message, ConsoleViewContentType.ERROR_OUTPUT);
window.setAvailable(true,null);
window.show(null);
}
}
});
}
示例3: applyFilter
import com.intellij.execution.ui.ConsoleViewContentType; //导入依赖的package包/类
@Nullable
@Override
public Result applyFilter(final String currentLine, int endPoint) {
if(RestoreSqlConfig.running) {
if(currentLine.contains("Parameters:") && StringHelper.isNotEmpty(prevLine) && prevLine.contains("Preparing:")) {
String preStr = RestoreSqlConfig.indexNum++ + " " + currentLine.split("Parameters:")[0].trim();
String restoreSql = RestoreSqlUtil.restoreSql(prevLine, currentLine);
println(preStr, ConsoleViewContentType.USER_INPUT);
if(sqlFormat) {
restoreSql = format(restoreSql);
}
println(restoreSql);
println("------------------------------------------------------------------------------------------------------------------------", ConsoleViewContentType.USER_INPUT);
}
prevLine = currentLine;
}
return null;
}
示例4: execute
import com.intellij.execution.ui.ConsoleViewContentType; //导入依赖的package包/类
@Override
protected void execute() {
myIsBusy.set(true);
myHost.runSensitiveOperation(getProgressIndicator(), true, new Runnable() {
@Override
public void run() {
try {
doLongRunningOperation(SetupProgressStep.this);
}
catch (WizardException e) {
Logger.getInstance(getClass()).error(e);
showConsole();
print(e.getMessage() + "\n", ConsoleViewContentType.ERROR_OUTPUT);
}
finally {
myIsBusy.set(false);
}
}
});
}
示例5: initConsoleUi
import com.intellij.execution.ui.ConsoleViewContentType; //导入依赖的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: printOn
import com.intellij.execution.ui.ConsoleViewContentType; //导入依赖的package包/类
@Override
public void printOn(Printer printer) {
printer.print(CompositePrintable.NEW_LINE, ConsoleViewContentType.ERROR_OUTPUT);
printer.mark();
// Error msg
TestsPresentationUtil.printWithAnsiColoring(printer, myErrorMsgPresentation, ProcessOutputTypes.STDERR);
// Diff link
myHyperlink.printOn(printer);
// Stacktrace
printer.print(CompositePrintable.NEW_LINE, ConsoleViewContentType.ERROR_OUTPUT);
TestsPresentationUtil.printWithAnsiColoring(printer, myStacktracePresentation, ProcessOutputTypes.STDERR);
printer.print(CompositePrintable.NEW_LINE, ConsoleViewContentType.ERROR_OUTPUT);
}
示例7: perform
import com.intellij.execution.ui.ConsoleViewContentType; //导入依赖的package包/类
@NotNull
@Override
protected File perform(@NotNull ProgressIndicator indicator, @NotNull File archive) throws WizardException {
String fileName = archive.getName();
ArchiveType archiveType = ArchiveType.fromFileName(fileName);
myContext.print(String.format("Unpacking %s\n", fileName), ConsoleViewContentType.SYSTEM_OUTPUT);
File dir = new File(myContext.getTempDirectory(), fileName + "-unpacked");
do {
try {
return archiveType.unpack(archive, dir, myContext, indicator);
}
catch (IOException e) {
String failure = String.format("Unable to unpack file %1$s", fileName);
String message = WelcomeUIUtils.getMessageWithDetails(failure, e.getMessage());
promptToRetry(message + " Make sure you have enough disk space on destination drive and retry.", message, e);
}
}
while (true);
}
示例8: initConsoleUi
import com.intellij.execution.ui.ConsoleViewContentType; //导入依赖的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;
}
示例9: print
import com.intellij.execution.ui.ConsoleViewContentType; //导入依赖的package包/类
private void print(String text, ConsoleViewContentType contentType) {
consoleStream.print(text, contentType);
consoleStream.print("\n", contentType);
if (activated) {
return;
}
boolean activate =
popupBehavior == BlazeConsolePopupBehavior.ALWAYS
|| (popupBehavior == BlazeConsolePopupBehavior.ON_ERROR
&& contentType == ConsoleViewContentType.ERROR_OUTPUT);
if (activate) {
activated = true;
ApplicationManager.getApplication().invokeLater(blazeConsoleService::activateConsoleWindow);
}
}
示例10: printLine
import com.intellij.execution.ui.ConsoleViewContentType; //导入依赖的package包/类
private void printLine(@NotNull String line, @NotNull ConsoleViewContentType contentType) {
Filter.Result result = null;
try {
result = myFilter.applyFilter(line, line.length());
}
catch (Throwable t) {
throw new RuntimeException("Error while applying " + myFilter + " to '"+line+"'", t);
}
if (result != null) {
defaultPrint(line.substring(0, result.getHighlightStartOffset()), contentType);
String linkText = line.substring(result.getHighlightStartOffset(), result.getHighlightEndOffset());
printHyperlink(linkText, result.getHyperlinkInfo());
defaultPrint(line.substring(result.getHighlightEndOffset()), contentType);
}
else {
defaultPrint(line, contentType);
}
}
示例11: perform
import com.intellij.execution.ui.ConsoleViewContentType; //导入依赖的package包/类
@Override
@NotNull
protected File perform(@NotNull ProgressIndicator indicator, @NotNull File arg) throws WizardException, InstallationCancelledException {
File file = new File(myContext.getTempDirectory(), getFileName(myUrl));
myContext.print(String.format("Downloading %1$s from %2$s\n", file.getName(), myUrl), ConsoleViewContentType.SYSTEM_OUTPUT);
indicator.start();
try {
//noinspection StatementWithEmptyBody
while (!attemptDownload(file, indicator)) {
// Nothing to do
}
return file;
}
catch (ProcessCanceledException e) {
throw new InstallationCancelledException();
}
}
示例12: create
import com.intellij.execution.ui.ConsoleViewContentType; //导入依赖的package包/类
@Override
protected Key create(List<TextAttributesKey> keys) {
StringBuilder keyName = new StringBuilder("ConsoleViewUtil_");
for (TextAttributesKey key : keys) {
keyName.append("_").append(key.getExternalName());
}
final Key newKey = new Key(keyName.toString());
textAttributeKeys.put(newKey, keys);
ConsoleViewContentType contentType = new ConsoleViewContentType(keyName.toString(), HighlighterColors.TEXT) {
@Override
public TextAttributes getAttributes() {
return mergedTextAttributes.get(newKey);
}
};
registerNewConsoleViewType(newKey, contentType);
return newKey;
}
示例13: testTypeText
import com.intellij.execution.ui.ConsoleViewContentType; //导入依赖的package包/类
public void testTypeText() throws Exception {
final ConsoleViewImpl console = createConsole();
console.print("Initial", ConsoleViewContentType.NORMAL_OUTPUT);
console.flushDeferredText();
try {
console.clear();
console.print("Hi", ConsoleViewContentType.NORMAL_OUTPUT);
assertEquals(2, console.getContentSize());
}
catch (Exception e) {
e.printStackTrace();
}
finally {
Disposer.dispose(console);
}
}
示例14: logCommand
import com.intellij.execution.ui.ConsoleViewContentType; //导入依赖的package包/类
@SuppressWarnings("UseOfSystemOutOrSystemErr")
protected void logCommand(@NotNull String operation, @Nullable List<String> arguments) {
if (myProject.isDisposed()) {
return;
}
final HgGlobalSettings settings = myVcs.getGlobalSettings();
String exeName;
final int lastSlashIndex = settings.getHgExecutable().lastIndexOf(File.separator);
exeName = settings.getHgExecutable().substring(lastSlashIndex + 1);
String str = String.format("%s %s %s", exeName, operation, arguments == null ? "" : StringUtil.join(arguments, " "));
//remove password from path before log
final String cmdString = myDestination != null ? HgUtil.removePasswordIfNeeded(str) : str;
final boolean isUnitTestMode = ApplicationManager.getApplication().isUnitTestMode();
// log command
if (isUnitTestMode) {
System.out.print(cmdString + "\n");
}
if (!myIsSilent) {
LOG.info(cmdString);
myVcs.showMessageInConsole(cmdString, ConsoleViewContentType.NORMAL_OUTPUT.getAttributes());
}
else {
LOG.debug(cmdString);
}
}
示例15: applyFilter
import com.intellij.execution.ui.ConsoleViewContentType; //导入依赖的package包/类
@Override
@Nullable
public List<Pair<String, ConsoleViewContentType>> applyFilter(final String text, final ConsoleViewContentType contentType) {
boolean dumb = myDumbService.isDumb();
for (Pair<InputFilter, Boolean> pair : myFilters) {
if (!dumb || pair.second == Boolean.TRUE) {
long t0 = System.currentTimeMillis();
InputFilter filter = pair.first;
List<Pair<String, ConsoleViewContentType>> result = filter.applyFilter(text, contentType);
t0 = System.currentTimeMillis() - t0;
if (t0 > 100) {
LOG.warn(filter.getClass().getSimpleName() + ".applyFilter() took " + t0 + " ms on '''" + text + "'''");
}
if (result != null) {
return result;
}
}
}
return null;
}