use of io.flutter.view.OpenFlutterViewAction in project flutter-intellij by flutter.
the class LaunchState method setUpConsoleAndActions.
@NotNull
private ExecutionResult setUpConsoleAndActions(@NotNull FlutterApp app) throws ExecutionException {
final ConsoleView console = createConsole(getEnvironment().getExecutor());
if (console != null) {
app.setConsole(console);
console.attachToProcess(app.getProcessHandler());
}
// Add observatory actions.
// These actions are effectively added only to the Run tool window.
// For Debug see FlutterDebugProcess.registerAdditionalActions()
final Computable<Boolean> observatoryAvailable = () -> !app.getProcessHandler().isProcessTerminated() && app.getConnector().getBrowserUrl() != null;
final List<AnAction> actions = new ArrayList<>(Arrays.asList(super.createActions(console, app.getProcessHandler(), getEnvironment().getExecutor())));
actions.add(new Separator());
actions.add(new OpenObservatoryAction(app.getConnector(), observatoryAvailable));
actions.add(new OpenTimelineViewAction(app.getConnector(), observatoryAvailable));
actions.add(new Separator());
actions.add(new OpenFlutterViewAction(() -> !app.getProcessHandler().isProcessTerminated()));
return new DefaultExecutionResult(console, app.getProcessHandler(), actions.toArray(new AnAction[actions.size()]));
}
use of io.flutter.view.OpenFlutterViewAction in project flutter-intellij by flutter.
the class FlutterDebugProcess method registerAdditionalActions.
@Override
public void registerAdditionalActions(@NotNull final DefaultActionGroup leftToolbar, @NotNull final DefaultActionGroup topToolbar, @NotNull final DefaultActionGroup settings) {
if (app.getMode() != RunMode.DEBUG) {
// Remove the debug-specific actions that aren't needed when we're not debugging.
// Remove all but specified actions.
final AnAction[] leftActions = leftToolbar.getChildActionsOrStubs();
// Not all on the classpath so we resort to Strings.
final List<String> actionClassNames = Arrays.asList("com.intellij.execution.actions.StopAction", "com.intellij.ui.content.tabs.PinToolwindowTabAction", "com.intellij.execution.ui.actions.CloseAction", "com.intellij.ide.actions.ContextHelpAction");
for (AnAction a : leftActions) {
if (!actionClassNames.contains(a.getClass().getName())) {
leftToolbar.remove(a);
}
}
// Remove all top actions.
final AnAction[] topActions = topToolbar.getChildActionsOrStubs();
for (AnAction action : topActions) {
topToolbar.remove(action);
}
// Remove all settings actions.
final AnAction[] settingsActions = settings.getChildActionsOrStubs();
for (AnAction a : settingsActions) {
settings.remove(a);
}
}
// Add actions common to the run and debug windows.
final Computable<Boolean> isSessionActive = () -> app.isStarted() && getVmConnected() && !getSession().isStopped();
final Computable<Boolean> canReload = () -> app.getLaunchMode().supportsReload() && isSessionActive.compute() && !app.isReloading();
final Computable<Boolean> observatoryAvailable = () -> isSessionActive.compute() && app.getConnector().getBrowserUrl() != null;
if (app.getMode() == RunMode.DEBUG) {
topToolbar.addSeparator();
topToolbar.addAction(new FlutterPopFrameAction());
}
topToolbar.addSeparator();
topToolbar.addAction(new ReloadFlutterApp(app, canReload));
topToolbar.addAction(new RestartFlutterApp(app, canReload));
topToolbar.addSeparator();
topToolbar.addAction(new OpenObservatoryAction(app.getConnector(), observatoryAvailable));
topToolbar.addAction(new OpenTimelineViewAction(app.getConnector(), observatoryAvailable));
topToolbar.addSeparator();
topToolbar.addAction(new OpenFlutterViewAction(isSessionActive));
// Don't call super since we have our own observatory action.
}
Aggregations