Search in sources :

Example 96 with Content

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

the class BaseViewAction method update.

@Override
public final void update(final AnActionEvent e) {
    ViewContext context = getViewFacade(e);
    Content[] content = getContent(e);
    if (context != null && content != null) {
        if (containsInvalidContent(content)) {
            e.getPresentation().setEnabled(false);
        } else {
            update(e, context, content);
        }
    } else {
        e.getPresentation().setEnabled(false);
    }
}
Also used : ViewContext(com.intellij.execution.ui.layout.ViewContext) Content(com.intellij.ui.content.Content)

Example 97 with Content

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

the class QuickDocUtil method getActiveDocComponent.

@Nullable
public static DocumentationComponent getActiveDocComponent(@NotNull Project project) {
    DocumentationManager documentationManager = DocumentationManager.getInstance(project);
    DocumentationComponent component;
    JBPopup hint = documentationManager.getDocInfoHint();
    if (hint != null) {
        component = (DocumentationComponent) ((AbstractPopup) hint).getComponent();
    } else if (documentationManager.hasActiveDockedDocWindow()) {
        ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.DOCUMENTATION);
        Content selectedContent = toolWindow == null ? null : toolWindow.getContentManager().getSelectedContent();
        component = selectedContent == null ? null : (DocumentationComponent) selectedContent.getComponent();
    } else {
        component = null;
    }
    return component;
}
Also used : AbstractPopup(com.intellij.ui.popup.AbstractPopup) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) JBPopup(com.intellij.openapi.ui.popup.JBPopup) Nullable(org.jetbrains.annotations.Nullable)

Example 98 with Content

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

the class LogConsoleManagerBase method addAdditionalTabComponent.

public Content addAdditionalTabComponent(@NotNull AdditionalTabComponent tabComponent, @NotNull String id, @Nullable Icon icon) {
    Content logContent = getUi().createContent(id, (ComponentWithActions) tabComponent, tabComponent.getTabTitle(), icon, tabComponent.getPreferredFocusableComponent());
    myAdditionalContent.put(tabComponent, logContent);
    getUi().addContent(logContent);
    return logContent;
}
Also used : Content(com.intellij.ui.content.Content)

Example 99 with Content

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

the class CyclicDependenciesHandler method analyze.

public void analyze() {
    final CyclicDependenciesBuilder builder = new CyclicDependenciesBuilder(myProject, myScope);
    final Runnable process = () -> builder.analyze();
    final Runnable successRunnable = () -> SwingUtilities.invokeLater(() -> {
        CyclicDependenciesPanel panel = new CyclicDependenciesPanel(myProject, builder);
        Content content = ContentFactory.SERVICE.getInstance().createContent(panel, AnalysisScopeBundle.message("action.analyzing.cyclic.dependencies.in.scope", builder.getScope().getDisplayName()), false);
        content.setDisposer(panel);
        panel.setContent(content);
        DependenciesToolWindow.getInstance(myProject).addContent(content);
    });
    ProgressManager.getInstance().runProcessWithProgressAsynchronously(myProject, AnalysisScopeBundle.message("package.dependencies.progress.title"), process, successRunnable, null, new PerformAnalysisInBackgroundOption(myProject));
}
Also used : CyclicDependenciesBuilder(com.intellij.cyclicDependencies.CyclicDependenciesBuilder) Content(com.intellij.ui.content.Content) CyclicDependenciesPanel(com.intellij.cyclicDependencies.ui.CyclicDependenciesPanel) PerformAnalysisInBackgroundOption(com.intellij.analysis.PerformAnalysisInBackgroundOption)

Example 100 with Content

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

the class ExternalSystemNotificationManager method clearNotifications.

public void clearNotifications(@Nullable final String groupName, @NotNull final NotificationSource notificationSource, @NotNull final ProjectSystemId externalSystemId) {
    myMessageCounter.remove(groupName, notificationSource, externalSystemId);
    myUpdater.submit(() -> {
        if (myProject.isDisposed())
            return;
        for (Iterator<Notification> iterator = myNotifications.iterator(); iterator.hasNext(); ) {
            Notification notification = iterator.next();
            if (groupName == null || groupName.equals(notification.getGroupId())) {
                notification.expire();
                iterator.remove();
            }
        }
        final ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
        if (toolWindow == null)
            return;
        final Pair<NotificationSource, ProjectSystemId> contentIdPair = Pair.create(notificationSource, externalSystemId);
        final MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
        UIUtil.invokeLaterIfNeeded(() -> {
            if (myProject.isDisposed())
                return;
            for (Content content : messageView.getContentManager().getContents()) {
                if (!content.isPinned() && contentIdPair.equals(content.getUserData(CONTENT_ID_KEY))) {
                    if (groupName == null) {
                        messageView.getContentManager().removeContent(content, true);
                    } else {
                        assert content.getComponent() instanceof NewEditableErrorTreeViewPanel;
                        NewEditableErrorTreeViewPanel errorTreeView = (NewEditableErrorTreeViewPanel) content.getComponent();
                        ErrorViewStructure errorViewStructure = errorTreeView.getErrorViewStructure();
                        errorViewStructure.removeGroup(groupName);
                    }
                }
            }
        });
    });
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) MessageView(com.intellij.ui.content.MessageView) Content(com.intellij.ui.content.Content) ProjectSystemId(com.intellij.openapi.externalSystem.model.ProjectSystemId) Notification(com.intellij.notification.Notification)

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