本文整理汇总了Java中consulo.ide.IconDescriptorUpdaters类的典型用法代码示例。如果您正苦于以下问题:Java IconDescriptorUpdaters类的具体用法?Java IconDescriptorUpdaters怎么用?Java IconDescriptorUpdaters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IconDescriptorUpdaters类属于consulo.ide包,在下文中一共展示了IconDescriptorUpdaters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildTypeLikeElement
import consulo.ide.IconDescriptorUpdaters; //导入依赖的package包/类
@RequiredReadAction
private static <E extends DotNetGenericParameterListOwner & DotNetQualifiedElement> LookupElementBuilder buildTypeLikeElement(@NotNull E element, @NotNull DotNetGenericExtractor extractor)
{
String genericText = CSharpElementPresentationUtil.formatGenericParameters(element, extractor);
String name = CSharpNamedElement.getEscapedName(element);
LookupElementBuilder builder = LookupElementBuilder.create(element, name + (extractor == DotNetGenericExtractor.EMPTY ? "" : genericText));
builder = builder.withPresentableText(name); // always show only name
builder = builder.withIcon(IconDescriptorUpdaters.getIcon(element, Iconable.ICON_FLAG_VISIBILITY));
builder = builder.withTypeText(element.getPresentableParentQName());
builder = builder.withTailText(genericText, true);
if(extractor == DotNetGenericExtractor.EMPTY)
{
builder = withGenericInsertHandler(element, builder);
}
return builder;
}
示例2: getItemsByName
import consulo.ide.IconDescriptorUpdaters; //导入依赖的package包/类
@Override
public NavigationItem[] getItemsByName(String name, String pattern, Project project, boolean includeNonProjectItems) {
GlobalSearchScope scope = includeNonProjectItems ? GlobalSearchScope.allScope(project) : GlobalSearchScope.projectScope(project);
final Collection<LuaDeclarationExpression> globals = ResolveUtil.getFilteredGlobals(project, scope);
List<NavigationItem> symbols = new ArrayList<NavigationItem>();
for (LuaDeclarationExpression global : globals) {
if (!includeNonProjectItems && !scope.contains(global.getContainingFile().getVirtualFile()))
continue;
if (global.getDefinedName().startsWith(pattern))
symbols.add(new BaseNavigationItem(global, global.getDefinedName(), IconDescriptorUpdaters.getIcon(global, 0)));
}
//symbols.addAll(StubIndex.getInstance().get(LuaGlobalDeclarationIndex.KEY, name, project, scope));
return symbols.toArray(new NavigationItem[symbols.size()]);
}
示例3: getPresentation
import consulo.ide.IconDescriptorUpdaters; //导入依赖的package包/类
@Override
public ItemPresentation getPresentation(final ThriftSubDeclaration item) {
return new ItemPresentation() {
@Nullable
@Override
public String getPresentableText() {
return item.getName();
}
@Nullable
@Override
public String getLocationString() {
ThriftTopLevelDeclaration topLevelDeclaration = PsiTreeUtil.getParentOfType(item, ThriftTopLevelDeclaration.class, true);
return topLevelDeclaration != null ? topLevelDeclaration.getName() : item.getContainingFile().getName();
}
@Nullable
@Override
public Icon getIcon(boolean unused) {
return IconDescriptorUpdaters.getIcon(item, Iconable.ICON_FLAG_VISIBILITY);
}
};
}
示例4: getPresentation
import consulo.ide.IconDescriptorUpdaters; //导入依赖的package包/类
@Override
public ItemPresentation getPresentation(final ThriftDeclaration item) {
return new ItemPresentation() {
@Nullable
@Override
public String getPresentableText() {
return item.getName();
}
@Nullable
@Override
public String getLocationString() {
return item.getContainingFile().getName();
}
@Nullable
@Override
public Icon getIcon(boolean unused) {
return IconDescriptorUpdaters.getIcon(item, Iconable.ICON_FLAG_VISIBILITY);
}
};
}
开发者ID:consulo,项目名称:consulo-apache-thrift,代码行数:23,代码来源:ThriftTopLevelDeclarationPresentationProvider.java
示例5: update
import consulo.ide.IconDescriptorUpdaters; //导入依赖的package包/类
@Override
protected void update(final PresentationData presentation) {
ApplicationManager.getApplication().runReadAction(new Runnable() {
public void run() {
final Object value = getValue();
if (value instanceof PsiNamedElement) {
if (value instanceof PsiQualifiedNamedElement &&
(myStateBean.myFlattenPackages && ((PsiNamedElement)value).getContainingFile() == null ||
getParent() instanceof CoverageListRootNode)) {
presentation.setPresentableText(((PsiQualifiedNamedElement)value).getQualifiedName());
}
else {
presentation.setPresentableText(((PsiNamedElement)value).getName());
}
presentation.setIcon(IconDescriptorUpdaters.getIcon(((PsiElement)value), 0));
}
}
});
}
示例6: getPresentation
import consulo.ide.IconDescriptorUpdaters; //导入依赖的package包/类
@Override
public ItemPresentation getPresentation() {
return new ItemPresentation() {
@Override
public String getPresentableText() {
return getName();
}
@Override
public String getLocationString() {
final PsiDirectory psiDirectory = getParent();
if (psiDirectory != null) {
return psiDirectory.getVirtualFile().getPresentableUrl();
}
return null;
}
@Override
public Icon getIcon(final boolean open) {
return IconDescriptorUpdaters.getIcon(PsiFileImpl.this, 0);
}
};
}
示例7: customizeCellRenderer
import consulo.ide.IconDescriptorUpdaters; //导入依赖的package包/类
@Override
protected void customizeCellRenderer(final JList list,
final Object value,
final int index,
final boolean selected,
final boolean hasFocus) {
Usage usage = (Usage)value;
UsagePresentation presentation = usage.getPresentation();
setIcon(presentation.getIcon());
VirtualFile virtualFile = getVirtualFile(usage);
if (virtualFile != null) {
append(virtualFile.getName() + ": ", SimpleTextAttributes.REGULAR_ATTRIBUTES);
setIcon(virtualFile.getFileType().getIcon());
PsiFile psiFile = PsiManager.getInstance(myProject).findFile(virtualFile);
if (psiFile != null) {
setIcon(IconDescriptorUpdaters.getIcon(psiFile, 0));
}
}
TextChunk[] text = presentation.getText();
for (TextChunk textChunk : text) {
SimpleTextAttributes simples = textChunk.getSimpleAttributesIgnoreBackground();
append(textChunk.getText(), simples);
}
}
示例8: updateImpl
import consulo.ide.IconDescriptorUpdaters; //导入依赖的package包/类
@Override
protected void updateImpl(PresentationData data) {
PsiFile value = getValue();
data.setPresentableText(value.getName());
data.setIcon(IconDescriptorUpdaters.getIcon(value, Iconable.ICON_FLAG_READ_STATUS));
VirtualFile file = getVirtualFile();
if (file != null && file.is(VFileProperty.SYMLINK)) {
String target = file.getCanonicalPath();
if (target == null) {
data.setAttributesKey(CodeInsightColors.WRONG_REFERENCES_ATTRIBUTES);
data.setTooltip(CommonBundle.message("vfs.broken.link"));
}
else {
data.setTooltip(FileUtil.toSystemDependentName(target));
}
}
}
示例9: createAddingAction
import consulo.ide.IconDescriptorUpdaters; //导入依赖的package包/类
protected AnAction createAddingAction(final AnActionEvent e,
final String name,
final Icon icon,
final Type type,
final DomCollectionChildDescription description) {
final DomElement parentDomElement = getParentDomElement(e);
if (parentDomElement instanceof MergedObject) {
final List<DomElement> implementations = (List<DomElement>)((MergedObject)parentDomElement).getImplementations();
final DefaultActionGroup actionGroup = new DefaultActionGroup(name, true);
for (DomElement implementation : implementations) {
final XmlFile xmlFile = DomUtil.getFile(implementation);
actionGroup.add(new MyDefaultAddAction(implementation, xmlFile.getName(), IconDescriptorUpdaters.getIcon(xmlFile, 0), e, type, description));
}
return actionGroup;
}
return new MyDefaultAddAction(parentDomElement, name, icon, e, type, description);
}
示例10: getFieldPresentation
import consulo.ide.IconDescriptorUpdaters; //导入依赖的package包/类
public static ItemPresentation getFieldPresentation(final PsiField psiField) {
return new ColoredItemPresentation() {
@Override
public String getPresentableText() {
return psiField.getName();
}
@Override
public TextAttributesKey getTextAttributesKey() {
if (psiField.isDeprecated()) {
return CodeInsightColors.DEPRECATED_ATTRIBUTES;
}
return null;
}
@Override
public String getLocationString() {
return getJavaSymbolContainerText(psiField);
}
@Override
public Icon getIcon(boolean open) {
return IconDescriptorUpdaters.getIcon(psiField, Iconable.ICON_FLAG_VISIBILITY);
}
};
}
示例11: getPresentation
import consulo.ide.IconDescriptorUpdaters; //导入依赖的package包/类
@Override
public ItemPresentation getPresentation(final T variable) {
return new ItemPresentation() {
@Override
public String getPresentableText() {
//return PsiFormatUtil.formatVariable(variable, PsiFormatUtilBase.SHOW_TYPE, PsiSubstitutor.EMPTY);
return variable.getName();
}
@Override
public String getLocationString() {
return "";
}
@Override
public Icon getIcon(boolean open) {
return IconDescriptorUpdaters.getIcon(variable, 0);
}
};
}
示例12: createOverridingLookupElement
import consulo.ide.IconDescriptorUpdaters; //导入依赖的package包/类
private static LookupElementBuilder createOverridingLookupElement(boolean implemented, final PsiMethod baseMethod, PsiClass baseClass, PsiSubstitutor substitutor)
{
RowIcon icon = new RowIcon(IconDescriptorUpdaters.getIcon(baseMethod, 0), implemented ? AllIcons.Gutter.ImplementingMethod : AllIcons.Gutter.OverridingMethod);
return createGenerateMethodElement(baseMethod, substitutor, icon, baseClass.getName(), new InsertHandler<LookupElement>()
{
@Override
public void handleInsert(InsertionContext context, LookupElement item)
{
removeLookupString(context);
final PsiClass parent = PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), context.getStartOffset(), PsiClass.class, false);
if(parent == null)
{
return;
}
List<PsiMethod> prototypes = OverrideImplementUtil.overrideOrImplementMethod(parent, baseMethod, false);
insertGenerationInfos(context, OverrideImplementUtil.convert2GenerationInfos(prototypes));
}
});
}
示例13: forMethod
import consulo.ide.IconDescriptorUpdaters; //导入依赖的package包/类
public static LookupElementBuilder forMethod(@NotNull PsiMethod method,
@NotNull String lookupString, final @NotNull PsiSubstitutor substitutor,
@Nullable PsiClass qualifierClass) {
LookupElementBuilder builder = LookupElementBuilder.create(method, lookupString)
.withIcon(IconDescriptorUpdaters.getIcon(method, Iconable.ICON_FLAG_VISIBILITY))
.withPresentableText(method.getName())
.withTailText(PsiFormatUtil.formatMethod(method, substitutor,
PsiFormatUtilBase.SHOW_PARAMETERS,
PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_TYPE));
final PsiType returnType = method.getReturnType();
if (returnType != null) {
builder = builder.withTypeText(substitutor.substitute(returnType).getPresentableText());
}
builder = setBoldIfInClass(method, qualifierClass, builder);
return builder;
}
示例14: getSingleArrayElementAccess
import consulo.ide.IconDescriptorUpdaters; //导入依赖的package包/类
@Nullable
private static ExpressionLookupItem getSingleArrayElementAccess(PsiElement element, LookupElement item)
{
if(item.getObject() instanceof PsiLocalVariable)
{
final PsiLocalVariable variable = (PsiLocalVariable) item.getObject();
final PsiType type = variable.getType();
final PsiExpression expression = variable.getInitializer();
if(type instanceof PsiArrayType && expression instanceof PsiNewExpression)
{
final PsiNewExpression newExpression = (PsiNewExpression) expression;
final PsiExpression[] dimensions = newExpression.getArrayDimensions();
if(dimensions.length == 1 && "1".equals(dimensions[0].getText()) && newExpression.getArrayInitializer() == null)
{
final String text = variable.getName() + "[0]";
return new ExpressionLookupItem(createExpression(text, element), IconDescriptorUpdaters.getIcon(variable, Iconable.ICON_FLAG_VISIBILITY), text, text);
}
}
}
return null;
}
示例15: addArrayMemberAccessors
import consulo.ide.IconDescriptorUpdaters; //导入依赖的package包/类
private static void addArrayMemberAccessors(final PsiElement element,
final String prefix,
final PsiType itemType,
final PsiElement qualifier,
final Consumer<LookupElement> result,
PsiModifierListOwner object,
final PsiType expectedType) throws IncorrectOperationException
{
if(itemType instanceof PsiArrayType && expectedType.isAssignableFrom(((PsiArrayType) itemType).getComponentType()))
{
final PsiExpression conversion = createExpression(getQualifierText(qualifier) + prefix + "[0]", element);
result.consume(new ExpressionLookupItem(conversion, IconDescriptorUpdaters.getIcon(object, Iconable.ICON_FLAG_VISIBILITY), prefix + "[...]", prefix)
{
@Override
public void handleInsert(InsertionContext context)
{
FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.SECOND_SMART_COMPLETION_ARRAY_MEMBER);
final int tailOffset = context.getTailOffset();
final String callSpace = getSpace(CodeStyleSettingsManager.getSettings(element.getProject()).SPACE_WITHIN_BRACKETS);
context.getDocument().insertString(tailOffset, "[" + callSpace + callSpace + "]");
context.getEditor().getCaretModel().moveToOffset(tailOffset + 1 + callSpace.length());
}
});
}
}