}
String decorationIcon = null;
if (functionDefToken.decs != null) {
for (decoratorsType decorator : functionDefToken.decs) {
if (decorator.func instanceof Name) {
Name decoratorFuncName = (Name) decorator.func;
if (decoratorFuncName.id.equals("staticmethod")) {
decorationIcon = UIConstants.DECORATION_STATIC;
} else if (decoratorFuncName.id.equals("classmethod")) {
decorationIcon = UIConstants.DECORATION_CLASS;
}
}
}
}
if (qualifierIcon != null) {
//it's OK if the decorationIcon is null as that's properly handled in getImageDecorated.
return imageCache.getImageDecorated(UIConstants.METHOD_ICON, qualifierIcon,
ImageCache.DECORATION_LOCATION_BOTTOM_RIGHT, decorationIcon,
ImageCache.DECORATION_LOCATION_TOP_RIGHT);
} else if (decorationIcon != null) {
return imageCache.getImageDecorated(UIConstants.METHOD_ICON, decorationIcon,
ImageCache.DECORATION_LOCATION_TOP_RIGHT);
}
return imageCache.get(UIConstants.METHOD_ICON);
} else if (token instanceof Import) {
return imageCache.get(UIConstants.IMPORT_ICON);
} else if (token instanceof If && NodeUtils.isIfMAinNode((If) token)) {
return imageCache.get(UIConstants.MAIN_FUNCTION_ICON);
} else if (token instanceof ImportFrom) {
return imageCache.get(UIConstants.IMPORT_ICON);
} else if (token instanceof commentType) {
return imageCache.get(UIConstants.COMMENT);
} else if (token instanceof Attribute || token instanceof Name || token instanceof NameTok) {
String name = null;
if (token instanceof Attribute) {
Attribute attributeToken = (Attribute) token;
name = NodeUtils.getNameFromNameTok((NameTok) (attributeToken).attr);
} else if (token instanceof Name) {
Name nameToken = (Name) token;
name = nameToken.id;
} else {
NameTok nameTokToken = (NameTok) token;
name = NodeUtils.getNameFromNameTok(nameTokToken);
}