Search in sources :

Example 1 with ContentFactory

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());
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ContentFactory(com.intellij.ui.content.ContentFactory) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 2 with ContentFactory

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;
}
Also used : RunnerLayoutUi(com.intellij.execution.ui.RunnerLayoutUi) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) ContentFactory(com.intellij.ui.content.ContentFactory)

Example 3 with ContentFactory

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);
}
Also used : DefaultTreeModel(javax.swing.tree.DefaultTreeModel) ContentFactory(com.intellij.ui.content.ContentFactory) Project(com.intellij.openapi.project.Project) Content(com.intellij.ui.content.Content)

Example 4 with ContentFactory

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);
}
Also used : Content(com.intellij.ui.content.Content) ContentFactory(com.intellij.ui.content.ContentFactory)

Example 5 with ContentFactory

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);
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) CloseTabToolbarAction(com.intellij.ide.actions.CloseTabToolbarAction) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) ContentFactory(com.intellij.ui.content.ContentFactory)

Aggregations

Content (com.intellij.ui.content.Content)13 ContentFactory (com.intellij.ui.content.ContentFactory)13 ContentManager (com.intellij.ui.content.ContentManager)3 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)2 ToolWindow (com.intellij.openapi.wm.ToolWindow)2 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)2 RunnerLayoutUi (com.intellij.execution.ui.RunnerLayoutUi)1 CloseTabToolbarAction (com.intellij.ide.actions.CloseTabToolbarAction)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 Project (com.intellij.openapi.project.Project)1 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)1 ToolWindowManagerAdapter (com.intellij.openapi.wm.ex.ToolWindowManagerAdapter)1 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)1