本文整理汇总了Java中com.intellij.execution.ui.ConsoleView.clear方法的典型用法代码示例。如果您正苦于以下问题:Java ConsoleView.clear方法的具体用法?Java ConsoleView.clear怎么用?Java ConsoleView.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.execution.ui.ConsoleView
的用法示例。
在下文中一共展示了ConsoleView.clear方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doFilter
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
/**
* Filters the console
*/
private synchronized void doFilter(ProgressIndicator progressIndicator) {
final ConsoleView console = getConsole();
String allLInes = getOriginalDocument().toString();
final String[] lines = allLInes.split("\n");
if (console != null) {
console.clear();
}
myLogFilterModel.processingStarted();
int size = lines.length;
float current = 0;
for (String line : lines) {
printMessageToConsole(line);
current++;
progressIndicator.setFraction(current / size);
}
if (console != null) {
((ConsoleViewImpl) console).requestScrollingToEnd();
}
}
示例2: createConsole
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
@Nullable
@Override
protected ConsoleView createConsole(@NotNull Executor executor) throws ExecutionException {
ConsoleView console = super.createConsole(executor);
// before run new task,clean log
if (console != null) {
console.clear();
}
return console;
}
示例3: clearAllConsoles
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
protected void clearAllConsoles() {
for (ConsoleView consoleView : consoleViewList) {
consoleView.clear();
}
}
示例4: actionPerformed
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
final ConsoleView consoleView = myConsoleView != null ? myConsoleView : e.getData(LangDataKeys.CONSOLE_VIEW);
if (consoleView != null) {
consoleView.clear();
}
}
示例5: doFilter
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
private synchronized void doFilter() {
if (myDisposed) {
return;
}
final ConsoleView console = getConsoleNotNull();
console.clear();
myModel.processingStarted();
final String[] lines = myOriginalDocument != null ? myOriginalDocument.toString().split("\n") : ArrayUtil.EMPTY_STRING_ARRAY;;
int offset = 0;
boolean caretPositioned = false;
for (String line : lines) {
final int printed = printMessageToConsole(line);
if (printed > 0) {
if (!caretPositioned) {
if (Comparing.strEqual(myLineUnderSelection, line)) {
caretPositioned = true;
offset += myLineOffset != -1 ? myLineOffset : 0;
}
else {
offset += printed;
}
}
}
}
// we need this, because, document can change before actual scrolling, so offset may be already not at the end
if (caretPositioned) {
console.scrollTo(offset);
}
else {
((ConsoleViewImpl)console).requestScrollingToEnd();
}
}
示例6: processConsole
import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
private static void processConsole(Project project, ProcessHandler processHandler) {
ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
consoleView.clear();
consoleView.attachToProcess(processHandler);
processHandler.startNotify();
ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
ToolWindow toolWindow;
toolWindow = toolWindowManager.getToolWindow(TOOL_ID);
// if already exist tool window then show it
if (toolWindow != null) {
toolWindow.show(null);// TODO add more tabs here?
return;
}
toolWindow = toolWindowManager.registerToolWindow(TOOL_ID, true, ToolWindowAnchor.BOTTOM);
toolWindow.setTitle("Android....");
toolWindow.setStripeTitle("Android Console");
toolWindow.setShowStripeButton(true);
toolWindow.setIcon(PluginIcons.ICON_TOOL_WINDOW);
JPanel panel = new JPanel((LayoutManager) new BorderLayout());
panel.add((Component) consoleView.getComponent(), "Center");
// Create toolbars
DefaultActionGroup toolbarActions = new DefaultActionGroup();
AnAction[]
consoleActions = consoleView.createConsoleActions();// 必须在 consoleView.getComponent() 调用后组件真正初始化之后调用
toolbarActions.addAll((AnAction[]) Arrays.copyOf(consoleActions, consoleActions.length));
toolbarActions.add((AnAction) new StopProcessAction("Stop process", "Stop process", processHandler));
// toolbarActions.add((AnAction) new CloseAction(defaultExecutor, runDescriptor, project));
ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("unknown", (ActionGroup) toolbarActions, false);
toolbar.setTargetComponent(consoleView.getComponent());
panel.add((Component) toolbar.getComponent(), "West");
ContentImpl consoleContent = new ContentImpl(panel, "Build", false);
consoleContent.setManager(toolWindow.getContentManager());
toolbarActions.add(new CloseTabAction(consoleContent));
// addAdditionalConsoleEditorActions(consoleView, consoleContent);
// consoleComponent.setActions();
toolWindow.getContentManager().addContent(consoleContent);
toolWindow.getContentManager().addContent(new ContentImpl(new JButton("Test"), "Build2", false));
toolWindow.show(null);
}
示例7: 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);
}