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);
}
}
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);
}
}
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) {
}
}
});
}
Aggregations