Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2012-10-23 07:55:01 -0400
committerTobias Schwarz2012-10-23 07:55:38 -0400
commiteb42c4176b4f9ca129b80fa958fbe3cec4f23e6d (patch)
tree1ef1808ccf502a2513aa076560b665d12b24ac47 /target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence
parented1cdc21e989fb28e434ada63c57f9ec39473c92 (diff)
downloadorg.eclipse.tcf-eb42c4176b4f9ca129b80fa958fbe3cec4f23e6d.tar.gz
org.eclipse.tcf-eb42c4176b4f9ca129b80fa958fbe3cec4f23e6d.tar.xz
org.eclipse.tcf-eb42c4176b4f9ca129b80fa958fbe3cec4f23e6d.zip
[Target Explorer] unify variable delegate and configure it in the
contribution directly
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractPathVariableDelegate.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/AbstractPathVariableDelegate.java)2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractVariableDelegate.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/AbstractVariableDelegate.java)14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/GsonMapPersistenceDelegate.java)3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/PathVariableDelegate.java57
4 files changed, 72 insertions, 4 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/AbstractPathVariableDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractPathVariableDelegate.java
index 09da17128..840b23ae5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/AbstractPathVariableDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractPathVariableDelegate.java
@@ -8,7 +8,7 @@
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.runtime.persistence;
+package org.eclipse.tcf.te.runtime.persistence.delegates;
import org.eclipse.core.runtime.Path;
import org.eclipse.tcf.te.runtime.utils.Host;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/AbstractVariableDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractVariableDelegate.java
index b709d41d8..329a40b29 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/AbstractVariableDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractVariableDelegate.java
@@ -8,19 +8,23 @@
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.runtime.persistence;
+package org.eclipse.tcf.te.runtime.persistence.delegates;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
+import org.eclipse.tcf.te.runtime.persistence.PersistenceManager;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IVariableDelegate;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IVariableProvider;
/**
* AbstractVariableDelegate
*/
-public abstract class AbstractVariableDelegate implements IVariableDelegate {
+public abstract class AbstractVariableDelegate implements IVariableDelegate, IExecutableExtension {
/**
* Get the list of keys this delegate is handling.
@@ -123,4 +127,10 @@ public abstract class AbstractVariableDelegate implements IVariableDelegate {
return variables;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/GsonMapPersistenceDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java
index 06c37d5b0..a9a99c064 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/GsonMapPersistenceDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java
@@ -8,7 +8,7 @@
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.runtime.persistence;
+package org.eclipse.tcf.te.runtime.persistence.delegates;
import java.io.File;
import java.io.FileInputStream;
@@ -28,6 +28,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.tcf.te.runtime.extensions.ExecutableExtension;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.persistence.PersistenceManager;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IVariableDelegate;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/PathVariableDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/PathVariableDelegate.java
new file mode 100644
index 000000000..c7b9f520b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/PathVariableDelegate.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tcf.te.runtime.persistence.delegates;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
+/**
+ * General path variable delegate that can be configured directly in the contributions.
+ *
+ * To set the list of handled keys you have to use the <code>class</code> and <code>parameter</code> tags
+ * with <b>keysToHandle</b> as parameter name and a coma seperated list of handled keys
+ * (i.e. "file,directory") as parameter value.
+ */
+public class PathVariableDelegate extends AbstractPathVariableDelegate {
+
+ private String[] keysToHandle = new String[0];
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.persistence.AbstractPathVariableDelegate#isPathKey(java.lang.String)
+ */
+ @Override
+ protected boolean isPathKey(String key) {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.persistence.AbstractVariableDelegate#getKeysToHandle()
+ */
+ @Override
+ protected String[] getKeysToHandle() {
+ return keysToHandle;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+ if (data instanceof Map) {
+ String keys = (String)((Map<?,?>)data).get("keysToHandle"); //$NON-NLS-1$
+ if (keys != null) {
+ keysToHandle = keys.split("\\w*,\\w*"); //$NON-NLS-1$
+ }
+ }
+ }
+}

Back to the top