Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-10-22 17:32:49 +0000
committerEike Stepper2013-10-22 17:32:49 +0000
commit0acea3f41f00fe78cd2fe974e9c203e8ebbbaadb (patch)
tree8de56914b5114b65618a9e200649e22e2739e97b
parent7a74ca646b78f03a3fc266b95c0f8351dcbcffc2 (diff)
downloadcdo-0acea3f41f00fe78cd2fe974e9c203e8ebbbaadb.tar.gz
cdo-0acea3f41f00fe78cd2fe974e9c203e8ebbbaadb.tar.xz
cdo-0acea3f41f00fe78cd2fe974e9c203e8ebbbaadb.zip
Add PreferencesRecorderAction
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/SetupTaskPerformer.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/EclipsePreferenceTaskImpl.java20
2 files changed, 23 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/SetupTaskPerformer.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/SetupTaskPerformer.java
index af04607453..f754780968 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/SetupTaskPerformer.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/internal/setup/SetupTaskPerformer.java
@@ -192,6 +192,11 @@ public class SetupTaskPerformer extends HashMap<Object, Object> implements Setup
public String expandString(String string)
{
+ if (string == null)
+ {
+ return null;
+ }
+
StringBuilder result = new StringBuilder();
int previous = 0;
for (Matcher matcher = STRING_EXPANSION_PATTERN.matcher(string); matcher.find();)
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/EclipsePreferenceTaskImpl.java b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/EclipsePreferenceTaskImpl.java
index 4aadebc04d..090424fef9 100644
--- a/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/EclipsePreferenceTaskImpl.java
+++ b/plugins/org.eclipse.emf.cdo.releng.setup/src/org/eclipse/emf/cdo/releng/setup/impl/EclipsePreferenceTaskImpl.java
@@ -15,6 +15,8 @@ import org.eclipse.emf.cdo.releng.setup.SetupPackage;
import org.eclipse.emf.cdo.releng.setup.SetupTaskContext;
import org.eclipse.emf.cdo.releng.setup.Trigger;
+import org.eclipse.net4j.util.ObjectUtil;
+
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
@@ -127,7 +129,9 @@ public class EclipsePreferenceTaskImpl extends SetupTaskImpl implements EclipseP
String oldKey = key;
key = newKey;
if (eNotificationRequired())
+ {
eNotify(new ENotificationImpl(this, Notification.SET, SetupPackage.ECLIPSE_PREFERENCE_TASK__KEY, oldKey, key));
+ }
}
/**
@@ -150,8 +154,10 @@ public class EclipsePreferenceTaskImpl extends SetupTaskImpl implements EclipseP
String oldValue = value;
value = newValue;
if (eNotificationRequired())
+ {
eNotify(new ENotificationImpl(this, Notification.SET, SetupPackage.ECLIPSE_PREFERENCE_TASK__VALUE, oldValue,
value));
+ }
}
/**
@@ -239,7 +245,9 @@ public class EclipsePreferenceTaskImpl extends SetupTaskImpl implements EclipseP
public String toString()
{
if (eIsProxy())
+ {
return super.toString();
+ }
StringBuffer result = new StringBuffer(super.toString());
result.append(" (key: ");
@@ -277,7 +285,7 @@ public class EclipsePreferenceTaskImpl extends SetupTaskImpl implements EclipseP
expandedValue = context.expandString(getValue());
String oldValue = node.get(property, null);
- if (expandedValue.equals(oldValue))
+ if (ObjectUtil.equals(expandedValue, oldValue))
{
return false;
}
@@ -298,7 +306,15 @@ public class EclipsePreferenceTaskImpl extends SetupTaskImpl implements EclipseP
try
{
org.osgi.service.prefs.Preferences node = (org.osgi.service.prefs.Preferences)cachedNode;
- node.put(property, expandedValue);
+ if (expandedValue != null)
+ {
+ node.put(property, expandedValue);
+ }
+ else
+ {
+ node.remove(property);
+ }
+
node.flush();
}
catch (Exception ex)

Back to the top