Search in sources :

Example 1 with DartConsoleFilter

use of com.jetbrains.lang.dart.ide.runner.DartConsoleFilter in project intellij-plugins by JetBrains.

the class PubServerService method configureConsole.

@Override
protected void configureConsole(@NotNull final TextConsoleBuilder consoleBuilder) {
    consoleBuilder.addFilter(new DartConsoleFilter(getProject(), firstServedDir));
    consoleBuilder.addFilter(new DartRelativePathsConsoleFilter(getProject(), firstServedDir.getParent().getPath()));
    consoleBuilder.addFilter(new UrlFilter());
}
Also used : DartRelativePathsConsoleFilter(com.jetbrains.lang.dart.ide.runner.DartRelativePathsConsoleFilter) DartConsoleFilter(com.jetbrains.lang.dart.ide.runner.DartConsoleFilter) UrlFilter(com.intellij.execution.filters.UrlFilter)

Example 2 with DartConsoleFilter

use of com.jetbrains.lang.dart.ide.runner.DartConsoleFilter in project intellij-plugins by JetBrains.

the class DartPubActionBase method createConsole.

@NotNull
private static ConsoleView createConsole(@NotNull final Project project, @NotNull final VirtualFile pubspecYamlFile) {
    final TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
    consoleBuilder.setViewer(true);
    consoleBuilder.addFilter(new DartConsoleFilter(project, pubspecYamlFile));
    consoleBuilder.addFilter(new DartRelativePathsConsoleFilter(project, pubspecYamlFile.getParent().getPath()));
    consoleBuilder.addFilter(new UrlFilter());
    return consoleBuilder.getConsole();
}
Also used : DartRelativePathsConsoleFilter(com.jetbrains.lang.dart.ide.runner.DartRelativePathsConsoleFilter) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) DartConsoleFilter(com.jetbrains.lang.dart.ide.runner.DartConsoleFilter) UrlFilter(com.intellij.execution.filters.UrlFilter) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with DartConsoleFilter

use of com.jetbrains.lang.dart.ide.runner.DartConsoleFilter in project flutter-intellij by flutter.

the class SdkRunConfig method getState.

@NotNull
@Override
public LaunchState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
    final SdkFields launchFields = fields.copy();
    try {
        launchFields.checkRunnable(env.getProject());
    } catch (RuntimeConfigurationError e) {
        throw new ExecutionException(e);
    }
    final MainFile mainFile = MainFile.verify(launchFields.getFilePath(), env.getProject()).get();
    final Project project = env.getProject();
    final RunMode mode = RunMode.fromEnv(env);
    final Module module = ModuleUtil.findModuleForFile(mainFile.getFile(), env.getProject());
    final LaunchState.Callback callback = (device) -> {
        if (device == null)
            return null;
        final GeneralCommandLine command = fields.createFlutterSdkRunCommand(project, device, mode);
        final FlutterApp app = FlutterApp.start(env, project, module, mode, device, command, StringUtil.capitalize(mode.mode()) + "App", "StopApp");
        // Stop the app if the Flutter SDK changes.
        final FlutterSdkManager.Listener sdkListener = new FlutterSdkManager.Listener() {

            @Override
            public void flutterSdkRemoved() {
                app.shutdownAsync();
            }
        };
        FlutterSdkManager.getInstance(project).addListener(sdkListener);
        Disposer.register(project, () -> FlutterSdkManager.getInstance(project).removeListener(sdkListener));
        return app;
    };
    final LaunchState launcher = new LaunchState(env, mainFile.getAppDir(), mainFile.getFile(), this, callback);
    // Set up additional console filters.
    final TextConsoleBuilder builder = launcher.getConsoleBuilder();
    builder.addFilter(new DartConsoleFilter(env.getProject(), mainFile.getFile()));
    if (module != null) {
        builder.addFilter(new FlutterConsoleFilter(module));
    }
    return launcher;
}
Also used : XmlSerializer(com.intellij.util.xmlb.XmlSerializer) RunConfigurationWithSuppressedDefaultRunAction(com.intellij.execution.runners.RunConfigurationWithSuppressedDefaultRunAction) ExecutionException(com.intellij.execution.ExecutionException) VirtualFile(com.intellij.openapi.vfs.VirtualFile) RefactoringElementListener(com.intellij.refactoring.listeners.RefactoringElementListener) InvalidDataException(com.intellij.openapi.util.InvalidDataException) com.intellij.execution.configurations(com.intellij.execution.configurations) UndoRefactoringElementAdapter(com.intellij.refactoring.listeners.UndoRefactoringElementAdapter) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) ModuleUtil(com.intellij.openapi.module.ModuleUtil) DartConsoleFilter(com.jetbrains.lang.dart.ide.runner.DartConsoleFilter) Disposer(com.intellij.openapi.util.Disposer) PsiElement(com.intellij.psi.PsiElement) SkipDefaultValuesSerializationFilters(com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters) Project(com.intellij.openapi.project.Project) PsiFile(com.intellij.psi.PsiFile) Module(com.intellij.openapi.module.Module) SettingsEditor(com.intellij.openapi.options.SettingsEditor) FlutterApp(io.flutter.run.daemon.FlutterApp) FlutterSdkManager(io.flutter.sdk.FlutterSdkManager) RunMode(io.flutter.run.daemon.RunMode) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) StringUtil(com.intellij.openapi.util.text.StringUtil) Executor(com.intellij.execution.Executor) Nullable(org.jetbrains.annotations.Nullable) PsiDirectory(com.intellij.psi.PsiDirectory) PathUtil(com.intellij.util.PathUtil) WriteExternalException(com.intellij.openapi.util.WriteExternalException) FlutterConsoleFilter(io.flutter.console.FlutterConsoleFilter) NotNull(org.jetbrains.annotations.NotNull) PsiFileSystemItem(com.intellij.psi.PsiFileSystemItem) Element(org.jdom.Element) FlutterApp(io.flutter.run.daemon.FlutterApp) RefactoringElementListener(com.intellij.refactoring.listeners.RefactoringElementListener) FlutterConsoleFilter(io.flutter.console.FlutterConsoleFilter) DartConsoleFilter(com.jetbrains.lang.dart.ide.runner.DartConsoleFilter) Project(com.intellij.openapi.project.Project) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) FlutterSdkManager(io.flutter.sdk.FlutterSdkManager) RunMode(io.flutter.run.daemon.RunMode) ExecutionException(com.intellij.execution.ExecutionException) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with DartConsoleFilter

use of com.jetbrains.lang.dart.ide.runner.DartConsoleFilter in project intellij-plugins by JetBrains.

the class DartTestRunningState method createConsole.

private static ConsoleView createConsole(@NotNull ExecutionEnvironment env) {
    final Project project = env.getProject();
    final DartRunConfiguration runConfiguration = (DartRunConfiguration) env.getRunProfile();
    final DartTestRunnerParameters runnerParameters = (DartTestRunnerParameters) runConfiguration.getRunnerParameters();
    final TestConsoleProperties testConsoleProperties = new DartConsoleProperties(runConfiguration, env);
    final ConsoleView consoleView = SMTestRunnerConnectionUtil.createConsole(DART_FRAMEWORK_NAME, testConsoleProperties);
    try {
        final VirtualFile dartFile = runnerParameters.getDartFileOrDirectory();
        consoleView.addMessageFilter(new DartConsoleFilter(project, dartFile));
        consoleView.addMessageFilter(new DartRelativePathsConsoleFilter(project, runnerParameters.computeProcessWorkingDirectory(project)));
        consoleView.addMessageFilter(new UrlFilter());
    } catch (RuntimeConfigurationError ignore) {
    /* can't happen because already checked */
    }
    Disposer.register(project, consoleView);
    return consoleView;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) DartRelativePathsConsoleFilter(com.jetbrains.lang.dart.ide.runner.DartRelativePathsConsoleFilter) Project(com.intellij.openapi.project.Project) DartRunConfiguration(com.jetbrains.lang.dart.ide.runner.base.DartRunConfiguration) SMTRunnerConsoleView(com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView) ConsoleView(com.intellij.execution.ui.ConsoleView) DartConsoleFilter(com.jetbrains.lang.dart.ide.runner.DartConsoleFilter) UrlFilter(com.intellij.execution.filters.UrlFilter) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) TestConsoleProperties(com.intellij.execution.testframework.TestConsoleProperties)

Aggregations

DartConsoleFilter (com.jetbrains.lang.dart.ide.runner.DartConsoleFilter)4 UrlFilter (com.intellij.execution.filters.UrlFilter)3 DartRelativePathsConsoleFilter (com.jetbrains.lang.dart.ide.runner.DartRelativePathsConsoleFilter)3 TextConsoleBuilder (com.intellij.execution.filters.TextConsoleBuilder)2 Project (com.intellij.openapi.project.Project)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 NotNull (org.jetbrains.annotations.NotNull)2 ExecutionException (com.intellij.execution.ExecutionException)1 Executor (com.intellij.execution.Executor)1 com.intellij.execution.configurations (com.intellij.execution.configurations)1 RuntimeConfigurationError (com.intellij.execution.configurations.RuntimeConfigurationError)1 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)1 RunConfigurationWithSuppressedDefaultRunAction (com.intellij.execution.runners.RunConfigurationWithSuppressedDefaultRunAction)1 TestConsoleProperties (com.intellij.execution.testframework.TestConsoleProperties)1 SMTRunnerConsoleView (com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView)1 ConsoleView (com.intellij.execution.ui.ConsoleView)1 Module (com.intellij.openapi.module.Module)1 ModuleUtil (com.intellij.openapi.module.ModuleUtil)1 SettingsEditor (com.intellij.openapi.options.SettingsEditor)1 Disposer (com.intellij.openapi.util.Disposer)1