diff options
author | Thomas Wolf | 2020-11-01 23:01:51 +0000 |
---|---|---|
committer | Thomas Wolf | 2020-11-01 23:06:52 +0000 |
commit | 8717a9718e3cdde469f88833928f03e06bcf9e61 (patch) | |
tree | 6e01b7f2ce5f6fdf0e994a41c6855e9dbe8f87e7 | |
parent | f3aaed185656ccd76f47dc969f83b72dacf6ff92 (diff) | |
download | egit-8717a9718e3cdde469f88833928f03e06bcf9e61.tar.gz egit-8717a9718e3cdde469f88833928f03e06bcf9e61.tar.xz egit-8717a9718e3cdde469f88833928f03e06bcf9e61.zip |
Handle subsections with periods in RepositoryPropertySource
The properties view of a repository did not show config entries with
subsection names containing periods.
Just look at the first and last period and take everything in between
(if anything) as the subsection name.
Bug: 568424
Change-Id: I7d3c7790c758b6c230012f30fe28249bc12901bd
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
-rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryPropertySource.java | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryPropertySource.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryPropertySource.java index 849259c726..660436e55b 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryPropertySource.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryPropertySource.java @@ -16,7 +16,6 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.StringTokenizer; import org.eclipse.egit.ui.Activator; import org.eclipse.egit.ui.internal.UIIcons; @@ -312,25 +311,17 @@ public class RepositoryPropertySource implements IPropertySource { } private Object getValueFromConfig(Config config, String keyString) { - StringTokenizer tok = new StringTokenizer(keyString, "."); //$NON-NLS-1$ - - String section; - String subsection; - String name; - - String[] valueList = null; - if (tok.countTokens() == 2) { - section = tok.nextToken(); - subsection = null; - name = tok.nextToken(); - } else if (tok.countTokens() == 3) { - section = tok.nextToken(); - subsection = tok.nextToken(); - name = tok.nextToken(); - } else { + int i = keyString.indexOf('.'); + if (i < 0) { return ""; //$NON-NLS-1$ } + int j = keyString.lastIndexOf('.'); + + String section = keyString.substring(0, i); + String subsection = i == j ? null : keyString.substring(i + 1, j); + String name = keyString.substring(j + 1); + String[] valueList = null; if (getSingleValueMode()) valueList = new String[] { config.getString(section, subsection, name) }; |