summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-09-28 10:07:40 (EDT)
committerEike Stepper2007-09-28 10:07:40 (EDT)
commit1cdf7ebb11dca2ec0e55b844e2ad55031f481ae6 (patch)
treea293e5dca159a2f190882c957336c503408d6297
parentc270807d1b77658796254eac0158e781cacd8405 (diff)
downloadcdo-1cdf7ebb11dca2ec0e55b844e2ad55031f481ae6.zip
cdo-1cdf7ebb11dca2ec0e55b844e2ad55031f481ae6.tar.gz
cdo-1cdf7ebb11dca2ec0e55b844e2ad55031f481ae6.tar.bz2
[204732] Add dialog for "Open Session"
https://bugs.eclipse.org/bugs/show_bug.cgi?id=204732
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/collection/History.java16
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/collection/PreferenceHistory.java4
2 files changed, 9 insertions, 11 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/collection/History.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/collection/History.java
index 8ea898d..c0cd95c 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/collection/History.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/collection/History.java
@@ -25,7 +25,7 @@ import java.util.List;
*/
public class History<T> extends Notifier implements IHistory<T>
{
- private List<IHistoryElement<T>> elements = new ArrayList<IHistoryElement<T>>(0);
+ protected List<IHistoryElement<T>> elements = new ArrayList<IHistoryElement<T>>(0);
private boolean loaded;
@@ -88,7 +88,11 @@ public class History<T> extends Notifier implements IHistory<T>
public boolean add(T data)
{
lazyLoad();
- boolean changed = internalAdd(data);
+ int index = indexOf(data);
+ IHistoryElement<T> element = index != -1 ? elements.remove(index) : createElement(data);
+ elements.add(0, element);
+
+ boolean changed = index != 0;
if (changed)
{
changed();
@@ -186,14 +190,6 @@ public class History<T> extends Notifier implements IHistory<T>
fireChangedEvent();
}
- protected final boolean internalAdd(T data)
- {
- int index = indexOf(data);
- IHistoryElement<T> element = index != -1 ? elements.remove(index) : createElement(data);
- elements.add(0, element);
- return index != 0;
- }
-
private void lazyLoad()
{
if (!loaded)
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/collection/PreferenceHistory.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/collection/PreferenceHistory.java
index 5e2c3d9..bed5e2a 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/collection/PreferenceHistory.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/collection/PreferenceHistory.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.internal.util.collection;
+import org.eclipse.net4j.util.collection.IHistoryElement;
import org.eclipse.net4j.util.om.pref.OMPreference;
/**
@@ -35,7 +36,8 @@ public class PreferenceHistory extends History<String>
String[] value = preference.getValue();
for (String data : value)
{
- internalAdd(data);
+ IHistoryElement<String> element = createElement(data);
+ elements.add(element);
}
}