use of com.intellij.ui.content.ContentFactory in project intellij-code-outline by sitano.
the class CodeOutlinePlugin method regForProject.
/**
* Creates a code outline tool window for the given project.
*
* @param project the project to register
*/
private synchronized void regForProject(final Project project) {
final CodeOutlineToolWindow window = new CodeOutlineToolWindow(this, project);
ToolWindowManager twm = ToolWindowManager.getInstance(project);
ToolWindowManagerEx twmEx = (ToolWindowManagerEx) twm;
ToolWindow tw = twm.registerToolWindow(TOOLWINDOW_ID, false, ToolWindowAnchor.RIGHT);
ContentFactory contentFactory = ServiceManager.getService(ContentFactory.class);
Content content = contentFactory.createContent(window, "", false);
tw.getContentManager().addContent(content);
tw.getContentManager().setSelectedContent(content, false);
twmEx.addToolWindowManagerListener(window.getToolWindowManagerListener());
}
use of com.intellij.ui.content.ContentFactory in project intellij-community by JetBrains.
the class MvcConsole method setUpToolWindow.
private Content setUpToolWindow() {
//Create runner UI layout
final RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject);
final RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject);
// Adding actions
DefaultActionGroup group = new DefaultActionGroup();
group.add(myKillAction);
group.addSeparator();
layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);
final Content console = layoutUi.createContent(CONSOLE_ID, myConsole.getComponent(), "", null, null);
layoutUi.addContent(console, 0, PlaceInGrid.right, false);
final JComponent uiComponent = layoutUi.getComponent();
myPanel.add(uiComponent, BorderLayout.CENTER);
final ContentManager manager = myToolWindow.getContentManager();
final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
final Content content = contentFactory.createContent(uiComponent, null, true);
manager.addContent(content);
return content;
}
use of com.intellij.ui.content.ContentFactory in project intellij-community by JetBrains.
the class TodoView method initToolWindow.
public void initToolWindow(@NotNull ToolWindow toolWindow) {
// Create panels
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
Content allTodosContent = contentFactory.createContent(null, IdeBundle.message("title.project"), false);
myAllTodos = new TodoPanel(myProject, state.all, false, allTodosContent) {
@Override
protected TodoTreeBuilder createTreeBuilder(JTree tree, DefaultTreeModel treeModel, Project project) {
AllTodosTreeBuilder builder = createAllTodoBuilder(tree, treeModel, project);
builder.init();
return builder;
}
};
allTodosContent.setComponent(myAllTodos);
Disposer.register(this, myAllTodos);
Content currentFileTodosContent = contentFactory.createContent(null, IdeBundle.message("title.todo.current.file"), false);
CurrentFileTodosPanel currentFileTodos = new CurrentFileTodosPanel(myProject, state.current, currentFileTodosContent) {
@Override
protected TodoTreeBuilder createTreeBuilder(JTree tree, DefaultTreeModel treeModel, Project project) {
CurrentFileTodosTreeBuilder builder = new CurrentFileTodosTreeBuilder(tree, treeModel, project);
builder.init();
return builder;
}
};
Disposer.register(this, currentFileTodos);
currentFileTodosContent.setComponent(currentFileTodos);
myChangeListTodosContent = contentFactory.createContent(null, IdeBundle.message("changelist.todo.title", ChangeListManager.getInstance(myProject).getDefaultChangeList().getName()), false);
ChangeListTodosPanel changeListTodos = new ChangeListTodosPanel(myProject, state.current, myChangeListTodosContent) {
@Override
protected TodoTreeBuilder createTreeBuilder(JTree tree, DefaultTreeModel treeModel, Project project) {
ChangeListTodosTreeBuilder builder = new ChangeListTodosTreeBuilder(tree, treeModel, project);
builder.init();
return builder;
}
};
Disposer.register(this, changeListTodos);
myChangeListTodosContent.setComponent(changeListTodos);
Content scopeBasedTodoContent = contentFactory.createContent(null, "Scope Based", false);
ScopeBasedTodosPanel scopeBasedTodos = new ScopeBasedTodosPanel(myProject, state.current, scopeBasedTodoContent);
Disposer.register(this, scopeBasedTodos);
scopeBasedTodoContent.setComponent(scopeBasedTodos);
myContentManager = toolWindow.getContentManager();
myContentManager.addContent(allTodosContent);
myContentManager.addContent(currentFileTodosContent);
myContentManager.addContent(scopeBasedTodoContent);
if (ProjectLevelVcsManager.getInstance(myProject).hasActiveVcss()) {
myVcsListener.myIsVisible = true;
myContentManager.addContent(myChangeListTodosContent);
}
for (Content content : myNotAddedContent) {
myContentManager.addContent(content);
}
myChangeListTodosContent.setCloseable(false);
allTodosContent.setCloseable(false);
currentFileTodosContent.setCloseable(false);
scopeBasedTodoContent.setCloseable(false);
Content content = myContentManager.getContent(state.selectedIndex);
myContentManager.setSelectedContent(content == null ? allTodosContent : content);
myPanels.add(myAllTodos);
myPanels.add(changeListTodos);
myPanels.add(currentFileTodos);
myPanels.add(scopeBasedTodos);
}
use of com.intellij.ui.content.ContentFactory in project intellij-community by JetBrains.
the class ServersToolWindowFactory method createToolWindowContent.
@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
final ServersToolWindowContent serversContent = new ServersToolWindowContent(project, myContribution);
Content content = contentFactory.createContent(serversContent.getMainPanel(), null, false);
Disposer.register(content, serversContent);
toolWindow.getContentManager().addContent(content);
}
use of com.intellij.ui.content.ContentFactory in project intellij-community by JetBrains.
the class AbstractVcsHelperImpl method openCommittedChangesTab.
public void openCommittedChangesTab(final CommittedChangesProvider provider, final RepositoryLocation location, final ChangeBrowserSettings settings, final int maxCount, String title) {
DefaultActionGroup extraActions = new DefaultActionGroup();
CommittedChangesPanel panel = new CommittedChangesPanel(myProject, provider, settings, location, extraActions);
panel.setMaxCount(maxCount);
panel.refreshChanges(false);
final ContentFactory factory = ContentFactory.SERVICE.getInstance();
if (title == null && location != null) {
title = VcsBundle.message("browse.changes.content.title", location.toPresentableString());
}
final Content content = factory.createContent(panel, title, false);
final ChangesViewContentI contentManager = ChangesViewContentManager.getInstance(myProject);
contentManager.addContent(content);
contentManager.setSelectedContent(content);
extraActions.add(new CloseTabToolbarAction() {
public void actionPerformed(final AnActionEvent e) {
contentManager.removeContent(content);
}
});
ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID);
if (!window.isVisible()) {
window.activate(null);
}
}
Aggregations