Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/UserStringMappings.java')
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/UserStringMappings.java34
1 files changed, 17 insertions, 17 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/UserStringMappings.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/UserStringMappings.java
index 9d6fa3fe5..8d312ba0e 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/UserStringMappings.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/UserStringMappings.java
@@ -20,36 +20,36 @@ import org.eclipse.team.core.Team;
public class UserStringMappings implements Preferences.IPropertyChangeListener {
-
+
public static final Integer BINARY= new Integer(Team.BINARY);
public static final Integer TEXT= new Integer(Team.TEXT);
public static final Integer UNKNOWN= new Integer(Team.UNKNOWN);
-
-
+
+
private static final String PREF_TEAM_SEPARATOR = "\n"; //$NON-NLS-1$
-
+
private final Preferences fPreferences;
private final String fKey;
private Map fMap;
-
+
public UserStringMappings(String key) {
fKey= key;
fPreferences= TeamPlugin.getPlugin().getPluginPreferences();
fPreferences.addPropertyChangeListener(this);
}
-
+
public Map referenceMap() {
if (fMap == null) {
fMap= loadMappingsFromPreferences();
}
return fMap;
}
-
+
public void addStringMappings(String[] names, int[] types) {
Assert.isTrue(names.length == types.length);
final Map map= referenceMap();
-
+
for (int i = 0; i < names.length; i++) {
switch (types[i]) {
case Team.BINARY: map.put(names[i], BINARY); break;
@@ -59,13 +59,13 @@ public class UserStringMappings implements Preferences.IPropertyChangeListener {
}
save();
}
-
+
public void setStringMappings(String [] names, int [] types) {
Assert.isTrue(names.length == types.length);
referenceMap().clear();
addStringMappings(names, types);
}
-
+
public int getType(String string) {
if (string == null)
return Team.UNKNOWN;
@@ -77,12 +77,12 @@ public class UserStringMappings implements Preferences.IPropertyChangeListener {
if(event.getProperty().equals(fKey))
fMap= null;
}
-
+
public void save() {
// Now set into preferences
final StringBuffer buffer = new StringBuffer();
final Iterator e = fMap.keySet().iterator();
-
+
while (e.hasNext()) {
final String filename = (String)e.next();
buffer.append(filename);
@@ -93,13 +93,13 @@ public class UserStringMappings implements Preferences.IPropertyChangeListener {
}
TeamPlugin.getPlugin().getPluginPreferences().setValue(fKey, buffer.toString());
}
-
+
protected Map loadMappingsFromPreferences() {
final Map result= new HashMap();
-
- if (!fPreferences.contains(fKey))
+
+ if (!fPreferences.contains(fKey))
return result;
-
+
final String prefTypes = fPreferences.getString(fKey);
final StringTokenizer tok = new StringTokenizer(prefTypes, PREF_TEAM_SEPARATOR);
try {
@@ -107,7 +107,7 @@ public class UserStringMappings implements Preferences.IPropertyChangeListener {
final String name = tok.nextToken();
final String mode= tok.nextToken();
result.put(name, Integer.valueOf(mode));
- }
+ }
} catch (NoSuchElementException e) {
}
return result;

Back to the top