本文整理汇总了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);
}
}
}
});
}
示例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());
}
}
});
}
示例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);
}
});
}
示例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);
}
示例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);
}
});
}
示例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);
}
示例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);
}
示例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();
}
});
}