Search in sources :

Example 6 with DataProvider

use of com.intellij.openapi.actionSystem.DataProvider in project intellij-community by JetBrains.

the class NavigationItemListCellRenderer method getBackgroundColor.

protected static Color getBackgroundColor(@Nullable Object value) {
    if (value instanceof PsiElement || value instanceof DataProvider) {
        final PsiElement psiElement = value instanceof PsiElement ? (PsiElement) value : CommonDataKeys.PSI_ELEMENT.getData((DataProvider) value);
        if (psiElement != null && psiElement.isValid()) {
            VirtualFile virtualFile = PsiUtilCore.getVirtualFile(psiElement);
            Color fileColor = virtualFile == null ? null : EditorTabbedContainer.calcTabColor(psiElement.getProject(), virtualFile);
            if (fileColor != null) {
                return fileColor;
            }
        }
    }
    return UIUtil.getListBackground();
}
Also used : DataProvider(com.intellij.openapi.actionSystem.DataProvider) VirtualFile(com.intellij.openapi.vfs.VirtualFile) JBColor(com.intellij.ui.JBColor) PsiElement(com.intellij.psi.PsiElement)

Example 7 with DataProvider

use of com.intellij.openapi.actionSystem.DataProvider in project intellij-plugins by JetBrains.

the class IDEAFacade method getData.

public static Object getData(Component c, String dataId) {
    Object result = null;
    while (c != null) {
        if (c instanceof DataProvider) {
            DataProvider provider = (DataProvider) c;
            Object data = provider.getData(dataId);
            if (data != null) {
                result = data;
                break;
            }
        }
        c = c.getParent();
    }
    return result;
}
Also used : DataProvider(com.intellij.openapi.actionSystem.DataProvider)

Aggregations

DataProvider (com.intellij.openapi.actionSystem.DataProvider)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 PsiElement (com.intellij.psi.PsiElement)2 UsageTarget (com.intellij.usages.UsageTarget)2 ArrayList (java.util.ArrayList)2 PsiElement2UsageTargetAdapter (com.intellij.find.findUsages.PsiElement2UsageTargetAdapter)1 ContentManagerWatcher (com.intellij.ide.impl.ContentManagerWatcher)1 Disposable (com.intellij.openapi.Disposable)1 EditorEx (com.intellij.openapi.editor.ex.EditorEx)1 ToolWindow (com.intellij.openapi.wm.ToolWindow)1 PsiReference (com.intellij.psi.PsiReference)1 MapDataContext (com.intellij.testFramework.MapDataContext)1 JBColor (com.intellij.ui.JBColor)1 RelativePoint (com.intellij.ui.awt.RelativePoint)1 JBList (com.intellij.ui.components.JBList)1 JBTabsImpl (com.intellij.ui.tabs.impl.JBTabsImpl)1 PsiElementUsageTarget (com.intellij.usages.PsiElementUsageTarget)1