diff options
author | Tobias Schwarz | 2012-10-23 11:55:01 +0000 |
---|---|---|
committer | Tobias Schwarz | 2012-10-23 11:55:38 +0000 |
commit | eb42c4176b4f9ca129b80fa958fbe3cec4f23e6d (patch) | |
tree | 1ef1808ccf502a2513aa076560b665d12b24ac47 /target_explorer | |
parent | ed1cdc21e989fb28e434ada63c57f9ec39473c92 (diff) | |
download | org.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')
14 files changed, 288 insertions, 202 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/plugin.xml index fe36af6f8..adbf37550 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/plugin.xml @@ -150,8 +150,11 @@ <extension point="org.eclipse.tcf.te.runtime.persistence.variableDelegates"> <delegate id="org.eclipse.tcf.te.launch.core.persistence.variableDelegate" - class="org.eclipse.tcf.te.launch.core.internal.FileTransferItemVariableDelegate" - delegateId="org.eclipse.tcf.te.launch.core.persistence.gson.fileTransferItem"/> + delegateId="org.eclipse.tcf.te.launch.core.persistence.gson.fileTransferItem"> + <class class="org.eclipse.tcf.te.runtime.persistence.delegates.PathVariableDelegate"> + <parameter name="keysToHandle" value="host"/> + </class> + </delegate> </extension> diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/FileTransferItemVariableDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/FileTransferItemVariableDelegate.java deleted file mode 100644 index 12f142e79..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/FileTransferItemVariableDelegate.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * FileTransferItemVariableDelegate.java - * Created on 15.10.2012 - * - * Copyright (c) 2012 Wind River Systems, Inc. - * - * The right to copy, distribute, modify, or otherwise make use - * of this software may be licensed only pursuant to the terms - * of an applicable Wind River license agreement. - */ -package org.eclipse.tcf.te.launch.core.internal; - -import org.eclipse.tcf.te.runtime.persistence.AbstractPathVariableDelegate; -import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem; - -/** - * FileTransferItemVariableDelegate - */ -public class FileTransferItemVariableDelegate extends AbstractPathVariableDelegate { - - /* (non-Javadoc) - * @see org.eclipse.tcf.te.runtime.persistence.AbstractVariableDelegate#getKeysToHandle() - */ - @Override - protected String[] getKeysToHandle() { - return new String[]{IFileTransferItem.PROPERTY_HOST}; - } - - /* (non-Javadoc) - * @see org.eclipse.tcf.te.runtime.persistence.AbstractPathVariableDelegate#isPathKey(java.lang.String) - */ - @Override - protected boolean isPathKey(String key) { - return true; - } -} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/GsonFileTransferItemPersistenceDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/GsonFileTransferItemPersistenceDelegate.java index fa85fb0ea..39daa2472 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/GsonFileTransferItemPersistenceDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/GsonFileTransferItemPersistenceDelegate.java @@ -1,78 +1,78 @@ -/*******************************************************************************
- * 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.launch.core.internal;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.tcf.te.runtime.persistence.GsonMapPersistenceDelegate;
-import org.eclipse.tcf.te.runtime.services.filetransfer.FileTransferItem;
-import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
-
-/**
- * File transfer item to string delegate implementation.
- */
-public class GsonFileTransferItemPersistenceDelegate extends GsonMapPersistenceDelegate {
-
- /**
- * Constructor.
- */
- public GsonFileTransferItemPersistenceDelegate() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#getPersistedClass(java.lang.Object)
- */
- @Override
- public Class<?> getPersistedClass(Object context) {
- return IFileTransferItem.class;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.persistence.AbstractPropertiesPersistenceDelegate#toMap(java.lang.Object)
- */
- @Override
- protected Map<String, Object> toMap(final Object context) throws IOException {
- IFileTransferItem item = getFileTransferItem(context);
- if (item != null) {
- return super.toMap(item.getProperties());
- }
-
- return new HashMap<String, Object>();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.persistence.AbstractPropertiesPersistenceDelegate#fromMap(java.util.Map, java.lang.Object)
- */
- @Override
- protected Object fromMap(Map<String, Object> map, Object context) throws IOException {
- IFileTransferItem item = new FileTransferItem();
- item.setProperties(map);
- return item;
- }
-
- /**
- * Get a file transfer item from the given context.
- *
- * @param context The context. Must not be <code>null</code>.
- * @return The file transfer item or <code>null</code>.
- */
- protected IFileTransferItem getFileTransferItem(Object context) {
- IFileTransferItem item = null;
-
- if (context instanceof IFileTransferItem) {
- item = (IFileTransferItem)context;
- }
-
- return item;
- }
-}
+/******************************************************************************* + * 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.launch.core.internal; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.tcf.te.runtime.persistence.delegates.GsonMapPersistenceDelegate; +import org.eclipse.tcf.te.runtime.services.filetransfer.FileTransferItem; +import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem; + +/** + * File transfer item to string delegate implementation. + */ +public class GsonFileTransferItemPersistenceDelegate extends GsonMapPersistenceDelegate { + + /** + * Constructor. + */ + public GsonFileTransferItemPersistenceDelegate() { + super(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#getPersistedClass(java.lang.Object) + */ + @Override + public Class<?> getPersistedClass(Object context) { + return IFileTransferItem.class; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.persistence.AbstractPropertiesPersistenceDelegate#toMap(java.lang.Object) + */ + @Override + protected Map<String, Object> toMap(final Object context) throws IOException { + IFileTransferItem item = getFileTransferItem(context); + if (item != null) { + return super.toMap(item.getProperties()); + } + + return new HashMap<String, Object>(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.persistence.AbstractPropertiesPersistenceDelegate#fromMap(java.util.Map, java.lang.Object) + */ + @Override + protected Object fromMap(Map<String, Object> map, Object context) throws IOException { + IFileTransferItem item = new FileTransferItem(); + item.setProperties(map); + return item; + } + + /** + * Get a file transfer item from the given context. + * + * @param context The context. Must not be <code>null</code>. + * @return The file transfer item or <code>null</code>. + */ + protected IFileTransferItem getFileTransferItem(Object context) { + IFileTransferItem item = null; + + if (context instanceof IFileTransferItem) { + item = (IFileTransferItem)context; + } + + return item; + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/GsonLaunchConfigAttributesPersistenceDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/GsonLaunchConfigAttributesPersistenceDelegate.java index 01ac3fc7a..5722a78b4 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/GsonLaunchConfigAttributesPersistenceDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/GsonLaunchConfigAttributesPersistenceDelegate.java @@ -16,7 +16,7 @@ import java.util.Map; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.tcf.te.runtime.persistence.GsonMapPersistenceDelegate; +import org.eclipse.tcf.te.runtime.persistence.delegates.GsonMapPersistenceDelegate; /** * Launch configuration to string delegate implementation. diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/GsonReferencedProjectItemPersistenceDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/GsonReferencedProjectItemPersistenceDelegate.java index 004923fa4..7041eff0f 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/GsonReferencedProjectItemPersistenceDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/internal/GsonReferencedProjectItemPersistenceDelegate.java @@ -1,78 +1,78 @@ -/*******************************************************************************
- * 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.launch.core.internal;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.tcf.te.launch.core.interfaces.IReferencedProjectItem;
-import org.eclipse.tcf.te.launch.core.persistence.projects.ReferencedProjectItem;
-import org.eclipse.tcf.te.runtime.persistence.GsonMapPersistenceDelegate;
-
-/**
- * Referenced project item to string delegate implementation.
- */
-public class GsonReferencedProjectItemPersistenceDelegate extends GsonMapPersistenceDelegate {
-
- /**
- * Constructor.
- */
- public GsonReferencedProjectItemPersistenceDelegate() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#getPersistedClass(java.lang.Object)
- */
- @Override
- public Class<?> getPersistedClass(Object context) {
- return IReferencedProjectItem.class;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.persistence.AbstractPropertiesPersistenceDelegate#toMap(java.lang.Object)
- */
- @Override
- protected Map<String, Object> toMap(final Object context) throws IOException {
- IReferencedProjectItem item = getReferencedProjectItem(context);
- if (item != null) {
- return super.toMap(item.getProperties());
- }
-
- return new HashMap<String, Object>();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.persistence.AbstractPropertiesPersistenceDelegate#fromMap(java.util.Map, java.lang.Object)
- */
- @Override
- protected Object fromMap(Map<String, Object> map, Object context) throws IOException {
- IReferencedProjectItem item = new ReferencedProjectItem();
- item.setProperties(map);
- return item;
- }
-
- /**
- * Get a referenced project item from the given context.
- *
- * @param context The context. Must not be <code>null</code>.
- * @return The referenced project item or <code>null</code>.
- */
- protected IReferencedProjectItem getReferencedProjectItem(Object context) {
- IReferencedProjectItem item = null;
-
- if (context instanceof IReferencedProjectItem) {
- item = (IReferencedProjectItem)context;
- }
-
- return item;
- }
-}
+/******************************************************************************* + * 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.launch.core.internal; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.tcf.te.launch.core.interfaces.IReferencedProjectItem; +import org.eclipse.tcf.te.launch.core.persistence.projects.ReferencedProjectItem; +import org.eclipse.tcf.te.runtime.persistence.delegates.GsonMapPersistenceDelegate; + +/** + * Referenced project item to string delegate implementation. + */ +public class GsonReferencedProjectItemPersistenceDelegate extends GsonMapPersistenceDelegate { + + /** + * Constructor. + */ + public GsonReferencedProjectItemPersistenceDelegate() { + super(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#getPersistedClass(java.lang.Object) + */ + @Override + public Class<?> getPersistedClass(Object context) { + return IReferencedProjectItem.class; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.persistence.AbstractPropertiesPersistenceDelegate#toMap(java.lang.Object) + */ + @Override + protected Map<String, Object> toMap(final Object context) throws IOException { + IReferencedProjectItem item = getReferencedProjectItem(context); + if (item != null) { + return super.toMap(item.getProperties()); + } + + return new HashMap<String, Object>(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.persistence.AbstractPropertiesPersistenceDelegate#fromMap(java.util.Map, java.lang.Object) + */ + @Override + protected Object fromMap(Map<String, Object> map, Object context) throws IOException { + IReferencedProjectItem item = new ReferencedProjectItem(); + item.setProperties(map); + return item; + } + + /** + * Get a referenced project item from the given context. + * + * @param context The context. Must not be <code>null</code>. + * @return The referenced project item or <code>null</code>. + */ + protected IReferencedProjectItem getReferencedProjectItem(Object context) { + IReferencedProjectItem item = null; + + if (context instanceof IReferencedProjectItem) { + item = (IReferencedProjectItem)context; + } + + return item; + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/META-INF/MANIFEST.MF index 17f2c1ecd..22620e410 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/META-INF/MANIFEST.MF @@ -16,6 +16,7 @@ Bundle-ActivationPolicy: lazy Bundle-Localization: plugin Export-Package: org.eclipse.tcf.te.runtime.persistence, org.eclipse.tcf.te.runtime.persistence.activator;x-internal:=true, + org.eclipse.tcf.te.runtime.persistence.delegates, org.eclipse.tcf.te.runtime.persistence.history, org.eclipse.tcf.te.runtime.persistence.interfaces, org.eclipse.tcf.te.runtime.persistence.internal;x-internal:=true, diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/plugin.xml index ef2d60cee..021ba1cc8 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/plugin.xml @@ -21,7 +21,7 @@ <extension point="org.eclipse.tcf.te.runtime.persistence.delegates"> <delegate id="org.eclipse.tcf.te.runtime.persistence.gson.map" - class="org.eclipse.tcf.te.runtime.persistence.GsonMapPersistenceDelegate"> + class="org.eclipse.tcf.te.runtime.persistence.delegates.GsonMapPersistenceDelegate"> </delegate> </extension> diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/schema/variableDelegates.exsd b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/schema/variableDelegates.exsd index e3cbe6a84..c79954d37 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/schema/variableDelegates.exsd +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/schema/variableDelegates.exsd @@ -54,6 +54,9 @@ </documentation> </annotation> <complexType> + <sequence> + <element ref="class" minOccurs="0" maxOccurs="1"/> + </sequence> <attribute name="id" type="string" use="required"> <annotation> <documentation> @@ -84,6 +87,53 @@ </complexType> </element> + <element name="class"> + <annotation> + <documentation> + Used when creating an <code>IExecutableExtension</code> with a named parameter, or more than one. + </documentation> + </annotation> + <complexType> + <sequence> + <element ref="parameter" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + <attribute name="class" type="string"> + <annotation> + <documentation> + The variable delegate implementation class must be specified either by the class attribute or the class child element! + </documentation> + <appinfo> + <meta.attribute kind="java" basedOn=":org.eclipse.tcf.te.runtime.persistence.interfaces.IVariableDelegate"/> + </appinfo> + </annotation> + </attribute> + </complexType> + </element> + + <element name="parameter"> + <annotation> + <documentation> + A parameter for an <code>IExecutableExtension</code>. + </documentation> + </annotation> + <complexType> + <attribute name="name" type="string" use="required"> + <annotation> + <documentation> + <p>The parameter name.</p> + </documentation> + </annotation> + </attribute> + <attribute name="value" type="string" use="required"> + <annotation> + <documentation> + <p>The parameter value.</p> + </documentation> + </annotation> + </attribute> + </complexType> + </element> + <annotation> <appinfo> <meta.section type="since"/> 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$ + } + } + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManagerDelegate.java index 8b2dad54b..28fd5baa1 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManagerDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManagerDelegate.java @@ -22,7 +22,7 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.QualifiedName; import org.eclipse.core.runtime.SafeRunner; import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.tcf.te.runtime.persistence.GsonMapPersistenceDelegate; +import org.eclipse.tcf.te.runtime.persistence.delegates.GsonMapPersistenceDelegate; /** * The persistence delegate to persist or restore a map whose keys are URIs. diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/persistence/GsonPeerPersistenceDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/persistence/GsonPeerPersistenceDelegate.java index b700efa2a..246ff5658 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/persistence/GsonPeerPersistenceDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/persistence/GsonPeerPersistenceDelegate.java @@ -18,7 +18,7 @@ import java.util.concurrent.atomic.AtomicReference; import org.eclipse.tcf.protocol.IPeer; import org.eclipse.tcf.protocol.Protocol; import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode; -import org.eclipse.tcf.te.runtime.persistence.GsonMapPersistenceDelegate; +import org.eclipse.tcf.te.runtime.persistence.delegates.GsonMapPersistenceDelegate; import org.eclipse.tcf.te.tcf.core.peers.Peer; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider; |