use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.
the class PaletteToolWindowManager method initToolWindow.
@Override
protected void initToolWindow() {
myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(IdeBundle.message("toolwindow.palette"), false, getAnchor(), myProject, true);
myToolWindow.setIcon(AllIcons.Toolwindows.ToolWindowPalette);
initGearActions();
ContentManager contentManager = myToolWindow.getContentManager();
Content content = contentManager.getFactory().createContent(myToolWindowPanel, null, false);
content.setCloseable(false);
content.setPreferredFocusableComponent(myToolWindowPanel);
contentManager.addContent(content);
contentManager.setSelectedContent(content, true);
myToolWindow.setAvailable(false, null);
}
use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.
the class FileHistorySessionPartner method createOrSelectContentIfNeeded.
private void createOrSelectContentIfNeeded() {
ToolWindow toolWindow = getToolWindow(myVcs.getProject());
if (myRefresherI.isFirstTime()) {
ContentManager manager = toolWindow.getContentManager();
boolean selectedExistingContent = ContentUtilEx.selectContent(manager, myFileHistoryPanel, true);
if (!selectedExistingContent) {
String tabName = myPath.getName();
if (myStartingRevisionNumber != null) {
tabName += " (";
if (myStartingRevisionNumber instanceof ShortVcsRevisionNumber) {
tabName += ((ShortVcsRevisionNumber) myStartingRevisionNumber).toShortString();
} else {
tabName += myStartingRevisionNumber.asString();
}
tabName += ")";
}
ContentUtilEx.addTabbedContent(manager, myFileHistoryPanel, "History", tabName, true);
}
toolWindow.activate(null);
}
}
use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.
the class PaletteToolWindowManager method initToolWindow.
//////////////////////////////////////////////////////////////////////////////////////////
//
// Impl
//
//////////////////////////////////////////////////////////////////////////////////////////
@Override
protected void initToolWindow() {
if (myToolWindowPanel == null) {
myToolWindowPanel = new PalettePanel();
}
myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow("Palette\t", false, getAnchor(), myProject, true);
myToolWindow.setIcon(AllIcons.Toolwindows.ToolWindowPalette);
initGearActions();
ContentManager contentManager = myToolWindow.getContentManager();
Content content = contentManager.getFactory().createContent(myToolWindowPanel, null, false);
content.setCloseable(false);
content.setPreferredFocusableComponent(myToolWindowPanel);
contentManager.addContent(content);
contentManager.setSelectedContent(content, true);
myToolWindow.setAvailable(false, null);
}
use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.
the class CloseLogTabAction method actionPerformed.
public void actionPerformed(@NotNull AnActionEvent e) {
VcsLogUtil.triggerUsage(e);
Project project = e.getProject();
assert project != null;
ContentManager contentManager = getContentManager(project);
if (contentManager == null)
return;
Content selectedContent = getTabbedContent(contentManager);
if (selectedContent != null) {
ContentsUtil.closeContentTab(contentManager, selectedContent);
}
}
use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.
the class GitShowExternalLogAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
final GitVcs vcs = ObjectUtils.assertNotNull(GitVcs.getInstance(project));
final List<VirtualFile> roots = getGitRootsFromUser(project);
if (roots.isEmpty()) {
return;
}
if (project.isDefault() || !ProjectLevelVcsManager.getInstance(project).hasActiveVcss()) {
ProgressManager.getInstance().run(new ShowLogInDialogTask(project, roots, vcs));
return;
}
final ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID);
final Runnable showContent = () -> {
ContentManager cm = window.getContentManager();
if (checkIfProjectLogMatches(project, vcs, cm, roots) || checkIfAlreadyOpened(cm, roots)) {
return;
}
String tabName = calcTabName(cm, roots);
MyContentComponent component = createManagerAndContent(project, vcs, roots, tabName);
Content content = ContentFactory.SERVICE.getInstance().createContent(component, tabName, false);
content.setDisposer(component.myDisposable);
content.setDescription("Log for " + StringUtil.join(roots, VirtualFile::getPath, "\n"));
content.setCloseable(true);
cm.addContent(content);
cm.setSelectedContent(content);
};
if (!window.isVisible()) {
window.activate(showContent, true);
} else {
showContent.run();
}
}
Aggregations