List of usage examples for org.eclipse.jgit.lib StoredConfig getNames
public Set<String> getNames(String section)
From source file:org.eclipse.egit.ui.internal.repository.RepositoryPropertySource.java
License:Open Source License
public IPropertyDescriptor[] getPropertyDescriptors() { try {// w ww . j av a2s . c o m userHomeConfig.load(); repositoryConfig.load(); effectiveConfig.load(); } catch (IOException e) { showExceptionMessage(e); } catch (ConfigInvalidException e) { showExceptionMessage(e); } List<IPropertyDescriptor> resultList = new ArrayList<IPropertyDescriptor>(); StoredConfig config; String category; String prefix; switch (getCurrentMode()) { case EFFECTIVE: prefix = EFFECTIVE_ID_PREFIX; category = UIText.RepositoryPropertySource_EffectiveConfigurationCategory; config = effectiveConfig; break; case REPO: { prefix = REPO_ID_PREFIX; String location = ""; //$NON-NLS-1$ if (repositoryConfig instanceof FileBasedConfig) { location = ((FileBasedConfig) repositoryConfig).getFile().getAbsolutePath(); } category = NLS.bind(UIText.RepositoryPropertySource_RepositoryConfigurationCategory, location); config = repositoryConfig; break; } case USER: { prefix = USER_ID_PREFIX; String location = userHomeConfig.getFile().getAbsolutePath(); category = NLS.bind(UIText.RepositoryPropertySource_GlobalConfigurationCategory, location); config = userHomeConfig; break; } default: return new IPropertyDescriptor[0]; } for (String key : config.getSections()) { for (String sectionItem : config.getNames(key)) { String sectionId = key + "." + sectionItem; //$NON-NLS-1$ PropertyDescriptor desc = new PropertyDescriptor(prefix + sectionId, sectionId); desc.setCategory(category); resultList.add(desc); } for (String sub : config.getSubsections(key)) { for (String sectionItem : config.getNames(key, sub)) { String sectionId = key + "." + sub + "." + sectionItem; //$NON-NLS-1$ //$NON-NLS-2$ PropertyDescriptor desc = new PropertyDescriptor(prefix + sectionId, sectionId); desc.setCategory(category); resultList.add(desc); } } } return resultList.toArray(new IPropertyDescriptor[0]); }