Search in sources :

Example 56 with Content

use of com.intellij.ui.content.Content in project intellij-community by JetBrains.

the class RunnerLayoutUiImpl method createContent.

@Override
@NotNull
public Content createContent(@NotNull final String contentId, @NotNull final ComponentWithActions withActions, @NotNull final String displayName, @Nullable final Icon icon, @Nullable final JComponent toFocus) {
    final Content content = getContentFactory().createContent(withActions.getComponent(), displayName, false);
    content.putUserData(CONTENT_TYPE, contentId);
    content.putUserData(ViewImpl.ID, contentId);
    content.setIcon(icon);
    if (toFocus != null) {
        content.setPreferredFocusableComponent(toFocus);
    }
    if (!withActions.isContentBuiltIn()) {
        content.setSearchComponent(withActions.getSearchComponent());
        content.setActions(withActions.getToolbarActions(), withActions.getToolbarPlace(), withActions.getToolbarContextComponent());
    }
    return content;
}
Also used : Content(com.intellij.ui.content.Content) NotNull(org.jetbrains.annotations.NotNull)

Example 57 with Content

use of com.intellij.ui.content.Content in project intellij-community by JetBrains.

the class FindInProjectManager method findInProject.

public void findInProject(@NotNull DataContext dataContext) {
    final boolean isOpenInNewTabEnabled;
    final boolean toOpenInNewTab;
    Content selectedContent = UsageViewManager.getInstance(myProject).getSelectedContent(true);
    if (selectedContent != null && selectedContent.isPinned()) {
        toOpenInNewTab = true;
        isOpenInNewTabEnabled = false;
    } else {
        toOpenInNewTab = FindSettings.getInstance().isShowResultsInSeparateView();
        isOpenInNewTabEnabled = UsageViewManager.getInstance(myProject).getReusableContentsCount() > 0;
    }
    final FindManager findManager = FindManager.getInstance(myProject);
    final FindModel findModel = findManager.getFindInProjectModel().clone();
    findModel.setReplaceState(false);
    findModel.setOpenInNewTabVisible(true);
    findModel.setOpenInNewTabEnabled(isOpenInNewTabEnabled);
    findModel.setOpenInNewTab(toOpenInNewTab);
    initModel(findModel, dataContext);
    findManager.showFindDialog(findModel, () -> {
        findModel.setOpenInNewTabVisible(false);
        if (isOpenInNewTabEnabled) {
            FindSettings.getInstance().setShowResultsInSeparateView(findModel.isOpenInNewTab());
        }
        startFindInProject(findModel);
        //todo check it in both cases: dialog & popup
        findModel.setOpenInNewTabVisible(false);
    });
}
Also used : FindManager(com.intellij.find.FindManager) FindModel(com.intellij.find.FindModel) Content(com.intellij.ui.content.Content)

Example 58 with Content

use of com.intellij.ui.content.Content 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 59 with Content

use of com.intellij.ui.content.Content in project intellij-community by JetBrains.

the class TodoView method addCustomTodoView.

public void addCustomTodoView(final TodoTreeBuilderFactory factory, final String title, final TodoPanelSettings settings) {
    Content content = ContentFactory.SERVICE.getInstance().createContent(null, title, true);
    final ChangeListTodosPanel panel = new ChangeListTodosPanel(myProject, settings, content) {

        @Override
        protected TodoTreeBuilder createTreeBuilder(JTree tree, DefaultTreeModel treeModel, Project project) {
            TodoTreeBuilder todoTreeBuilder = factory.createTreeBuilder(tree, treeModel, project);
            todoTreeBuilder.init();
            return todoTreeBuilder;
        }
    };
    content.setComponent(panel);
    Disposer.register(this, panel);
    if (myContentManager == null) {
        myNotAddedContent.add(content);
    } else {
        myContentManager.addContent(content);
    }
    myPanels.add(panel);
    content.setCloseable(true);
    content.setDisposer(new Disposable() {

        @Override
        public void dispose() {
            myPanels.remove(panel);
        }
    });
}
Also used : Disposable(com.intellij.openapi.Disposable) Project(com.intellij.openapi.project.Project) Content(com.intellij.ui.content.Content) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 60 with Content

use of com.intellij.ui.content.Content 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);
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager)

Aggregations

Content (com.intellij.ui.content.Content)157 ContentManager (com.intellij.ui.content.ContentManager)42 ToolWindow (com.intellij.openapi.wm.ToolWindow)37 NotNull (org.jetbrains.annotations.NotNull)19 ContentFactory (com.intellij.ui.content.ContentFactory)14 Project (com.intellij.openapi.project.Project)13 Nullable (org.jetbrains.annotations.Nullable)13 MessageView (com.intellij.ui.content.MessageView)10 Disposable (com.intellij.openapi.Disposable)8 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)8 RunnerLayoutUi (com.intellij.execution.ui.RunnerLayoutUi)7 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)7 ConsoleView (com.intellij.execution.ui.ConsoleView)6 SimpleToolWindowPanel (com.intellij.openapi.ui.SimpleToolWindowPanel)6 TabbedContent (com.intellij.ui.content.TabbedContent)6 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)5 Ref (com.intellij.openapi.util.Ref)5 ExecutionConsole (com.intellij.execution.ui.ExecutionConsole)4 ToolWindowManagerAdapter (com.intellij.openapi.wm.ex.ToolWindowManagerAdapter)4 Assert.assertNotNull (junit.framework.Assert.assertNotNull)4