diff options
author | Uwe Stieber | 2014-07-08 10:55:23 +0000 |
---|---|---|
committer | Uwe Stieber | 2014-07-08 10:55:23 +0000 |
commit | e29b92ea344912e1c26865e950a2e90e133dd6cb (patch) | |
tree | ba809d370caf9328b99aebce0ccb267a2c7afbb4 /target_explorer | |
parent | a9a1e47ae6d7f003232450c82cf413c2e2b6deca (diff) | |
download | org.eclipse.tcf-e29b92ea344912e1c26865e950a2e90e133dd6cb.tar.gz org.eclipse.tcf-e29b92ea344912e1c26865e950a2e90e133dd6cb.tar.xz org.eclipse.tcf-e29b92ea344912e1c26865e950a2e90e133dd6cb.zip |
Reworked: Target Explorer: add steps for channel manager rework
Diffstat (limited to 'target_explorer')
37 files changed, 740 insertions, 68 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/AbstractItemListXMLParser.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/AbstractItemListXMLParser.java index 809233741..48b60910e 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/AbstractItemListXMLParser.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/AbstractItemListXMLParser.java @@ -155,7 +155,8 @@ public abstract class AbstractItemListXMLParser<ItemType> extends DefaultHandler IPersistenceDelegate delegate = PersistenceManager.getInstance().getDelegate(clazz, lastData); if (delegate != null) { try { - ItemType item = (ItemType)delegate.read(getReadClass(), lastData); + @SuppressWarnings("unchecked") + ItemType item = (ItemType)delegate.read(getReadClass(), lastData); if (items != null && !items.contains(item)) { items.add(item); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/filetransfers/AbstractFileTransferSection.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/filetransfers/AbstractFileTransferSection.java index 1f74c70f0..b90cf6e2a 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/filetransfers/AbstractFileTransferSection.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/filetransfers/AbstractFileTransferSection.java @@ -187,7 +187,8 @@ public abstract class AbstractFileTransferSection extends AbstractTableSection i colHost.setText(Messages.FileTransferSection_host_column); colHost.setResizable(true); tvHostCol.setLabelProvider(new ColumnLabelProvider() { - @Override + @SuppressWarnings("unchecked") + @Override public String getToolTipText(Object element) { if (element instanceof IFileTransferItem) { IFileTransferItem item = (IFileTransferItem)element; @@ -282,7 +283,8 @@ public abstract class AbstractFileTransferSection extends AbstractTableSection i colTarget.setText(Messages.FileTransferSection_target_column); colTarget.setResizable(true); tvTargetCol.setLabelProvider(new ColumnLabelProvider() { - @Override + @SuppressWarnings("unchecked") + @Override public String getToolTipText(Object element) { if (element instanceof IFileTransferItem) { IFileTransferItem item = (IFileTransferItem)element; @@ -379,7 +381,8 @@ public abstract class AbstractFileTransferSection extends AbstractTableSection i @SuppressWarnings("unused") AbstractDecorationCellPaintListener cpl = new AbstractDecorationCellPaintListener(table, 1, 3) { - @Override + @SuppressWarnings("unchecked") + @Override protected int getDecorationState(Object data, int columnIndex) { if (data instanceof IFileTransferItem) { IFileTransferItem item = (IFileTransferItem)data; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/refprojects/RefProjectsSection.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/refprojects/RefProjectsSection.java index 9afef7ccd..92373d72d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/refprojects/RefProjectsSection.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/refprojects/RefProjectsSection.java @@ -199,7 +199,8 @@ public class RefProjectsSection extends AbstractTableSection implements ILaunchC colProject.setText(Messages.ReferencedProjectsSection_name_column); colProject.setResizable(true); tvProjectCol.setLabelProvider(new ColumnLabelProvider() { - @Override + @SuppressWarnings("unchecked") + @Override public String getToolTipText(Object element) { if (element instanceof IReferencedProjectItem) { IReferencedProjectItem item = (IReferencedProjectItem)element; @@ -241,7 +242,8 @@ public class RefProjectsSection extends AbstractTableSection implements ILaunchC @SuppressWarnings("unused") AbstractDecorationCellPaintListener cpl = new AbstractDecorationCellPaintListener(table, 1) { - @Override + @SuppressWarnings("unchecked") + @Override protected int getDecorationState(Object data, int columnIndex) { if (data instanceof IReferencedProjectItem) { IReferencedProjectItem item = (IReferencedProjectItem)data; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/internal/factory/FactoryDelegateProxy.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/internal/factory/FactoryDelegateProxy.java index 998b7df8f..f053c434d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/internal/factory/FactoryDelegateProxy.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/internal/factory/FactoryDelegateProxy.java @@ -91,7 +91,8 @@ public class FactoryDelegateProxy extends ExecutableExtensionProxy<IFactoryDeleg if (bundle == null) bundle = CoreBundleActivator.getContext().getBundle(); // Try to load the node type class now. - Class<? extends IModelNode> typeClass = (Class<? extends IModelNode>)(bundle != null ? bundle.loadClass(type) : Class.forName(type)); + @SuppressWarnings("unchecked") + Class<? extends IModelNode> typeClass = (Class<? extends IModelNode>)(bundle != null ? bundle.loadClass(type) : Class.forName(type)); this.nodeTypes.add(typeClass); } catch (Exception e) { diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java index 05e8acd71..b40acb181 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java @@ -216,7 +216,8 @@ public class GsonMapPersistenceDelegate extends ExecutableExtension implements I return read(context, container, false); } - private Object read(Object context, Object container, boolean isList) throws IOException { + @SuppressWarnings("unchecked") + private Object read(Object context, Object container, boolean isList) throws IOException { Assert.isNotNull(container); // Gson gson = new GsonBuilder().enableComplexMapKeySerialization().create(); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/history/HistoryManager.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/history/HistoryManager.java index 3e29fe54c..fd5a1eaaf 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/history/HistoryManager.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/history/HistoryManager.java @@ -60,7 +60,8 @@ public class HistoryManager { /** * Initialize the history manager. */ - private void initialize() { + @SuppressWarnings("unchecked") + private void initialize() { history.clear(); try { // Get the persistence service diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/StepperAttributeUtil.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/StepperAttributeUtil.java index 798836236..0ef68d438 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/StepperAttributeUtil.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/StepperAttributeUtil.java @@ -147,8 +147,7 @@ public class StepperAttributeUtil { * @param fullQualifiedId The full qualified id for this step. * @param data The data. * @param value The new value. - * @param share When <code>true</code>, the value is also stored within the parent full - * qualified id to share the value with other steps within the same parent (group). + * @param share If <code>true</code>, the value is also stored without the full qualified id. * @return <code>true</code> if the value was set. */ public final static boolean setProperty(String key, IFullQualifiedId fullQualifiedId, IPropertiesContainer data, Object value, boolean share) { @@ -182,8 +181,7 @@ public class StepperAttributeUtil { * @param fullQualifiedId The full qualified id for this step. * @param data The data. * @param value The new boolean value. - * @param share When <code>true</code>, the value is also stored within the parent full - * qualified id to share the value with other steps within the same parent (group). + * @param share If <code>true</code>, the value is also stored without the full qualified id. * @return <code>true</code> if the value was set. */ public final static boolean setProperty(String key, IFullQualifiedId fullQualifiedId, IPropertiesContainer data, boolean value, boolean share) { @@ -191,7 +189,7 @@ public class StepperAttributeUtil { Assert.isNotNull(data); if (share && fullQualifiedId != null) { - data.setProperty(getFullQualifiedKey(key, fullQualifiedId.getParentId(), data), value); + data.setProperty(getFullQualifiedKey(key, null, data), value); } return data.setProperty(getFullQualifiedKey(key, fullQualifiedId, data), value); } @@ -217,8 +215,7 @@ public class StepperAttributeUtil { * @param fullQualifiedId The full qualified id for this step. * @param data The data. * @param value The new int value. - * @param share When <code>true</code>, the value is also stored within the parent full - * qualified id to share the value with other steps within the same parent (group). + * @param share If <code>true</code>, the value is also stored without the full qualified id. * @return <code>true</code> if the value was set. */ public final static boolean setProperty(String key, IFullQualifiedId fullQualifiedId, IPropertiesContainer data, int value, boolean share) { @@ -226,7 +223,7 @@ public class StepperAttributeUtil { Assert.isNotNull(data); if (share && fullQualifiedId != null) { - data.setProperty(getFullQualifiedKey(key, fullQualifiedId.getParentId(), data), value); + data.setProperty(getFullQualifiedKey(key, null, data), value); } return data.setProperty(getFullQualifiedKey(key, fullQualifiedId, data), value); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/job/StepperJob.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/job/StepperJob.java index f3df21e69..e6c3d16c9 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/job/StepperJob.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/job/StepperJob.java @@ -167,6 +167,7 @@ public final class StepperJob extends Job { setJobs(jobs, stepContext.getContextObject()); } + @SuppressWarnings("unchecked") public static Map<String,List<Job>> getJobs(Object context) { IPropertiesAccessService service = ServiceManager.getInstance().getService(context, IPropertiesAccessService.class); Map<String,List<Job>> jobs = null; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/extensions/ExecutableExtensionProxy.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/extensions/ExecutableExtensionProxy.java index 5530d6b34..a88c93b11 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/extensions/ExecutableExtensionProxy.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/extensions/ExecutableExtensionProxy.java @@ -116,7 +116,8 @@ public class ExecutableExtensionProxy<V> { * * @return A new extension class instance or <code>null</code> if the instantiation fails. */ - public V newInstance() { + @SuppressWarnings("unchecked") + public V newInstance() { IConfigurationElement element = getConfigurationElement(); Assert.isNotNull(element); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF index 03631e48c..6dd2a83d0 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF @@ -36,6 +36,7 @@ Export-Package: org.eclipse.tcf.te.tcf.core, org.eclipse.tcf.te.tcf.core.nls;x-internal:=true, org.eclipse.tcf.te.tcf.core.peers, org.eclipse.tcf.te.tcf.core.steps, + org.eclipse.tcf.te.tcf.core.steps.internal;x-internal:=true, org.eclipse.tcf.te.tcf.core.streams, org.eclipse.tcf.te.tcf.core.util, org.eclipse.tcf.te.tcf.core.util.persistence, diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml index 5adce2509..c0aaa661a 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml @@ -19,7 +19,7 @@ </service> </extension> -<!-- Launch Step contributions --> +<!-- Step contributions --> <extension point="org.eclipse.tcf.te.runtime.stepper.steps"> <step id="org.eclipse.tcf.te.tcf.core.openChannelStep" @@ -35,6 +35,65 @@ id="org.eclipse.tcf.te.tcf.core.shutDownStep" class="org.eclipse.tcf.te.tcf.core.steps.ShutDownStep" label="%ShutDownStep.name"/> + + <step + id="org.eclipse.tcf.te.tcf.core.internal.launchValueAddStep" + class="org.eclipse.tcf.te.tcf.core.steps.internal.LaunchValueAddStep" + label="%LaunchValueAddStep.name"/> + <step + id="org.eclipse.tcf.te.tcf.core.internal.chainPeerStep" + class="org.eclipse.tcf.te.tcf.core.steps.internal.ChainPeerStep" + label="%ChainPeerStep.name"/> + <step + id="org.eclipse.tcf.te.tcf.core.internal.applyPathMapsStep" + class="org.eclipse.tcf.te.tcf.core.steps.internal.ApplyPathMapsStep" + label="%ApplyPatMapsStep.name"/> + <step + id="org.eclipse.tcf.te.tcf.core.internal.closeChannelStep" + class="org.eclipse.tcf.te.tcf.core.steps.internal.CloseChannelStep" + label="%CloseChannelStep.name"/> + <step + id="org.eclipse.tcf.te.tcf.core.internal.shutdownValueAddsStepGroup" + class="org.eclipse.tcf.te.tcf.core.steps.internal.ShutdownValueAddStep" + label="%ShutdownValueAddStep.name"/> + </extension> +<!-- Step contributions --> + <extension point="org.eclipse.tcf.te.runtime.stepper.stepGroups"> + <stepGroup id="org.eclipse.tcf.te.tcf.core.openChannelStepGroup"> + <references> + <reference id="org.eclipse.tcf.te.tcf.core.launchValueAddsStepGroup"/> + <reference id="org.eclipse.tcf.te.tcf.core.chainPeersStepGroup"/> + <reference id="org.eclipse.tcf.te.tcf.core.internal.applyPathMapsStep"/> + </references> + </stepGroup> + <stepGroup id="org.eclipse.tcf.te.tcf.core.internal.launchValueAddsStepGroup" + iterator="org.eclipse.tcf.te.tcf.core.iterators.ValueAddsIterator"> + <references> + <reference id="org.eclipse.tcf.te.tcf.core.internal.launchValueAddStep"/> + </references> + </stepGroup> + <stepGroup id="org.eclipse.tcf.te.tcf.core.internal.chainPeersStepGroup" + iterator="org.eclipse.tcf.te.tcf.core.iterators.ChainPeersIterator"> + <references> + <reference id="org.eclipse.tcf.te.tcf.core.internal.chainPeerStep"/> + </references> + </stepGroup> + + + <stepGroup id="org.eclipse.tcf.te.tcf.core.closeChannelStepGroup"> + <references> + <reference id="org.eclipse.tcf.te.tcf.core.internal.closeChannelStep"/> + <reference id="org.eclipse.tcf.te.tcf.core.shutdownValueAddsStepGroup"/> + </references> + </stepGroup> + <stepGroup id="org.eclipse.tcf.te.tcf.core.internal.shutdownValueAddsStepGroup" + iterator="org.eclipse.tcf.te.tcf.core.iterators.ValueAddsIterator"> + <references> + <reference id="org.eclipse.tcf.te.tcf.core.internal.shutdownValueAddStep"/> + </references> + </stepGroup> + </extension> + </plugin> diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/steps/ITcfStepAttributes.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/steps/ITcfStepAttributes.java index 86a2ae520..5258a52bf 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/steps/ITcfStepAttributes.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/steps/ITcfStepAttributes.java @@ -21,12 +21,18 @@ public interface ITcfStepAttributes { public static final String ATTR_PREFIX = "org.eclipse.tcf.te.tcf.locator"; //$NON-NLS-1$ /** - * Launch configuration attribute: The TCF channel. + * Step attribute: The TCF channel. */ public static final String ATTR_CHANNEL = ITcfStepAttributes.ATTR_PREFIX + ".channel"; //$NON-NLS-1$ /** - * Launch configuration attribute: The token for a running TCF command. + * Step attribute: The token for a running TCF command. */ public static final String ATTR_RUNNING_TOKEN = ITcfStepAttributes.ATTR_PREFIX + ".running_token"; //$NON-NLS-1$ + + /** + * Step attribute: The value add. + */ + public static final String ATTR_VALUE_ADD = ITcfStepAttributes.ATTR_PREFIX + ".value_add"; //$NON-NLS-1$ + } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/ChainPeersIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/ChainPeersIterator.java new file mode 100644 index 000000000..6355634e4 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/ChainPeersIterator.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2014 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.core.iterators; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.tcf.protocol.IPeer; +import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; +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.IStepAttributes; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext; +import org.eclipse.tcf.te.tcf.core.interfaces.IPeerProperties; +import org.eclipse.tcf.te.tcf.core.util.persistence.PeerDataHelper; +import org.eclipse.tcf.te.tcf.core.va.ValueAddManager; +import org.eclipse.tcf.te.tcf.core.va.interfaces.IValueAdd; + +/** + * ChainPeersIterator + */ +public class ChainPeersIterator extends AbstractPeerStepGroupIterator { + + private final List<IPeer> peers = new ArrayList<IPeer>(); + + /** + * Constructor. + */ + public ChainPeersIterator() { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator#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) throws CoreException { + super.initialize(context, data, fullQualifiedId, monitor); + + final IPeer peer = getActivePeerContext(context, data, fullQualifiedId); + final String peerId = peer.getID(); + + IValueAdd[] valueAdds = ValueAddManager.getInstance().getValueAdd(peer); + for (IValueAdd valueAdd : valueAdds) { + IPeer valueAddPeer = valueAdd.getPeer(peerId); + if (valueAddPeer != null) { + peers.add(valueAddPeer); + } + } + + String proxyConfiguration = peer.getAttributes().get(IPeerProperties.PROP_PROXIES); + IPeer[] proxies = proxyConfiguration != null ? PeerDataHelper.decodePeerList(proxyConfiguration) : null; + + for (IPeer proxy : proxies) { + peers.add(proxy); + } + peers.add(peer); + + setIterations(peers.size()); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator#internalNext(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 internalNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException { + StepperAttributeUtil.setProperty(IStepAttributes.ATTR_ACTIVE_CONTEXT, fullQualifiedId, data, peers.get(getIteration())); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/ValueAddsIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/ValueAddsIterator.java new file mode 100644 index 000000000..066264b4d --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/ValueAddsIterator.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2014 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.core.iterators; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; +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.core.interfaces.steps.ITcfStepAttributes; +import org.eclipse.tcf.te.tcf.core.va.ValueAddManager; +import org.eclipse.tcf.te.tcf.core.va.interfaces.IValueAdd; + +/** + * ValueAddsIterator + */ +public class ValueAddsIterator extends AbstractPeerStepGroupIterator { + + private IValueAdd[] valueAdds = null; + + /** + * Constructor. + */ + public ValueAddsIterator() { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator#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) throws CoreException { + super.initialize(context, data, fullQualifiedId, monitor); + + valueAdds = ValueAddManager.getInstance().getValueAdd(getActivePeerContext(context, data, fullQualifiedId)); + + setIterations(valueAdds != null ? valueAdds.length : 0); + + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator#internalNext(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 internalNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException { + StepperAttributeUtil.setProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data, valueAdds[getIteration()]); + } + +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/CloseChannelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/CloseChannelStep.java index 0aa87b5cd..c33878b5c 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/CloseChannelStep.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/CloseChannelStep.java @@ -48,6 +48,6 @@ public class CloseChannelStep extends AbstractPeerStep { if (channel != null && channel.getState() != IChannel.STATE_CLOSED) { Tcf.getChannelManager().closeChannel(channel); } - callback.done(this, Status.OK_STATUS); + callback(data, fullQualifiedId, callback, Status.OK_STATUS, null); } } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/OpenChannelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/OpenChannelStep.java index bc90bcba7..7c07759ce 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/OpenChannelStep.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/OpenChannelStep.java @@ -51,7 +51,7 @@ public class OpenChannelStep extends AbstractPeerStep { @Override public void doneOpenChannel(final Throwable error, final IChannel channel) { StepperAttributeUtil.setProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId.getParentId(), data, channel); - callback.done(OpenChannelStep.this, StatusHelper.getStatus(error)); + callback(data, fullQualifiedId, callback, StatusHelper.getStatus(error), null); } }); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/ShutDownStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/ShutDownStep.java index 03eaa4e1a..cbdb61f46 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/ShutDownStep.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/ShutDownStep.java @@ -48,6 +48,6 @@ public class ShutDownStep extends AbstractPeerStep { Tcf.getChannelManager().shutdown(getActivePeerContext(context, data, fullQualifiedId)); } }); - callback.done(this, Status.OK_STATUS); + callback(data, fullQualifiedId, callback, Status.OK_STATUS, null); } } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ApplyPathMapsStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ApplyPathMapsStep.java new file mode 100644 index 000000000..93af0ed0b --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ApplyPathMapsStep.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2014 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.core.steps.internal; + +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.protocol.IChannel; +import org.eclipse.tcf.protocol.IPeer; +import org.eclipse.tcf.services.IPathMap; +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.ServiceManager; +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.core.activator.CoreBundleActivator; +import org.eclipse.tcf.te.tcf.core.interfaces.IPathMapService; +import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes; +import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep; + +/** + * ApplyPathMapsStep + */ +public class ApplyPathMapsStep extends AbstractPeerStep { + + /** + * Constructor. + */ + public ApplyPathMapsStep() { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#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 { + IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data); + if (channel == null || channel.getState() != IChannel.STATE_OPEN) { + throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing TCF channel")); //$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) { + final IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data); + final IPeer peer = getActivePeerContext(context, data, fullQualifiedId); + final IPathMapService service = ServiceManager.getInstance().getService(peer, IPathMapService.class); + final IPathMap svc = channel.getRemoteService(IPathMap.class); + if (service != null && svc != null) { + // Apply the initial path map to the opened channel. + // This must happen outside the TCF dispatch thread as it may trigger + // the launch configuration change listeners. + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + service.applyPathMap(peer, true, callback); + } + }); + thread.start(); + } else { + callback(data, fullQualifiedId, callback, Status.OK_STATUS, null); + } + } + +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ChainPeerStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ChainPeerStep.java new file mode 100644 index 000000000..2b03e5294 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ChainPeerStep.java @@ -0,0 +1,96 @@ +/******************************************************************************* + * Copyright (c) 2014 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.core.steps.internal; + +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.protocol.IChannel; +import org.eclipse.tcf.protocol.IPeer; +import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; +import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; +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.runtime.utils.StatusHelper; +import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes; +import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep; + +/** + * ChainPeerStep + */ +public class ChainPeerStep extends AbstractPeerStep { + + /** + * Constructor. + */ + public ChainPeerStep() { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#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 { + } + + /* (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, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) { + IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data); + final IPeer peer = getActivePeerContext(context, data, fullQualifiedId); + + if (channel == null) { + channel = peer.openChannel(); + } + else { + channel.redirect(peer.getAttributes()); + } + + final IChannel finChannel = channel; + channel.addChannelListener(new IChannel.IChannelListener() { + @Override + public void onChannelOpened() { + finChannel.removeChannelListener(this); + StepperAttributeUtil.setProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data, finChannel, true); + callback(data, fullQualifiedId, callback, Status.OK_STATUS, null); + } + + @Override + public void onChannelClosed(Throwable error) { + // Remove ourself as listener from the channel + finChannel.removeChannelListener(this); + callback(data, fullQualifiedId, callback, StatusHelper.getStatus(error), null); + } + + @Override + public void congestionLevel(int level) { + } + }); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.steps.AbstractStep#rollback(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.core.runtime.IStatus, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback) + */ + @Override + public void rollback(IStepContext context, IPropertiesContainer data, IStatus status, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) { + IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data); + + if (channel != null && channel.getState() != IChannel.STATE_CLOSED) { + channel.close(); + } + + super.rollback(context, data, status, fullQualifiedId, monitor, callback); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/CloseChannelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/CloseChannelStep.java new file mode 100644 index 000000000..715bcc8f8 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/CloseChannelStep.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2014 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.core.steps.internal; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Status; +import org.eclipse.tcf.protocol.IChannel; +import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; +import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; +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.core.interfaces.steps.ITcfStepAttributes; +import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep; + +/** + * Close channel step implementation. + */ +public class CloseChannelStep extends AbstractPeerStep { + + /** + * Constructor. + */ + public CloseChannelStep() { + } + + /* (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 { + } + + /* (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, ICallback callback) { + IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data); + if (channel != null && channel.getState() != IChannel.STATE_CLOSED) { + channel.close(); + } + callback(data, fullQualifiedId, callback, Status.OK_STATUS, null); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/LaunchValueAddStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/LaunchValueAddStep.java new file mode 100644 index 000000000..593153476 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/LaunchValueAddStep.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2014 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.core.steps.internal; + +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.runtime.callback.Callback; +import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; +import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; +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.core.activator.CoreBundleActivator; +import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes; +import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep; +import org.eclipse.tcf.te.tcf.core.va.interfaces.IValueAdd; + +/** + * LaunchValueAddStep + */ +public class LaunchValueAddStep extends AbstractPeerStep { + + /** + * Constructor. + */ + public LaunchValueAddStep() { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#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 { + IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data); + if (valueAdd == null) { + throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing value add channel")); //$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, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) { + final IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data); + final String peerId = getActivePeerContext(context, data, fullQualifiedId).getID(); + valueAdd.isAlive(peerId, new Callback() { + @Override + protected void internalDone(Object caller, IStatus status) { + boolean alive = ((Boolean)getResult()).booleanValue(); + + if (!alive) { + valueAdd.launch(peerId, callback); + } + else { + callback(data, fullQualifiedId, callback, Status.OK_STATUS, null); + } + } + }); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.steps.AbstractStep#rollback(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.core.runtime.IStatus, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback) + */ + @Override + public void rollback(IStepContext context, IPropertiesContainer data, IStatus status, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) { + final IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data); + final String peerId = getActivePeerContext(context, data, fullQualifiedId).getID(); + + valueAdd.shutdown(peerId, callback); + + super.rollback(context, data, status, fullQualifiedId, monitor, callback); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ShutdownValueAddStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ShutdownValueAddStep.java new file mode 100644 index 000000000..c333ed43c --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/internal/ShutdownValueAddStep.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2014 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.core.steps.internal; + +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.runtime.interfaces.callback.ICallback; +import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; +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.core.activator.CoreBundleActivator; +import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes; +import org.eclipse.tcf.te.tcf.core.steps.AbstractPeerStep; +import org.eclipse.tcf.te.tcf.core.va.interfaces.IValueAdd; + +/** + * ShutdownValueAddStep + */ +public class ShutdownValueAddStep extends AbstractPeerStep { + + /** + * Constructor. + */ + public ShutdownValueAddStep() { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#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 { + IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data); + if (valueAdd == null) { + throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing value add channel")); //$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, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) { + final IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data); + final String peerId = getActivePeerContext(context, data, fullQualifiedId).getID(); + + valueAdd.shutdown(peerId, callback); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml index 7fb76c053..b6ddf7a2a 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml @@ -23,6 +23,7 @@ adaptableType="org.eclipse.tcf.protocol.IPeer" class="org.eclipse.tcf.te.tcf.locator.internal.adapters.AdapterFactory"> <adapter type="org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistableURIProvider"/> + <adapter type="org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext"/> <adapter type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode"/> </factory> <factory diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java index 2a93510ad..1b1f89d46 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/AdapterFactory.java @@ -107,6 +107,9 @@ public class AdapterFactory implements IAdapterFactory { } } if (IStepContext.class.equals(adapterType)) { + if (adaptableObject instanceof IPeer) { + return new PeerStepContext((IPeer)adaptableObject); + } if (adaptableObject instanceof IPeerNode) { return new PeerNodeStepContext((IPeerNode)adaptableObject); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerStepContext.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerStepContext.java new file mode 100644 index 000000000..00dc08dae --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerStepContext.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2014 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.locator.internal.adapters; + +import org.eclipse.tcf.protocol.IPeer; +import org.eclipse.tcf.te.runtime.stepper.context.AbstractStepContext; + +/** + * Peer step context implementation. + */ +public class PeerStepContext extends AbstractStepContext { + + /** + * Constructor + */ + public PeerStepContext(IPeer peer) { + super(peer); + } + + /** + * Returns the peer. + * @return The peer. + */ + public IPeer getPeer() { + return (IPeer)getContextObject(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getId() + */ + @Override + public String getId() { + return getPeer().getID(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext#getName() + */ + @Override + public String getName() { + return getPeer().getName(); + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class) + */ + @Override + public Object getAdapter(final Class adapter) { + if (IPeer.class.equals(adapter)) { + return getPeer(); + } + + return super.getAdapter(adapter); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelUpdateService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelUpdateService.java index b7b95beb6..da4813679 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelUpdateService.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelUpdateService.java @@ -50,7 +50,8 @@ public class LocatorModelUpdateService extends AbstractLocatorModelService imple /* (non-Javadoc) * @see org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelUpdateService#add(org.eclipse.tcf.protocol.IPeer, boolean) */ - @Override + @SuppressWarnings("unchecked") + @Override public ILocatorNode add(final IPeer peer, boolean isStatic) { Assert.isNotNull(peer); Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$ @@ -113,7 +114,8 @@ public class LocatorModelUpdateService extends AbstractLocatorModelService imple /* (non-Javadoc) * @see org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelUpdateService#remove(org.eclipse.tcf.protocol.IPeer) */ - @Override + @SuppressWarnings("unchecked") + @Override public ILocatorNode remove(final IPeer peer) { Assert.isNotNull(peer); Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$ @@ -145,7 +147,8 @@ public class LocatorModelUpdateService extends AbstractLocatorModelService imple /* (non-Javadoc) * @see org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelUpdateService#update(org.eclipse.tcf.protocol.IPeer, org.eclipse.tcf.protocol.IPeer) */ - @Override + @SuppressWarnings("unchecked") + @Override public ILocatorNode update(final IPeer oldPeer, final IPeer newPeer) { Assert.isNotNull(oldPeer); Assert.isNotNull(newPeer); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/PeerModelUpdateService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/PeerModelUpdateService.java index 28396033f..907c06a3d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/PeerModelUpdateService.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/PeerModelUpdateService.java @@ -38,7 +38,8 @@ public class PeerModelUpdateService extends AbstractPeerModelService implements /* (non-Javadoc) * @see org.eclipse.tcf.te.tcf.locator.core.interfaces.services.ILocatorModelUpdateService#add(org.eclipse.tcf.te.tcf.locator.core.interfaces.nodes.IPeerModel) */ - @Override + @SuppressWarnings("unchecked") + @Override public void add(final IPeerNode peerNode) { Assert.isNotNull(peerNode); Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$ @@ -63,7 +64,8 @@ public class PeerModelUpdateService extends AbstractPeerModelService implements /* (non-Javadoc) * @see org.eclipse.tcf.te.tcf.locator.core.interfaces.services.ILocatorModelUpdateService#remove(org.eclipse.tcf.te.tcf.locator.core.interfaces.nodes.IPeerModel) */ - @Override + @SuppressWarnings("unchecked") + @Override public void remove(final IPeerNode peerNode) { Assert.isNotNull(peerNode); Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$ diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java index 1be0aeeec..286eb006d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java @@ -891,7 +891,8 @@ public class ProcessLauncher extends PlatformObject implements IProcessLauncher // Merge the initial process environment and the desired process environment Map<String, String> processEnv = new HashMap<String, String>(environment); - Map<String, String> processEnvDiff = (Map<String, String>)properties.getProperty(IProcessLauncher.PROP_PROCESS_ENV); + @SuppressWarnings("unchecked") + Map<String, String> processEnvDiff = (Map<String, String>)properties.getProperty(IProcessLauncher.PROP_PROCESS_ENV); if (processEnvDiff != null && !processEnvDiff.isEmpty()) { processEnv.putAll(processEnvDiff); } @@ -919,6 +920,7 @@ public class ProcessLauncher extends PlatformObject implements IProcessLauncher params.put(IProcessesV1.START_USE_TERMINAL, Boolean.FALSE); if (properties.getProperty(IProcessLauncher.PROP_PROCESSESV1_PARAMS) != null) { + @SuppressWarnings("unchecked") Map<String, Object> addParams = (Map<String, Object>)properties.getProperty(IProcessLauncher.PROP_PROCESSESV1_PARAMS); for (Entry<String,Object> entry : addParams.entrySet()) { params.put(entry.getKey(), entry.getValue()); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/properties/PropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/properties/PropertyTester.java index a16793d56..c4ebdf711 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/properties/PropertyTester.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/properties/PropertyTester.java @@ -100,7 +100,8 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester Runnable runnable = new Runnable() { @Override public void run() { - Map<String, Object> caps = (Map<String, Object>)node.getProperty(IProcessContextNodeProperties.PROPERTY_CAPABILITIES); + @SuppressWarnings("unchecked") + Map<String, Object> caps = (Map<String, Object>)node.getProperty(IProcessContextNodeProperties.PROPERTY_CAPABILITIES); if (caps != null) { hasCapability.set(caps.containsKey(expectedValue) && Boolean.parseBoolean(caps.get(expectedValue).toString())); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelLookupService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelLookupService.java index ee637aabc..c251511b1 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelLookupService.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelLookupService.java @@ -183,7 +183,8 @@ public class RuntimeModelLookupService extends AbstractModelService<IRuntimeMode IProcessContextNode node = null; List<IProcessContextNode> candidates = container.getChildren(IProcessContextNode.class); for (IProcessContextNode candidate : candidates) { - Map<String, Object> caps = (Map<String, Object>)candidate.getProperty(IProcessContextNodeProperties.PROPERTY_CAPABILITIES); + @SuppressWarnings("unchecked") + Map<String, Object> caps = (Map<String, Object>)candidate.getProperty(IProcessContextNodeProperties.PROPERTY_CAPABILITIES); if (Boolean.getBoolean("sm.trace.rootnodelkup")) { //$NON-NLS-1$ String message = "RuntimeModelLookupService: findInContainerByCapabilitiesRecursively: candidate=" + candidate + ", capabilities=" + caps.keySet(); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java index 02c99ccaa..b5a24bb97 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java @@ -622,7 +622,8 @@ public class TerminalsLauncher extends PlatformObject implements ITerminalsLaunc String encoding = properties.getStringProperty(ITerminalsLauncher.PROP_TERMINAL_ENCODING); // Environment: Default to "null" if not explicitly specified - Map<String, String> env = (Map<String, String>)properties.getProperty(ITerminalsLauncher.PROP_TERMINAL_ENV); + @SuppressWarnings("unchecked") + Map<String, String> env = (Map<String, String>)properties.getProperty(ITerminalsLauncher.PROP_TERMINAL_ENV); // Launch the remote terminal getSvcTerminals().launch(type, encoding, env != null ? makeEnvironmentArray(env) : null, new ITerminals.DoneLaunch() { diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/network/NetworkCablePanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/network/NetworkCablePanel.java index af431ceb1..3879c86c2 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/network/NetworkCablePanel.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/network/NetworkCablePanel.java @@ -260,6 +260,7 @@ public class NetworkCablePanel extends AbstractWizardConfigurationPanel implemen boolean isDirty = false; + @SuppressWarnings("unchecked") Map<String, Object> container = (Map<String, Object>)data.getProperty(IWireTypeNetwork.PROPERTY_CONTAINER_NAME); if (container == null) container = new HashMap<String, Object>(); @@ -287,6 +288,7 @@ public class NetworkCablePanel extends AbstractWizardConfigurationPanel implemen public void setupData(IPropertiesContainer data) { if (data == null) return; + @SuppressWarnings("unchecked") Map<String, Object> container = (Map<String, Object>)data.getProperty(IWireTypeNetwork.PROPERTY_CONTAINER_NAME); if (container == null) container = new HashMap<String, Object>(); @@ -310,6 +312,7 @@ public class NetworkCablePanel extends AbstractWizardConfigurationPanel implemen public void extractData(IPropertiesContainer data) { if (data == null) return; + @SuppressWarnings("unchecked") Map<String, Object> container = (Map<String, Object>)data.getProperty(IWireTypeNetwork.PROPERTY_CONTAINER_NAME); if (container == null) container = new HashMap<String, Object>(); @@ -354,6 +357,7 @@ public class NetworkCablePanel extends AbstractWizardConfigurationPanel implemen Assert.isNotNull(src); Assert.isNotNull(dst); + @SuppressWarnings("unchecked") Map<String, Object> srcContainer = (Map<String, Object>)src.getProperty(IWireTypeNetwork.PROPERTY_CONTAINER_NAME); Map<String, Object> dstContainer = null; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialLinePanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialLinePanel.java index 4cc8b7e9d..d22948d30 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialLinePanel.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/wire/serial/SerialLinePanel.java @@ -806,7 +806,8 @@ public class SerialLinePanel extends AbstractWizardConfigurationPanel implements boolean isDirty = false; if (!terminalMode) { - Map<String, Object> container = (Map<String, Object>)data.getProperty(IWireTypeSerial.PROPERTY_CONTAINER_NAME); + @SuppressWarnings("unchecked") + Map<String, Object> container = (Map<String, Object>)data.getProperty(IWireTypeSerial.PROPERTY_CONTAINER_NAME); if (container == null) container = new HashMap<String, Object>(); String value = SWTControlUtil.getText(hostTTYDeviceCombo); @@ -945,7 +946,8 @@ public class SerialLinePanel extends AbstractWizardConfigurationPanel implements if (data == null) return; if (!terminalMode) { - Map<String, Object> container = (Map<String, Object>)data.getProperty(IWireTypeSerial.PROPERTY_CONTAINER_NAME); + @SuppressWarnings("unchecked") + Map<String, Object> container = (Map<String, Object>)data.getProperty(IWireTypeSerial.PROPERTY_CONTAINER_NAME); if (container == null) container = new HashMap<String, Object>(); SWTControlUtil.setText(hostTTYDeviceCombo, (String)container.get(IWireTypeSerial.PROPERTY_SERIAL_DEVICE)); @@ -981,7 +983,8 @@ public class SerialLinePanel extends AbstractWizardConfigurationPanel implements if (data == null) return; if (!terminalMode) { - Map<String, Object> container = (Map<String, Object>)data.getProperty(IWireTypeSerial.PROPERTY_CONTAINER_NAME); + @SuppressWarnings("unchecked") + Map<String, Object> container = (Map<String, Object>)data.getProperty(IWireTypeSerial.PROPERTY_CONTAINER_NAME); if (container == null) container = new HashMap<String, Object>(); container.put(IWireTypeSerial.PROPERTY_SERIAL_DEVICE, SWTControlUtil.getText(hostTTYDeviceCombo)); @@ -1032,6 +1035,7 @@ public class SerialLinePanel extends AbstractWizardConfigurationPanel implements Assert.isNotNull(src); Assert.isNotNull(dst); + @SuppressWarnings("unchecked") Map<String, Object> srcContainer = (Map<String, Object>)src.getProperty(IWireTypeSerial.PROPERTY_CONTAINER_NAME); Map<String, Object> dstContainer = null; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryManager.java index e65f6706b..173461c46 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryManager.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryManager.java @@ -80,7 +80,8 @@ public class CategoryManager implements ICategoryManager { /** * Initialize the category manager. */ - private void initialize() { + @SuppressWarnings("unchecked") + private void initialize() { IPath root = getRoot(); if (root == null) { return; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/search/QuickFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/search/QuickFilter.java index 1a0e2bb00..dc505d88a 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/search/QuickFilter.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/search/QuickFilter.java @@ -202,7 +202,8 @@ public class QuickFilter extends TablePatternFilter implements PropertyChangeLis */ public void resetViewer() { viewer.removeFilter(this); - Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$ + @SuppressWarnings("unchecked") + Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$ if (filters != null) { filters.remove(root); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeViewerExtension.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeViewerExtension.java index 0c22ea533..58e239515 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeViewerExtension.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeViewerExtension.java @@ -438,7 +438,8 @@ public class TreeViewerExtension { } attribute = configuration.getAttribute("comparator"); //$NON-NLS-1$ if (attribute != null) { - Comparator<Object> comparator = (Comparator<Object>) configuration.createExecutableExtension("comparator"); //$NON-NLS-1$ + @SuppressWarnings("unchecked") + Comparator<Object> comparator = (Comparator<Object>) configuration.createExecutableExtension("comparator"); //$NON-NLS-1$ if (comparator != null) { column.setComparator(comparator); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/utils/TreeViewerUtil.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/utils/TreeViewerUtil.java index 38f628d69..f1626107d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/utils/TreeViewerUtil.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/utils/TreeViewerUtil.java @@ -64,10 +64,10 @@ public class TreeViewerUtil { } }); } - + /** * Decorate the image using the filtering image. - * + * * @param image * @param viewer * @param path @@ -77,10 +77,10 @@ public class TreeViewerUtil { AbstractImageDescriptor descriptor = new FilteringImageDescriptor(UIPlugin.getDefault().getImageRegistry(), image); return UIPlugin.getSharedImage(descriptor); } - + /** * Decorate the text using the filter text. - * + * * @param text * @param viewer * @param path @@ -97,12 +97,13 @@ public class TreeViewerUtil { /** * Reset the viewer to the original view. - * + * * @param viewer The viewer to be reset. */ public static void doReset(TreeViewer viewer) { ViewerFilter[] vFilters = viewer.getFilters(); - Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$ + @SuppressWarnings("unchecked") + Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$ if (filters != null && vFilters != null && !filters.isEmpty() && vFilters.length > 0) { List<ViewerFilter> filterList = new ArrayList<ViewerFilter>(Arrays.asList(vFilters)); for(Map.Entry<TreePath, QuickFilter> entry : filters.entrySet()) { @@ -118,14 +119,15 @@ public class TreeViewerUtil { /** * Provide a pop up to enter filter to filter the tree viewer. - * + * * @param viewer The tree viewer to be filtered. */ public static void doCommonViewerFilter(TreeViewer viewer) { TreePath rootPath = getSelectedPath(viewer); TreePath root = getViewFilterRoot(viewer, rootPath); if (root != null && (root.getSegmentCount() == 0 || viewer.getExpandedState(root))) { - Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$ + @SuppressWarnings("unchecked") + Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$ if (filters == null) { filters = new HashMap<TreePath, QuickFilter>(); viewer.setData("quick.filter", filters); //$NON-NLS-1$ @@ -138,17 +140,18 @@ public class TreeViewerUtil { filter.showFilterPopup(false); } } - + /** * Provide a pop up to enter filter to filter the tree viewer. - * + * * @param viewer The tree viewer to be filtered. */ public static void doEditorFilter(TreeViewer viewer) { TreePath rootPath = getSelectedPath(viewer); TreePath root = getEditorFilterRoot(viewer, rootPath); if (root != null && (root.getSegmentCount() == 0 || viewer.getExpandedState(root))) { - Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$ + @SuppressWarnings("unchecked") + Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$ if (filters == null) { filters = new HashMap<TreePath, QuickFilter>(); viewer.setData("quick.filter", filters); //$NON-NLS-1$ @@ -161,10 +164,10 @@ public class TreeViewerUtil { filter.showFilterPopup(root.getSegmentCount() == 0); } } - + /** * Search a tree viewer for specified name specified in the pop up dialog. - * + * * @param viewer The tree viewer to be searched. */ public static void doSearch(TreeViewer viewer) { @@ -174,16 +177,17 @@ public class TreeViewerUtil { TreeViewerSearchDialog dialog = new TreeViewerSearchDialog(viewer, rootPath); dialog.open(); } - + /** * If the specified element is being filtered. - * + * * @param path * @return */ public static boolean isFiltering(TreeViewer viewer, TreePath path) { if(path != null) { - Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$ + @SuppressWarnings("unchecked") + Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$ if (filters != null) { QuickFilter filter = filters.get(path); if(filter != null) { @@ -193,15 +197,16 @@ public class TreeViewerUtil { } return false; } - + /** * Test if the specified tree viewer is being filtered. - * + * * @param viewer The tree viewer to be tested. * @return true if there's at least a filter. */ public static boolean isFiltering(TreeViewer viewer) { - Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$ + @SuppressWarnings("unchecked") + Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$ if (filters != null && !filters.isEmpty()) { for(Map.Entry<TreePath, QuickFilter> entry : filters.entrySet()) { TreePath path = entry.getKey(); @@ -214,7 +219,7 @@ public class TreeViewerUtil { /** * Get the filter root for the viewer based on the root path. - * + * * @param viewer The tree viewer. * @param rootPath The root path of the filter. * @return An adjust filter. @@ -235,7 +240,7 @@ public class TreeViewerUtil { } /** * Get the filter root for the viewer based on the root path. - * + * * @param viewer The tree viewer. * @param rootPath The root path of the filter. * @return An adjust filter. @@ -280,7 +285,7 @@ public class TreeViewerUtil { }); return result[0]; } - + /** * Reposition the starting search path. */ @@ -296,11 +301,11 @@ public class TreeViewerUtil { } return new TreePath(new Object[] { viewer.getInput() }); } - + /** - * Test if the root for the tree viewer is eligible as a root path + * Test if the root for the tree viewer is eligible as a root path * of a quick filter. - * + * * @param root The root path to be tested. * @param viewer The tree viewer to be filtered. * @return true if it is eligible as a root path or else false. @@ -311,7 +316,7 @@ public class TreeViewerUtil { } return false; } - + /** * Judges if the specified root has children nodes. */ @@ -336,7 +341,7 @@ public class TreeViewerUtil { /** * Get the selected path of the viewer. - * + * * @param viewer The tree viewer to get the selected path from. * @return the first selected path or null if no selected path. */ @@ -354,13 +359,14 @@ public class TreeViewerUtil { /** * Get the filtering text of the filter attached to the specified tree viewer at the specified path. - * + * * @param viewer The tree viewer. * @param path The path at which the filter applies to. * @return The filter text. */ public static String getFilteringString(TreeViewer viewer, TreePath path) { - Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$ + @SuppressWarnings("unchecked") + Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$ if (filters != null) { QuickFilter filter = filters.get(path); if (filter != null) { |