| author | Tobias Schwarz | 2012-04-11 08:47:10 (EDT) |
|---|---|---|
| committer | Uwe Stieber | 2012-04-11 08:47:10 (EDT) |
| commit | 74f0ba2b8c46fb8af8977bb669dbe576aa4162a5 (patch) (side-by-side diff) | |
| tree | f903d8e3b989480c620eb371358deb1bb3868129 | |
| parent | aa5925aede10214fa6830270ed985658aa177baa (diff) | |
| download | org.eclipse.tcf-74f0ba2b8c46fb8af8977bb669dbe576aa4162a5.zip org.eclipse.tcf-74f0ba2b8c46fb8af8977bb669dbe576aa4162a5.tar.gz org.eclipse.tcf-74f0ba2b8c46fb8af8977bb669dbe576aa4162a5.tar.bz2 | |
Target Explorer: ADD File Transfer to Remote App launch
40 files changed, 1484 insertions, 614 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/META-INF/MANIFEST.MF index ed1b91c..216bdf1 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/META-INF/MANIFEST.MF @@ -19,10 +19,8 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Export-Package: org.eclipse.tcf.te.launch.core.activator;x-internal:=true,
- org.eclipse.tcf.te.launch.core.adapters.internal;x-internal:=true,
org.eclipse.tcf.te.launch.core.bindings,
org.eclipse.tcf.te.launch.core.bindings.interfaces,
- org.eclipse.tcf.te.launch.core.bindings.internal;x-friends:="org.eclipse.tcf.te.launch.ui",
org.eclipse.tcf.te.launch.core.delegates,
org.eclipse.tcf.te.launch.core.exceptions,
org.eclipse.tcf.te.launch.core.interfaces,
@@ -30,7 +28,6 @@ Export-Package: org.eclipse.tcf.te.launch.core.activator;x-internal:=true, org.eclipse.tcf.te.launch.core.lm,
org.eclipse.tcf.te.launch.core.lm.delegates,
org.eclipse.tcf.te.launch.core.lm.interfaces,
- org.eclipse.tcf.te.launch.core.lm.internal;x-internal:=true,
org.eclipse.tcf.te.launch.core.nls;x-internal:=true,
org.eclipse.tcf.te.launch.core.persistence,
org.eclipse.tcf.te.launch.core.persistence.filetransfer,
@@ -39,4 +36,5 @@ Export-Package: org.eclipse.tcf.te.launch.core.activator;x-internal:=true, org.eclipse.tcf.te.launch.core.preferences,
org.eclipse.tcf.te.launch.core.selection,
org.eclipse.tcf.te.launch.core.selection.interfaces,
- org.eclipse.tcf.te.launch.core.steps
+ org.eclipse.tcf.te.launch.core.steps,
+ org.eclipse.tcf.te.launch.core.steps.iterators
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 3b8add1..8504730 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 @@ -74,11 +74,11 @@ </with>
<with variable="context">
<or>
- <instanceof value="org.eclipse.tcf.te.launch.core.interfaces.IFileTransferItem"/>
+ <instanceof value="org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem"/>
<and>
<instanceof value="java.lang.Class"/>
<with variable="contextClass">
- <equals value="org.eclipse.tcf.te.launch.core.interfaces.IFileTransferItem"/>
+ <equals value="org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem"/>
</with>
</and>
</or>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/delegates/LaunchConfigurationDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/delegates/LaunchConfigurationDelegate.java index e8d70ed..91e52c5 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/delegates/LaunchConfigurationDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/delegates/LaunchConfigurationDelegate.java @@ -34,7 +34,7 @@ import org.eclipse.tcf.te.launch.core.activator.CoreBundleActivator; import org.eclipse.tcf.te.launch.core.bindings.LaunchConfigTypeBindingsManager;
import org.eclipse.tcf.te.launch.core.interfaces.IReferencedProjectItem;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ICommonLaunchAttributes;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.IContextSelectorLaunchAttributes;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate;
import org.eclipse.tcf.te.launch.core.nls.Messages;
import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
@@ -118,8 +118,8 @@ public class LaunchConfigurationDelegate extends AbstractLaunchConfigurationDele launch.getLaunchMode()));
IModelNode[] contexts = LaunchContextsPersistenceDelegate.decodeLaunchContexts(
- launchConfig.getAttribute(IContextSelectorLaunchAttributes.ATTR_LAUNCH_CONTEXTS, (String)null));
- properties.setProperty(IContextSelectorLaunchAttributes.ATTR_ACTIVE_LAUNCH_CONTEXT, contexts != null && contexts.length > 0 ? contexts[0] : null);
+ launchConfig.getAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS, (String)null));
+ properties.setProperty(ILaunchContextLaunchAttributes.ATTR_ACTIVE_LAUNCH_CONTEXT, contexts != null && contexts.length > 0 ? contexts[0] : null);
// Initialize the stepper
IStepContext context = (IStepContext)launch.getAdapter(IStepContext.class);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/interfaces/IFileTransferItem.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/interfaces/IFileTransferItem.java deleted file mode 100644 index 8c55196..0000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/interfaces/IFileTransferItem.java +++ b/dev/null @@ -1,28 +0,0 @@ -/*******************************************************************************
- * 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.interfaces;
-
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-
-/**
- * IFileTransferItem
- */
-public interface IFileTransferItem extends IPropertiesContainer {
-
- public static final String PROPERTY_ENABLED = "enabled"; //$NON-NLS-1$
- public static final String PROPERTY_DIRECTION = "direction"; //$NON-NLS-1$
- public static final String PROPERTY_HOST = "host"; //$NON-NLS-1$
- public static final String PROPERTY_TARGET = "target"; //$NON-NLS-1$
- public static final String PROPERTY_OPTIONS = "options"; //$NON-NLS-1$
-
- public static final int HOST_TO_TARGET = 1;
- public static final int TARGET_TO_HOST = 2;
-}
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 0bcfbe7..0d611f9 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 @@ -13,9 +13,9 @@ import java.io.IOException; import java.util.HashMap;
import java.util.Map;
-import org.eclipse.tcf.te.launch.core.interfaces.IFileTransferItem;
-import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransferItem;
import org.eclipse.tcf.te.runtime.persistence.AbstractGsonMapPersistenceDelegate;
+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.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/IFileTransferLaunchAttributes.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/IFileTransferLaunchAttributes.java index 79acc14..41e5ba5 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/IFileTransferLaunchAttributes.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/IFileTransferLaunchAttributes.java @@ -21,4 +21,8 @@ public interface IFileTransferLaunchAttributes { */
public static final String ATTR_FILE_TRANSFERS = ICommonLaunchAttributes.ATTR_PREFIX + ".file_transfers"; //$NON-NLS-1$
+ /**
+ * Launch attribute: The file transfer item the launch is currently operating with.
+ */
+ public static final String ATTR_ACTIVE_FILE_TRANSFER = ICommonLaunchAttributes.ATTR_PREFIX + ".file_transfer"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/IContextSelectorLaunchAttributes.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchContextLaunchAttributes.java index 5f90265..76efd9f 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/IContextSelectorLaunchAttributes.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchContextLaunchAttributes.java @@ -12,7 +12,7 @@ package org.eclipse.tcf.te.launch.core.lm.interfaces; /**
* Defines the launch configuration attribute id's to access the launch step contexts.
*/
-public interface IContextSelectorLaunchAttributes {
+public interface ILaunchContextLaunchAttributes {
/**
* Launch configuration attribute: The active launch context the launch is operating with.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/nls/Messages.java index e9b3a5b..5a3e40d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/nls/Messages.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/nls/Messages.java @@ -43,13 +43,6 @@ public class Messages extends NLS { public static String AbstractLaunchConfigurationDelegate_scoped_incremental_build;
- public static String FileTransferItemValidator_missingFile;
- public static String FileTransferItemValidator_missingFileOrDirectory;
- public static String FileTransferItemValidator_notExistingFile;
- public static String FileTransferItemValidator_notExistingFileOrDirectory;
- public static String FileTransferItemValidator_invalidFile;
- public static String FileTransferItemValidator_invalidFileOrDirectory;
-
public static String ReferencedProjectItemValidator_missingProject;
public static String ReferencedProjectItemValidator_notExistingProject;
public static String ReferencedProjectItemValidator_closedProject;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/nls/Messages.properties index 64c16b1..936f967 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/nls/Messages.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/nls/Messages.properties @@ -19,13 +19,6 @@ LaunchConfigurationDelegate_error_inaccessibleReferencedProject=Failed to access AbstractLaunchConfigurationDelegate_scoped_incremental_build=Scoped incremental build before launch...
-FileTransferItemValidator_missingFile = Missing file
-FileTransferItemValidator_missingFileOrDirectory = Missing file or directory
-FileTransferItemValidator_notExistingFile = File does not exist or is not readable
-FileTransferItemValidator_notExistingFileOrDirectory = File or directory does not exist or is not writeable
-FileTransferItemValidator_invalidFile = File is not valid
-FileTransferItemValidator_invalidFileOrDirectory = File or directory is not valid
-
ReferencedProjectItemValidator_missingProject = Missing project
ReferencedProjectItemValidator_notExistingProject = Project does not exist
ReferencedProjectItemValidator_closedProject = Project is closed
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/filetransfer/FileTransferItem.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/filetransfer/FileTransferItem.java deleted file mode 100644 index 31dea92..0000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/filetransfer/FileTransferItem.java +++ b/dev/null @@ -1,27 +0,0 @@ -/*******************************************************************************
- * 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.persistence.filetransfer;
-
-import org.eclipse.tcf.te.launch.core.interfaces.IFileTransferItem;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-
-/**
- * FileTransferItem
- */
-public class FileTransferItem extends PropertiesContainer implements IFileTransferItem {
-
- /**
- * Constructor.
- */
- public FileTransferItem() {
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/filetransfer/FileTransfersPersistenceDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/filetransfer/FileTransfersPersistenceDelegate.java index 074b065..abf4769 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/filetransfer/FileTransfersPersistenceDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/filetransfer/FileTransfersPersistenceDelegate.java @@ -13,11 +13,11 @@ import java.util.List; import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.tcf.te.launch.core.interfaces.IFileTransferItem;
import org.eclipse.tcf.te.launch.core.lm.interfaces.IFileTransferLaunchAttributes;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
import org.eclipse.tcf.te.launch.core.persistence.AbstractItemListPersistenceDelegate;
import org.eclipse.tcf.te.launch.core.persistence.AbstractItemListXMLParser;
+import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
/**
* File transfer persistence delegate.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/launchcontext/LaunchContextsPersistenceDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/launchcontext/LaunchContextsPersistenceDelegate.java index f624a0b..d8c644a 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/launchcontext/LaunchContextsPersistenceDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/launchcontext/LaunchContextsPersistenceDelegate.java @@ -17,7 +17,7 @@ import java.util.Map; import org.eclipse.core.runtime.Assert;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.IContextSelectorLaunchAttributes;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
import org.eclipse.tcf.te.launch.core.persistence.AbstractItemListPersistenceDelegate;
import org.eclipse.tcf.te.launch.core.persistence.AbstractItemListXMLParser;
@@ -43,7 +43,7 @@ public class LaunchContextsPersistenceDelegate { private static final String TAG_LAUNCH_CONTEXT = "context"; //$NON-NLS-1$
private static final AbstractItemListPersistenceDelegate<IModelNode> delegate =
- new AbstractItemListPersistenceDelegate<IModelNode>(TAG_LAUNCH_CONTEXT, IContextSelectorLaunchAttributes.ATTR_LAUNCH_CONTEXTS) {
+ new AbstractItemListPersistenceDelegate<IModelNode>(TAG_LAUNCH_CONTEXT, ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS) {
@Override
protected AbstractItemListXMLParser<IModelNode> getXMLParser() {
return new AbstractItemListXMLParser<IModelNode>(TAG_LAUNCH_CONTEXT) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/StepContextSelectionContext.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/RemoteSelectionContext.java index 9139008..b7f4033 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/StepContextSelectionContext.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/RemoteSelectionContext.java @@ -9,46 +9,46 @@ *******************************************************************************/ package org.eclipse.tcf.te.launch.core.selection; -import org.eclipse.tcf.te.launch.core.selection.interfaces.IStepContextSelectionContext; -import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext; +import org.eclipse.tcf.te.launch.core.selection.interfaces.IRemoteSelectionContext; +import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode; /** * Step context selection context implementation. */ -public class StepContextSelectionContext extends AbstractSelectionContext implements IStepContextSelectionContext { +public class RemoteSelectionContext extends AbstractSelectionContext implements IRemoteSelectionContext { // The step context - private IStepContext stepCtx = null; + private IModelNode remoteCtx = null; /** * Constructor. * - * @param stepCtx The step context or <code>null</code>. + * @param remoteCtx The remote context or <code>null</code>. * @param isPreferred <code>True</code> to mark the selection context the preferred context, * <code>false</code> otherwise. */ - public StepContextSelectionContext(IStepContext remoteCtx, boolean isPreferred) { + public RemoteSelectionContext(IModelNode remoteCtx, boolean isPreferred) { this(remoteCtx, null, isPreferred); } /** * Constructor. * - * @param stepCtx The step context or <code>null</code>. + * @param remoteCtx The remote context or <code>null</code>. * @param selections The selected objects or <code>null</code>. * @param isPreferred <code>True</code> to mark the selection context the preferred context, * <code>false</code> otherwise. */ - public StepContextSelectionContext(IStepContext remoteCtx, Object[] selections, boolean isPreferred) { + public RemoteSelectionContext(IModelNode remoteCtx, Object[] selections, boolean isPreferred) { super(selections, isPreferred); - this.stepCtx = remoteCtx; + this.remoteCtx = remoteCtx; } /* (non-Javadoc) - * @see org.eclipse.tcf.te.launch.core.selection.interfaces.IStepContextSelectionContext#getRemoteCtx() + * @see org.eclipse.tcf.te.launch.core.selection.interfaces.IRemoteSelectionContext#getRemoteCtx() */ @Override - public IStepContext getStepCtx() { - return stepCtx; + public IModelNode getRemoteCtx() { + return remoteCtx; } /* (non-Javadoc) @@ -58,8 +58,8 @@ public class StepContextSelectionContext extends AbstractSelectionContext implem public String toString() { StringBuffer toString = new StringBuffer(); - if (stepCtx != null) { - toString.append(stepCtx.toString()); + if (remoteCtx != null) { + toString.append(remoteCtx.toString()); } toString.append(toString.length() > 0 ? " " : ""); //$NON-NLS-1$ //$NON-NLS-2$ toString.append(super.toString()); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/interfaces/IStepContextSelectionContext.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/interfaces/IRemoteSelectionContext.java index 45cbe3e..df97305 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/interfaces/IStepContextSelectionContext.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/interfaces/IRemoteSelectionContext.java @@ -9,17 +9,17 @@ *******************************************************************************/ package org.eclipse.tcf.te.launch.core.selection.interfaces; -import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext; +import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode; /** - * A selection context providing the step context for the launch. + * A selection context providing the remote context for the launch. */ -public interface IStepContextSelectionContext extends ISelectionContext { +public interface IRemoteSelectionContext extends ISelectionContext { /** - * Returns the step context. + * Returns the remote context. * - * @return The step context or <code>null</code>. + * @return The remote context or <code>null</code>. */ - public IStepContext getStepCtx(); + public IModelNode getRemoteCtx(); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/AbstractLaunchStep.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/AbstractLaunchStep.java index f19061f..6d4daf0 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/AbstractLaunchStep.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/AbstractLaunchStep.java @@ -12,7 +12,7 @@ package org.eclipse.tcf.te.launch.core.steps; import org.eclipse.core.runtime.Assert;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.IContextSelectorLaunchAttributes;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
import org.eclipse.tcf.te.runtime.stepper.extensions.AbstractStep;
@@ -42,7 +42,7 @@ public abstract class AbstractLaunchStep extends AbstractStep { */
protected IModelNode getActiveLaunchContext(IPropertiesContainer data) {
Assert.isNotNull(data);
- Object context = data.getProperty(IContextSelectorLaunchAttributes.ATTR_ACTIVE_LAUNCH_CONTEXT);
+ Object context = data.getProperty(ILaunchContextLaunchAttributes.ATTR_ACTIVE_LAUNCH_CONTEXT);
Assert.isTrue(context instanceof IModelNode);
return (IModelNode)context;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/AbstractLaunchStepGroupIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/AbstractLaunchStepGroupIterator.java new file mode 100644 index 0000000..7e80338 --- a/dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/AbstractLaunchStepGroupIterator.java @@ -0,0 +1,63 @@ +/*******************************************************************************
+ * 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.steps.iterators;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
+import org.eclipse.tcf.te.runtime.extensions.ExecutableExtension;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator;
+
+/**
+ * Abstract launch stepgroup iterator.
+ */
+public abstract class AbstractLaunchStepGroupIterator extends ExecutableExtension implements IStepGroupIterator {
+
+ /**
+ * Returns the launch object for the given step context.
+ *
+ * @param context The step context.
+ * @return The launch or <code>null</code>.
+ */
+ protected ILaunch getLaunch(IStepContext context) {
+ Assert.isNotNull(context);
+ return (ILaunch)context.getAdapter(ILaunch.class);
+ }
+
+ /**
+ * Returns the active launch context model node that is currently used.
+ *
+ * @param data The data giving object. Must not be <code>null</code>.
+ * @return The active launch context model node.
+ */
+ protected IModelNode getActiveLaunchContext(IPropertiesContainer data) {
+ Assert.isNotNull(data);
+ Object context = data.getProperty(ILaunchContextLaunchAttributes.ATTR_ACTIVE_LAUNCH_CONTEXT);
+ Assert.isTrue(context instanceof IModelNode);
+ return (IModelNode)context;
+ }
+
+ /**
+ * Returns the uses launch configuration.
+ *
+ * @param context The step context.
+ * @return
+ */
+ protected ILaunchConfiguration getLaunchConfiguration(IStepContext context) {
+ ILaunch launch = getLaunch(context);
+ Assert.isNotNull(launch);
+ return launch.getLaunchConfiguration();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/META-INF/MANIFEST.MF index b45fade..112f08d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/META-INF/MANIFEST.MF @@ -21,7 +21,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0", org.eclipse.tcf.te.ui.controls;bundle-version="1.0.0",
org.eclipse.tcf.te.ui.forms;bundle-version="1.0.0",
org.eclipse.tcf.te.ui.swt;bundle-version="1.0.0",
- org.eclipse.tcf.te.ui.views;bundle-version="1.0.0"
+ org.eclipse.tcf.te.ui.views;bundle-version="1.0.0",
+ org.eclipse.tcf.te.runtime.concurrent;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/selection/LaunchSelectionManager.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/selection/LaunchSelectionManager.java index d2d4aea..cf76b37 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/selection/LaunchSelectionManager.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/selection/LaunchSelectionManager.java @@ -1,362 +1,366 @@ -/******************************************************************************* - * 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.ui.selection; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.cdt.utils.elf.Elf.Attribute; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.osgi.util.NLS; -import org.eclipse.tcf.te.core.cdt.elf.ElfUtils; -import org.eclipse.tcf.te.launch.core.selection.LaunchSelection; -import org.eclipse.tcf.te.launch.core.selection.ProjectSelectionContext; -import org.eclipse.tcf.te.launch.core.selection.StepContextSelectionContext; -import org.eclipse.tcf.te.launch.core.selection.interfaces.ILaunchSelection; -import org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext; -import org.eclipse.tcf.te.launch.ui.activator.UIPlugin; -import org.eclipse.tcf.te.launch.ui.nls.Messages; -import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode; -import org.eclipse.tcf.te.runtime.model.interfaces.IModelNodeProvider; -import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * Launch selection manager implementation. - */ -public class LaunchSelectionManager { - /** - * Part id: Target Explorer view - */ - public static final String PART_ID_TE_VIEW = "org.eclipse.tcf.te.ui.views.View"; //$NON-NLS-1$ - - /** - * Part id: Project Explorer view - */ - public static final String PART_ID_PROJECT_VIEW = "org.eclipse.ui.navigator.ProjectExplorer"; //$NON-NLS-1$ - - /** - * Part id: Debug view - */ - public static final String PART_ID_DEBUG_VIEW = "org.eclipse.debug.ui.DebugView"; //$NON-NLS-1$ - - // Remember the last remote context and project selections. - // <p> - // Some operations to determine the corresponding selection contexts may consume - // a lot of time. Avoid to redo them if not really needed. - private IStructuredSelection lastRemoteCtxInputSelection = null; - private Map<IStepContext, Set<IModelNode>> lastRemoteCtxOutputSelections = null; - private IStructuredSelection lastProjectInputSelection = null; - private long lastProjectHash = 0; - private Map<IProject, Set<IPath>> lastProjectOutputSelections = null; - - /* - * Thread save singleton instance creation. - */ - private static class LazyInstanceHolder { - public static LaunchSelectionManager instance = new LaunchSelectionManager(); - } - - /** - * Returns the singleton instance for the manager. - */ - public static LaunchSelectionManager getInstance() { - return LazyInstanceHolder.instance; - } - - /** - * Constructor. - */ - LaunchSelectionManager() { - } - - /** - * Returns a launch selection for the given launch mode and a preferred part. - * - * @param type The launch configuration type or <code>null</code>, to determine defaults. - * @param mode The launch mode to generate the launch selection for. - * @param preferredPartId The part id whose selections should be preferred. Can be <code>null</code>. - * @return A launch selection. - */ - public ILaunchSelection getLaunchSelection(ILaunchConfigurationType type, String mode, String preferredPartId) { - return new LaunchSelection(mode, getSelectionContexts(type, mode, preferredPartId)); - } - - private ISelectionContext[] getSelectionContexts(ILaunchConfigurationType type, String mode, String preferredPartId) { - List<ISelectionContext> contexts = new ArrayList<ISelectionContext>(); - - // Get the selected remote contexts - Map<IStepContext, Set<IModelNode>> remoteCtxSelections = getRemoteCtxSelections(getPartSelection(PART_ID_TE_VIEW)); - - for (IStepContext remoteCtx : remoteCtxSelections.keySet()) { - contexts.add(new StepContextSelectionContext(remoteCtx, remoteCtxSelections.get(remoteCtx).toArray(), - PART_ID_TE_VIEW.equalsIgnoreCase(preferredPartId))); - } - - // Get the selected project contexts - Map<IProject, Set<IPath>> projectSelections = getProjectSelections(getPartSelection(PART_ID_PROJECT_VIEW), true); - for (IProject prj : projectSelections.keySet()) { - contexts.add(new ProjectSelectionContext(prj, projectSelections.get(prj).toArray(), - PART_ID_PROJECT_VIEW.equalsIgnoreCase(preferredPartId))); - } - - return contexts.toArray(new ISelectionContext[contexts.size()]); - } - - /** - * Analyze the given UI selection and extract the remote context selection from it. - * - * @param structSel The UI selection or <code>null</code>. - * @return The remote context selections or an empty map. - */ - private Map<IStepContext, Set<IModelNode>> getRemoteCtxSelections(IStructuredSelection structSel) { - if (structSel != null && structSel.equals(lastRemoteCtxInputSelection) && lastRemoteCtxOutputSelections != null) { - return lastRemoteCtxOutputSelections; - } - - Map<IStepContext, Set<IModelNode>> remoteCtxSelections = new HashMap<IStepContext, Set<IModelNode>>(); - if (structSel != null && !structSel.isEmpty()) { - for (Object sel : structSel.toArray()) { - IStepContext remoteCtx = null; - IModelNode node = null; - - if (sel instanceof IModelNodeProvider) { - node = ((IModelNodeProvider)sel).getModelNode(); - } else if (sel instanceof IModelNode) { - node = (IModelNode)sel; - } - - if (node != null) { - // Adapt the selected node to an IStepContext - remoteCtx = (IStepContext)node.getAdapter(IStepContext.class); - // Adapt failed? Probably the adapter is not loaded yet? - if (remoteCtx == null) { - remoteCtx = (IStepContext)Platform.getAdapterManager().loadAdapter(node, IStepContext.class.getName()); - } - } - - Set<IModelNode> nodes; - if (remoteCtx != null) { - if (!remoteCtxSelections.containsKey(remoteCtx)) { - nodes = new HashSet<IModelNode>(); - remoteCtxSelections.put(remoteCtx, nodes); - } - else { - nodes = remoteCtxSelections.get(remoteCtx); - } - if (node != null) { - nodes.add(node); - } - } - } - } - - lastRemoteCtxInputSelection = structSel; - lastRemoteCtxOutputSelections = remoteCtxSelections; - - return lastRemoteCtxOutputSelections; - } - - /** - * Calculates a hash code based on the determined projects of - * the given UI selection. - * - * @param structSel The UI selection or <code>null</code>. - * @return The calculated hash code. - */ - private long getProjectHash(IStructuredSelection structSel) { - long hash = 0; - if (structSel != null) { - List<IProject> projects = new ArrayList<IProject>(); - for (Object sel : structSel.toArray()) { - IProject prj = null; - IResource resource = null; - - // If the selection is not an IResource itself, try to adapt to it. - // This will possibly trigger an plugin activation on loadAdapter(...). - if (sel instanceof IResource) { - resource = (IResource)sel; - } else { - resource = (IResource)Platform.getAdapterManager().loadAdapter(sel, IResource.class.getName()); - } - - // Get the project from the resource - prj = resource.getProject(); - - // If the project could be determined, add the project's - // hash code to the cumulative hash code. - if (prj != null && !projects.contains(prj)) { - projects.add(prj); - hash += prj.hashCode(); - } - } - - projects.clear(); - } - return hash; - } - - /** - * Analyze the given UI selection and extract the project selection from it. - * - * @param structSel The UI selection or <code>null</code>. - * @param storeToCache If <code>true</code> the project selection will be cached. - * - * @return The project context selection or an empty map. - */ - public Map<IProject, Set<IPath>> getProjectSelections(IStructuredSelection selection, boolean storeToCache) { - long projectHash = 0; - if (selection != null && selection.equals(lastProjectInputSelection) && - lastProjectOutputSelections != null) { - projectHash = getProjectHash(selection); - if (lastProjectHash == 0 || lastProjectHash == projectHash) { - return lastProjectOutputSelections; - } - } - - Map<IProject, Set<IPath>> projectSelections = new HashMap<IProject, Set<IPath>>(); - if (selection != null && !selection.isEmpty()) { - for (Object sel : selection.toArray()) { - IProject prj = null; - IPath location = null; - - if (sel instanceof IProject) { - prj = (IProject)sel; - } - else if (sel instanceof IFile) { - IFile file = (IFile)sel; - prj = file.getProject(); - if (getLocation(file) != null) { - File filePath = getLocation(file).toFile(); - try { - int elfType = ElfUtils.getELFType(filePath); - if (file.exists() && - (elfType == Attribute.ELF_TYPE_EXE || elfType == Attribute.ELF_TYPE_OBJ)) { - location = file.getLocation(); - } - } - catch (IOException e) { - if (Platform.inDebugMode()) { - IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), - NLS.bind(Messages.LaunchSelectionManager_error_failedToDetermineElfType, filePath.getAbsolutePath()), e); - UIPlugin.getDefault().getLog().log(status); - } - } - } - } else { - // Try to adapt the selection to an resource - IResource resource = (IResource)Platform.getAdapterManager().loadAdapter(sel, IResource.class.getName()); - if (resource != null) { - prj = resource.getProject(); - location = getLocation(resource); - if (location != null) { - try { - int elfType = ElfUtils.getELFType(location.toFile()); - if (elfType != Attribute.ELF_TYPE_EXE && elfType != Attribute.ELF_TYPE_OBJ) { - location = null; - } - } - catch (Exception e) { - if (Platform.inDebugMode()) { - IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), - NLS.bind(Messages.LaunchSelectionManager_error_failedToDetermineElfType, location.toFile().getAbsolutePath()), e); - UIPlugin.getDefault().getLog().log(status); - } - location = null; - } - } - } - } - - if (prj != null && (location == null || location.toFile().isDirectory())) { - // Try to get it from the build targets - location = getFirstExeLocation(prj); - } - - Set<IPath> nodes; - if (prj != null) { - if (!projectSelections.containsKey(prj)) { - nodes = new HashSet<IPath>(); - projectSelections.put(prj, nodes); - } - else { - nodes = projectSelections.get(prj); - } - if (location != null) { - nodes.add(location); - } - } - } - } - - if (storeToCache) { - lastProjectInputSelection = selection; - lastProjectHash = projectHash != 0 ? projectHash : getProjectHash(selection); - lastProjectOutputSelections = projectSelections; - } - - return storeToCache ? lastProjectOutputSelections : projectSelections; - } - - /** - * Get the selection of a workbench part. - * <p> - * <b>Note:</b> This method will return null if called from a non-UI thread! - * - * @param partId The part id. Must be not <code>null</code>. - * @return The structured selection if the workbench part or <code>null</code>. - */ - public static IStructuredSelection getPartSelection(String partId) { - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (partId != null && window != null && window.getActivePage() != null) { - ISelection sel = window.getActivePage().getSelection(partId); - - if (sel instanceof IStructuredSelection) { - return (IStructuredSelection)sel; - } - } - return null; - } - - /** - * Return the location on the file system of the first executable - * build-target found in the given project. Existing build-targets have - * precedence over non-existing build targets. - * - * @param prj The project. Must not be <code>null</code> - * @return IPath The first found executable or <code>null</code>. - */ - public IPath getFirstExeLocation(IProject prj) { - return null; - } - - /* - * Get the location of an IResource or null. - */ - private IPath getLocation(IResource resource) { - return (resource != null) ? resource.getLocation() : null; - } -} +/*******************************************************************************
+ * 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.ui.selection;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.cdt.utils.elf.Elf.Attribute;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.core.cdt.elf.ElfUtils;
+import org.eclipse.tcf.te.launch.core.selection.LaunchSelection;
+import org.eclipse.tcf.te.launch.core.selection.ProjectSelectionContext;
+import org.eclipse.tcf.te.launch.core.selection.RemoteSelectionContext;
+import org.eclipse.tcf.te.launch.core.selection.interfaces.ILaunchSelection;
+import org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext;
+import org.eclipse.tcf.te.launch.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.launch.ui.nls.Messages;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNodeProvider;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Launch selection manager implementation.
+ */
+public class LaunchSelectionManager {
+ /**
+ * Part id: Target Explorer view
+ */
+ public static final String PART_ID_TE_VIEW = "org.eclipse.tcf.te.ui.views.View"; //$NON-NLS-1$
+
+ /**
+ * Part id: Project Explorer view
+ */
+ public static final String PART_ID_PROJECT_VIEW = "org.eclipse.ui.navigator.ProjectExplorer"; //$NON-NLS-1$
+
+ /**
+ * Part id: Debug view
+ */
+ public static final String PART_ID_DEBUG_VIEW = "org.eclipse.debug.ui.DebugView"; //$NON-NLS-1$
+
+ // Remember the last remote context and project selections.
+ // <p>
+ // Some operations to determine the corresponding selection contexts may consume
+ // a lot of time. Avoid to redo them if not really needed.
+ private IStructuredSelection lastRemoteCtxInputSelection = null;
+ private Map<IModelNode, Set<IModelNode>> lastRemoteCtxOutputSelections = null;
+ private IStructuredSelection lastProjectInputSelection = null;
+ private long lastProjectHash = 0;
+ private Map<IProject, Set<IPath>> lastProjectOutputSelections = null;
+
+ /*
+ * Thread save singleton instance creation.
+ */
+ private static class LazyInstanceHolder {
+ public static LaunchSelectionManager instance = new LaunchSelectionManager();
+ }
+
+ /**
+ * Returns the singleton instance for the manager.
+ */
+ public static LaunchSelectionManager getInstance() {
+ return LazyInstanceHolder.instance;
+ }
+
+ /**
+ * Constructor.
+ */
+ LaunchSelectionManager() {
+ }
+
+ /**
+ * Returns a launch selection for the given launch mode and a preferred part.
+ *
+ * @param type The launch configuration type or <code>null</code>, to determine defaults.
+ * @param mode The launch mode to generate the launch selection for.
+ * @param preferredPartId The part id whose selections should be preferred. Can be <code>null</code>.
+ * @return A launch selection.
+ */
+ public ILaunchSelection getLaunchSelection(ILaunchConfigurationType type, String mode, String preferredPartId) {
+ return new LaunchSelection(mode, getSelectionContexts(type, mode, preferredPartId));
+ }
+
+ private ISelectionContext[] getSelectionContexts(ILaunchConfigurationType type, String mode, String preferredPartId) {
+ List<ISelectionContext> contexts = new ArrayList<ISelectionContext>();
+
+ // Get the selected remote contexts
+ Map<IModelNode, Set<IModelNode>> remoteCtxSelections = getRemoteCtxSelections(getPartSelection(PART_ID_TE_VIEW));
+
+ for (IModelNode remoteCtx : remoteCtxSelections.keySet()) {
+ contexts.add(new RemoteSelectionContext(remoteCtx, remoteCtxSelections.get(remoteCtx).toArray(),
+ PART_ID_TE_VIEW.equalsIgnoreCase(preferredPartId)));
+ }
+
+ // Get the selected project contexts
+ Map<IProject, Set<IPath>> projectSelections = getProjectSelections(getPartSelection(PART_ID_PROJECT_VIEW), true);
+ for (IProject prj : projectSelections.keySet()) {
+ contexts.add(new ProjectSelectionContext(prj, projectSelections.get(prj).toArray(),
+ PART_ID_PROJECT_VIEW.equalsIgnoreCase(preferredPartId)));
+ }
+
+ return contexts.toArray(new ISelectionContext[contexts.size()]);
+ }
+
+ /**
+ * Analyze the given UI selection and extract the remote context selection from it.
+ *
+ * @param structSel The UI selection or <code>null</code>.
+ * @return The remote context selections or an empty map.
+ */
+ private Map<IModelNode, Set<IModelNode>> getRemoteCtxSelections(IStructuredSelection structSel) {
+ if (structSel != null && structSel.equals(lastRemoteCtxInputSelection) && lastRemoteCtxOutputSelections != null) {
+ return lastRemoteCtxOutputSelections;
+ }
+
+ Map<IModelNode, Set<IModelNode>> remoteCtxSelections = new HashMap<IModelNode, Set<IModelNode>>();
+ if (structSel != null && !structSel.isEmpty()) {
+ for (Object sel : structSel.toArray()) {
+ IModelNode remoteCtx = null;
+ IModelNode node = null;
+
+ if (sel instanceof IModelNodeProvider) {
+ node = ((IModelNodeProvider)sel).getModelNode();
+ } else if (sel instanceof IModelNode) {
+ node = (IModelNode)sel;
+ }
+
+ if (node != null) {
+ IPropertiesAccessService service = ServiceManager.getInstance().getService(node, IPropertiesAccessService.class);
+ if (service != null) {
+ remoteCtx = node;
+ IModelNode parent = (IModelNode)service.getParent(node);
+ while (parent != null) {
+ remoteCtx = parent;
+ parent = (IModelNode)service.getParent(node);
+ }
+ }
+ }
+
+ Set<IModelNode> nodes;
+ if (remoteCtx != null) {
+ if (!remoteCtxSelections.containsKey(remoteCtx)) {
+ nodes = new HashSet<IModelNode>();
+ remoteCtxSelections.put(remoteCtx, nodes);
+ }
+ else {
+ nodes = remoteCtxSelections.get(remoteCtx);
+ }
+ if (node != null) {
+ nodes.add(node);
+ }
+ }
+ }
+ }
+
+ lastRemoteCtxInputSelection = structSel;
+ lastRemoteCtxOutputSelections = remoteCtxSelections;
+
+ return lastRemoteCtxOutputSelections;
+ }
+
+ /**
+ * Calculates a hash code based on the determined projects of
+ * the given UI selection.
+ *
+ * @param structSel The UI selection or <code>null</code>.
+ * @return The calculated hash code.
+ */
+ private long getProjectHash(IStructuredSelection structSel) {
+ long hash = 0;
+ if (structSel != null) {
+ List<IProject> projects = new ArrayList<IProject>();
+ for (Object sel : structSel.toArray()) {
+ IProject prj = null;
+ IResource resource = null;
+
+ // If the selection is not an IResource itself, try to adapt to it.
+ // This will possibly trigger an plugin activation on loadAdapter(...).
+ if (sel instanceof IResource) {
+ resource = (IResource)sel;
+ } else {
+ resource = (IResource)Platform.getAdapterManager().loadAdapter(sel, IResource.class.getName());
+ }
+
+ // Get the project from the resource
+ prj = resource.getProject();
+
+ // If the project could be determined, add the project's
+ // hash code to the cumulative hash code.
+ if (prj != null && !projects.contains(prj)) {
+ projects.add(prj);
+ hash += prj.hashCode();
+ }
+ }
+
+ projects.clear();
+ }
+ return hash;
+ }
+
+ /**
+ * Analyze the given UI selection and extract the project selection from it.
+ *
+ * @param structSel The UI selection or <code>null</code>.
+ * @param storeToCache If <code>true</code> the project selection will be cached.
+ *
+ * @return The project context selection or an empty map.
+ */
+ public Map<IProject, Set<IPath>> getProjectSelections(IStructuredSelection selection, boolean storeToCache) {
+ long projectHash = 0;
+ if (selection != null && selection.equals(lastProjectInputSelection) &&
+ lastProjectOutputSelections != null) {
+ projectHash = getProjectHash(selection);
+ if (lastProjectHash == 0 || lastProjectHash == projectHash) {
+ return lastProjectOutputSelections;
+ }
+ }
+
+ Map<IProject, Set<IPath>> projectSelections = new HashMap<IProject, Set<IPath>>();
+ if (selection != null && !selection.isEmpty()) {
+ for (Object sel : selection.toArray()) {
+ IProject prj = null;
+ IPath location = null;
+
+ if (sel instanceof IProject) {
+ prj = (IProject)sel;
+ }
+ else if (sel instanceof IFile) {
+ IFile file = (IFile)sel;
+ prj = file.getProject();
+ if (getLocation(file) != null) {
+ File filePath = getLocation(file).toFile();
+ try {
+ int elfType = ElfUtils.getELFType(filePath);
+ if (file.exists() &&
+ (elfType == Attribute.ELF_TYPE_EXE || elfType == Attribute.ELF_TYPE_OBJ)) {
+ location = file.getLocation();
+ }
+ }
+ catch (IOException e) {
+ if (Platform.inDebugMode()) {
+ IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
+ NLS.bind(Messages.LaunchSelectionManager_error_failedToDetermineElfType, filePath.getAbsolutePath()), e);
+ UIPlugin.getDefault().getLog().log(status);
+ }
+ }
+ }
+ } else {
+ // Try to adapt the selection to an resource
+ IResource resource = (IResource)Platform.getAdapterManager().loadAdapter(sel, IResource.class.getName());
+ if (resource != null) {
+ prj = resource.getProject();
+ location = getLocation(resource);
+ if (location != null) {
+ try {
+ int elfType = ElfUtils.getELFType(location.toFile());
+ if (elfType != Attribute.ELF_TYPE_EXE && elfType != Attribute.ELF_TYPE_OBJ) {
+ location = null;
+ }
+ }
+ catch (Exception e) {
+ if (Platform.inDebugMode()) {
+ IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
+ NLS.bind(Messages.LaunchSelectionManager_error_failedToDetermineElfType, location.toFile().getAbsolutePath()), e);
+ UIPlugin.getDefault().getLog().log(status);
+ }
+ location = null;
+ }
+ }
+ }
+ }
+
+ if (prj != null && (location == null || location.toFile().isDirectory())) {
+ // Try to get it from the build targets
+ location = getFirstExeLocation(prj);
+ }
+
+ Set<IPath> nodes;
+ if (prj != null) {
+ if (!projectSelections.containsKey(prj)) {
+ nodes = new HashSet<IPath>();
+ projectSelections.put(prj, nodes);
+ }
+ else {
+ nodes = projectSelections.get(prj);
+ }
+ if (location != null) {
+ nodes.add(location);
+ }
+ }
+ }
+ }
+
+ if (storeToCache) {
+ lastProjectInputSelection = selection;
+ lastProjectHash = projectHash != 0 ? projectHash : getProjectHash(selection);
+ lastProjectOutputSelections = projectSelections;
+ }
+
+ return storeToCache ? lastProjectOutputSelections : projectSelections;
+ }
+
+ /**
+ * Get the selection of a workbench part.
+ * <p>
+ * <b>Note:</b> This method will return null if called from a non-UI thread!
+ *
+ * @param partId The part id. Must be not <code>null</code>.
+ * @return The structured selection if the workbench part or <code>null</code>.
+ */
+ public static IStructuredSelection getPartSelection(String partId) {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (partId != null && window != null && window.getActivePage() != null) {
+ ISelection sel = window.getActivePage().getSelection(partId);
+
+ if (sel instanceof IStructuredSelection) {
+ return (IStructuredSelection)sel;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the location on the file system of the first executable
+ * build-target found in the given project. Existing build-targets have
+ * precedence over non-existing build targets.
+ *
+ * @param prj The project. Must not be <code>null</code>
+ * @return IPath The first found executable or <code>null</code>.
+ */
+ public IPath getFirstExeLocation(IProject prj) {
+ return null;
+ }
+
+ /*
+ * Get the location of an IResource or null.
+ */
+ private IPath getLocation(IResource resource) {
+ return (resource != null) ? resource.getLocation() : null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/META-INF/MANIFEST.MF index 69ce1fb..cc0ea9c 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/META-INF/MANIFEST.MF @@ -1,19 +1,21 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.tcf.te.runtime.services;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Activator: org.eclipse.tcf.te.runtime.services.activator.CoreBundleActivator -Bundle-Vendor: %providerName -Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0", - org.eclipse.core.expressions;bundle-version="3.4.300", - org.eclipse.tcf.te.runtime;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Bundle-ActivationPolicy: lazy -Bundle-Localization: plugin -Export-Package: org.eclipse.tcf.te.runtime.services, - org.eclipse.tcf.te.runtime.services.activator;x-internal:=true, - org.eclipse.tcf.te.runtime.services.interfaces, - org.eclipse.tcf.te.runtime.services.interfaces.constants, - org.eclipse.tcf.te.runtime.services.internal;x-internal:=true, - org.eclipse.tcf.te.runtime.services.nls;x-internal:=true +Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.tcf.te.runtime.services;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.tcf.te.runtime.services.activator.CoreBundleActivator
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.eclipse.core.expressions;bundle-version="3.4.300",
+ org.eclipse.tcf.te.runtime;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Export-Package: org.eclipse.tcf.te.runtime.services,
+ org.eclipse.tcf.te.runtime.services.activator;x-internal:=true,
+ org.eclipse.tcf.te.runtime.services.filetransfer,
+ org.eclipse.tcf.te.runtime.services.interfaces,
+ org.eclipse.tcf.te.runtime.services.interfaces.constants,
+ org.eclipse.tcf.te.runtime.services.interfaces.filetransfer,
+ org.eclipse.tcf.te.runtime.services.internal;x-internal:=true,
+ org.eclipse.tcf.te.runtime.services.nls;x-internal:=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/plugin.properties index ab8f9d5..3889458 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/plugin.properties @@ -1,12 +1,14 @@ -################################################################################## -# Copyright (c) 2011 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 -################################################################################## - -pluginName = Target Explorer, Services plug-in -providerName = Eclipse.org - TCF +##################################################################################
+# Copyright (c) 2011 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
+##################################################################################
+
+pluginName = Target Explorer, Services plug-in
+providerName = Eclipse.org - TCF
+
+ExtensionPoint.service = Service Contribution
\ No newline at end of file diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/plugin.xml index 8521aa6..56601c6 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/plugin.xml @@ -3,7 +3,7 @@ <plugin>
<!-- Extension points -->
- <extension-point id="services" name="Service Contributions" schema="schema/services.exsd"/>
+ <extension-point id="services" name="%ExtensionPoint.service" schema="schema/services.exsd"/>
<!-- Property tester contributions -->
<extension point="org.eclipse.core.expressions.propertyTesters">
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java new file mode 100644 index 0000000..5a4ef7f --- a/dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java @@ -0,0 +1,69 @@ +/*******************************************************************************
+ * 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.services.filetransfer;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
+
+/**
+ * FileTransferItem
+ */
+public class FileTransferItem extends PropertiesContainer implements IFileTransferItem {
+
+ /**
+ * Constructor.
+ */
+ public FileTransferItem() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IFileTransferItem#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ return getBooleanProperty(PROPERTY_ENABLED);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IFileTransferItem#getHostPath()
+ */
+ @Override
+ public IPath getHostPath() {
+ return new Path(getStringProperty(PROPERTY_HOST));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IFileTransferItem#getTargetPath()
+ */
+ @Override
+ public IPath getTargetPath() {
+ return new Path(getStringProperty(PROPERTY_TARGET));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IFileTransferItem#getDirection()
+ */
+ @Override
+ public int getDirection() {
+ int direction = getIntProperty(PROPERTY_DIRECTION);
+ return direction == TARGET_TO_HOST ? TARGET_TO_HOST : HOST_TO_TARGET;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IFileTransferItem#getOptions()
+ */
+ @Override
+ public String getOptions() {
+ return getStringProperty(PROPERTY_OPTIONS);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/filetransfer/IFileTransferItem.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/filetransfer/IFileTransferItem.java new file mode 100644 index 0000000..4dac74d --- a/dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/filetransfer/IFileTransferItem.java @@ -0,0 +1,58 @@ +/*******************************************************************************
+ * 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.services.interfaces.filetransfer;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+
+/**
+ * IFileTransferItem
+ */
+public interface IFileTransferItem extends IPropertiesContainer {
+
+ public static final String PROPERTY_ENABLED = "enabled"; //$NON-NLS-1$
+ public static final String PROPERTY_DIRECTION = "direction"; //$NON-NLS-1$
+ public static final String PROPERTY_HOST = "host"; //$NON-NLS-1$
+ public static final String PROPERTY_TARGET = "target"; //$NON-NLS-1$
+ public static final String PROPERTY_OPTIONS = "options"; //$NON-NLS-1$
+
+ public static final int HOST_TO_TARGET = 1;
+ public static final int TARGET_TO_HOST = 2;
+
+ /**
+ * Return <code>true</code> if the item is enabled.
+ */
+ public boolean isEnabled();
+
+ /**
+ * Return the host path. Must not be <code>null</code>.
+ * The host path needs to be a file for transfer from host to target.
+ * For a transfer from target to host, the path can be a file or directory.
+ */
+ public IPath getHostPath();
+
+ /**
+ * Return the target (remote) path. Must not be <code>null</code>.
+ * The target path needs to be a file for transfer from target to host.
+ * For a transfer from host to target, the path can be a file or directory.
+ */
+ public IPath getTargetPath();
+
+ /**
+ * Return the transfer direction.
+ */
+ public int getDirection();
+
+ /**
+ * Return the option string for the transfer or <code>null</code>.
+ */
+ public String getOptions();
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/properties/PropertiesContainer.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/properties/PropertiesContainer.java index e85c7a3..bc08a54 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/properties/PropertiesContainer.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/properties/PropertiesContainer.java @@ -131,7 +131,9 @@ public class PropertiesContainer extends PlatformObject implements IPropertiesCo @Override
public final boolean setChangeEventsEnabled(boolean enabled) {
boolean changed = changeEventsEnabled != enabled;
- if (changed) changeEventsEnabled = enabled;
+ if (changed) {
+ changeEventsEnabled = enabled;
+ }
return changed;
}
@@ -150,7 +152,9 @@ public class PropertiesContainer extends PlatformObject implements IPropertiesCo public void fireChangeEvent(String key, Object oldValue, Object newValue) {
Assert.isNotNull(key);
EventObject event = newEvent(this, key, oldValue, newValue);
- if (event != null) EventManager.getInstance().fireEvent(event);
+ if (event != null) {
+ EventManager.getInstance().fireEvent(event);
+ }
}
/**
@@ -176,10 +180,10 @@ public class PropertiesContainer extends PlatformObject implements IPropertiesCo // Log the event dropping if tracing is enabled
if (CoreBundleActivator.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_EVENTS)) {
CoreBundleActivator.getTraceHandler().trace("Drop event notification (not created change event)\n\t\t" + //$NON-NLS-1$
- "for eventId = " + key + ",\n\t\t" + //$NON-NLS-1$ //$NON-NLS-2$
- "currentValue = " + oldValue + ",\n\t\t" + //$NON-NLS-1$ //$NON-NLS-2$
- "newValue = " + newValue, //$NON-NLS-1$
- 0, ITraceIds.TRACE_EVENTS, IStatus.WARNING, this);
+ "for eventId = " + key + ",\n\t\t" + //$NON-NLS-1$ //$NON-NLS-2$
+ "currentValue = " + oldValue + ",\n\t\t" + //$NON-NLS-1$ //$NON-NLS-2$
+ "newValue = " + newValue, //$NON-NLS-1$
+ 0, ITraceIds.TRACE_EVENTS, IStatus.WARNING, this);
}
return null;
}
@@ -266,7 +270,7 @@ public class PropertiesContainer extends PlatformObject implements IPropertiesCo if (value instanceof String) {
String val = ((String)value).trim();
return "TRUE".equalsIgnoreCase(val) || "1".equals(val) || "Y".equalsIgnoreCase(val) || //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "JA".equalsIgnoreCase(val) || "YES".equalsIgnoreCase(val); //$NON-NLS-1$ //$NON-NLS-2$
+ "JA".equalsIgnoreCase(val) || "YES".equalsIgnoreCase(val); //$NON-NLS-1$ //$NON-NLS-2$
}
return false;
}
@@ -277,17 +281,17 @@ public class PropertiesContainer extends PlatformObject implements IPropertiesCo @Override
public final long getLongProperty(String key) {
Object value = getProperty(key);
- if (value instanceof Long) {
- return ((Long)value).longValue();
- }
- else if (value instanceof Integer) {
- return ((Integer)value).intValue();
- }
- else if (value != null) {
- try {
- return Long.decode(value.toString()).longValue();
+ try {
+ if (value instanceof Long) {
+ return ((Long)value).longValue();
+ }
+ if (value instanceof Number) {
+ return ((Long)value).longValue();
}
- catch (Exception e) {}
+
+ return Long.decode(value.toString()).longValue();
+ }
+ catch (Exception e) {
}
return -1;
}
@@ -299,12 +303,18 @@ public class PropertiesContainer extends PlatformObject implements IPropertiesCo public final int getIntProperty(String key) {
Object value = getProperty(key);
try {
- return value instanceof Integer ? ((Integer)value).intValue() :
- (value != null ? Integer.decode(value.toString()).intValue() : -1);
+ if (value instanceof Integer) {
+ return ((Integer)value).intValue();
+ }
+ if (value instanceof Number) {
+ return ((Number)value).intValue();
+ }
+
+ return Integer.decode(value.toString()).intValue();
}
catch (Exception e) {
- return -1;
}
+ return -1;
}
/* (non-Javadoc)
@@ -324,12 +334,18 @@ public class PropertiesContainer extends PlatformObject implements IPropertiesCo public final float getFloatProperty(String key) {
Object value = getProperty(key);
try {
- return value instanceof Float ? ((Float)value).floatValue() :
- (value != null ? Float.parseFloat(value.toString()) : Float.NaN);
+ if (value instanceof Float) {
+ return ((Float)value).floatValue();
+ }
+ if (value instanceof Number) {
+ return ((Number)value).floatValue();
+ }
+
+ return Float.parseFloat(value.toString());
}
catch (Exception e) {
- return Float.NaN;
}
+ return Float.NaN;
}
/* (non-Javadoc)
@@ -339,13 +355,18 @@ public class PropertiesContainer extends PlatformObject implements IPropertiesCo public final double getDoubleProperty(String key) {
Object value = getProperty(key);
try {
- return value instanceof Double ? ((Double)value).doubleValue() :
- (value != null ? Double.parseDouble(value.toString()) : Double.NaN);
+ if (value instanceof Double) {
+ return ((Double)value).doubleValue();
+ }
+ if (value instanceof Number) {
+ return ((Double)value).doubleValue();
+ }
+
+ return Double.parseDouble(value.toString());
}
catch (Exception e) {
- return Double.NaN;
}
-
+ return Double.NaN;
}
/* (non-Javadoc)
@@ -357,7 +378,9 @@ public class PropertiesContainer extends PlatformObject implements IPropertiesCo Assert.isNotNull(properties);
// Change the properties only if they have changed really
- if (this.properties.equals(properties)) return;
+ if (this.properties.equals(properties)) {
+ return;
+ }
// Clear out all old properties
this.properties.clear();
@@ -491,7 +514,7 @@ public class PropertiesContainer extends PlatformObject implements IPropertiesCo @Override
public boolean isEmpty() {
Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
- return properties.isEmpty();
+ return properties.isEmpty();
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/META-INF/MANIFEST.MF index e3c6458..8f2e868 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/META-INF/MANIFEST.MF @@ -1,30 +1,31 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.tcf.te.tcf.filesystem.core;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Activator: org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin -Require-Bundle: org.eclipse.core.runtime, - org.eclipse.tcf.te.tcf.locator;bundle-version="1.0.0", - org.eclipse.tcf.core;bundle-version="1.0.0", - org.eclipse.tcf.te.runtime;bundle-version="1.0.0", - org.eclipse.tcf.te.tcf.core;bundle-version="1.0.0", - org.eclipse.tcf.te.runtime.model;bundle-version="1.0.0", - org.eclipse.tcf.te.core;bundle-version="1.0.0", - org.eclipse.core.expressions;bundle-version="3.4.300", - org.eclipse.core.filesystem;bundle-version="1.3.100", - org.eclipse.tcf.te.runtime.persistence;bundle-version="1.0.0", - org.eclipse.tcf.te.runtime.services;bundle-version="1.0.0" -Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Bundle-Vendor: %providerName -Bundle-Localization: plugin -Export-Package: org.eclipse.tcf.te.tcf.filesystem.core.interfaces, - org.eclipse.tcf.te.tcf.filesystem.core.internal;x-friends:="org.eclipse.tcf.te.tests", - org.eclipse.tcf.te.tcf.filesystem.core.internal.callbacks;x-friends:="org.eclipse.tcf.te.tests", - org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions;x-friends:="org.eclipse.tcf.te.tcf.filesystem.ui,org.eclipse.tcf.te.tests", - org.eclipse.tcf.te.tcf.filesystem.core.internal.operations;x-friends:="org.eclipse.tcf.te.tcf.filesystem.ui,org.eclipse.tcf.te.tests", - org.eclipse.tcf.te.tcf.filesystem.core.internal.testers;x-friends:="org.eclipse.tcf.te.tests", - org.eclipse.tcf.te.tcf.filesystem.core.internal.url;x-friends:="org.eclipse.tcf.te.tests", - org.eclipse.tcf.te.tcf.filesystem.core.internal.utils;x-friends:="org.eclipse.tcf.te.tcf.filesystem.ui,org.eclipse.tcf.te.tests", - org.eclipse.tcf.te.tcf.filesystem.core.model +Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.tcf.te.tcf.filesystem.core;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.tcf.te.tcf.locator;bundle-version="1.0.0",
+ org.eclipse.tcf.core;bundle-version="1.0.0",
+ org.eclipse.tcf.te.runtime;bundle-version="1.0.0",
+ org.eclipse.tcf.te.tcf.core;bundle-version="1.0.0",
+ org.eclipse.tcf.te.runtime.model;bundle-version="1.0.0",
+ org.eclipse.tcf.te.core;bundle-version="1.0.0",
+ org.eclipse.core.expressions;bundle-version="3.4.300",
+ org.eclipse.core.filesystem;bundle-version="1.3.100",
+ org.eclipse.tcf.te.runtime.persistence;bundle-version="1.0.0",
+ org.eclipse.tcf.te.runtime.services;bundle-version="1.0.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Export-Package: org.eclipse.tcf.te.tcf.filesystem.core.interfaces,
+ org.eclipse.tcf.te.tcf.filesystem.core.internal;x-friends:="org.eclipse.tcf.te.tests",
+ org.eclipse.tcf.te.tcf.filesystem.core.internal.callbacks;x-friends:="org.eclipse.tcf.te.tests",
+ org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions;x-friends:="org.eclipse.tcf.te.tcf.filesystem.ui,org.eclipse.tcf.te.tests",
+ org.eclipse.tcf.te.tcf.filesystem.core.internal.operations;x-friends:="org.eclipse.tcf.te.tcf.filesystem.ui,org.eclipse.tcf.te.tests",
+ org.eclipse.tcf.te.tcf.filesystem.core.internal.testers;x-friends:="org.eclipse.tcf.te.tests",
+ org.eclipse.tcf.te.tcf.filesystem.core.internal.url;x-friends:="org.eclipse.tcf.te.tests",
+ org.eclipse.tcf.te.tcf.filesystem.core.internal.utils;x-friends:="org.eclipse.tcf.te.tcf.filesystem.ui,org.eclipse.tcf.te.tests",
+ org.eclipse.tcf.te.tcf.filesystem.core.model,
+ org.eclipse.tcf.te.tcf.filesystem.core.services
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java new file mode 100644 index 0000000..5b8e899 --- a/dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java @@ -0,0 +1,420 @@ +/******************************************************************************* + * 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.tcf.filesystem.core.services; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.ConnectException; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Status; +import org.eclipse.osgi.util.NLS; +import org.eclipse.tcf.protocol.IChannel; +import org.eclipse.tcf.protocol.IPeer; +import org.eclipse.tcf.protocol.IToken; +import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.services.IFileSystem; +import org.eclipse.tcf.services.IFileSystem.FileAttrs; +import org.eclipse.tcf.services.IFileSystem.FileSystemException; +import org.eclipse.tcf.services.IFileSystem.IFileHandle; +import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; +import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem; +import org.eclipse.tcf.te.runtime.utils.ProgressHelper; +import org.eclipse.tcf.te.runtime.utils.StatusHelper; +import org.eclipse.tcf.te.tcf.core.Tcf; +import org.eclipse.tcf.te.tcf.core.concurrent.BlockingCallProxy; +import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager; +import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel; +import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFChannelException; +import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages; +import org.eclipse.tcf.util.TCFFileInputStream; +import org.eclipse.tcf.util.TCFFileOutputStream; + +/** + * TCF file transfer service. + */ +public class FileTransferService { + + /** + * Transfer a file between host and target depending on the {@link IFileTransferItem} data. + * + * @param peer The peer. + * @param item The file transfer item. + * @param monitor The progress monitor. + * @param callback The callback. + */ + public static void transfer(IPeer peer, IFileTransferItem item, IProgressMonitor monitor, ICallback callback) { + + // Check if we can skip the transfer + if (!item.isEnabled()) { + if (callback != null) { + callback.done(peer, Status.OK_STATUS); + } + return; + } + + IFileSystem fileSystem; + try { + IChannel channel = openChannel(peer); + fileSystem = getBlockingFileSystem(channel); + } + catch (Exception e) { + if (callback != null) { + callback.done(peer, StatusHelper.getStatus(e)); + } + return; + } + + Assert.isNotNull(fileSystem); + + // Check the direction of the transfer + if (item.getDirection() == IFileTransferItem.TARGET_TO_HOST) { + transferToHost(peer, fileSystem, item, monitor, callback); + } + else { + transferToTarget(peer, fileSystem, item, monitor, callback); + } + return; + } + + protected static void transferToHost(IPeer peer, IFileSystem fileSystem, IFileTransferItem item, IProgressMonitor monitor, ICallback callback) { + + IStatus result = Status.OK_STATUS; + + IPath hostPath = item.getHostPath(); + IPath targetPath = item.getTargetPath(); + + BufferedOutputStream outStream = null; + TCFFileInputStream inStream = null; + + final IFileSystem.IFileHandle[] handle = new IFileSystem.IFileHandle[1]; + final FileSystemException[] error = new FileSystemException[1]; + final IFileSystem.FileAttrs[] attrs = new IFileSystem.FileAttrs[1]; + + item.getHostPath().removeLastSegments(1).toFile().mkdirs(); + // If the host file is a directory, append the remote file name + if (hostPath.toFile().isDirectory()) { + hostPath = item.getHostPath().append(targetPath.lastSegment()); + } + + // Remember the modification time of the remote file. + // We need this value to set the modification time of the host file + // _after_ the stream closed. + long mtime = -1; + + try { + // Open the remote file + fileSystem.open(targetPath.toString(), IFileSystem.TCF_O_READ, null, new IFileSystem.DoneOpen() { + @Override + public void doneOpen(IToken token, FileSystemException e, IFileHandle h) { + error[0] = e; + handle[0] = h; + } + }); + if (error[0] != null) { + throw error[0]; + } + // Get the remote file attributes + fileSystem.fstat(handle[0], new IFileSystem.DoneStat() { + @Override + public void doneStat(IToken token, FileSystemException e, FileAttrs a) { + error[0] = e; + attrs[0] = a; + } + }); + if (error[0] != null) { + throw error[0]; + } + // Remember the modification time + mtime = attrs[0].mtime; + + // Open a output stream to the host file + outStream = new BufferedOutputStream(new FileOutputStream(hostPath.toFile())); + // And open the input stream to the target file handle + inStream = new TCFFileInputStream(handle[0]); + + ProgressHelper.setSubTaskName(monitor, "Transfer '" + targetPath.toString() + "' to '" + hostPath.toOSString() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + long bytesTotal = attrs[0].size; + copy(inStream, outStream, bytesTotal, monitor); + } + catch (OperationCanceledException e) { + result = Status.CANCEL_STATUS; + } + catch (Exception e) { + result = StatusHelper.getStatus(e); + } + finally { + // Close all streams and cleanup + if (outStream != null) { + try { + outStream.close(); + outStream = null; + } + catch (IOException e) { + } + } + if (inStream != null) { + try { + inStream.close(); + inStream = null; + } + catch (IOException e) { + } + } + + if (result.isOK()) { + if (mtime >= 0) { + hostPath.toFile().setLastModified(mtime); + } + } + else if (result.getSeverity() == IStatus.ERROR || result.getSeverity() == IStatus.CANCEL) { + try { + hostPath.toFile().delete(); + } + catch (Throwable e) { + } + } + } + callback.done(peer, result); + } + + protected static void transferToTarget(IPeer peer, IFileSystem fileSystem, IFileTransferItem item, IProgressMonitor monitor, ICallback callback) { + + IStatus result = Status.OK_STATUS; + + IPath targetPath = item.getTargetPath(); + IPath hostPath = item.getHostPath(); + + BufferedInputStream inStream = null; + TCFFileOutputStream outStream = null; + + final IFileSystem.IFileHandle[] handle = new IFileSystem.IFileHandle[1]; + final FileSystemException[] error = new FileSystemException[1]; + final FileAttrs[] attrs = new FileAttrs[1]; + + // Check the target destination directory + fileSystem.stat(targetPath.toString(), new IFileSystem.DoneStat() { + @Override + public void doneStat(IToken token, FileSystemException e, FileAttrs a) { + error[0] = e; + attrs[0] = a; + } + }); + // If we get the attributes back, the name at least exist in the target file system + if (error[0] != null || (attrs[0] != null && attrs[0].isDirectory())) { + targetPath = targetPath.append(item.getHostPath().lastSegment()); + } + + try { + // Open the remote file + fileSystem.open(targetPath.toString(), IFileSystem.TCF_O_CREAT | IFileSystem.TCF_O_WRITE | IFileSystem.TCF_O_TRUNC, null, new IFileSystem.DoneOpen() { + @Override + public void doneOpen(IToken token, FileSystemException e, IFileHandle h) { + error[0] = e; + handle[0] = h; + } + }); + if (error[0] != null) { + throw error[0]; + } + + // Open a input stream from the host file + inStream = new BufferedInputStream(new FileInputStream(hostPath.toFile())); + // Open the output stream for the target file handle + outStream = new TCFFileOutputStream(handle[0]); + + ProgressHelper.setSubTaskName(monitor, "Transfer '" + hostPath.toOSString() + "' to '" + targetPath.toString() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + copy(inStream, outStream, hostPath.toFile().length(), monitor); + + // Get the remote file attributes + fileSystem.fstat(handle[0], new IFileSystem.DoneStat() { + @Override + public void doneStat(IToken token, FileSystemException e, FileAttrs a) { + error[0] = e; + attrs[0] = a; + } + }); + // Update the remote file attributes + IFileSystem.FileAttrs newAttrs = new FileAttrs(attrs[0].flags, attrs[0].size, attrs[0].uid, attrs[0].gid, attrs[0].permissions, + attrs[0].atime, hostPath.toFile().lastModified(), attrs[0].attributes); + // Set the remote file attributes + fileSystem.fsetstat(handle[0], newAttrs, new IFileSystem.DoneSetStat() { + @Override + public void doneSetStat(IToken token, FileSystemException e) { + error[0] = e; + } + }); + } + catch (OperationCanceledException e) { + result = Status.CANCEL_STATUS; + } + catch (Exception e) { + result = StatusHelper.getStatus(e); + } + finally { + // Close all streams and cleanup + if (outStream != null) { + try { + outStream.close(); + outStream = null; + } + catch (IOException e) { + } + } + if (inStream != null) { + try { + inStream.close(); + inStream = null; + } + catch (IOException e) { + } + } + + if (result.getSeverity() == IStatus.ERROR || result.getSeverity() == IStatus.CANCEL) { + fileSystem.remove(targetPath.toString(), null); + } + } + callback.done(peer, result); + } + + private static void copy(InputStream in, OutputStream out, long bytesTotal, IProgressMonitor monitor) throws IOException { + long bytesDone = 0; + long speed; + long startTimeStamp = System.currentTimeMillis(); + byte[] dataBuffer = new byte[12 * 1024]; + + // Copy from the input stream to the output stream (always binary). + while (true) { + if (ProgressHelper.isCanceled(monitor)) { + throw new OperationCanceledException(); + } + // Read the data from the remote file + int bytesRead = in.read(dataBuffer); + // If reached EOF, we are done and break the loop + if (bytesRead < 0) { + break; + } + if (ProgressHelper.isCanceled(monitor)) { + throw new OperationCanceledException(); + } + // Write back to the host file + out.write(dataBuffer, 0, bytesRead); + + bytesDone += bytesRead; + long timestamp = System.currentTimeMillis(); + speed = ((bytesDone) * 1000) / Math.max(timestamp - startTimeStamp, 1); + + ProgressHelper.worked(monitor, new Long((bytesRead/bytesTotal) * 1000).intValue()); + ProgressHelper.setSubTaskName(monitor, getProgressMessage(bytesDone, bytesTotal, speed)); + } + } + + protected static IChannel openChannel(final IPeer peer) throws TCFChannelException { + IChannelManager proxy = BlockingCallProxy.newInstance(IChannelManager.class, Tcf.getChannelManager()); + final TCFChannelException[] errors = new TCFChannelException[1]; + final IChannel[] channels = new IChannel[1]; + proxy.openChannel(peer, null, new DoneOpenChannel() { + @Override + public void doneOpenChannel(Throwable error, IChannel channel) { + if (error != null) { + if (error instanceof ConnectException) { + String message = NLS.bind(Messages.FSOperation_NotResponding, peer.getID()); + errors[0] = new TCFChannelException(message); + } + else { + String message = NLS.bind(Messages.OpeningChannelFailureMessage, peer.getID(), error.getLocalizedMessage()); + errors[0] = new TCFChannelException(message, error); + } + } + else { + channels[0] = channel; + } + } + }); + if (errors[0] != null) { + throw errors[0]; + } + return channels[0]; + } + + protected static IFileSystem getBlockingFileSystem(final IChannel channel) { + if(Protocol.isDispatchThread()) { + IFileSystem service = channel.getRemoteService(IFileSystem.class); + return BlockingCallProxy.newInstance(IFileSystem.class, service); + } + final IFileSystem[] service = new IFileSystem[1]; + Protocol.invokeAndWait(new Runnable(){ + @Override + public void run() { + service[0] = getBlockingFileSystem(channel); + }}); + return service[0]; + } + + private static String getProgressMessage(long bytesDone, long bytesTotal, long bytesSpeed) { + String done = "B"; //$NON-NLS-1$ + String total = "B"; //$NON-NLS-1$ + String speed = "B/s"; //$NON-NLS-1$ + + if (bytesDone > 1024) { + bytesDone /= 1024; + done = "KB"; //$NON-NLS-1$ + } + if (bytesDone > 1024) { + bytesDone /= 1024; + done = "MB"; //$NON-NLS-1$ + } + if (bytesSpeed > 1024) { + bytesSpeed /= 1024; + speed = "GB/s"; //$NON-NLS-1$ + } + + if (bytesTotal > 1024) { + bytesTotal /= 1024; + total = "KB"; //$NON-NLS-1$ + } + if (bytesTotal > 1024) { + bytesTotal /= 1024; + total = "MB"; //$NON-NLS-1$ + } + if (bytesTotal > 1024) { + bytesTotal /= 1024; + total = "GB"; //$NON-NLS-1$ + } + + if (bytesSpeed > 1024) { + bytesSpeed /= 1024; + speed = "KB/s"; //$NON-NLS-1$ + } + if (bytesSpeed > 1024) { + bytesSpeed /= 1024; + speed = "MB/s"; //$NON-NLS-1$ + } + if (bytesDone > 1024) { + bytesDone /= 1024; + done = "GB"; //$NON-NLS-1$ + } + + return bytesDone + done + " of " + bytesTotal + total + " at " + bytesSpeed + speed; //$NON-NLS-1$ //$NON-NLS-2$ + } + +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/META-INF/MANIFEST.MF new file mode 100644 index 0000000..036de8e --- a/dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/META-INF/MANIFEST.MF @@ -0,0 +1,61 @@ +Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.tcf.te.tcf.filesystem;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.tcf.te.tcf.filesystem.activator.UIPlugin
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.eclipse.ui.navigator;bundle-version="3.5.100",
+ org.eclipse.tcf.core;bundle-version="1.0.0",
+ org.eclipse.tcf.te.runtime;bundle-version="1.0.0",
+ org.eclipse.tcf.te.runtime.model;bundle-version="1.0.0",
+ org.eclipse.tcf.te.tcf.core;bundle-version="1.0.0",
+ org.eclipse.tcf.te.ui;bundle-version="1.0.0",
+ org.eclipse.tcf.te.ui.forms;bundle-version="1.0.0",
+ org.eclipse.tcf.te.ui.swt;bundle-version="1.0.0",
+ org.eclipse.tcf.te.ui.views;bundle-version="1.0.0",
+ org.eclipse.tcf.te.tcf.locator;bundle-version="1.0.0",
+ org.eclipse.core.filesystem;bundle-version="1.3.100",
+ org.eclipse.ui.ide;bundle-version="3.7.0",
+ org.eclipse.compare;bundle-version="3.5.200",
+ org.eclipse.text;bundle-version="3.5.100",
+ org.eclipse.ui.workbench.texteditor;bundle-version="3.7.0",
+ org.eclipse.core.expressions;bundle-version="3.4.300",
+ org.eclipse.tcf.te.ui.controls;bundle-version="1.0.0",
+ org.eclipse.tcf.te.tcf.ui;bundle-version="1.0.0",
+ org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.200",
+ org.eclipse.tcf.te.runtime.services;bundle-version="1.0.0",
+ org.eclipse.tcf.te.core;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Export-Package: org.eclipse.tcf.te.tcf.filesystem.activator;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.controls,
+ org.eclipse.tcf.te.tcf.filesystem.core.services,
+ org.eclipse.tcf.te.tcf.filesystem.dialogs,
+ org.eclipse.tcf.te.tcf.filesystem.filters,
+ org.eclipse.tcf.te.tcf.filesystem.help;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.interfaces,
+ org.eclipse.tcf.te.tcf.filesystem.interfaces.preferences,
+ org.eclipse.tcf.te.tcf.filesystem.internal;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.adapters;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.autosave;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.callbacks;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.celleditor;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.columns;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.compare;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.decorators;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.dnd;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.exceptions;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.handlers;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.operations;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.preferences;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.properties;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.tabbed;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.testers;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.url;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.utils;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.internal.wizards;x-internal:=true,
+ org.eclipse.tcf.te.tcf.filesystem.model,
+ org.eclipse.tcf.te.tcf.filesystem.nls;x-internal:=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/META-INF/MANIFEST.MF index 8e1d477..698cab8 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/META-INF/MANIFEST.MF @@ -19,13 +19,16 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0", org.eclipse.tcf.te.tcf.core;bundle-version="1.0.0",
org.eclipse.tcf.te.tcf.locator;bundle-version="1.0.0",
org.eclipse.tcf.te.tcf.processes.core;bundle-version="1.0.0",
- org.eclipse.tcf.te.runtime.persistence;bundle-version="1.0.0"
+ org.eclipse.tcf.te.runtime.persistence;bundle-version="1.0.0",
+ org.eclipse.tcf.te.tcf.filesystem.core;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Export-Package: org.eclipse.tcf.te.tcf.launch.core.activator;x-internal:=true,
+ org.eclipse.tcf.te.tcf.launch.core.filetransfer,
org.eclipse.tcf.te.tcf.launch.core.interfaces,
org.eclipse.tcf.te.tcf.launch.core.internal.adapters;x-internal:=true,
+ org.eclipse.tcf.te.tcf.launch.core.lm.delegates,
org.eclipse.tcf.te.tcf.launch.core.nls;x-internal:=true,
org.eclipse.tcf.te.tcf.launch.core.services,
org.eclipse.tcf.te.tcf.launch.core.steps
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.properties index de55062..8c69601 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.properties @@ -18,9 +18,11 @@ LaunchType.Remote.App.name=Remote Application # ***** Launch Step Groups *****
LaunchStepGroup.Remote.App.name=Remote Application
+LaunchStepGroup.FileTransfer.name=File Transfer
# ***** Launch Steps *****
LaunchStep.OpenChannel.name=Open TCF Channel
+LaunchStep.FileTransfer.name=Transfer File
LaunchStep.LaunchProcess.name=Launch Process
LaunchStep.CloseChannel.name=Close TCF Channel
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.xml index 842a8dd..78c065e 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.xml @@ -70,6 +70,7 @@ locked="false">
<references>
<reference id="org.eclipse.tcf.te.tcf.launch.core.openChannelStep"/>
+ <reference id="org.eclipse.tcf.te.tcf.launch.core.fileTransferStepGroup"/>
<reference id="org.eclipse.tcf.te.tcf.launch.core.launchProcessStep"/>
<reference id="org.eclipse.tcf.te.tcf.launch.core.closeChannelStep"/>
<reference id="org.eclipse.tcf.te.launch.core.removeLaunchStep">
@@ -83,26 +84,43 @@ </reference>
</references>
</stepGroup>
+ <stepGroup
+ id="org.eclipse.tcf.te.tcf.launch.core.fileTransferStepGroup"
+ label="%LaunchStepGroup.FileTransfer.name"
+ iterator="org.eclipse.tcf.te.tcf.launch.core.steps.iterators.FileTransferIterator"
+ locked="false">
+ <references>
+ <reference id="org.eclipse.tcf.te.tcf.launch.core.fileTransferStep"/>
+ </references>
+ </stepGroup>
</extension>
<!-- Launch Step contributions -->
<extension point="org.eclipse.tcf.te.runtime.stepper.steps">
<step
- class="org.eclipse.tcf.te.tcf.launch.core.steps.OpenChannelStep"
id="org.eclipse.tcf.te.tcf.launch.core.openChannelStep"
+ class="org.eclipse.tcf.te.tcf.launch.core.steps.OpenChannelStep"
label="%LaunchStep.OpenChannel.name">
</step>
<step
- class="org.eclipse.tcf.te.tcf.launch.core.steps.LaunchProcessStep"
+ id="org.eclipse.tcf.te.tcf.launch.core.fileTransferStep"
+ class="org.eclipse.tcf.te.tcf.launch.core.steps.FileTransferStep"
+ label="%LaunchStep.FileTransfer.name">
+ <requires
+ id="org.eclipse.tcf.te.tcf.launch.core.openChannelStep">
+ </requires>
+ </step>
+ <step
id="org.eclipse.tcf.te.tcf.launch.core.launchProcessStep"
+ class="org.eclipse.tcf.te.tcf.launch.core.steps.LaunchProcessStep"
label="%LaunchStep.LaunchProcess.name">
<requires
id="org.eclipse.tcf.te.tcf.launch.core.openChannelStep">
</requires>
</step>
<step
- class="org.eclipse.tcf.te.tcf.launch.core.steps.CloseChannelStep"
id="org.eclipse.tcf.te.tcf.launch.core.closeChannelStep"
+ class="org.eclipse.tcf.te.tcf.launch.core.steps.CloseChannelStep"
label="%LaunchStep.CloseChannel.name">
<requires
id="org.eclipse.tcf.te.tcf.launch.core.openChannelStep">
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/filetransfer/FileTransferItemValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/filetransfer/FileTransferItemValidator.java index 82ef470..1da6896 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/filetransfer/FileTransferItemValidator.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/filetransfer/FileTransferItemValidator.java @@ -8,7 +8,7 @@ * Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.launch.core.persistence.filetransfer;
+package org.eclipse.tcf.te.tcf.launch.core.filetransfer;
import java.io.File;
import java.util.HashMap;
@@ -17,8 +17,8 @@ import java.util.Map; import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.tcf.te.launch.core.interfaces.IFileTransferItem;
-import org.eclipse.tcf.te.launch.core.nls.Messages;
+import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
+import org.eclipse.tcf.te.tcf.launch.core.nls.Messages;
/**
* FileTransferItemValidator
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java index 905259f..b9a0593 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java @@ -17,18 +17,22 @@ import java.util.List; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.tcf.te.launch.core.interfaces.IFileTransferItem;
import org.eclipse.tcf.te.launch.core.interfaces.IReferencedProjectItem;
import org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate;
import org.eclipse.tcf.te.launch.core.lm.interfaces.IFileTransferLaunchAttributes;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
import org.eclipse.tcf.te.launch.core.lm.interfaces.IReferencedProjectLaunchAttributes;
-import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransferItem;
import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransfersPersistenceDelegate;
+import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
import org.eclipse.tcf.te.launch.core.persistence.projects.ReferencedProjectItem;
import org.eclipse.tcf.te.launch.core.persistence.projects.ReferencedProjectsPersistenceDelegate;
import org.eclipse.tcf.te.launch.core.selection.interfaces.IProjectSelectionContext;
+import org.eclipse.tcf.te.launch.core.selection.interfaces.IRemoteSelectionContext;
import org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.services.filetransfer.FileTransferItem;
+import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
/**
* RemoteAppLaunchManagerDelegate
@@ -46,6 +50,9 @@ public class RemoteAppLaunchManagerDelegate extends DefaultLaunchManagerDelegate public void initLaunchConfigAttributes(ILaunchConfigurationWorkingCopy wc, ILaunchSpecification launchSpec) {
super.initLaunchConfigAttributes(wc, launchSpec);
+ if (launchSpec.hasAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS)) {
+ wc.setAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS, (String)launchSpec.getAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS).getValue());
+ }
if (launchSpec.hasAttribute(IFileTransferLaunchAttributes.ATTR_FILE_TRANSFERS)) {
wc.setAttribute(IFileTransferLaunchAttributes.ATTR_FILE_TRANSFERS, (String)launchSpec.getAttribute(IFileTransferLaunchAttributes.ATTR_FILE_TRANSFERS).getValue());
}
@@ -58,7 +65,15 @@ public class RemoteAppLaunchManagerDelegate extends DefaultLaunchManagerDelegate protected ILaunchSpecification addLaunchSpecAttributes(ILaunchSpecification launchSpec, String launchConfigTypeId, ISelectionContext selectionContext) {
launchSpec = super.addLaunchSpecAttributes(launchSpec, launchConfigTypeId, selectionContext);
- if (selectionContext instanceof IProjectSelectionContext) {
+ if (selectionContext instanceof IRemoteSelectionContext) {
+ List<IModelNode> launchContexts = new ArrayList<IModelNode>(Arrays.asList(LaunchContextsPersistenceDelegate.getLaunchContexts(launchSpec)));
+ IModelNode remoteCtx = ((IRemoteSelectionContext)selectionContext).getRemoteCtx();
+ if (!launchContexts.contains(remoteCtx)) {
+ launchContexts.add(remoteCtx);
+ LaunchContextsPersistenceDelegate.setLaunchContexts(launchSpec, launchContexts.toArray(new IModelNode[launchContexts.size()]));
+ }
+ }
+ else if (selectionContext instanceof IProjectSelectionContext) {
List<IFileTransferItem> transfers = new ArrayList<IFileTransferItem>(Arrays.asList(FileTransfersPersistenceDelegate.getFileTransfers(launchSpec)));
List<IReferencedProjectItem> projects = new ArrayList<IReferencedProjectItem>(Arrays.asList(ReferencedProjectsPersistenceDelegate.getReferencedProjects(launchSpec)));
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.java index 3768b02..3bb5586 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.java @@ -1,32 +1,39 @@ -/******************************************************************************* - * Copyright (c) 2011 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.tcf.launch.core.nls; - -import org.eclipse.osgi.util.NLS; - -/** - * TCF Launch Core Plug-in externalized strings management. - */ -public class Messages extends NLS { - - // The plug-in resource bundle name - private static final String BUNDLE_NAME = "org.eclipse.tcf.te.tcf.launch.core.nls.Messages"; //$NON-NLS-1$ - - /** - * Static constructor. - */ - static { - // Load message values from bundle file - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - // **** Declare externalized string id's down here ***** - -} +/*******************************************************************************
+ * Copyright (c) 2011 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.tcf.launch.core.nls;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * TCF Launch Core Plug-in externalized strings management.
+ */
+public class Messages extends NLS {
+
+ // The plug-in resource bundle name
+ private static final String BUNDLE_NAME = "org.eclipse.tcf.te.tcf.launch.core.nls.Messages"; //$NON-NLS-1$
+
+ /**
+ * Static constructor.
+ */
+ static {
+ // Load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ // **** Declare externalized string id's down here *****
+
+ public static String FileTransferItemValidator_missingFile;
+ public static String FileTransferItemValidator_missingFileOrDirectory;
+ public static String FileTransferItemValidator_notExistingFile;
+ public static String FileTransferItemValidator_notExistingFileOrDirectory;
+ public static String FileTransferItemValidator_invalidFile;
+ public static String FileTransferItemValidator_invalidFileOrDirectory;
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.properties index 3913356..be0ec79 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.properties @@ -1,5 +1,12 @@ -# -# org.eclipse.tcf.te.tcf.launch.core -# Externalized Strings. -# - +#
+# org.eclipse.tcf.te.tcf.launch.core
+# Externalized Strings.
+#
+
+FileTransferItemValidator_missingFile = Missing file
+FileTransferItemValidator_missingFileOrDirectory = Missing file or directory
+FileTransferItemValidator_notExistingFile = File does not exist or is not readable
+FileTransferItemValidator_notExistingFileOrDirectory = File or directory does not exist or is not writeable
+FileTransferItemValidator_invalidFile = File is not valid
+FileTransferItemValidator_invalidFileOrDirectory = File or directory is not valid
+
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/FileTransferStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/FileTransferStep.java new file mode 100644 index 0000000..3921b53 --- a/dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/FileTransferStep.java @@ -0,0 +1,65 @@ +/*******************************************************************************
+ * 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.tcf.launch.core.steps;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.IFileTransferLaunchAttributes;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
+import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.filesystem.core.services.FileTransferService;
+import org.eclipse.tcf.te.tcf.launch.core.activator.CoreBundleActivator;
+
+/**
+ * Launch process step implementation.
+ */
+public class FileTransferStep extends AbstractTcfLaunchStep {
+
+ /**
+ * Constructor.
+ */
+ public FileTransferStep() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ Object item = StepperAttributeUtil.getProperty(IFileTransferLaunchAttributes.ATTR_ACTIVE_FILE_TRANSFER, fullQualifiedId, data);
+ if (!(item instanceof IFileTransferItem)) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing file transfer item")); //$NON-NLS-1$
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) {
+ IFileTransferItem item = (IFileTransferItem)StepperAttributeUtil.getProperty(IFileTransferLaunchAttributes.ATTR_ACTIVE_FILE_TRANSFER, fullQualifiedId, data);
+
+ FileTransferService.transfer(getActivePeerModel(data).getPeer(), item, monitor, callback);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.extensions.AbstractStep#getTotalWork(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public int getTotalWork(IStepContext context, IPropertiesContainer data) {
+ return 1000;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/AbstractTcfLaunchStepGroupIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/AbstractTcfLaunchStepGroupIterator.java new file mode 100644 index 0000000..0660b25 --- a/dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/AbstractTcfLaunchStepGroupIterator.java @@ -0,0 +1,36 @@ +/*******************************************************************************
+ * 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.tcf.launch.core.steps.iterators;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.te.launch.core.steps.iterators.AbstractLaunchStepGroupIterator;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+
+
+/**
+ * AbstractTcfLaunchStepGroupIterator
+ */
+public abstract class AbstractTcfLaunchStepGroupIterator extends AbstractLaunchStepGroupIterator {
+
+ /**
+ * Returns the active peer model that is currently used.
+ *
+ * @param data The data giving object. Must not be <code>null</code>.
+ * @return The active peer model.
+ */
+ protected IPeerModel getActivePeerModel(IPropertiesContainer data) {
+ IModelNode node = getActiveLaunchContext(data);
+ Assert.isTrue(node instanceof IPeerModel);
+ return (IPeerModel)node;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/FileTransferIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/FileTransferIterator.java new file mode 100644 index 0000000..6054233 --- a/dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/FileTransferIterator.java @@ -0,0 +1,79 @@ +/*******************************************************************************
+ * 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.tcf.launch.core.steps.iterators;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.IFileTransferLaunchAttributes;
+import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransfersPersistenceDelegate;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
+import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.launch.core.activator.CoreBundleActivator;
+
+/**
+ * Step group iterator for file transfer.
+ */
+public class FileTransferIterator extends AbstractTcfLaunchStepGroupIterator {
+
+ private IFileTransferItem[] items = null;
+ private int iteration = -1;
+
+ /**
+ * Constructor.
+ */
+ public FileTransferIterator() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#initialize(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) {
+ items = FileTransfersPersistenceDelegate.getFileTransfers(getLaunchConfiguration(context));
+ iteration = 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#getNumIterations()
+ */
+ @Override
+ public int getNumIterations() {
+ return items != null ? items.length : 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#hasNext(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public boolean hasNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) {
+ return iteration < getNumIterations();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#next(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void next(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ if (iteration < 0) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "iterator not initialized")); //$NON-NLS-1$
+ }
+ if (iteration >= getNumIterations()) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "no more iterations")); //$NON-NLS-1$
+ }
+ StepperAttributeUtil.setProperty(IFileTransferLaunchAttributes.ATTR_ACTIVE_FILE_TRANSFER, fullQualifiedId, data, items[iteration++]);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF index 5b5f09e..38ac541 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF @@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0", org.eclipse.tcf.te.tcf.processes.core;bundle-version="1.0.0",
org.eclipse.tcf.te.ui.controls;bundle-version="1.0.0",
org.eclipse.tcf.te.runtime.model;bundle-version="1.0.0",
- org.eclipse.tcf.te.tcf.filesystem.core;bundle-version="1.0.0"
+ org.eclipse.tcf.te.tcf.filesystem.core;bundle-version="1.0.0",
+ org.eclipse.tcf.te.runtime.services;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/filetransfer/AddEditFileTransferDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/filetransfer/AddEditFileTransferDialog.java index 1e0a5e9..271b257 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/filetransfer/AddEditFileTransferDialog.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/filetransfer/AddEditFileTransferDialog.java @@ -30,13 +30,13 @@ import org.eclipse.swt.widgets.DirectoryDialog; import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.te.launch.core.interfaces.IFileTransferItem;
-import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransferItem;
-import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransferItemValidator;
import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.services.filetransfer.FileTransferItem;
+import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
import org.eclipse.tcf.te.tcf.filesystem.ui.dialogs.FSFolderSelectionDialog;
import org.eclipse.tcf.te.tcf.filesystem.ui.dialogs.FSOpenFileDialog;
+import org.eclipse.tcf.te.tcf.launch.core.filetransfer.FileTransferItemValidator;
import org.eclipse.tcf.te.tcf.launch.ui.nls.Messages;
import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
import org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/filetransfer/FileTransferSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/filetransfer/FileTransferSection.java index a65416a..c177e3d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/filetransfer/FileTransferSection.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/filetransfer/FileTransferSection.java @@ -54,13 +54,13 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.tcf.te.launch.core.interfaces.IFileTransferItem;
-import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransferItem;
-import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransferItemValidator;
import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransfersPersistenceDelegate;
import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
import org.eclipse.tcf.te.launch.ui.interfaces.ILaunchConfigurationTabFormPart;
import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.services.filetransfer.FileTransferItem;
+import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
+import org.eclipse.tcf.te.tcf.launch.core.filetransfer.FileTransferItemValidator;
import org.eclipse.tcf.te.tcf.launch.ui.nls.Messages;
import org.eclipse.tcf.te.ui.forms.parts.AbstractTableSection;
import org.eclipse.tcf.te.ui.swt.listener.AbstractDecorationCellPaintListener;
|

