本文整理汇总了Java中com.intellij.ui.LayeredIcon.setIcon方法的典型用法代码示例。如果您正苦于以下问题:Java LayeredIcon.setIcon方法的具体用法?Java LayeredIcon.setIcon怎么用?Java LayeredIcon.setIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.LayeredIcon
的用法示例。
在下文中一共展示了LayeredIcon.setIcon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: customize
import com.intellij.ui.LayeredIcon; //导入方法依赖的package包/类
@Override
public void customize(JList list, FileType type, int index, boolean selected, boolean hasFocus) {
LayeredIcon layeredIcon = new LayeredIcon(2);
layeredIcon.setIcon(EMPTY_ICON, 0);
final Icon icon = type.getIcon();
if (icon != null) {
layeredIcon.setIcon(icon, 1, (- icon.getIconWidth() + EMPTY_ICON.getIconWidth())/2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight())/2);
}
setIcon(layeredIcon);
String description = type.getDescription();
String trimmedDescription = StringUtil.capitalizeWords(description.replaceAll("(?i)\\s*file(?:s)?$", ""), true);
if (isDuplicated(description)) {
setText(trimmedDescription + " (" + type.getName() + ")");
}
else {
setText(trimmedDescription);
}
}
示例2: createParametersLookupElement
import com.intellij.ui.LayeredIcon; //导入方法依赖的package包/类
private static LookupElement createParametersLookupElement(PsiMethod takeParametersFrom, PsiElement call, PsiMethod invoked) {
PsiParameter[] parameters = takeParametersFrom.getParameterList().getParameters();
final String lookupString = StringUtil.join(parameters, new Function<PsiParameter, String>() {
@Override
public String fun(PsiParameter psiParameter) {
return psiParameter.getName();
}
}, ", ");
final int w = PlatformIcons.PARAMETER_ICON.getIconWidth();
LayeredIcon icon = new LayeredIcon(2);
icon.setIcon(PlatformIcons.PARAMETER_ICON, 0, 2*w/5, 0);
icon.setIcon(PlatformIcons.PARAMETER_ICON, 1);
final LookupElement element = LookupElementBuilder.create(lookupString).withIcon(icon);
element.putUserData(JavaCompletionUtil.SUPER_METHOD_PARAMETERS, Boolean.TRUE);
return TailTypeDecorator.withTail(element, ExpectedTypesProvider.getFinalCallParameterTailType(call, invoked.getReturnType(), invoked));
}
示例3: customize
import com.intellij.ui.LayeredIcon; //导入方法依赖的package包/类
@Override
public void customize(JList list, FileType type, int index, boolean selected, boolean hasFocus) {
LayeredIcon layeredIcon = new LayeredIcon(2);
layeredIcon.setIcon(EMPTY_ICON, 0);
final Icon icon = type.getIcon();
if (icon != null) {
layeredIcon.setIcon(icon, 1, (- icon.getIconWidth() + EMPTY_ICON.getIconWidth())/2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight())/2);
}
setIcon(layeredIcon);
if (isDuplicated(type.getDescription())) {
setText(type.getDescription() + " (" + type.getName() + ")");
}
else {
setText(type.getDescription());
}
}
示例4: createActionLabel
import com.intellij.ui.LayeredIcon; //导入方法依赖的package包/类
protected JLabel createActionLabel(final AnAction anAction, final String anActionName,
final Color fg, final Color bg,
final Icon icon) {
final LayeredIcon layeredIcon = new LayeredIcon(2);
layeredIcon.setIcon(EMPTY_ICON, 0);
if (icon != null && icon.getIconWidth() <= EMPTY_ICON.getIconWidth() && icon.getIconHeight() <= EMPTY_ICON.getIconHeight()) {
layeredIcon
.setIcon(icon, 1, (-icon.getIconWidth() + EMPTY_ICON.getIconWidth()) / 2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight()) / 2);
}
final Shortcut[] shortcutSet = KeymapManager.getInstance().getActiveKeymap().getShortcuts(getActionId(anAction));
final String actionName = anActionName + (shortcutSet != null && shortcutSet.length > 0
? " (" + KeymapUtil.getShortcutText(shortcutSet[0]) + ")"
: "");
final JLabel actionLabel = new JLabel(actionName, layeredIcon, SwingConstants.LEFT);
actionLabel.setBackground(bg);
actionLabel.setForeground(fg);
return actionLabel;
}
示例5: toIcon
import com.intellij.ui.LayeredIcon; //导入方法依赖的package包/类
@Nonnull
public Icon toIcon() {
Icon mainIcon = null;
if(myLayerIcons == null) {
mainIcon = myMainIcon;
}
else {
LayeredIcon layeredIcon = new LayeredIcon(myLayerIcons.size() + 1);
layeredIcon.setIcon(myMainIcon, 0);
for (int i = 0; i < myLayerIcons.size(); i++) {
Icon icon = myLayerIcons.get(i);
layeredIcon.setIcon(icon, i + 1);
}
mainIcon = layeredIcon;
}
if(myRightIcon == null) {
return mainIcon == null ? EmptyIcon.ICON_16 : mainIcon;
}
else {
RowIcon baseIcon = new RowIcon(2);
baseIcon.setIcon(mainIcon, 0);
baseIcon.setIcon(myRightIcon, 1);
return baseIcon;
}
}
示例6: createParametersLookupElement
import com.intellij.ui.LayeredIcon; //导入方法依赖的package包/类
private static LookupElement createParametersLookupElement(final PsiMethod takeParametersFrom, PsiElement call, PsiMethod invoked) {
final PsiParameter[] parameters = takeParametersFrom.getParameterList().getParameters();
final String lookupString = StringUtil.join(parameters, new Function<PsiParameter, String>() {
@Override
public String fun(PsiParameter psiParameter) {
return psiParameter.getName();
}
}, ", ");
final int w = PlatformIcons.PARAMETER_ICON.getIconWidth();
LayeredIcon icon = new LayeredIcon(2);
icon.setIcon(PlatformIcons.PARAMETER_ICON, 0, 2*w/5, 0);
icon.setIcon(PlatformIcons.PARAMETER_ICON, 1);
LookupElementBuilder element = LookupElementBuilder.create(lookupString).withIcon(icon);
if (PsiTreeUtil.isAncestor(takeParametersFrom, call, true)) {
element = element.withInsertHandler(new InsertHandler<LookupElement>() {
@Override
public void handleInsert(InsertionContext context, LookupElement item) {
context.commitDocument();
for (PsiParameter parameter : CompletionUtil.getOriginalOrSelf(takeParametersFrom).getParameterList().getParameters()) {
VariableLookupItem.makeFinalIfNeeded(context, parameter);
}
}
});
}
element.putUserData(JavaCompletionUtil.SUPER_METHOD_PARAMETERS, Boolean.TRUE);
return TailTypeDecorator.withTail(element, ExpectedTypesProvider.getFinalCallParameterTailType(call, invoked.getReturnType(), invoked));
}
示例7: getServerNodeIcon
import com.intellij.ui.LayeredIcon; //导入方法依赖的package包/类
public static Icon getServerNodeIcon(@NotNull Icon itemIcon, @Nullable Icon statusIcon) {
if (statusIcon == null) {
return itemIcon;
}
LayeredIcon icon = new LayeredIcon(2);
icon.setIcon(itemIcon, 0);
icon.setIcon(statusIcon, 1, itemIcon.getIconWidth() - statusIcon.getIconWidth(), itemIcon.getIconHeight() - statusIcon.getIconHeight());
return icon;
}
示例8: createLayeredIcon
import com.intellij.ui.LayeredIcon; //导入方法依赖的package包/类
public static RowIcon createLayeredIcon(Iconable instance, Icon icon, int flags) {
List<Icon> layersFromProviders = new SmartList<Icon>();
for (IconLayerProvider provider : Extensions.getExtensions(IconLayerProvider.EP_NAME)) {
final Icon layerIcon = provider.getLayerIcon(instance, (flags & FLAGS_LOCKED) != 0);
if (layerIcon != null) {
layersFromProviders.add(layerIcon);
}
}
if (flags != 0 || !layersFromProviders.isEmpty()) {
List<Icon> iconLayers = new SmartList<Icon>();
for(IconLayer l: ourIconLayers) {
if ((flags & l.flagMask) != 0) {
iconLayers.add(l.icon);
}
}
iconLayers.addAll(layersFromProviders);
LayeredIcon layeredIcon = new LayeredIcon(1 + iconLayers.size());
layeredIcon.setIcon(icon, 0);
for (int i = 0; i < iconLayers.size(); i++) {
Icon icon1 = iconLayers.get(i);
layeredIcon.setIcon(icon1, i+1);
}
icon = layeredIcon;
}
RowIcon baseIcon = new RowIcon(2);
baseIcon.setIcon(icon, 0);
return baseIcon;
}
示例9: createIconWithNotificationCount
import com.intellij.ui.LayeredIcon; //导入方法依赖的package包/类
private LayeredIcon createIconWithNotificationCount(ArrayList<Notification> notifications) {
LayeredIcon icon = new LayeredIcon(2);
Icon statusIcon = getPendingNotificationsIcon(AllIcons.Ide.Notifications, getMaximumType(notifications));
icon.setIcon(statusIcon, 0);
if (notifications.size() > 0) {
icon.setIcon(new TextIcon(this, String.valueOf(notifications.size())), 1, statusIcon.getIconWidth() - 2, 0);
}
return icon;
}
示例10: updateTemplateIcon
import com.intellij.ui.LayeredIcon; //导入方法依赖的package包/类
private void updateTemplateIcon(@Nullable EditorSearchSession session) {
if (session == null || getTemplatePresentation().getIcon() != null) return;
Icon base = AllIcons.Actions.Find;
Icon text = IconUtil.textToIcon("ALL", session.getComponent(), JBUI.scale(6F));
LayeredIcon icon = new LayeredIcon(2);
icon.setIcon(base, 0);
icon.setIcon(text, 1, 0, base.getIconHeight() - text.getIconHeight());
getTemplatePresentation().setIcon(icon);
}
示例11: wrapIconWithWarningDecorator
import com.intellij.ui.LayeredIcon; //导入方法依赖的package包/类
private static LayeredIcon wrapIconWithWarningDecorator(Icon icon) {
final LayeredIcon layered = new LayeredIcon(2);
layered.setIcon(icon, 0);
final Icon overlay = AllIcons.Actions.Cancel;
layered.setIcon(overlay, 1);
return layered;
}
示例12: getElementIcon
import com.intellij.ui.LayeredIcon; //导入方法依赖的package包/类
@Nullable
@Override
protected Icon getElementIcon(@IconFlags int flags) {
Icon superIcon = JetgroovyIcons.Groovy.Field;
if (!isProperty()) return superIcon;
LayeredIcon rowIcon = new LayeredIcon(2);
rowIcon.setIcon(superIcon, 0);
rowIcon.setIcon(JetgroovyIcons.Groovy.Def, 1);
return rowIcon;
}
示例13: getIcon
import com.intellij.ui.LayeredIcon; //导入方法依赖的package包/类
@Nullable
public Icon getIcon(int flags) {
Icon superIcon = JetgroovyIcons.Groovy.Field;
if (!isProperty()) return superIcon;
LayeredIcon rowIcon = new LayeredIcon(2);
rowIcon.setIcon(superIcon, 0);
rowIcon.setIcon(JetgroovyIcons.Groovy.Def, 1);
return rowIcon;
}
示例14: getServerNodeIcon
import com.intellij.ui.LayeredIcon; //导入方法依赖的package包/类
public static Icon getServerNodeIcon(@Nonnull Icon itemIcon, @javax.annotation.Nullable Icon statusIcon) {
if (statusIcon == null) {
return itemIcon;
}
LayeredIcon icon = new LayeredIcon(2);
icon.setIcon(itemIcon, 0);
icon.setIcon(statusIcon, 1, itemIcon.getIconWidth() - statusIcon.getIconWidth(), itemIcon.getIconHeight() - statusIcon.getIconHeight());
return icon;
}
示例15: createIconWithNotificationCount
import com.intellij.ui.LayeredIcon; //导入方法依赖的package包/类
@Nonnull
public static LayeredIcon createIconWithNotificationCount(JComponent component, NotificationType type, int size) {
LayeredIcon icon = new LayeredIcon(2);
icon.setIcon(getPendingNotificationsIcon(AllIcons.Ide.Notification.NoEvents, type), 0);
if (size > 0) {
//noinspection UseJBColor
Color textColor = type == NotificationType.ERROR ? new JBColor(Color.white, new Color(0xF2F2F2)) : new Color(0x333333);
icon.setIcon(new TextIcon(component, size < 10 ? String.valueOf(size) : "9+", textColor), 1);
}
return icon;
}