com.intellij.execution.ui.RunnerLayoutUi Java Examples

The following examples show how to use com.intellij.execution.ui.RunnerLayoutUi. 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: FlutterDebugProcess.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Turn off debug-only views (variables and frames).
 */
private static void suppressDebugViews(@Nullable RunnerLayoutUi ui) {
  if (ui == null) {
    return;
  }

  for (Content c : ui.getContents()) {
    if (!Objects.equals(c.getTabName(), "Console")) {
      try {
        GuiUtils.runOrInvokeAndWait(() -> ui.removeContent(c, false /* dispose? */));
      }
      catch (InvocationTargetException | InterruptedException e) {
        FlutterUtils.warn(LOG, e);
      }
    }
  }
}
 
Example #2
Source File: ExecutionManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void processTerminated(ProcessEvent event) {
  if (myProject.isDisposed()) return;
  if (!myTerminateNotified.compareAndSet(false, true)) return;

  ApplicationManager.getApplication().invokeLater(() -> {
    RunnerLayoutUi ui = myDescriptor.getRunnerLayoutUi();
    if (ui != null && !ui.isDisposed()) {
      ui.updateActionsNow();
    }
  }, ModalityState.any());

  myProject.getMessageBus().syncPublisher(EXECUTION_TOPIC).processTerminated(myExecutorId, myEnvironment, myProcessHandler, event.getExitCode());

  SaveAndSyncHandler saveAndSyncHandler = SaveAndSyncHandler.getInstance();
  if (saveAndSyncHandler != null) {
    saveAndSyncHandler.scheduleRefresh();
  }
}
 
Example #3
Source File: BuckToolWindowFactory.java    From Buck-IntelliJ-Plugin with Apache License 2.0 6 votes vote down vote up
@Override
public void createToolWindowContent(
    @NotNull final Project project, @NotNull ToolWindow toolWindow) {
  toolWindow.setAvailable(true, null);
  toolWindow.setToHideOnEmptyContent(true);

  RunnerLayoutUi runnerLayoutUi = BuckUIManager.getInstance(project).getLayoutUi(project);
  Content consoleContent = createConsoleContent(runnerLayoutUi, project);

  runnerLayoutUi.addContent(consoleContent, 0, PlaceInGrid.center, false);
  runnerLayoutUi.getOptions().setLeftToolbar(
      getLeftToolbarActions(project), ActionPlaces.UNKNOWN);

  runnerLayoutUi.updateActionsNow();

  final ContentManager contentManager = toolWindow.getContentManager();
  Content content = contentManager.getFactory().createContent(
      runnerLayoutUi.getComponent(), "", true);
  contentManager.addContent(content);

  updateBuckToolWindowTitle(project);
}
 
Example #4
Source File: EmbeddedLinuxJVMConsoleView.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 6 votes vote down vote up
/**
 * Creats the tool window content
 * @param toolWindow
 */
public void createToolWindowContent(@NotNull ToolWindow toolWindow) {
    //Create runner UI layout
    RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(project);
    RunnerLayoutUi layoutUi = factory.create("", "", "session", project);

    // Adding actions
    DefaultActionGroup group = new DefaultActionGroup();
    layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);

    Content console = layoutUi.createContent(EmbeddedLinuxJVMToolWindowFactory.ID, consoleView.getComponent(), "", null, null);
    AnAction[] consoleActions = consoleView.createConsoleActions();
    for (AnAction action : consoleActions) {
        if (!shouldIgnoreAction(action)) {
            group.add(action);
        }
    }
    layoutUi.addContent(console, 0, PlaceInGrid.right, false);

    JComponent layoutComponent = layoutUi.getComponent();
    myConsolePanel.add(layoutComponent, BorderLayout.CENTER);
    Content content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true);
    toolWindow.getContentManager().addContent(content);
}
 
Example #5
Source File: RunTab.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public LogConsoleManagerBase getLogConsoleManager() {
  if (logConsoleManager == null) {
    logConsoleManager = new LogConsoleManagerBase(myProject, mySearchScope) {
      @Override
      protected Image getDefaultIcon() {
        return AllIcons.Debugger.Console_log;
      }

      @Override
      protected RunnerLayoutUi getUi() {
        return myUi;
      }

      @Override
      public ProcessHandler getProcessHandler() {
        return myRunContentDescriptor == null ? null : myRunContentDescriptor.getProcessHandler();
      }
    };
  }
  return logConsoleManager;
}
 
Example #6
Source File: FlutterDebugProcess.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Turn off debug-only views (variables and frames).
 */
private static void suppressDebugViews(@Nullable RunnerLayoutUi ui) {
  if (ui == null) {
    return;
  }

  for (Content c : ui.getContents()) {
    if (!Objects.equals(c.getTabName(), "Console")) {
      try {
        GuiUtils.runOrInvokeAndWait(() -> ui.removeContent(c, false /* dispose? */));
      }
      catch (InvocationTargetException | InterruptedException e) {
        FlutterUtils.warn(LOG, e);
      }
    }
  }
}
 
Example #7
Source File: BuckToolWindowFactory.java    From Buck-IntelliJ-Plugin with Apache License 2.0 5 votes vote down vote up
private Content createConsoleContent(RunnerLayoutUi layoutUi, Project project) {
  ConsoleView consoleView = BuckUIManager.getInstance(project).getConsoleWindow(project);
  Content consoleWindowContent = layoutUi.createContent(
      OUTPUT_WINDOW_CONTENT_ID, consoleView.getComponent(), "Output Logs", null, null);
  consoleWindowContent.setCloseable(false);
  return consoleWindowContent;
}
 
Example #8
Source File: BuckUIManager.java    From Buck-IntelliJ-Plugin with Apache License 2.0 5 votes vote down vote up
public RunnerLayoutUi getLayoutUi(Project project) {
  if (mRunnerLayoutUi == null) {
    mRunnerLayoutUi = RunnerLayoutUi.Factory.getInstance(project).create(
        "buck", "buck", "buck", project);
  }
  return mRunnerLayoutUi;
}
 
Example #9
Source File: RunTab.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected RunTab(@Nonnull Project project, @Nonnull GlobalSearchScope searchScope, @Nonnull String runnerType, @Nonnull String runnerTitle, @Nonnull String sessionName) {
  myProject = project;
  mySearchScope = searchScope;

  myUi = RunnerLayoutUi.Factory.getInstance(project).create(runnerType, runnerTitle, sessionName, this);
  myUi.getContentManager().addDataProvider(this);
}
 
Example #10
Source File: XDebugTabLayouter.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Registers tab for the given {@code console}.
 *
 * @param console {@code ExecutionConsole} instance
 * @param ui {@code RunnerLayoutUi} instance
 * @return registered {@code Content} instance
 */
@Nonnull
public Content registerConsoleContent(@Nonnull RunnerLayoutUi ui, @Nonnull ExecutionConsole console) {
  Content content = ui.createContent(DebuggerContentInfo.CONSOLE_CONTENT, console.getComponent(),
                                     XDebuggerBundle.message("debugger.session.tab.console.content.name"),
                                     AllIcons.Debugger.Console,
                                     console.getPreferredFocusableComponent());
  content.setCloseable(false);
  ui.addContent(content, 1, PlaceInGrid.bottom, false);
  return content;
}
 
Example #11
Source File: CompositeDiffPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public CompositeDiffPanel(Project project, final DiscloseMultiRequest request, final Window window, @Nonnull Disposable parentDisposable) {
  myRequest = request;
  myWindow = window;
  myParentDisposable = parentDisposable;
  myUi = RunnerLayoutUi.Factory.getInstance(project).create("Diff", "Diff", "Diff", parentDisposable);
  myUi.getComponent().setBorder(null);
  myUi.getOptions().setMinimizeActionEnabled(false);
  //myUi.getOptions().setTopToolbar()
  myMap = new HashMap<String, Pair<DiffViewer, Content>>();
}
 
Example #12
Source File: RunnerContentUi.java    From consulo with Apache License 2.0 5 votes vote down vote up
public RunnerContentUi(@Nonnull Project project,
                       @Nonnull RunnerLayoutUi ui,
                       @Nonnull ActionManager actionManager,
                       @Nonnull IdeFocusManager focusManager,
                       @Nonnull RunnerLayout settings,
                       @Nonnull String sessionName) {
  myProject = project;
  myRunnerUi = ui;
  myLayoutSettings = settings;
  myActionManager = actionManager;
  mySessionName = sessionName;
  myFocusManager = focusManager;
}
 
Example #13
Source File: RunnerLayoutUiImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public RunnerLayoutUi addListener(@Nonnull final ContentManagerListener listener, @Nonnull final Disposable parent) {
  final ContentManager mgr = getContentManager();
  mgr.addContentManagerListener(listener);
  Disposer.register(parent, new Disposable() {
    @Override
    public void dispose() {
      mgr.removeContentManagerListener(listener);
    }
  });
  return this;
}
 
Example #14
Source File: LayoutAttractionPolicy.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void attract(final Content content, final RunnerLayoutUi ui) {
  if (!myWasAttracted) {
    myWasAttracted = true;
    ui.selectAndFocus(content, myRequestFocus, true, true);
  } else {
    ui.setBouncing(content, true);
  }
}
 
Example #15
Source File: LayoutAttractionPolicy.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void clearAttraction(final Content content, final RunnerLayoutUi ui) {
  ui.setBouncing(content, false);
}
 
Example #16
Source File: RunnerContentUi.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public RunnerLayoutUi getRunnerLayoutUi() {
  return myRunnerUi;
}
 
Example #17
Source File: RunnerLayoutUiFactoryImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public RunnerLayoutUi create(@Nonnull final String runnerId, @Nonnull final String runnerTitle, @Nonnull final String sessionName, @Nonnull final Disposable parent) {
  return new RunnerLayoutUiImpl(myProject, parent, runnerId, runnerTitle, sessionName);
}
 
Example #18
Source File: XDebugSessionTab.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public RunnerLayoutUi getUi() {
  return myUi;
}
 
Example #19
Source File: XDebugSessionImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public RunnerLayoutUi getUI() {
  assertSessionTabInitialized();
  assert mySessionTab != null;
  return mySessionTab.getUi();
}
 
Example #20
Source File: LayoutAttractionPolicy.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void clearAttraction(final Content content, final RunnerLayoutUi ui) {
}
 
Example #21
Source File: LayoutAttractionPolicy.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void attract(final Content content, final RunnerLayoutUi ui) {
  ui.selectAndFocus(content, true, true);
}
 
Example #22
Source File: LayoutAttractionPolicy.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void clearAttraction(final Content content, final RunnerLayoutUi ui) {
  ui.setBouncing(content, false);
}
 
Example #23
Source File: LogviewFactory.java    From logviewer with Apache License 2.0 4 votes vote down vote up
@Override
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {

    final File adb = AndroidSdkUtils.getAdb(project);
    ExecutionManager.getInstance(project).getContentManager();

    RunnerLayoutUi layoutUi = RunnerLayoutUi.Factory.getInstance(project).create("LogViewer", TOOL_WINDOW_ID, "Logview Tools", project);

    toolWindow.setIcon(LogviewerPluginIcons.TOOL_ICON);
    toolWindow.setAvailable(true, null);
    toolWindow.setToHideOnEmptyContent(true);
    toolWindow.setTitle(TOOL_WINDOW_ID);


    DeviceContext deviceContext = new DeviceContext();

    Content logcatContent = createLogcatContent(layoutUi, project, deviceContext);
    final LogView logcatView = logcatContent.getUserData(LOG_VIEW_KEY);
    layoutUi.addContent(logcatContent, 0, PlaceInGrid.center, false);

    final JBLoadingPanel loadingPanel = new JBLoadingPanel(new BorderLayout(), project);
    loadingPanel.add(layoutUi.getComponent(), BorderLayout.CENTER);

    final ContentManager contentManager = toolWindow.getContentManager();
    Content c = contentManager.getFactory().createContent(loadingPanel, "", true);
    c.putUserData(LOG_VIEW_KEY, logcatView);
    contentManager.addContent(c);
    ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
            logcatView.activate();
        }
    }, project.getDisposed());


    if (adb != null) {
        loadingPanel.setLoadingText("Initializing ADB");
        loadingPanel.startLoading();

        //ListenableFuture<AndroidDebugBridge> future = AdbService.getInstance().getDebugBridge(adb);
        ListenableFuture<AndroidDebugBridge> future = AdbBridgeFactory.getAdb(adb);
        Futures.addCallback(future, new FutureCallback<AndroidDebugBridge>() {
            @Override
            public void onSuccess(@Nullable AndroidDebugBridge bridge) {
                Logger.getInstance(LogviewFactory.class).info("Successfully obtained debug bridge");
                loadingPanel.stopLoading();
            }

            @Override
            public void onFailure(@NotNull Throwable t) {
                loadingPanel.stopLoading();
                Logger.getInstance(LogviewFactory.class).info("Unable to obtain debug bridge", t);
                String msg;
                if (t.getMessage() != null) {
                    msg = t.getMessage();
                } else {
                    msg = String.format("Unable to establish a connection to adb",
                            ApplicationNamesInfo.getInstance().getProductName(), adb.getAbsolutePath());
                }
                Messages.showErrorDialog(msg, "ADB Connection Error");
            }
        }, EdtExecutor.INSTANCE);
    } else {
        logcatView.showHint("No adb connection!.\n\nDrag and drop log files to view them.");
    }
}
 
Example #24
Source File: LayoutAttractionPolicy.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void attract(final Content content, final RunnerLayoutUi ui) {
  ui.setBouncing(content, true);
}
 
Example #25
Source File: BuckToolWindowImpl.java    From buck with Apache License 2.0 4 votes vote down vote up
public BuckToolWindowImpl(Project project) {
  this.project = project;
  this.runnerLayoutUi =
      RunnerLayoutUi.Factory.getInstance(project).create("buck", "buck", "buck", project);
}
 
Example #26
Source File: BlazeConsoleView.java    From intellij with Apache License 2.0 4 votes vote down vote up
void createToolWindowContent(ToolWindow toolWindow) {
  // Create runner UI layout
  RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(project);
  RunnerLayoutUi layoutUi = factory.create("", "", "session", project);
  layoutUi.getOptions().setMoveToGridActionEnabled(false).setMinimizeActionEnabled(false);

  Content console =
      layoutUi.createContent(
          BlazeConsoleToolWindowFactory.ID, consoleView.getComponent(), "", null, null);
  console.setCloseable(false);
  layoutUi.addContent(console, 0, PlaceInGrid.right, false);

  // Adding actions
  DefaultActionGroup group = new DefaultActionGroup();
  layoutUi.getOptions().setLeftToolbar(group, TOOLBAR_ACTION_PLACE);

  // Initializing prev and next occurrences actions
  OccurenceNavigator navigator = fromConsoleView(consoleView);
  CommonActionsManager actionsManager = CommonActionsManager.getInstance();
  AnAction prevAction = actionsManager.createPrevOccurenceAction(navigator);
  prevAction.getTemplatePresentation().setText(navigator.getPreviousOccurenceActionName());
  AnAction nextAction = actionsManager.createNextOccurenceAction(navigator);
  nextAction.getTemplatePresentation().setText(navigator.getNextOccurenceActionName());

  group.addAll(prevAction, nextAction);

  AnAction[] consoleActions = consoleView.createConsoleActions();
  for (AnAction action : consoleActions) {
    if (!shouldIgnoreAction(action)) {
      group.add(action);
    }
  }
  group.add(new StopAction());

  JComponent layoutComponent = layoutUi.getComponent();

  layoutComponent.setFocusTraversalPolicyProvider(true);
  layoutComponent.setFocusTraversalPolicy(
      new LayoutFocusTraversalPolicy() {
        @Override
        public Component getDefaultComponent(Container container) {
          if (container.equals(layoutComponent)) {
            return consoleView.getPreferredFocusableComponent();
          }
          return super.getDefaultComponent(container);
        }
      });

  Content content =
      ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true);
  content.setCloseable(false);
  toolWindow.getContentManager().addContent(content);
}
 
Example #27
Source File: XDebugTabLayouter.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Registers additional tabs for 'Debug' tool window.
 * @param ui {@code RunnerLayoutUi} instance
 */
public void registerAdditionalContent(@Nonnull RunnerLayoutUi ui) {
}
 
Example #28
Source File: ViewContext.java    From consulo with Apache License 2.0 votes vote down vote up
RunnerLayoutUi getRunnerLayoutUi(); 
Example #29
Source File: LayoutAttractionPolicy.java    From consulo with Apache License 2.0 votes vote down vote up
public abstract void clearAttraction(Content content, RunnerLayoutUi ui); 
Example #30
Source File: LayoutAttractionPolicy.java    From consulo with Apache License 2.0 votes vote down vote up
public abstract void attract(Content content, RunnerLayoutUi ui);