Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2006-11-24 18:42:55 +0000
committermkersten2006-11-24 18:42:55 +0000
commit762af6e3f46b0a87059c5f72b78c0a8f20e57a9d (patch)
tree5575db8e73ddb714d5dad614d8c7bca5b90ab333 /org.eclipse.mylyn.tasks.core/src
parent821672d2acc8be00651542c3048d799e652cdd9f (diff)
downloadorg.eclipse.mylyn.tasks-762af6e3f46b0a87059c5f72b78c0a8f20e57a9d.tar.gz
org.eclipse.mylyn.tasks-762af6e3f46b0a87059c5f72b78c0a8f20e57a9d.tar.xz
org.eclipse.mylyn.tasks-762af6e3f46b0a87059c5f72b78c0a8f20e57a9d.zip
RESOLVED - bug 159223: reduce amount of refresh required by Task List
https://bugs.eclipse.org/bugs/show_bug.cgi?id=159223
Diffstat (limited to 'org.eclipse.mylyn.tasks.core/src')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
index 21e760b75..592814ead 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
@@ -71,6 +71,8 @@ public class TaskRepository {
public static final String PROXY_PASSWORD = "org.eclipse.mylar.tasklist.repositories.proxy.password";
+ private String cachedUserName = null;
+
static {
URL url = null;
try {
@@ -130,14 +132,27 @@ public class TaskRepository {
return username != null && username.length() > 0 && password != null && password.length() > 0;
}
- @SuppressWarnings("unchecked")
+ /**
+ * The username is cached since it needs to be retrieved frequently (e.g. for Task List decoration).
+ * @return
+ */
public String getUserName() {
+ if (cachedUserName != null) {
+ return cachedUserName;
+ } else {
+ return getUserNameFromKeyRing();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private String getUserNameFromKeyRing() {
Map<String, String> map = getAuthInfo();
if (map != null && map.containsKey(AUTH_USERNAME)) {
- return map.get(AUTH_USERNAME);
+ cachedUserName = map.get(AUTH_USERNAME);
+ return cachedUserName;
} else {
return null;
- }
+ }
}
@SuppressWarnings("unchecked")
@@ -190,6 +205,7 @@ public class TaskRepository {
if (username != null) {
map.put(AUTH_USERNAME, username);
+ cachedUserName = username;
}
if (password != null) {
map.put(AUTH_PASSWORD, password);

Back to the top