Search in sources :

Example 1 with ViewContext

use of com.intellij.execution.ui.layout.ViewContext in project intellij-community by JetBrains.

the class XDebugView method getData.

@Nullable
public static <T> T getData(DataKey<T> key, @NotNull Component component) {
    DataContext dataContext = DataManager.getInstance().getDataContext(component);
    ViewContext viewContext = ViewContext.CONTEXT_KEY.getData(dataContext);
    ContentManager contentManager = viewContext == null ? null : viewContext.getContentManager();
    if (contentManager != null) {
        T data = key.getData(DataManager.getInstance().getDataContext(contentManager.getComponent()));
        if (data != null) {
            return data;
        }
    }
    return key.getData(dataContext);
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) ViewContext(com.intellij.execution.ui.layout.ViewContext) ContentManager(com.intellij.ui.content.ContentManager) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with ViewContext

use of com.intellij.execution.ui.layout.ViewContext 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)

Aggregations

ViewContext (com.intellij.execution.ui.layout.ViewContext)2 DataContext (com.intellij.openapi.actionSystem.DataContext)1 Content (com.intellij.ui.content.Content)1 ContentManager (com.intellij.ui.content.ContentManager)1 Nullable (org.jetbrains.annotations.Nullable)1