com.intellij.execution.filters.TextConsoleBuilderFactory Java Examples
The following examples show how to use
com.intellij.execution.filters.TextConsoleBuilderFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FlutterConsole.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
@NotNull static FlutterConsole create(@NotNull Project project, @Nullable Module module) { final TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project); builder.setViewer(true); if (module != null) { builder.addFilter(new FlutterConsoleFilter(module)); } final ConsoleView view = builder.getConsole(); final SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true); panel.setContent(view.getComponent()); final String title = module != null ? "[" + module.getName() + "] Flutter" : "Flutter"; final Content content = ContentFactory.SERVICE.getInstance().createContent(panel.getComponent(), title, true); Disposer.register(content, view); return new FlutterConsole(view, content, project, module); }
Example #2
Source File: FlutterConsole.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
@NotNull static FlutterConsole create(@NotNull Project project, @Nullable Module module) { final TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project); builder.setViewer(true); if (module != null) { builder.addFilter(new FlutterConsoleFilter(module)); } final ConsoleView view = builder.getConsole(); final SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true); panel.setContent(view.getComponent()); final String title = module != null ? "[" + module.getName() + "] Flutter" : "Flutter"; final Content content = ContentFactory.SERVICE.getInstance().createContent(panel.getComponent(), title, true); Disposer.register(content, view); return new FlutterConsole(view, content, project, module); }
Example #3
Source File: AnalyzeStacktraceUtil.java From consulo with Apache License 2.0 | 6 votes |
public static RunContentDescriptor addConsole(Project project, @Nullable ConsoleFactory consoleFactory, final String tabTitle, String text, @Nullable consulo.ui.image.Image icon) { final TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project); builder.filters(EP_NAME.getExtensions(project)); final ConsoleView consoleView = builder.getConsole(); final DefaultActionGroup toolbarActions = new DefaultActionGroup(); JComponent consoleComponent = consoleFactory != null ? consoleFactory.createConsoleComponent(consoleView, toolbarActions) : new MyConsolePanel(consoleView, toolbarActions); final RunContentDescriptor descriptor = new RunContentDescriptor(consoleView, null, consoleComponent, tabTitle, icon) { @Override public boolean isContentReuseProhibited() { return true; } }; final Executor executor = DefaultRunExecutor.getRunExecutorInstance(); for (AnAction action : consoleView.createConsoleActions()) { toolbarActions.add(action); } final ConsoleViewImpl console = (ConsoleViewImpl)consoleView; ConsoleViewUtil.enableReplaceActionForConsoleViewEditor(console.getEditor()); console.getEditor().getSettings().setCaretRowShown(true); toolbarActions.add(new AnnotateStackTraceAction(console.getEditor(), console.getHyperlinks())); ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, descriptor); consoleView.allowHeavyFilters(); if (consoleFactory == null) { printStacktrace(consoleView, text); } return descriptor; }
Example #4
Source File: RunIdeConsoleAction.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull private static RunContentDescriptor createConsoleView(@Nonnull Project project, @Nonnull PsiFile psiFile) { ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole(); DefaultActionGroup toolbarActions = new DefaultActionGroup(); JComponent panel = new JPanel(new BorderLayout()); panel.add(consoleView.getComponent(), BorderLayout.CENTER); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false); toolbar.setTargetComponent(consoleView.getComponent()); panel.add(toolbar.getComponent(), BorderLayout.WEST); final RunContentDescriptor descriptor = new RunContentDescriptor(consoleView, null, panel, psiFile.getName()) { @Override public boolean isContentReuseProhibited() { return true; } }; Executor executor = DefaultRunExecutor.getRunExecutorInstance(); toolbarActions.addAll(consoleView.createConsoleActions()); toolbarActions.add(new CloseAction(executor, descriptor, project)); ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, descriptor); return descriptor; }
Example #5
Source File: ProjectLevelVcsManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
private Content getOrCreateConsoleContent(final ContentManager contentManager) { final String displayName = VcsBundle.message("vcs.console.toolwindow.display.name"); Content content = contentManager.findContent(displayName); if (content == null) { releaseConsole(); myConsole = TextConsoleBuilderFactory.getInstance().createBuilder(myProject).getConsole(); JPanel panel = new JPanel(new BorderLayout()); panel.add(myConsole.getComponent(), BorderLayout.CENTER); ActionToolbar toolbar = ActionManager.getInstance() .createActionToolbar("VcsManager", new DefaultActionGroup(myConsole.createConsoleActions()), false); panel.add(toolbar.getComponent(), BorderLayout.WEST); content = ContentFactory.getInstance().createContent(panel, displayName, true); content.setDisposer(myConsoleDisposer); contentManager.addContent(content); for (Pair<String, ConsoleViewContentType> pair : myPendingOutput) { printToConsole(pair.first, pair.second); } myPendingOutput.clear(); } return content; }
Example #6
Source File: ANTLRv4PluginController.java From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void createToolWindows() { LOG.info("createToolWindows "+project.getName()); ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); previewPanel = new PreviewPanel(project); ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); Content content = contentFactory.createContent(previewPanel, "", false); content.setCloseable(false); previewWindow = toolWindowManager.registerToolWindow(PREVIEW_WINDOW_ID, true, ToolWindowAnchor.BOTTOM); previewWindow.getContentManager().addContent(content); previewWindow.setIcon(Icons.getToolWindow()); TextConsoleBuilderFactory factory = TextConsoleBuilderFactory.getInstance(); TextConsoleBuilder consoleBuilder = factory.createBuilder(project); this.console = consoleBuilder.getConsole(); JComponent consoleComponent = console.getComponent(); content = contentFactory.createContent(consoleComponent, "", false); content.setCloseable(false); consoleWindow = toolWindowManager.registerToolWindow(CONSOLE_WINDOW_ID, true, ToolWindowAnchor.BOTTOM); consoleWindow.getContentManager().addContent(content); consoleWindow.setIcon(Icons.getToolWindow()); }
Example #7
Source File: HaxeTestsRunner.java From intellij-haxe with Apache License 2.0 | 5 votes |
@Override protected RunContentDescriptor doExecute(@NotNull final Project project, @NotNull RunProfileState state, final RunContentDescriptor descriptor, @NotNull final ExecutionEnvironment environment) throws ExecutionException { final HaxeTestsConfiguration profile = (HaxeTestsConfiguration)environment.getRunProfile(); final Module module = profile.getConfigurationModule().getModule(); ModuleRootManager rootManager = ModuleRootManager.getInstance(module); VirtualFile[] roots = rootManager.getContentRoots(); return super.doExecute(project, new CommandLineState(environment) { @NotNull @Override protected ProcessHandler startProcess() throws ExecutionException { //actually only neko target is supported for tests HaxeTarget currentTarget = HaxeTarget.NEKO; final GeneralCommandLine commandLine = new GeneralCommandLine(); commandLine.setWorkDirectory(PathUtil.getParentPath(module.getModuleFilePath())); commandLine.setExePath(currentTarget.getFlag()); final HaxeModuleSettings settings = HaxeModuleSettings.getInstance(module); String folder = settings.getOutputFolder() != null ? (settings.getOutputFolder() + "/release/") : ""; commandLine.addParameter(getFileNameWithCurrentExtension(currentTarget, folder + settings.getOutputFileName())); final TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(module.getProject()); consoleBuilder.addFilter(new ErrorFilter(module)); setConsoleBuilder(consoleBuilder); return new OSProcessHandler(commandLine.createProcess(), commandLine.getCommandLineString()); } private String getFileNameWithCurrentExtension(HaxeTarget haxeTarget, String fileName) { if (haxeTarget != null) { return haxeTarget.getTargetFileNameWithExtension(FileUtil.getNameWithoutExtension(fileName)); } return fileName; } }, descriptor, environment); }
Example #8
Source File: LogConsoleBase.java From consulo with Apache License 2.0 | 5 votes |
public LogConsoleBase(@Nonnull Project project, @Nullable Reader reader, String title, final boolean buildInActions, LogFilterModel model, @Nonnull GlobalSearchScope scope) { super(new BorderLayout()); myProject = project; myTitle = title; myModel = model; myFilters = myModel.getLogFilters(); myReaderThread = new ReaderThread(reader); myBuildInActions = buildInActions; TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project, scope); myConsole = builder.getConsole(); myConsole.attachToProcess(myProcessHandler); myDisposed = false; myModel.addFilterListener(this); }
Example #9
Source File: RunContentExecutor.java From consulo with Apache License 2.0 | 5 votes |
private ConsoleView createConsole(@Nonnull Project project) { TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(project); consoleBuilder.filters(myFilterList); final ConsoleView console = consoleBuilder.getConsole(); if (myHelpId != null) { console.setHelpId(myHelpId); } Executor executor = DefaultRunExecutor.getRunExecutorInstance(); DefaultActionGroup actions = new DefaultActionGroup(); final JComponent consolePanel = createConsolePanel(console, actions); RunContentDescriptor descriptor = new RunContentDescriptor(console, myProcess, consolePanel, myTitle); Disposer.register(descriptor, this); Disposer.register(descriptor, console); actions.add(new RerunAction(consolePanel)); actions.add(new StopAction()); actions.add(new CloseAction(executor, descriptor, myProject)); ExecutionManager.getInstance(myProject).getContentManager().showRunContent(executor, descriptor); if (myActivateToolWindow) { activateToolWindow(); } return console; }
Example #10
Source File: CommandLineState.java From consulo with Apache License 2.0 | 5 votes |
protected CommandLineState(ExecutionEnvironment environment) { myEnvironment = environment; if (myEnvironment != null) { final Project project = myEnvironment.getProject(); final GlobalSearchScope searchScope = SearchScopeProvider.createSearchScope(project, myEnvironment.getRunProfile()); myConsoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(project, searchScope); } }
Example #11
Source File: XQueryRunConfiguration.java From intellij-xquery with Apache License 2.0 | 5 votes |
@Nullable @Override public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException { XQueryRunProfileState state = new XQueryRunProfileState(env, (XQueryRunConfiguration) env .getRunnerAndConfigurationSettings().getConfiguration()); XQueryRunConfigurationModule module = getConfigurationModule(); state.setConsoleBuilder(TextConsoleBuilderFactory.getInstance().createBuilder(getProject(), module.getSearchScope())); return state; }
Example #12
Source File: NMERunningState.java From intellij-haxe with Apache License 2.0 | 5 votes |
private HaxeCommandLine getCommandForNeko(Sdk sdk, HaxeModuleSettings settings) throws ExecutionException { final HaxeSdkData sdkData = sdk.getSdkAdditionalData() instanceof HaxeSdkData ? (HaxeSdkData)sdk.getSdkAdditionalData() : null; if (sdkData == null) { throw new ExecutionException(HaxeCommonBundle.message("invalid.haxe.sdk")); } final HaxeCommandLine commandLine = new HaxeCommandLine(module); commandLine.setWorkDirectory(PathUtil.getParentPath(module.getModuleFilePath())); final String haxelibPath = sdkData.getHaxelibPath(); if (haxelibPath == null || haxelibPath.isEmpty()) { throw new ExecutionException(HaxeCommonBundle.message("no.haxelib.for.sdk", sdk.getName())); } commandLine.setExePath(haxelibPath); commandLine.addParameter("run"); commandLine.addParameter("nme"); commandLine.addParameter(myRunInTest ? "test" : "run"); commandLine.addParameter(settings.getNmmlPath()); for (String flag : settings.getNmeTarget().getFlags()) { commandLine.addParameter(flag); } if (myDebug) { commandLine.addParameter("-debug"); commandLine.addParameter("-Ddebug"); commandLine.addParameter("-args"); commandLine.addParameter("-start_debugger"); commandLine.addParameter("-debugger_host=localhost:" + myDebugPort); } final StringTokenizer flagsTokenizer = new StringTokenizer(settings.getNmeFlags()); while (flagsTokenizer.hasMoreTokens()) { commandLine.addParameter(flagsTokenizer.nextToken()); } final TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(module.getProject()); setConsoleBuilder(consoleBuilder); return commandLine; }
Example #13
Source File: MongoRunConfiguration.java From nosql4idea with Apache License 2.0 | 5 votes |
@Nullable @Override public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException { final VirtualFile script = getScriptPath(); if (script == null) { throw new CantRunException("Cannot find script " + scriptPath); } final MongoCommandLineState state = new MongoCommandLineState(this, env); state.setConsoleBuilder(TextConsoleBuilderFactory.getInstance().createBuilder(getProject())); return state; }
Example #14
Source File: UnityDebugProcess.java From consulo-unity3d with Apache License 2.0 | 5 votes |
@Nonnull @Override public ExecutionConsole createConsole() { if(myConsoleView != null) { return myConsoleView; } ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(getSession().getProject()).getConsole(); consoleView.attachToProcess(getProcessHandler()); return consoleView; }
Example #15
Source File: AndroidTestConsoleProvider.java From intellij with Apache License 2.0 | 5 votes |
private ConsoleView createBlazeTestConsole(Executor executor) { if (testUiSession == null || isDebugging(executor)) { // SM runner console not yet supported when debugging, because we're calling this once per // test case (see ConnectBlazeTestDebuggerTask::setUpForReattachingDebugger) return TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole(); } return SmRunnerUtils.getConsoleView(project, runConfiguration, executor, testUiSession); }
Example #16
Source File: BlazeAndroidBinaryConsoleProvider.java From intellij with Apache License 2.0 | 5 votes |
@NotNull @Override public ConsoleView createAndAttach( @NotNull Disposable parent, @NotNull ProcessHandler handler, @NotNull Executor executor) throws ExecutionException { final TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project); ConsoleView console = builder.getConsole(); console.attachToProcess(handler); return console; }
Example #17
Source File: OCamlApplicationRunningState.java From reasonml-idea-plugin with MIT License | 5 votes |
@NotNull private GeneralCommandLine getCommand() { GeneralCommandLine commandLine = new GeneralCommandLine(); // set exe/working dir/... TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(m_module.getProject()); setConsoleBuilder(consoleBuilder); return commandLine; }
Example #18
Source File: RNUtil.java From react-native-console with BSD 3-Clause "New" or "Revised" License | 4 votes |
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); }
Example #19
Source File: OpenFLRunningState.java From intellij-haxe with Apache License 2.0 | 4 votes |
private HaxeCommandLine getCommandForOpenFL(Sdk sdk, HaxeModuleSettings settings) throws ExecutionException { final HaxeSdkData sdkData = sdk.getSdkAdditionalData() instanceof HaxeSdkData ? (HaxeSdkData)sdk.getSdkAdditionalData() : null; if (sdkData == null) { throw new ExecutionException(HaxeCommonBundle.message("invalid.haxe.sdk")); } final HaxeCommandLine commandLine = new HaxeCommandLine(module); commandLine.setWorkDirectory(PathUtil.getParentPath(module.getModuleFilePath())); final String haxelibPath = sdkData.getHaxelibPath(); if (haxelibPath == null || haxelibPath.isEmpty()) { throw new ExecutionException(HaxeCommonBundle.message("no.haxelib.for.sdk", sdk.getName())); } commandLine.setExePath(haxelibPath); commandLine.addParameter("run"); commandLine.addParameter("lime"); commandLine.addParameter(myRunInTest ? "test" : "run"); if(!StringUtil.isEmpty(settings.getOpenFLPath())) { commandLine.addParameter(settings.getOpenFLPath()); } for (String flag : settings.getOpenFLTarget().getFlags()) { commandLine.addParameter(flag); } commandLine.addParameter("-verbose"); if (myDebug) { commandLine.addParameter("-Ddebug"); commandLine.addParameter("-debug"); if (settings.getOpenFLTarget() == OpenFLTarget.FLASH) { commandLine.addParameter("-Dfdb"); } else { commandLine.addParameter("-args"); commandLine.addParameter("-start_debugger"); commandLine.addParameter("-debugger_host=localhost:" + myDebugPort); } } final StringTokenizer flagsTokenizer = new StringTokenizer(settings.getOpenFLFlags()); while (flagsTokenizer.hasMoreTokens()) { commandLine.addParameter(flagsTokenizer.nextToken()); } final TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(module.getProject()); setConsoleBuilder(consoleBuilder); return commandLine; }
Example #20
Source File: PantsConsoleManager.java From intellij-pants-plugin with Apache License 2.0 | 4 votes |
private static ConsoleView createNewConsole(Project project) { return TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole(); }
Example #21
Source File: LoggingHandlerImpl.java From consulo with Apache License 2.0 | 4 votes |
public LoggingHandlerImpl(Project project) { myConsole = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole(); }
Example #22
Source File: XDebugProcess.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public ExecutionConsole createConsole() { return TextConsoleBuilderFactory.getInstance().createBuilder(getSession().getProject()).getConsole(); }
Example #23
Source File: DWConsoleService.java From intellij-demandware with MIT License | 4 votes |
public DWConsoleService(Project project) { consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole(); }
Example #24
Source File: RoboVmPlugin.java From robovm-idea with GNU General Public License v2.0 | 4 votes |
public static void initializeProject(final Project project) { // setup a compile task if there isn't one yet boolean found = false; for (CompileTask task : CompilerManager.getInstance(project).getAfterTasks()) { if (task instanceof RoboVmCompileTask) { found = true; break; } } if (!found) { CompilerManager.getInstance(project).addAfterTask(new RoboVmCompileTask()); } // hook ito the message bus so we get to know if a storyboard/xib // file is opened project.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new RoboVmFileEditorManagerListener(project)); // initialize our tool window to which we // log all messages UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { if (project.isDisposed()) { return; } ToolWindow toolWindow = ToolWindowManager.getInstance(project).registerToolWindow(ROBOVM_TOOLWINDOW_ID, false, ToolWindowAnchor.BOTTOM, project, true); ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole(); Content content = toolWindow.getContentManager().getFactory().createContent(consoleView.getComponent(), "Console", true); toolWindow.getContentManager().addContent(content); toolWindow.setIcon(RoboVmIcons.ROBOVM_SMALL); consoleViews.put(project, consoleView); toolWindows.put(project, toolWindow); logInfo(project, "RoboVM plugin initialized"); } }); // initialize virtual file change listener so we can // trigger recompiles on file saves VirtualFileListener listener = new VirtualFileAdapter() { @Override public void contentsChanged(@NotNull VirtualFileEvent event) { compileIfChanged(event, project); } }; VirtualFileManager.getInstance().addVirtualFileListener(listener); fileListeners.put(project, listener); }
Example #25
Source File: FreeUIManager.java From freeline with BSD 3-Clause "New" or "Revised" License | 4 votes |
public ConsoleView getConsoleView(Project project) { if (mFreeConsole == null) { mFreeConsole = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole(); } return mFreeConsole; }