diff options
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/delegates/Launch.java')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/delegates/Launch.java | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/delegates/Launch.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/delegates/Launch.java new file mode 100644 index 000000000..d0e8a70ec --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/delegates/Launch.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * 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.delegates; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.tcf.internal.debug.model.TCFLaunch; +import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; +import org.eclipse.tcf.te.runtime.properties.PropertiesContainer; + +/** + * Default tcf launch implementation. + * <p> + * The launch can be adapted to {@link IPropertiesContainer} to exchange user defined data + * between the launch steps. + */ +@SuppressWarnings("restriction") +public final class Launch extends TCFLaunch { + + /** + * Non-notifying properties container used for data exchange between the steps. + */ + private final IPropertiesContainer properties = new PropertiesContainer() { + @Override + public Object getAdapter(Class adapter) { + if (ILaunch.class.equals(adapter)) { + return Launch.this; + } + return super.getAdapter(adapter); + } + }; + + /** + * Constructor. + * + * @param configuration The launch configuration that was launched. + * @param mode The launch mode. + */ + public Launch(ILaunchConfiguration configuration, String mode) { + super(configuration, mode); + } + + /** + * Attach the tcf debugger to the given peer id. + * @param peerId The peer id. + */ + public void attachDebugger(String peerId) { + launchTCF(getLaunchMode(), peerId); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.Launch#getAdapter(java.lang.Class) + */ + @Override + public Object getAdapter(Class adapter) { + if (IPropertiesContainer.class.equals(adapter)) { + return properties; + } + + // Must force adapters to be loaded: (Defect WIND00243348, and Eclipse bug 197664). + Platform.getAdapterManager().loadAdapter(this, adapter.getName()); + + return super.getAdapter(adapter); + } +} |