本文整理汇总了Java中com.intellij.ui.ColoredListCellRendererWrapper类的典型用法代码示例。如果您正苦于以下问题:Java ColoredListCellRendererWrapper类的具体用法?Java ColoredListCellRendererWrapper怎么用?Java ColoredListCellRendererWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColoredListCellRendererWrapper类属于com.intellij.ui包,在下文中一共展示了ColoredListCellRendererWrapper类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: LanguageLevelCombo
import com.intellij.ui.ColoredListCellRendererWrapper; //导入依赖的package包/类
public LanguageLevelCombo(String defaultItem) {
myDefaultItem = defaultItem;
for (LanguageLevel level : LanguageLevel.values()) {
addItem(level);
}
setRenderer(new ColoredListCellRendererWrapper() {
@Override
protected void doCustomize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof LanguageLevel) {
append(((LanguageLevel)value).getPresentableText());
}
else if (value instanceof String) { // default for SDK or project
append((String)value);
LanguageLevel defaultLevel = getDefaultLevel();
if (defaultLevel != null) {
append(" (" + defaultLevel.getPresentableText() + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
}
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:LanguageLevelCombo.java
示例2: DotNetCoverageConfigurationEditor
import com.intellij.ui.ColoredListCellRendererWrapper; //导入依赖的package包/类
public DotNetCoverageConfigurationEditor()
{
myPanel.add(myEnabledCheckBox);
myPanel.add(LabeledComponent.left(myRunnersBox, "Runner"));
myRunnersBox.setRenderer(new ColoredListCellRendererWrapper<Object>()
{
@Override
protected void doCustomize(JList list, Object value, int index, boolean selected, boolean hasFocus)
{
if(value == null)
{
append("<none>");
}
else if(value instanceof String)
{
append((String) value, SimpleTextAttributes.ERROR_ATTRIBUTES);
}
else if(value instanceof CoverageRunner)
{
append(((CoverageRunner) value).getPresentableName());
}
}
});
}
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:25,代码来源:DotNetCoverageConfigurationEditor.java
示例3: DotNetLibraryModuleDependencyTabContext
import com.intellij.ui.ColoredListCellRendererWrapper; //导入依赖的package包/类
public DotNetLibraryModuleDependencyTabContext(ClasspathPanel classpathPanel, StructureConfigurableContext context)
{
super(classpathPanel, context);
myLibraryList = new JBList();
myLibraryList.setCellRenderer(new ColoredListCellRendererWrapper<Map.Entry<String, String>>()
{
@Override
protected void doCustomize(JList jList, Map.Entry<String, String> entry, int i, boolean b, boolean b2)
{
append(entry.getKey());
append(" ");
append("(" + entry.getValue() + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
});
}
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:17,代码来源:DotNetLibraryModuleDependencyTabContext.java
示例4: ProjectLibraryTabContext
import com.intellij.ui.ColoredListCellRendererWrapper; //导入依赖的package包/类
public ProjectLibraryTabContext(final ClasspathPanel classpathPanel, StructureConfigurableContext context) {
super(classpathPanel, context);
StructureLibraryTableModifiableModelProvider projectLibrariesProvider = context.getProjectLibrariesProvider();
Library[] libraries = projectLibrariesProvider.getModifiableModel().getLibraries();
final Condition<Library> condition = LibraryEditingUtil.getNotAddedLibrariesCondition(myClasspathPanel.getRootModel());
myItems = ContainerUtil.filter(libraries, condition);
ContainerUtil.sort(myItems, new Comparator<Library>() {
@Override
public int compare(Library o1, Library o2) {
return StringUtil.compare(o1.getName(), o2.getName(), false);
}
});
myLibraryList = new JBList(myItems);
myLibraryList.setCellRenderer(new ColoredListCellRendererWrapper<Library>() {
@Override
protected void doCustomize(JList list, Library value, int index, boolean selected, boolean hasFocus) {
final CellAppearanceEx appearance = OrderEntryAppearanceService.getInstance().forLibrary(classpathPanel.getProject(), value, false);
appearance.customize(this);
}
});
new ListSpeedSearch(myLibraryList);
}
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:ProjectLibraryTabContext.java
示例5: ExternalSystemJdkComboBox
import com.intellij.ui.ColoredListCellRendererWrapper; //导入依赖的package包/类
public ExternalSystemJdkComboBox(@Nullable Project project) {
myProject = project;
setRenderer(new ColoredListCellRendererWrapper() {
@Override
protected void doCustomize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
JdkComboBoxItem item = (JdkComboBoxItem)value;
CompositeAppearance appearance = new CompositeAppearance();
SdkType sdkType = JavaSdk.getInstance();
appearance.setIcon(sdkType.getIcon());
SimpleTextAttributes attributes = getTextAttributes(item.valid, selected);
CompositeAppearance.DequeEnd ending = appearance.getEnding();
ending.addText(item.label, attributes);
if (item.comment != null && !item.comment.equals(item.jdkName)) {
final SimpleTextAttributes textAttributes;
if (!item.valid) {
textAttributes = SimpleTextAttributes.ERROR_ATTRIBUTES;
}
else {
textAttributes = SystemInfo.isMac && selected
? new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, JBColor.WHITE)
: SimpleTextAttributes.GRAY_ATTRIBUTES;
}
ending.addComment(item.comment, textAttributes);
}
final CompositeAppearance compositeAppearance = ending.getAppearance();
compositeAppearance.customize(this);
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:ExternalSystemJdkComboBox.java
示例6: ChangeListChooser
import com.intellij.ui.ColoredListCellRendererWrapper; //导入依赖的package包/类
public ChangeListChooser(List<? extends ChangeList> lists) {
super(new BorderLayout(4, 2));
myChooser = new JComboBox();
myChooser.setRenderer(new ColoredListCellRendererWrapper<LocalChangeList>() {
@Override
protected void doCustomize(JList list, LocalChangeList value, int index, boolean selected, boolean hasFocus) {
if (value != null) {
String name = value.getName().trim();
if (name.length() > MAX_LEN) {
name = name.substring(0, MAX_LEN - 3) + "...";
}
append(name, value.isDefault() ? SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
}
});
myChooser.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
final LocalChangeList changeList = (LocalChangeList)myChooser.getSelectedItem();
setSelectedList(changeList);
myChooser.setToolTipText(changeList == null ? "" : (changeList.getName()));
}
}
});
updateLists(lists);
myChooser.setEditable(false);
add(myChooser, BorderLayout.CENTER);
JLabel label = new JLabel(VcsBundle.message("commit.dialog.changelist.label"));
label.setLabelFor(myChooser);
add(label, BorderLayout.WEST);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:MultipleChangeListBrowser.java
示例7: ChangeListChooser
import com.intellij.ui.ColoredListCellRendererWrapper; //导入依赖的package包/类
public ChangeListChooser() {
super(new BorderLayout(4, 2));
myChooser = new ComboBox();
//noinspection unchecked
myChooser.setRenderer(new ColoredListCellRendererWrapper<LocalChangeList>() {
@Override
protected void doCustomize(JList list, LocalChangeList value, int index, boolean selected, boolean hasFocus) {
if (value != null) {
String name = StringUtil.shortenTextWithEllipsis(value.getName().trim(), MAX_LEN, 0);
append(name, value.isDefault() ? SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
}
});
myChooser.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
final LocalChangeList changeList = (LocalChangeList)myChooser.getSelectedItem();
setSelectedList(changeList);
myChooser.setToolTipText(changeList == null ? "" : (changeList.getName()));
}
}
});
myChooser.setEditable(false);
add(myChooser, BorderLayout.CENTER);
JLabel label = new JLabel(VcsBundle.message("commit.dialog.changelist.label"));
label.setLabelFor(myChooser);
add(label, BorderLayout.WEST);
}
开发者ID:consulo,项目名称:consulo,代码行数:33,代码来源:MultipleChangeListBrowser.java
示例8: LanguagePanel
import com.intellij.ui.ColoredListCellRendererWrapper; //导入依赖的package包/类
public LanguagePanel(Project project, BaseInjection injection) {
super(injection, project);
$$$setupUI$$$();
final String[] languageIDs = InjectedLanguage.getAvailableLanguageIDs();
Arrays.sort(languageIDs);
myLanguage.setModel(new DefaultComboBoxModel(languageIDs));
myLanguage.setRenderer(new ColoredListCellRendererWrapper<String>() {
final Set<String> IDs = new HashSet<String>(Arrays.asList(languageIDs));
@Override
protected void doCustomize(JList list, String s, int index, boolean selected, boolean hasFocus) {
final SimpleTextAttributes attributes =
IDs.contains(s) ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.ERROR_ATTRIBUTES;
append(s, attributes);
final Language language = InjectedLanguage.findLanguageById(s);
if (language != null) {
final FileType fileType = language.getAssociatedFileType();
if (fileType != null) {
setIcon(fileType.getIcon());
append(" ", SimpleTextAttributes.REGULAR_ATTRIBUTES);
append("(" + fileType.getDescription() + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
}
}
});
myLanguage.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
updateHighlighters();
}
}
});
myRoot.addAncestorListener(new AncestorListenerAdapter() {
@Override
public void ancestorAdded(AncestorEvent event) {
updateHighlighters();
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:45,代码来源:LanguagePanel.java
注:本文中的com.intellij.ui.ColoredListCellRendererWrapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论