本文整理汇总了Java中com.intellij.ui.CollectionListModel类的典型用法代码示例。如果您正苦于以下问题:Java CollectionListModel类的具体用法?Java CollectionListModel怎么用?Java CollectionListModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CollectionListModel类属于com.intellij.ui包,在下文中一共展示了CollectionListModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onVersionChanged
import com.intellij.ui.CollectionListModel; //导入依赖的package包/类
private void onVersionChanged(final @Nullable List<? extends DownloadableLibraryFileDescription> selectedFiles) {
final FrameworkLibraryVersion version = getSelectedVersion();
if (Comparing.equal(myLastSelectedVersion, version)) return;
if (version != null) {
final List<? extends DownloadableLibraryFileDescription> downloads = version.getFiles();
myFilesList.setModel(new CollectionListModel<JCheckBox>(
ContainerUtil.map2Array(downloads, JCheckBox.class, new Function<DownloadableLibraryFileDescription, JCheckBox>() {
@Override
public JCheckBox fun(DownloadableLibraryFileDescription description) {
final boolean selected = selectedFiles != null ? selectedFiles.contains(description) : !description.isOptional();
return new JCheckBox(description.getPresentableFileName(), selected);
}
})));
if (myNameAndLevelPanel != null) {
myNameAndLevelPanel.setDefaultName(version.getDefaultLibraryName());
}
}
updateSourcesAndJavadocCheckboxes();
myLastSelectedVersion = version;
}
示例2: setTemplates
import com.intellij.ui.CollectionListModel; //导入依赖的package包/类
public void setTemplates(List<ProjectTemplate> list, boolean preserveSelection) {
Collections.sort(list, new Comparator<ProjectTemplate>() {
@Override
public int compare(ProjectTemplate o1, ProjectTemplate o2) {
return Comparing.compare(o1 instanceof ArchivedProjectTemplate, o2 instanceof ArchivedProjectTemplate);
}
});
int index = preserveSelection ? myList.getSelectedIndex() : -1;
//noinspection unchecked
myList.setModel(new CollectionListModel(list));
if (myList.isEnabled()) {
myList.setSelectedIndex(index == -1 ? 0 : index);
}
updateSelection();
}
示例3: show
import com.intellij.ui.CollectionListModel; //导入依赖的package包/类
public void show(Collection<T> schemes) {
if (schemes.isEmpty()) {
Messages.showMessageDialog("There are no available schemes to import", "Import", Messages.getWarningIcon());
return;
}
final JList list = new JBList(new CollectionListModel<T>(schemes));
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setCellRenderer(new SchemesToImportListCellRenderer());
Runnable selectAction = new Runnable() {
@Override
public void run() {
onSchemeSelected((T)list.getSelectedValue());
}
};
showList(list, selectAction);
}
示例4: ImportDependenciesDialog
import com.intellij.ui.CollectionListModel; //导入依赖的package包/类
protected ImportDependenciesDialog(Project project, List<ImportDependenciesTask> tasks) {
super(project, false);
setTitle(AndroidBundle.message("android.import.dependencies.dialog.title"));
myTasks = tasks;
final JCheckBox[] checkBoxes = new JCheckBox[tasks.size()];
for (int i = 0; i < checkBoxes.length; i++) {
final ImportDependenciesTask task = tasks.get(i);
final JCheckBox checkBox = new JCheckBox(task.getTitle());
checkBox.setSelected(true);
checkBoxes[i] = checkBox;
myTask2Checkbox.put(task, checkBox);
}
myCheckBoxList.setModel(new CollectionListModel(checkBoxes));
init();
}
示例5: GenerateDialog
import com.intellij.ui.CollectionListModel; //导入依赖的package包/类
protected GenerateDialog(final PsiClass psiClass) {
super(psiClass.getProject());
setTitle("Select Fields for Parcelable Generation");
fieldsCollection = new CollectionListModel<PsiField>();
final JBList fieldList = new JBList(fieldsCollection);
fieldList.setCellRenderer(new DefaultPsiElementCellRenderer());
final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(fieldList).disableAddAction();
final JPanel panel = decorator.createPanel();
fieldsComponent = LabeledComponent.create(panel, "Fields to include in Parcelable");
includeSubclasses = new JBCheckBox("Include fields from base classes");
setupCheckboxClickAction(psiClass);
showCheckbox = psiClass.getFields().length != psiClass.getAllFields().length;
updateFieldsDisplay(psiClass);
init();
}
示例6: initFactoryParams
import com.intellij.ui.CollectionListModel; //导入依赖的package包/类
private void initFactoryParams() {
Method constructor = originalClass.getConstructor();
java.util.List<ConstructorParameter> list = new ArrayList<>();
if (constructor != null) {
for (Parameter parameter : constructor.getParameters()) {
list.add(new ConstructorParameter(parameter));
}
}
ListModel<ConstructorParameter> model = new CollectionListModel<>(list);
factoryParams.setModel(model);
factoryParams.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
}
开发者ID:jiripudil,项目名称:intellij-nette-factory-generator,代码行数:14,代码来源:GenerateFactoryInterfaceDialog.java
示例7: SettingsForm
import com.intellij.ui.CollectionListModel; //导入依赖的package包/类
/**
* Create new {@link SettingsForm} instance.
*
* @param settings is null if settings dialog runs without a project.
*/
@SuppressWarnings("unchecked")
public SettingsForm(Project project, @Nullable ProtobufSettings settings) {
this.project = project;
List<String> internalIncludePathList = new ArrayList<>();
if (settings != null) {
internalIncludePathList.addAll(settings.getIncludePaths());
}
includePathListList = Collections.unmodifiableList(internalIncludePathList);
includePathModel = new CollectionListModel<>(internalIncludePathList, true);
includePathList.setModel(includePathModel);
addButton.addActionListener(e -> {
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
FileChooser.chooseFile(descriptor, this.project, null, selectedFolder -> {
String path = selectedFolder.getPath();
includePathModel.add(path);
});
});
removeButton.addActionListener(e -> {
int selectedIndex = includePathList.getSelectedIndex();
if (selectedIndex != -1) {
includePathModel.removeRow(selectedIndex);
}
});
if (settings == null) {
addButton.setEnabled(false);
removeButton.setEnabled(false);
}
}
示例8: NonProjectFileWritingAccessDialog
import com.intellij.ui.CollectionListModel; //导入依赖的package包/类
protected NonProjectFileWritingAccessDialog(@NotNull Project project, @NotNull List<VirtualFile> nonProjectFiles) {
super(project);
setTitle("Non-Project Files Access");
myFileList.setCellRenderer(new FileListRenderer());
myFileList.setModel(new CollectionListModel<VirtualFile>(nonProjectFiles));
getOKAction().putValue(DEFAULT_ACTION, null);
getCancelAction().putValue(DEFAULT_ACTION, true);
init();
}
示例9: fillPlugins
import com.intellij.ui.CollectionListModel; //导入依赖的package包/类
public void fillPlugins() {
Collections.sort(myPlugins, new Comparator<IdeaPluginDescriptor>() {
public int compare(final IdeaPluginDescriptor o1, final IdeaPluginDescriptor o2) {
return StringUtil.compare(o1.getName(), o2.getName(), true);
}
});
myPluginsList.setModel(new CollectionListModel(myPlugins));
myPluginsList.setSelectedIndex(0);
}
示例10: ChangelistConflictDialog
import com.intellij.ui.CollectionListModel; //导入依赖的package包/类
public ChangelistConflictDialog(Project project, List<ChangeList> changeLists, List<VirtualFile> conflicts) {
super(project);
myProject = project;
setTitle("Resolve Changelist Conflict");
myFileList.setCellRenderer(new FileListRenderer());
myFileList.setModel(new CollectionListModel(conflicts));
ChangeListManagerImpl manager = ChangeListManagerImpl.getInstanceImpl(myProject);
ChangelistConflictResolution resolution = manager.getConflictTracker().getOptions().LAST_RESOLUTION;
if (changeLists.size() > 1) {
mySwitchToChangelistRadioButton.setEnabled(false);
if (resolution == ChangelistConflictResolution.SWITCH) {
resolution = ChangelistConflictResolution.IGNORE;
}
}
mySwitchToChangelistRadioButton.setText(VcsBundle.message("switch.to.changelist", changeLists.iterator().next().getName()));
myMoveChangesToActiveRadioButton.setText(VcsBundle.message("move.to.changelist", manager.getDefaultChangeList().getName()));
switch (resolution) {
case SHELVE:
myShelveChangesRadioButton.setSelected(true);
break;
case MOVE:
myMoveChangesToActiveRadioButton.setSelected(true);
break;
case SWITCH:
mySwitchToChangelistRadioButton.setSelected(true) ;
break;
case IGNORE:
myIgnoreRadioButton.setSelected(true);
break;
}
init();
}
示例11: GenerateDialog
import com.intellij.ui.CollectionListModel; //导入依赖的package包/类
protected GenerateDialog(PsiClass psiClass) {
super(psiClass.getProject());
setTitle("Select fields for SerializableParcelable generation");
PsiField[] allFields = psiClass.getAllFields();
PsiField[] fields = new PsiField[allFields.length];
int i = 0;
for (PsiField field : allFields) {
// Exclude static fields
if (!field.hasModifierProperty(PsiModifier.STATIC)) {
fields[i++] = field;
}
}
// i is post-incremented, so no need to add 1 for the count
fields = Arrays.copyOfRange(fields, 0, i);
myFields = new CollectionListModel<PsiField>(fields);
JBList fieldList = new JBList(myFields);
fieldList.setCellRenderer(new DefaultPsiElementCellRenderer());
ToolbarDecorator decorator = ToolbarDecorator.createDecorator(fieldList);
decorator.disableAddAction();
JPanel panel = decorator.createPanel();
myComponent = LabeledComponent.create(panel, "Fields to include in Parcelable");
init();
}
示例12: GeneratorDialog
import com.intellij.ui.CollectionListModel; //导入依赖的package包/类
protected GeneratorDialog(PsiClass psiClass, List<PsiPropertyContainer> allProperties) {
super(psiClass.getProject());
setTitle("Configure Step Builder");
this.properties = new JBList(new CollectionListModel<PsiPropertyContainer>(allProperties));
this.properties.setCellRenderer(new PropertyCellRenderer());
this.properties.setSelectedIndices(range(allProperties.size()));
ToolbarDecorator decorator = ToolbarDecorator.createDecorator(properties);
decorator.disableAddAction();
decorator.disableRemoveAction();
JPanel panel = decorator.createPanel();
component = LabeledComponent.create(panel, "Properties to include in Step Builder:");
init();
}
示例13: NonProjectFileWritingAccessDialog
import com.intellij.ui.CollectionListModel; //导入依赖的package包/类
public NonProjectFileWritingAccessDialog(@Nonnull Project project,
@Nonnull List<VirtualFile> nonProjectFiles,
@Nonnull String filesType) {
super(project);
setTitle(filesType + " Protection");
myFileList.setPreferredSize(ReadOnlyStatusDialog.getDialogPreferredSize());
myFileList.setCellRenderer(new FileListRenderer());
myFileList.setModel(new CollectionListModel<>(nonProjectFiles));
String theseFilesMessage = ReadOnlyStatusDialog.getTheseFilesMessage(nonProjectFiles);
myListTitle.setText(StringUtil.capitalize(theseFilesMessage)
+ " " + (nonProjectFiles.size() > 1 ? "do" : "does")
+ " not belong to the project:");
myUnlockOneButton.setSelected(true);
setTextAndMnemonicAndListeners(myUnlockOneButton, "I want to edit " + theseFilesMessage + " anyway", "edit");
int dirs = ContainerUtil.map2Set(nonProjectFiles, VirtualFile::getParent).size();
setTextAndMnemonicAndListeners(myUnlockDirButton, "I want to edit all files in "
+ StringUtil.pluralize("this", dirs)
+ " " + StringUtil.pluralize("directory", dirs), "dir");
setTextAndMnemonicAndListeners(myUnlockAllButton, "I want to edit any non-project file in the current session", "any");
// disable default button to avoid accidental pressing, if user typed something, missed the dialog and pressed 'enter'.
getOKAction().putValue(DEFAULT_ACTION, null);
getCancelAction().putValue(DEFAULT_ACTION, null);
getRootPane().registerKeyboardAction(e -> doOKAction(), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK),
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
getRootPane().registerKeyboardAction(e -> doOKAction(), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.META_DOWN_MASK),
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
init();
}
示例14: createPopupContent
import com.intellij.ui.CollectionListModel; //导入依赖的package包/类
private static JComponent createPopupContent(NavBarPanel panel, Object[] siblings) {
class MyList<E> extends JBList<E> implements DataProvider, Queryable {
@Override
public void putInfo(@Nonnull Map<String, String> info) {
panel.putInfo(info);
}
@Nullable
@Override
public Object getData(Key dataId) {
return panel.getDataImpl(dataId, () -> JBIterable.of(getSelectedValuesList()));
}
}
JBList<Object> list = new MyList<>();
list.setModel(new CollectionListModel<>(siblings));
HintUpdateSupply.installSimpleHintUpdateSupply(list);
List<Disposable> disposables = new ArrayList<>();
list.putClientProperty(DISPOSED_OBJECTS, disposables);
list.installCellRenderer(obj -> {
final NavBarItem navBarItem = new NavBarItem(panel, obj, null);
disposables.add(navBarItem);
return navBarItem;
});
list.setBorder(JBUI.Borders.empty(5));
installMoveAction(list, panel, -1, KeyEvent.VK_LEFT);
installMoveAction(list, panel, 1, KeyEvent.VK_RIGHT);
installEnterAction(list, panel, KeyEvent.VK_ENTER);
installEscapeAction(list, panel, KeyEvent.VK_ESCAPE);
JComponent component = ListWithFilter.wrap(list, new NavBarListWrapper(list), o -> panel.getPresentation().getPresentableText(o));
component.putClientProperty(JBLIST_KEY, list);
return component;
}
示例15: addAll
import com.intellij.ui.CollectionListModel; //导入依赖的package包/类
public void addAll(List elements) {
myData.addAll(elements);
((CollectionListModel)myOriginalModel).add(elements);
}