use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.
the class PyEduDebugRunner method initSession.
@Override
protected void initSession(XDebugSession session, RunProfileState state, Executor executor) {
XDebugSessionTab tab = ((XDebugSessionImpl) session).getSessionTab();
if (tab != null) {
RunnerLayoutUi ui = tab.getUi();
ContentManager contentManager = ui.getContentManager();
Content content = findContent(contentManager, XDebuggerBundle.message("debugger.session.tab.console.content.name"));
if (content != null) {
ExecutionConsole console = session.getDebugProcess().createConsole();
PythonDebugLanguageConsoleView view = (PythonDebugLanguageConsoleView) console;
Presentation presentation = view.getSwitchConsoleActionPresentation();
ToggleAction action = new ToggleAction(presentation.getText(), presentation.getDescription(), presentation.getIcon()) {
@Override
public boolean isSelected(AnActionEvent e) {
return !view.isPrimaryConsoleEnabled();
}
@Override
public void setSelected(AnActionEvent e, boolean state) {
view.enableConsole(!state);
}
};
content.setActions(new DefaultActionGroup(action), ActionPlaces.DEBUGGER_TOOLBAR, view.getPreferredFocusableComponent());
}
patchLeftToolbar(session, ui);
}
}
use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.
the class RunnerLayoutUiImpl method addListener.
@NotNull
@Override
public RunnerLayoutUi addListener(@NotNull final ContentManagerListener listener, @NotNull final Disposable parent) {
final ContentManager mgr = getContentManager();
mgr.addContentManagerListener(listener);
Disposer.register(parent, new Disposable() {
@Override
public void dispose() {
mgr.removeContentManagerListener(listener);
}
});
return this;
}
use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.
the class SliceManager method createToolWindow.
public void createToolWindow(boolean dataFlowToThis, @NotNull SliceRootNode rootNode, boolean splitByLeafExpressions, @NotNull String displayName) {
final SliceToolwindowSettings sliceToolwindowSettings = SliceToolwindowSettings.getInstance(myProject);
final ContentManager contentManager = getContentManager(dataFlowToThis);
final Content[] myContent = new Content[1];
ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(dataFlowToThis ? BACK_TOOLWINDOW_ID : FORTH_TOOLWINDOW_ID);
final SlicePanel slicePanel = new SlicePanel(myProject, dataFlowToThis, rootNode, splitByLeafExpressions, toolWindow) {
@Override
protected void close() {
super.close();
contentManager.removeContent(myContent[0], true);
}
@Override
public boolean isAutoScroll() {
return sliceToolwindowSettings.isAutoScroll();
}
@Override
public void setAutoScroll(boolean autoScroll) {
sliceToolwindowSettings.setAutoScroll(autoScroll);
}
@Override
public boolean isPreview() {
return sliceToolwindowSettings.isPreview();
}
@Override
public void setPreview(boolean preview) {
sliceToolwindowSettings.setPreview(preview);
}
};
myContent[0] = contentManager.getFactory().createContent(slicePanel, displayName, true);
contentManager.addContent(myContent[0]);
contentManager.setSelectedContent(myContent[0]);
toolWindow.activate(null);
}
use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.
the class RunDashboardManagerImpl method createToolWindowContent.
@Override
public void createToolWindowContent(@NotNull ToolWindow toolWindow) {
myDashboardContent = new RunDashboardContent(myProject, myContentManager, myGroupers);
ContentManager contentManager = toolWindow.getContentManager();
Content content = contentManager.getFactory().createContent(myDashboardContent, null, false);
Disposer.register(content, myDashboardContent);
Disposer.register(content, () -> myDashboardContent = null);
toolWindow.getContentManager().addContent(content);
}
use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.
the class BrowseHierarchyActionBase method createAndAddToPanel.
@NotNull
public static HierarchyBrowser createAndAddToPanel(@NotNull Project project, @NotNull final HierarchyProvider provider, @NotNull PsiElement target) {
HierarchyBrowser hierarchyBrowser = provider.createHierarchyBrowser(target);
final Content content;
HierarchyBrowserManager hierarchyBrowserManager = HierarchyBrowserManager.getInstance(project);
final ContentManager contentManager = hierarchyBrowserManager.getContentManager();
final Content selectedContent = contentManager.getSelectedContent();
if (selectedContent != null && !selectedContent.isPinned()) {
content = selectedContent;
final Component component = content.getComponent();
if (component instanceof Disposable) {
Disposer.dispose((Disposable) component);
}
content.setComponent(hierarchyBrowser.getComponent());
} else {
content = ContentFactory.SERVICE.getInstance().createContent(hierarchyBrowser.getComponent(), null, true);
contentManager.addContent(content);
}
contentManager.setSelectedContent(content);
hierarchyBrowser.setContent(content);
final Runnable runnable = () -> {
if (hierarchyBrowser instanceof HierarchyBrowserBase && ((HierarchyBrowserBase) hierarchyBrowser).isDisposed()) {
return;
}
provider.browserActivated(hierarchyBrowser);
};
ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.HIERARCHY).activate(runnable);
return hierarchyBrowser;
}
Aggregations