/** * @deprecated use {@link #ConfigurationModuleSelector(Project, ModulesComboBox, String)} instead */ public ConfigurationModuleSelector(final Project project, final JComboBox modulesList, final String noModule) { myProject = project; myModulesList = modulesList; new ComboboxSpeedSearch(modulesList){ protected String getElementText(Object element) { if (element instanceof Module){ return ((Module)element).getName(); } else if (element == null) { return noModule; } return super.getElementText(element); } }; myModulesList.setModel(new SortedComboBoxModel<Module>(ModulesAlphaComparator.INSTANCE)); myModulesList.setRenderer(new ModuleListCellRenderer(noModule)); }
private ModulesComboBox(final SortedComboBoxModel<Module> model) { super(model); myModel = model; new ComboboxSpeedSearch(this){ @Override protected String getElementText(Object element) { if (element instanceof Module) { return ((Module)element).getName(); } else if (element == null) { return ""; } return super.getElementText(element); } }; setRenderer(new ModuleListCellRenderer()); }
private ComboBoxModel createRemoteBranchDropdownModel() { final SortedComboBoxModel<GitRemoteBranch> sortedRemoteBranches = new SortedComboBoxModel<GitRemoteBranch>(new TfGitHelper.BranchComparator()); final GitRemoteBranch remoteTrackingBranch = this.getRemoteTrackingBranch(); // only show valid remote branches sortedRemoteBranches.addAll(Collections2.filter(getInfo().getRemoteBranches(), new Predicate<GitRemoteBranch>() { @Override public boolean apply(final GitRemoteBranch remoteBranch) { /* two conditions: * 1. remote must be a vso/tfs remote * 2. this isn't the remote tracking branch of current local branch */ return tfGitRemotes.contains(remoteBranch.getRemote()) && !remoteBranch.equals(remoteTrackingBranch); } }) ); sortedRemoteBranches.setSelectedItem(TfGitHelper.getDefaultBranch(sortedRemoteBranches.getItems(), tfGitRemotes)); return sortedRemoteBranches; }
private SortedComboBoxModel<GitRemoteBranch> createRemoteBranchDropdownModel() { logger.info("CreateBranchModel.createRemoteBranchDropdownModel"); final SortedComboBoxModel<GitRemoteBranch> sortedRemoteBranches = new SortedComboBoxModel<GitRemoteBranch>(new TfGitHelper.BranchComparator()); // TODO: add option to retrieve more branches in case the branch they are looking for is missing local // only show valid remote branches sortedRemoteBranches.addAll(Collections2.filter(gitRepository.getInfo().getRemoteBranches(), new Predicate<GitRemoteBranch>() { @Override public boolean apply(final GitRemoteBranch remoteBranch) { // condition: remote must be a vso/tfs remote return tfGitRemotes.contains(remoteBranch.getRemote()); } }) ); sortedRemoteBranches.setSelectedItem(TfGitHelper.getDefaultBranch(sortedRemoteBranches.getItems(), tfGitRemotes)); return sortedRemoteBranches; }
public ConfigurationModuleSelector(final Project project, final JComboBox<Module> modulesList, final String noModule) { myProject = project; myModulesList = modulesList; new ComboboxSpeedSearch(modulesList) { protected String getElementText(Object element) { if (element instanceof Module) { return ((Module) element).getName(); } else if (element == null) { return noModule; } return super.getElementText(element); } }; myModulesList.setModel(new SortedComboBoxModel<>(ModulesAlphaComparator.INSTANCE)); myModulesList.setRenderer(new ModuleListCellRenderer(noModule)); }
private SortedComboBoxModel createProfilesModel() { // noinspection unchecked SortedComboBoxModel settingsSortedComboBoxModel = new SortedComboBoxModel(new Comparator<Settings>() { @Override public int compare(Settings o1, Settings o2) { if (o1.isProjectSpecific()) { return -1; } if (o2.isProjectSpecific()) { return 1; } return o1.getName().compareTo(o2.getName()); } }); refreshProfilesModel(settingsSortedComboBoxModel); return settingsSortedComboBoxModel; }
public ModuleDescriptionsComboBox() { myModel = new SortedComboBoxModel<>(Comparator.comparing(description -> description != null ? description.getName() : "", String.CASE_INSENSITIVE_ORDER)); setModel(myModel); new ComboboxSpeedSearch(this){ @Override protected String getElementText(Object element) { if (element instanceof ModuleDescription) { return ((ModuleDescription)element).getName(); } else { return ""; } } }; setRenderer(new ModuleDescriptionListCellRenderer()); }
/** * @deprecated use {@link #ConfigurationModuleSelector(Project, ModulesComboBox, String)} instead */ public ConfigurationModuleSelector(final Project project, final JComboBox<Module> modulesList, final String noModule) { myProject = project; myModulesList = modulesList; myModulesDescriptionsComboBox = null; new ComboboxSpeedSearch(modulesList) { protected String getElementText(Object element) { if(element instanceof Module) { return ((Module) element).getName(); } else if(element == null) { return noModule; } return super.getElementText(element); } }; myModulesList.setModel(new SortedComboBoxModel<>(ModulesAlphaComparator.INSTANCE)); myModulesList.setRenderer(new ModuleListCellRenderer(noModule)); }
private void setModules(final Collection<Module> modules) { if(myModulesDescriptionsComboBox != null) { myModulesDescriptionsComboBox.setModules(modules); } else if(myModulesList instanceof ModulesComboBox) { ((ModulesComboBox) myModulesList).setModules(modules); } else { SortedComboBoxModel<Module> model = (SortedComboBoxModel<Module>) myModulesList.getModel(); model.setAll(modules); model.add(null); } }
private void setModules(final Collection<Module> modules) { if (myModulesList instanceof ModulesComboBox) { ((ModulesComboBox)myModulesList).setModules(modules); } else { SortedComboBoxModel<Module> model = (SortedComboBoxModel<Module>)myModulesList.getModel(); model.setAll(modules); model.add(null); } }
public GithubCreatePullRequestPanel() { myDescriptionTextArea.setBorder(BorderFactory.createEtchedBorder()); myBranchModel = new SortedComboBoxModel<BranchInfo>(new Comparator<BranchInfo>() { @Override public int compare(BranchInfo o1, BranchInfo o2) { return StringUtil.naturalCompare(o1.getRemoteName(), o2.getRemoteName()); } }); myBranchComboBox.setModel(myBranchModel); myForkModel = new SortedComboBoxModel<ForkInfo>(new Comparator<ForkInfo>() { @Override public int compare(ForkInfo o1, ForkInfo o2) { return StringUtil.naturalCompare(o1.getPath().getUser(), o2.getPath().getUser()); } }); myForkComboBox.setModel(myForkModel); DocumentListener userModifiedDocumentListener = new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { myTitleDescriptionUserModified = true; } }; myTitleTextField.getDocument().addDocumentListener(userModifiedDocumentListener); myDescriptionTextArea.getDocument().addDocumentListener(userModifiedDocumentListener); }
public GithubSelectForkPanel() { myModel = new SortedComboBoxModel<String>(new Comparator<String>() { @Override public int compare(String o1, String o2) { return StringUtil.naturalCompare(o1, o2); } }); myComboBox.setModel(myModel); }
public ChooseAndEditComboBoxController(ComboboxWithBrowseButton combobox, Convertor<Item, Ref> toRef, Comparator<Ref> comparator) { myCombobox = combobox; myToString = toRef; myCombobox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { resetList(openConfigureDialog(myItems.get(getSelectedString()), getCombobox())); } }); getCombobox().setModel(new SortedComboBoxModel<Ref>(comparator)); }
public void resetList(Item selection) { Ref selectedItem = getSelectedString(); myItems.clear(); myItems.putAll(ContainerUtil.newMapFromValues(getAllListItems(), myToString)); SortedComboBoxModel<Ref> model = getModel(); model.setAll(myItems.keySet()); if (selection != null) model.setSelectedItem(myToString.convert(selection)); else model.setSelectedItem(selectedItem); }
private ModulesCombobox(final SortedComboBoxModel<Module> model) { super(model); myModel = model; new ComboboxSpeedSearch(this){ @Override protected String getElementText(Object element) { if (element instanceof Module) { return ((Module)element).getName(); } else if (element == null) { return ""; } return super.getElementText(element); } }; setRenderer(new ListCellRendererWrapper<Module>() { @Override public void customize(JList list, Module value, int index, boolean selected, boolean hasFocus) { if (value != null) { setText(value.getName()); setIcon(ModuleType.get(value).getIcon()); } else { setText("[none]"); } } }); }
static SortedComboBoxModel<String> comboBoxModel() { return new SortedComboBoxModel<String>(new Comparator<String>() { @Override public int compare(String o1, String o2) { return o1.compareToIgnoreCase(o2); } }); }
private SortedComboBoxModel<XQueryFlavour> comboBoxModel() { return new SortedComboBoxModel<>(new Comparator<XQueryFlavour>() { @Override public int compare(XQueryFlavour o1, XQueryFlavour o2) { return o1.getPresentableName().compareToIgnoreCase(o2.getPresentableName()); } }); }
private void setModules(final Collection<Module> modules) { if (myModulesList instanceof ModulesComboBox) { ((ModulesComboBox) myModulesList).setModules(modules); } else { SortedComboBoxModel<Module> model = (SortedComboBoxModel<Module>) myModulesList.getModel(); model.setAll(modules); model.add(null); } }
private ComboBoxModel createProfilesModel(JTextField pathToEclipsePreferenceFile, String selectedProfile) { @SuppressWarnings("unchecked") SortedComboBoxModel profilesModel = new SortedComboBoxModel(new Comparator<String>() { @Override public int compare(String o1, String o2) { return o1.compareTo(o2); } }); String text = pathToEclipsePreferenceFile.getText(); if (!text.isEmpty()) { if (text.endsWith("xml")) { try { profilesModel.addAll(FileUtils.getProfileNamesFromConfigXML(new File(text))); } catch (ParsingFailedException e) { profilesModel.add(PARSING_FAILED); } } else { // not xml } } else { // empty } List<String> items = profilesModel.getItems(); if (items.size() > 0) { for (String item : items) { if (item.equals(selectedProfile)) { profilesModel.setSelectedItem(item); } } if (profilesModel.getSelectedItem() == null) { profilesModel.setSelectedItem(items.get(0)); } } return profilesModel; }
public LocalToServerSettingsEditor(final ServerType<S> type, DeploymentConfigurator<D> deploymentConfigurator, Project project) { myServerType = type; myDeploymentConfigurator = deploymentConfigurator; myProject = project; mySourceListModel = new SortedComboBoxModel<DeploymentSource>(new Comparator<DeploymentSource>() { @Override public int compare(DeploymentSource o1, DeploymentSource o2) { return o1.getPresentableName().compareToIgnoreCase(o2.getPresentableName()); } }); mySourceListModel.addAll(deploymentConfigurator.getAvailableDeploymentSources()); mySourceComboBox = new ComboBox(mySourceListModel); mySourceComboBox.setRenderer(new ListCellRendererWrapper<DeploymentSource>() { @Override public void customize(JList list, DeploymentSource value, int index, boolean selected, boolean hasFocus) { if (value == null) return; setIcon(value.getIcon()); setText(value.getPresentableName()); } }); myDeploymentSettingsComponent = new JPanel(new BorderLayout()); mySourceComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { onDeploymentSourceChanged(null); } }); }
public JreComboboxEditor(SortedComboBoxModel<JrePathEditor.JreComboBoxItem> comboBoxModel) { myComboBoxModel = comboBoxModel; }
public ModulesComboBox() { this(new SortedComboBoxModel<Module>(ModulesAlphaComparator.INSTANCE)); }
private SortedComboBoxModel<Ref> getModel() { return ((SortedComboBoxModel<Ref>)getCombobox().getModel()); }
public ModulesCombobox() { this(new SortedComboBoxModel<Module>(ModulesAlphaComparator.INSTANCE)); }
private void populateExtensionsList(SortedComboBoxModel<String> model, Object defaultItem, List<String> allItems) { for (String type : allItems) { model.add(type); } model.setSelectedItem(defaultItem); }
private void refreshProfilesModel(SortedComboBoxModel profilesModel) { profilesModel.setAll(GlobalSettings.getInstance().getSettingsList()); Settings projectSpecificProfile = ProjectSettings.getInstance(project).getState().getProjectSpecificProfile(); profilesModel.add(projectSpecificProfile); }
public ModulesComboBox() { this(new SortedComboBoxModel<>(ModulesAlphaComparator.INSTANCE)); }