com.intellij.execution.filters.TextConsoleBuilder Java Examples
The following examples show how to use
com.intellij.execution.filters.TextConsoleBuilder.
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: SdkRunConfig.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
protected void addConsoleFilters(@NotNull LaunchState launcher, @NotNull ExecutionEnvironment env, @NotNull MainFile mainFile, @Nullable Module module) { // Set up additional console filters. final TextConsoleBuilder builder = launcher.getConsoleBuilder(); // file:, package:, and dart: references builder.addFilter(new DartConsoleFilter(env.getProject(), mainFile.getFile())); //// links often found when running tests //builder.addFilter(new DartRelativePathsConsoleFilter(env.getProject(), mainFile.getAppDir().getPath())); if (module != null) { // various flutter run links builder.addFilter(new FlutterConsoleFilter(module)); } // general urls builder.addFilter(new UrlFilter()); }
Example #3
Source File: DaemonConsoleView.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Sets up a launcher to use a DaemonConsoleView. */ public static void install(@NotNull CommandLineState launcher, @NotNull ExecutionEnvironment env, @NotNull VirtualFile workDir) { // Create our own console builder. // // We need to filter input to this console without affecting other consoles, so we cannot use // a consoleFilterInputProvider. final GlobalSearchScope searchScope = SearchScopeProvider.createSearchScope(env.getProject(), env.getRunProfile()); final TextConsoleBuilder builder = new TextConsoleBuilderImpl(env.getProject(), searchScope) { @NotNull @Override protected ConsoleView createConsole() { return new DaemonConsoleView(env.getProject(), searchScope); } }; // Set up basic console filters. (More may be added later.) // TODO(devoncarew): Do we need this filter? What about DartConsoleFilter (for package: uris)? builder.addFilter(new DartRelativePathsConsoleFilter(env.getProject(), workDir.getPath())); launcher.setConsoleBuilder(builder); }
Example #4
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 #5
Source File: SdkRunConfig.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
protected void addConsoleFilters(@NotNull LaunchState launcher, @NotNull ExecutionEnvironment env, @NotNull MainFile mainFile, @Nullable Module module) { // Set up additional console filters. final TextConsoleBuilder builder = launcher.getConsoleBuilder(); // file:, package:, and dart: references builder.addFilter(new DartConsoleFilter(env.getProject(), mainFile.getFile())); //// links often found when running tests //builder.addFilter(new DartRelativePathsConsoleFilter(env.getProject(), mainFile.getAppDir().getPath())); if (module != null) { // various flutter run links builder.addFilter(new FlutterConsoleFilter(module)); } // general urls builder.addFilter(new UrlFilter()); }
Example #6
Source File: DaemonConsoleView.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Sets up a launcher to use a DaemonConsoleView. */ public static void install(@NotNull CommandLineState launcher, @NotNull ExecutionEnvironment env, @NotNull VirtualFile workDir) { // Create our own console builder. // // We need to filter input to this console without affecting other consoles, so we cannot use // a consoleFilterInputProvider. final GlobalSearchScope searchScope = SearchScopeProvider.createSearchScope(env.getProject(), env.getRunProfile()); final TextConsoleBuilder builder = new TextConsoleBuilderImpl(env.getProject(), searchScope) { @NotNull @Override protected ConsoleView createConsole() { return new DaemonConsoleView(env.getProject(), searchScope); } }; // Set up basic console filters. (More may be added later.) // TODO(devoncarew): Do we need this filter? What about DartConsoleFilter (for package: uris)? builder.addFilter(new DartRelativePathsConsoleFilter(env.getProject(), workDir.getPath())); launcher.setConsoleBuilder(builder); }
Example #7
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 #8
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 #9
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 #10
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 #11
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 #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: 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 #14
Source File: BlazePyRunConfigurationRunner.java From intellij with Apache License 2.0 | 5 votes |
private static TextConsoleBuilder createConsoleBuilder(Project project, Sdk sdk) { return new PyDebugConsoleBuilder(project, sdk) { @Override protected ConsoleView createConsole() { PythonDebugLanguageConsoleView consoleView = new PythonDebugLanguageConsoleView(project, sdk); for (Filter filter : getFilters()) { consoleView.addMessageFilter(filter); } return consoleView; } }; }
Example #15
Source File: BlazeCidrRemoteDebugProcess.java From intellij with Apache License 2.0 | 5 votes |
BlazeCidrRemoteDebugProcess( ProcessHandler targetProcess, DebuggerDriverConfiguration debuggerDriverConfiguration, CidrRemoteDebugParameters remoteDebugParameters, XDebugSession xDebugSession, TextConsoleBuilder textConsoleBuilder) throws ExecutionException { super( new TrivialRunParameters( debuggerDriverConfiguration, new TrivialInstaller(new GeneralCommandLine())), xDebugSession, textConsoleBuilder); this.remoteDebugParameters = remoteDebugParameters; this.targetProcess = targetProcess; }
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: 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 #18
Source File: CommandLineState.java From consulo with Apache License 2.0 | 4 votes |
@javax.annotation.Nullable protected ConsoleView createConsole(@Nonnull final Executor executor) throws ExecutionException { TextConsoleBuilder builder = getConsoleBuilder(); return builder != null ? builder.getConsole() : null; }
Example #19
Source File: CommandLineState.java From consulo with Apache License 2.0 | 4 votes |
public TextConsoleBuilder getConsoleBuilder() { return myConsoleBuilder; }
Example #20
Source File: CommandLineState.java From consulo with Apache License 2.0 | 4 votes |
public void setConsoleBuilder(final TextConsoleBuilder consoleBuilder) { myConsoleBuilder = consoleBuilder; }
Example #21
Source File: RunAnythingCommandHandler.java From consulo with Apache License 2.0 | 2 votes |
/** * Creates console builder for matched command */ public abstract TextConsoleBuilder getConsoleBuilder(@Nonnull Project project);