Search in sources :

Example 1 with ProjectViewNodeDecorator

use of com.intellij.ide.projectView.ProjectViewNodeDecorator in project intellij-community by JetBrains.

the class PackageElementNode method updateValidData.

private void updateValidData(PresentationData presentation, PackageElement value) {
    final PsiPackage aPackage = value.getPackage();
    if (!getSettings().isFlattenPackages() && getSettings().isHideEmptyMiddlePackages() && PackageUtil.isPackageEmpty(aPackage, value.getModule(), true, isLibraryElement())) {
        setValue(null);
        return;
    }
    PsiPackage parentPackage;
    Object parentValue = getParentValue();
    if (parentValue instanceof PackageElement) {
        parentPackage = ((PackageElement) parentValue).getPackage();
    } else {
        parentPackage = null;
    }
    String qName = aPackage.getQualifiedName();
    String name = PackageUtil.getNodeName(getSettings(), aPackage, parentPackage, qName, showFQName(aPackage));
    presentation.setPresentableText(name);
    presentation.setIcon(PlatformIcons.PACKAGE_ICON);
    for (ProjectViewNodeDecorator decorator : Extensions.getExtensions(ProjectViewNodeDecorator.EP_NAME, myProject)) {
        decorator.decorate(this, presentation);
    }
}
Also used : ProjectViewNodeDecorator(com.intellij.ide.projectView.ProjectViewNodeDecorator) PsiPackage(com.intellij.psi.PsiPackage)

Example 2 with ProjectViewNodeDecorator

use of com.intellij.ide.projectView.ProjectViewNodeDecorator in project intellij-community by JetBrains.

the class BaseSmartPointerPsiNode method update.

@Override
public void update(PresentationData data) {
    final PsiElement value = getPsiElement();
    if (value == null || !value.isValid()) {
        setValue(null);
    }
    if (getPsiElement() == null)
        return;
    int flags = Iconable.ICON_FLAG_VISIBILITY;
    if (isMarkReadOnly()) {
        flags |= Iconable.ICON_FLAG_READ_STATUS;
    }
    LOG.assertTrue(value.isValid());
    Icon icon = value.getIcon(flags);
    data.setIcon(icon);
    data.setPresentableText(myName);
    if (isDeprecated()) {
        data.setAttributesKey(CodeInsightColors.DEPRECATED_ATTRIBUTES);
    }
    updateImpl(data);
    for (ProjectViewNodeDecorator decorator : Extensions.getExtensions(ProjectViewNodeDecorator.EP_NAME, myProject)) {
        decorator.decorate(this, data);
    }
}
Also used : ProjectViewNodeDecorator(com.intellij.ide.projectView.ProjectViewNodeDecorator)

Example 3 with ProjectViewNodeDecorator

use of com.intellij.ide.projectView.ProjectViewNodeDecorator in project intellij-community by JetBrains.

the class AbstractPsiBasedNode method update.

// Should be called in atomic action
@Override
public void update(final PresentationData data) {
    ApplicationManager.getApplication().runReadAction(() -> {
        if (!validate()) {
            return;
        }
        final PsiElement value = extractPsiFromValue();
        LOG.assertTrue(value.isValid());
        int flags = getIconableFlags();
        try {
            Icon icon = value.getIcon(flags);
            data.setIcon(icon);
        } catch (IndexNotReadyException ignored) {
        }
        data.setPresentableText(myName);
        try {
            if (isDeprecated()) {
                data.setAttributesKey(CodeInsightColors.DEPRECATED_ATTRIBUTES);
            }
        } catch (IndexNotReadyException ignored) {
        }
        updateImpl(data);
        data.setIcon(patchIcon(myProject, data.getIcon(true), getVirtualFile()));
        for (ProjectViewNodeDecorator decorator : Extensions.getExtensions(ProjectViewNodeDecorator.EP_NAME, myProject)) {
            try {
                decorator.decorate(this, data);
            } catch (IndexNotReadyException ignored) {
            }
        }
    });
}
Also used : ProjectViewNodeDecorator(com.intellij.ide.projectView.ProjectViewNodeDecorator) IndexNotReadyException(com.intellij.openapi.project.IndexNotReadyException) RowIcon(com.intellij.ui.RowIcon) LayeredIcon(com.intellij.ui.LayeredIcon) PsiElement(com.intellij.psi.PsiElement)

Aggregations

ProjectViewNodeDecorator (com.intellij.ide.projectView.ProjectViewNodeDecorator)3 IndexNotReadyException (com.intellij.openapi.project.IndexNotReadyException)1 PsiElement (com.intellij.psi.PsiElement)1 PsiPackage (com.intellij.psi.PsiPackage)1 LayeredIcon (com.intellij.ui.LayeredIcon)1 RowIcon (com.intellij.ui.RowIcon)1