use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.
the class PyExecuteSelectionAction method selectConsole.
private static void selectConsole(@NotNull DataContext dataContext, @NotNull Project project, final Consumer<PyCodeExecutor> consumer, Editor editor) {
Collection<RunContentDescriptor> consoles = getConsoles(project);
ExecutionHelper.selectContentDescriptor(dataContext, project, consoles, "Select console to execute in", descriptor -> {
if (descriptor != null && descriptor.getExecutionConsole() instanceof PyCodeExecutor) {
ExecutionConsole console = descriptor.getExecutionConsole();
consumer.consume((PyCodeExecutor) console);
if (console instanceof PythonDebugLanguageConsoleView) {
XDebugSession currentSession = XDebuggerManager.getInstance(project).getCurrentSession();
if (currentSession != null) {
ContentManager contentManager = currentSession.getUI().getContentManager();
Content content = contentManager.findContent("Console");
contentManager.setSelectedContent(content);
IdeFocusManager.findInstance().requestFocus(editor.getContentComponent(), true);
}
} else {
PythonConsoleToolWindow consoleToolWindow = PythonConsoleToolWindow.getInstance(project);
ToolWindow toolWindow = consoleToolWindow != null ? consoleToolWindow.getToolWindow() : null;
if (toolWindow != null && !toolWindow.isVisible()) {
toolWindow.show(null);
ContentManager contentManager = toolWindow.getContentManager();
Content content = contentManager.findContent(descriptor.getDisplayName());
if (content != null) {
contentManager.setSelectedContent(content);
}
}
}
}
});
}
use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.
the class StudyToolWindowFactory method createToolWindowContent.
@Override
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {
toolWindow.setIcon(InteractiveLearningIcons.TaskDescription);
StudyTaskManager taskManager = StudyTaskManager.getInstance(project);
final Course course = taskManager.getCourse();
if (course != null) {
final StudyToolWindow studyToolWindow;
if (StudyUtils.hasJavaFx() && taskManager.shouldUseJavaFx()) {
studyToolWindow = new StudyJavaFxToolWindow();
} else {
studyToolWindow = new StudySwingToolWindow();
}
studyToolWindow.init(project, true);
final ContentManager contentManager = toolWindow.getContentManager();
final Content content = contentManager.getFactory().createContent(studyToolWindow, null, false);
contentManager.addContent(content);
Disposer.register(project, studyToolWindow);
}
}
use of com.intellij.ui.content.ContentManager in project flutter-intellij by flutter.
the class ObservatoryActionGroup method removeEmptyContent.
private void removeEmptyContent(ToolWindow toolWindow) {
final ContentManager contentManager = toolWindow.getContentManager();
contentManager.removeContent(emptyContent, true);
toolWindow.setIcon(ExecutionUtil.getLiveIndicator(FlutterIcons.Flutter_13));
emptyContent = null;
}
use of com.intellij.ui.content.ContentManager in project flutter-intellij by flutter.
the class ObservatoryActionGroup method displayEmptyContent.
private void displayEmptyContent(ToolWindow toolWindow) {
// Display a 'No running applications' message.
final ContentManager contentManager = toolWindow.getContentManager();
final JPanel panel = new JPanel(new BorderLayout());
final JLabel label = new JLabel("No running applications", SwingConstants.CENTER);
label.setForeground(UIUtil.getLabelDisabledForeground());
panel.add(label, BorderLayout.CENTER);
emptyContent = contentManager.getFactory().createContent(panel, null, false);
contentManager.addContent(emptyContent);
toolWindow.setIcon(FlutterIcons.Flutter_13);
}
use of com.intellij.ui.content.ContentManager in project flutter-intellij by flutter.
the class FlutterConsole method bringToFront.
/**
* Moves this console to the end of the tool window's tab list, selects it, and shows the tool window.
*/
void bringToFront() {
// Move the tab to be last and select it.
final MessageView messageView = MessageView.SERVICE.getInstance(project);
final ContentManager contentManager = messageView.getContentManager();
contentManager.addContent(content);
contentManager.setSelectedContent(content);
// Show the panel.
final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
toolWindow.activate(null, true);
}
Aggregations