Java Code Examples for com.intellij.ui.SortedComboBoxModel#addAll()
The following examples show how to use
com.intellij.ui.SortedComboBoxModel#addAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CreatePullRequestModel.java From azure-devops-intellij with MIT License | 6 votes |
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(), 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; }
Example 2
Source File: ConfigFileLocator.java From EclipseCodeFormatter with Apache License 2.0 | 6 votes |
private void processWorkspaceConfig(SortedComboBoxModel profilesModel, JComboBox comboBox, File uiPrefs) throws IOException { Properties properties = FileUtils.readPropertiesFile(uiPrefs); String xml = properties.getProperty("org.eclipse.jdt.ui.formatterprofiles"); List<String> profileNamesFromConfigXML = FileUtils.getProfileNamesFromConfigXML(IOUtils.toInputStream(xml)); if (profileNamesFromConfigXML.isEmpty()) { invalid("Workspace does not contain custom formatter profiles!", profilesModel, comboBox); } else { profilesModel.addAll(profileNamesFromConfigXML); String formatter_profile1 = properties.getProperty("formatter_profile"); String substring = formatter_profile1.substring(1); if (new HashSet<>(profileNamesFromConfigXML).contains(substring)) { profilesModel.setSelectedItem(substring); } } }
Example 3
Source File: CreateBranchModel.java From azure-devops-intellij with MIT License | 5 votes |
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(), remoteBranch -> { // condition: remote must be a vso/tfs remote return tfGitRemotes.contains(remoteBranch.getRemote()); })); sortedRemoteBranches.setSelectedItem(TfGitHelper.getDefaultBranch(sortedRemoteBranches.getItems(), tfGitRemotes)); return sortedRemoteBranches; }
Example 4
Source File: ConfigFileLocator.java From EclipseCodeFormatter with Apache License 2.0 | 5 votes |
private void processXml(SortedComboBoxModel profilesModel, File file, JComboBox comboBox) { try { profilesModel.addAll(FileUtils.getProfileNamesFromConfigXML(file)); if (profilesModel.getSize() == 0) { invalid(ProjectSettingsForm.CONTAINS_NO_PROFILES, profilesModel, comboBox); } } catch (ParsingFailedException e) { invalid(ProjectSettingsForm.PARSING_FAILED, profilesModel, comboBox); } }