本文整理汇总了Java中com.intellij.ui.ListCellRendererWrapper类的典型用法代码示例。如果您正苦于以下问题:Java ListCellRendererWrapper类的具体用法?Java ListCellRendererWrapper怎么用?Java ListCellRendererWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListCellRendererWrapper类属于com.intellij.ui包,在下文中一共展示了ListCellRendererWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSelector
import com.intellij.ui.ListCellRendererWrapper; //导入依赖的package包/类
@NotNull
private ComboBox getSelector() {
ArrayList<TemplateForSearch> listTemplateForSearch = FileTemplateHelper.getTemplates(
project,
cbAddInternal.isSelected(),
cbAddJ2EE.isSelected(),
ptWrapper.getPackageTemplate().getFileTemplateSource()
);
ComboBox comboBox = new ComboBox(listTemplateForSearch.toArray());
comboBox.setRenderer(new ListCellRendererWrapper<TemplateForSearch>() {
@Override
public void customize(JList list, TemplateForSearch template, int index, boolean selected, boolean hasFocus) {
if (template != null) {
setIcon(FileTemplateUtil.getIcon(template.getTemplate()));
setText(template.getTemplate().getName());
}
}
});
new ComboboxSpeedSearch(comboBox);
return comboBox;
}
示例2: CreateNewLibraryDialog
import com.intellij.ui.ListCellRendererWrapper; //导入依赖的package包/类
public CreateNewLibraryDialog(@NotNull JComponent parent, @NotNull StructureConfigurableContext context, @NotNull NewLibraryEditor libraryEditor,
@NotNull List<LibraryTable> libraryTables, int selectedTable) {
super(parent, new LibraryRootsComponent(context.getProject(), libraryEditor));
myContext = context;
myLibraryEditor = libraryEditor;
final DefaultComboBoxModel model = new DefaultComboBoxModel();
for (LibraryTable table : libraryTables) {
model.addElement(table);
}
myLibraryLevelCombobox = new ComboBox(model);
myLibraryLevelCombobox.setSelectedIndex(selectedTable);
myLibraryLevelCombobox.setRenderer(new ListCellRendererWrapper() {
@Override
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof LibraryTable) {
setText(((LibraryTable)value).getPresentation().getDisplayName(false));
}
}
});
init();
}
示例3: FrameworkSupportConfigurableBase
import com.intellij.ui.ListCellRendererWrapper; //导入依赖的package包/类
public FrameworkSupportConfigurableBase(FrameworkSupportProviderBase frameworkSupportProvider, FrameworkSupportModel model,
@NotNull List<FrameworkVersion> versions, @Nullable String versionLabelText) {
myFrameworkSupportProvider = frameworkSupportProvider;
myFrameworkSupportModel = model;
myVersions = versions;
myDescriptionLabel.setText(versionLabelText);
myVersionComboBox.setRenderer(new ListCellRendererWrapper() {
@Override
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof FrameworkVersion) {
setText(((FrameworkVersion)value).getVersionName());
}
}
});
updateAvailableVersions(versions);
myVersionComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fireFrameworkVersionChanged();
}
});
}
示例4: TemplateKindCombo
import com.intellij.ui.ListCellRendererWrapper; //导入依赖的package包/类
public TemplateKindCombo() {
//noinspection unchecked
getComboBox().setRenderer(new ListCellRendererWrapper() {
@Override
public void customize(final JList list, final Object value, final int index, final boolean selected, final boolean cellHasFocus) {
if (value instanceof Trinity) {
setText((String)((Trinity)value).first);
setIcon ((Icon)((Trinity)value).second);
}
}
});
new ComboboxSpeedSearch(getComboBox()) {
@Override
protected String getElementText(Object element) {
if (element instanceof Trinity) {
return (String)((Trinity)element).first;
}
return null;
}
}.setComparator(new SpeedSearchComparator(true));
setButtonListener(null);
}
示例5: JsonCodeStylePanel
import com.intellij.ui.ListCellRendererWrapper; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public JsonCodeStylePanel(@NotNull CodeStyleSettings settings) {
super(JsonLanguage.INSTANCE, null, settings);
addPanelToWatch(myPanel);
installPreviewPanel(myPreviewPanel);
// Initialize combo box with property value alignment types
for (PropertyAlignment alignment : PropertyAlignment.values()) {
myPropertiesAlignmentCombo.addItem(alignment);
}
myPropertiesAlignmentCombo.setRenderer(new ListCellRendererWrapper<PropertyAlignment>() {
@Override
public void customize(JList list, PropertyAlignment value, int index, boolean selected, boolean hasFocus) {
setText(value.getDescription());
}
});
myPropertiesAlignmentCombo.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
somethingChanged();
}
}
});
}
示例6: DeveloperServicesPanel
import com.intellij.ui.ListCellRendererWrapper; //导入依赖的package包/类
public DeveloperServicesPanel(@NotNull ComboBoxModel moduleList, @NotNull final ServiceCategory serviceCategory) {
super(new BorderLayout());
ListCellRendererWrapper<Module> renderer = new ListCellRendererWrapper<Module>() {
@Override
public void customize(JList list, Module value, int index, boolean selected, boolean hasFocus) {
setText(value.getName());
}
};
myModuleCombo.setModel(moduleList);
myModuleCombo.setRenderer(renderer);
myServicesPanel.setBorder(new TitledBorder(serviceCategory.getDisplayName()));
updateServicePanels(serviceCategory);
myModuleCombo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
updateServicePanels(serviceCategory);
}
});
add(myRoot);
}
示例7: NewStringKeyDialog
import com.intellij.ui.ListCellRendererWrapper; //导入依赖的package包/类
public NewStringKeyDialog(@NotNull final AndroidFacet facet, @NotNull Set<String> existing) {
super(facet.getModule().getProject(), false);
final VirtualFile baseDir = facet.getModule().getProject().getBaseDir();
myResFolderCombo.setModel(new ListComboBoxModel(facet.getAllResourceDirectories()));
myResFolderCombo.setRenderer(new ListCellRendererWrapper<VirtualFile>() {
@Override
public void customize(JList list, VirtualFile file, int index, boolean selected, boolean hasFocus) {
setText(VfsUtilCore.getRelativePath(file, baseDir, File.separatorChar));
}
});
myResFolderCombo.setSelectedIndex(0);
myResourceNameValidator = ResourceNameValidator.create(false, existing, ResourceType.STRING);
init();
}
示例8: setupAppEngineArtifactCombobox
import com.intellij.ui.ListCellRendererWrapper; //导入依赖的package包/类
public static void setupAppEngineArtifactCombobox(@NotNull Project project, final @NotNull JComboBox comboBox, final boolean withAppEngineFacetOnly) {
comboBox.setRenderer(new ListCellRendererWrapper<Artifact>() {
@Override
public void customize(JList list, Artifact value, int index, boolean selected, boolean hasFocus) {
if (value != null) {
setIcon(value.getArtifactType().getIcon());
setText(value.getName());
}
}
});
comboBox.removeAllItems();
for (Artifact artifact : collectAppEngineArtifacts(project, withAppEngineFacetOnly)) {
comboBox.addItem(artifact);
}
}
示例9: reset
import com.intellij.ui.ListCellRendererWrapper; //导入依赖的package包/类
public void reset() {
final GuiDesignerConfiguration configuration = GuiDesignerConfiguration.getInstance(myProject);
/*general*/
if (configuration.INSTRUMENT_CLASSES) {
myGeneralUI.myRbInstrumentClasses.setSelected(true);
}
else {
myGeneralUI.myRbInstrumentSources.setSelected(true);
}
myGeneralUI.myChkCopyFormsRuntime.setSelected(configuration.COPY_FORMS_RUNTIME_TO_OUTPUT);
myGeneralUI.myLayoutManagerCombo.setModel(new DefaultComboBoxModel(LayoutManagerRegistry.getNonDeprecatedLayoutManagerNames()));
myGeneralUI.myLayoutManagerCombo.setRenderer(new ListCellRendererWrapper<String>() {
@Override
public void customize(JList list, String value, int index, boolean selected, boolean hasFocus) {
setText(LayoutManagerRegistry.getLayoutManagerDisplayName(value));
}
});
myGeneralUI.myLayoutManagerCombo.setSelectedItem(configuration.DEFAULT_LAYOUT_MANAGER);
myGeneralUI.myDefaultFieldAccessibilityCombo.setSelectedItem(configuration.DEFAULT_FIELD_ACCESSIBILITY);
myGeneralUI.myResizeHeaders.setSelected(configuration.RESIZE_HEADERS);
}
示例10: getGitRemoteListCellRenderer
import com.intellij.ui.ListCellRendererWrapper; //导入依赖的package包/类
/**
* Create list cell renderer for remotes. It shows both name and url and highlights the default
* remote for the branch with bold.
*
*
* @param defaultRemote a default remote
* @return a list cell renderer for virtual files (it renders presentable URL
*/
public ListCellRendererWrapper<GitRemote> getGitRemoteListCellRenderer(final String defaultRemote) {
return new ListCellRendererWrapper<GitRemote>() {
@Override
public void customize(final JList list, final GitRemote remote, final int index, final boolean selected, final boolean hasFocus) {
final String text;
if (remote == null) {
text = GitBundle.getString("util.remote.renderer.none");
}
else if (".".equals(remote.getName())) {
text = GitBundle.getString("util.remote.renderer.self");
}
else {
String key;
if (defaultRemote != null && defaultRemote.equals(remote.getName())) {
key = "util.remote.renderer.default";
}
else {
key = "util.remote.renderer.normal";
}
text = GitBundle.message(key, remote.getName(), remote.getFirstUrl());
}
setText(text);
}
};
}
示例11: createUIComponents
import com.intellij.ui.ListCellRendererWrapper; //导入依赖的package包/类
private void createUIComponents() {
myProtectedBranchesButton = new TextFieldWithBrowseButton.NoPathCompletion(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Messages.showTextAreaDialog(myProtectedBranchesButton.getTextField(), "Protected Branches", "Git.Force.Push.Protected.Branches",
ParametersListUtil.COLON_LINE_PARSER, ParametersListUtil.COLON_LINE_JOINER);
}
});
myProtectedBranchesButton.setButtonIcon(AllIcons.Actions.ShowViewer);
myUpdateMethodComboBox = new ComboBox(new EnumComboBoxModel<UpdateMethod>(UpdateMethod.class));
myUpdateMethodComboBox.setRenderer(new ListCellRendererWrapper<UpdateMethod>() {
@Override
public void customize(JList list, UpdateMethod value, int index, boolean selected, boolean hasFocus) {
setText(StringUtil.capitalize(StringUtil.toLowerCase(value.name().replace('_', ' '))));
}
});
}
示例12: createOptionsPanel
import com.intellij.ui.ListCellRendererWrapper; //导入依赖的package包/类
@Override
public JComponent createOptionsPanel() {
final JFormattedTextField valueField = prepareNumberEditor("m_limit");
final JComboBox comboBox = new ComboBox(new Object[] {Scope.NONE, Scope.PRIVATE, Scope.PACKAGE_LOCAL, Scope.PROTECTED});
comboBox.setRenderer(new ListCellRendererWrapper() {
@Override
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof Scope) setText(((Scope)value).getText());
}
});
comboBox.setSelectedItem(ignoreScope);
comboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ignoreScope = (Scope)comboBox.getSelectedItem();
}
});
comboBox.setPrototypeDisplayValue(Scope.PROTECTED);
final FormBuilder formBuilder = FormBuilder.createFormBuilder();
formBuilder.addLabeledComponent(getConfigurationLabel(), valueField);
formBuilder.addLabeledComponent(InspectionGadgetsBundle.message("constructor.visibility.option"), comboBox);
final JPanel panel = new JPanel(new BorderLayout());
panel.add(formBuilder.getPanel(), BorderLayout.NORTH);
return panel;
}
示例13: BlazeIntellijPluginConfigurationSettingsEditor
import com.intellij.ui.ListCellRendererWrapper; //导入依赖的package包/类
public BlazeIntellijPluginConfigurationSettingsEditor(
Iterable<Label> javaLabels,
RunConfigurationStateEditor blazeFlagsEditor,
RunConfigurationStateEditor exeFlagsEditor) {
targetCombo =
new ComboBox<>(
new DefaultComboBoxModel<>(
Ordering.usingToString().sortedCopy(javaLabels).toArray(new Label[0])));
targetCombo.setRenderer(
new ListCellRendererWrapper<Label>() {
@Override
public void customize(
JList list, @Nullable Label value, int index, boolean selected, boolean hasFocus) {
setText(value == null ? null : value.toString());
}
});
this.blazeFlagsEditor = blazeFlagsEditor;
this.exeFlagsEditor = exeFlagsEditor;
ProjectSdksModel sdksModel = new ProjectSdksModel();
sdksModel.reset(null);
sdkCombo = new JdkComboBox(sdksModel, IdeaJdkHelper::isIdeaJdkType);
keepInSyncCheckBox = new JBCheckBox("Keep in sync with source XML");
keepInSyncCheckBox.addItemListener(e -> updateEnabledStatus());
}
示例14: initDeploymentSources
import com.intellij.ui.ListCellRendererWrapper; //导入依赖的package包/类
/**
* Initializes the 'artifact to deploy' combobox with the eligible artifact deployment sources.
*/
private void initDeploymentSources() {
myArtifactComboBox.setRenderer(
new ListCellRendererWrapper<Artifact>() {
@Override
public void customize(
JList list, Artifact value, int index, boolean selected, boolean hasFocus) {
if (value != null) {
setIcon(value.getArtifactType().getIcon());
setText(value.getName());
}
}
});
List<AppEngineArtifactDeploymentSource> deploymentSources = Lists.newArrayList();
deploymentSources.addAll(AppEngineUtil.createArtifactDeploymentSources(myProject));
deploymentSources
.stream()
.map(ArtifactDeploymentSourceImpl::getArtifact)
.forEach(myArtifactComboBox::addItem);
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:25,代码来源:AppEngineRunConfigurationEditor.java
示例15: createUIComponents
import com.intellij.ui.ListCellRendererWrapper; //导入依赖的package包/类
private void createUIComponents() {
moduleComboBox = new DefracModuleComboBox(project);
mainClassTextField = new DefracMainClassTextFieldWithBrowseButton(project, moduleComboBox.moduleSelector);
emulatorComboBox = new AvdComboBox(project, true, false) {
@Nullable
@Override
public Module getModule() {
return moduleComboBox.moduleSelector.getModule();
}
};
emulatorComboBox.getComboBox().setRenderer(new ListCellRendererWrapper() {
@Override
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if(value instanceof IdDisplay) {
setText(((IdDisplay) value).getDisplay());
}
}
});
}