本文整理汇总了Java中com.intellij.ui.LayeredIcon类的典型用法代码示例。如果您正苦于以下问题:Java LayeredIcon类的具体用法?Java LayeredIcon怎么用?Java LayeredIcon使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LayeredIcon类属于com.intellij.ui包,在下文中一共展示了LayeredIcon类的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: customizeRenderer
import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
@Override
public void customizeRenderer(ColoredTreeCellRenderer renderer,
JTree tree,
@NotNull Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus) {
renderer.clear();
renderer.setIcon(Bookmark.DEFAULT_ICON);
if (value instanceof Bookmark) {
Bookmark bookmark = (Bookmark)value;
BookmarkItem.setupRenderer(renderer, myProject, bookmark, selected);
if (renderer.getIcon() != null) {
renderer.setIcon(LayeredIcon.createHorizontalIcon(bookmark.getIcon(), renderer.getIcon()));
}
else {
renderer.setIcon(bookmark.getIcon());
}
}
else {
renderer.append(getListName(myProject));
}
}
示例3: patchIcon
import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
protected Icon patchIcon(Icon original, VirtualFile file) {
Icon icon = original;
final Bookmark bookmarkAtFile = BookmarkManager.getInstance(myProject).findFileBookmark(file);
if (bookmarkAtFile != null) {
final RowIcon composite = new RowIcon(2, RowIcon.Alignment.CENTER);
composite.setIcon(icon, 0);
composite.setIcon(bookmarkAtFile.getIcon(), 1);
icon = composite;
}
if (!file.isWritable()) {
icon = LayeredIcon.create(icon, PlatformIcons.LOCKED_ICON);
}
if (file.is(VFileProperty.SYMLINK)) {
icon = LayeredIcon.create(icon, PlatformIcons.SYMLINK_ICON);
}
return icon;
}
示例4: 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));
}
示例5: 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());
}
}
示例6: 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;
}
示例7: 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;
}
}
示例8: patchIcon
import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
protected Icon patchIcon(Icon original, VirtualFile file) {
Icon icon = original;
final Bookmark bookmarkAtFile = BookmarkManager.getInstance(myProject).findFileBookmark(file);
if (bookmarkAtFile != null) {
final RowIcon composite = new RowIcon(2, RowIcon.Alignment.CENTER);
composite.setIcon(icon, 0);
composite.setIcon(bookmarkAtFile.getIcon(), 1);
icon = composite;
}
if (!file.isWritable()) {
icon = LayeredIcon.create(icon, AllIcons.Nodes.Locked);
}
if (file.is(VFileProperty.SYMLINK)) {
icon = LayeredIcon.create(icon, AllIcons.Nodes.Symlink);
}
return icon;
}
示例9: getIcon
import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
@Override
public Icon getIcon() {
return LayeredIcon.create(
PythonUltimateIcons.Django.Django,
AllIcons.Nodes.RunnableMark
);
}
示例10: 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));
}
示例11: patchIcon
import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
public Icon patchIcon(final Icon baseIcon, final VirtualFile file, final int flags, final Project project) {
if (project == null) {
return baseIcon;
}
Icon icon = replaceIcon(file, flags, project, baseIcon);
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
if (fileIndex.isInSource(file) && CompilerManager.getInstance(project).isExcludedFromCompilation(file)) {
return new LayeredIcon(icon, PlatformIcons.EXCLUDED_FROM_COMPILE_ICON);
}
return icon;
}
示例12: 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;
}
示例13: 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;
}
示例14: setIcon
import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
@Override
public final void setIcon(final Icon icon) {
ApplicationManager.getApplication().assertIsDispatchThread();
final Icon oldIcon = getIcon();
if (oldIcon != icon && icon != null && !(icon instanceof LayeredIcon) && (icon.getIconHeight() != JBUI.scale(13) || icon.getIconWidth() != JBUI.scale(13))) {
LOG.warn("ToolWindow icons should be 13x13. Please fix ToolWindow (ID: " + getId() + ") or icon " + icon);
}
//getSelectedContent().setIcon(icon);
myIcon = icon;
myChangeSupport.firePropertyChange(PROP_ICON, oldIcon, icon);
}
示例15: update
import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
protected void update(FileSystemTree fileSystemTree, AnActionEvent e) {
Presentation presentation = e.getPresentation();
final FileType fileType = e.getData(FileChooserKeys.NEW_FILE_TYPE);
if (fileType != null) {
presentation.setVisible(true);
VirtualFile selectedFile = fileSystemTree.getNewFileParent();
presentation.setEnabled(selectedFile != null && selectedFile.isDirectory());
presentation.setIcon(LayeredIcon.create(fileType.getIcon(), AllIcons.Actions.New));
}
else {
presentation.setVisible(false);
}
}