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/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse | |
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/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse')
4 files changed, 157 insertions, 193 deletions
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; + } +} |