Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.tcf.debug')
-rw-r--r--plugins/org.eclipse.tcf.debug/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.tcf.debug/plugin.xml4
-rw-r--r--plugins/org.eclipse.tcf.debug/schema/launch_project_builder.exsd72
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/debug/ITCFLaunchProjectBuilder.java28
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java33
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchProjectBuilder.java60
6 files changed, 196 insertions, 4 deletions
diff --git a/plugins/org.eclipse.tcf.debug/META-INF/MANIFEST.MF b/plugins/org.eclipse.tcf.debug/META-INF/MANIFEST.MF
index a6c465ec3..1136d9e2a 100644
--- a/plugins/org.eclipse.tcf.debug/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.tcf.debug/META-INF/MANIFEST.MF
@@ -18,7 +18,8 @@ Import-Package: org.eclipse.core.variables,
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true
-Export-Package: org.eclipse.tcf.internal.debug;x-internal:=true,
+Export-Package: org.eclipse.tcf.debug,
+ org.eclipse.tcf.internal.debug;x-internal:=true,
org.eclipse.tcf.internal.debug.actions;x-friends:="org.eclipse.tcf.debug.ui,org.eclipse.tcf.cdt.ui,org.eclipse.tcf.te.tcf.launch.core",
org.eclipse.tcf.internal.debug.cmdline;x-friends:="org.eclipse.tcf.debug.ui",
org.eclipse.tcf.internal.debug.launch;x-friends:="org.eclipse.tcf.debug.ui,org.eclipse.tcf.cdt.ui,org.eclipse.tcf.te.tcf.launch.core",
diff --git a/plugins/org.eclipse.tcf.debug/plugin.xml b/plugins/org.eclipse.tcf.debug/plugin.xml
index 33df924fa..23eae9363 100644
--- a/plugins/org.eclipse.tcf.debug/plugin.xml
+++ b/plugins/org.eclipse.tcf.debug/plugin.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?><!--
- Copyright (c) 2010 Wind River Systems, Inc. and others.
+ Copyright (c) 2010, 2016 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
@@ -12,6 +12,8 @@
<plugin>
+ <extension-point id="launch_project_builder" name="TCF Launch Project Builder" schema="schema/launch_project_builder.exsd"/>
+
<extension
point="org.eclipse.debug.core.breakpoints">
<breakpoint
diff --git a/plugins/org.eclipse.tcf.debug/schema/launch_project_builder.exsd b/plugins/org.eclipse.tcf.debug/schema/launch_project_builder.exsd
new file mode 100644
index 000000000..8a586e071
--- /dev/null
+++ b/plugins/org.eclipse.tcf.debug/schema/launch_project_builder.exsd
@@ -0,0 +1,72 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.tcf">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.tcf.debug" id="launch_project_builder" name="TCF Launch Project Builder"/>
+ </appInfo>
+ <documentation>
+ This extension point is used to register plugins
+ that want to extends TCF Launch Configuration functionality.
+ </documentation>
+
+</annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="class" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="class">
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ Class should implement org.eclipse.tcf.debug.ITCFLaunchProjectBuilder interface
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/debug/ITCFLaunchProjectBuilder.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/debug/ITCFLaunchProjectBuilder.java
new file mode 100644
index 000000000..d9643ee4d
--- /dev/null
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/debug/ITCFLaunchProjectBuilder.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Xilinx, 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:
+ * Xilinx - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.debug;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+/**
+ * @since 1.4
+ */
+public interface ITCFLaunchProjectBuilder {
+
+ boolean isSupportedProject(String project_name);
+
+ IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException;
+
+ boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException;
+}
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java
index 7c062f549..ec4da2bb4 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2014 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2016 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
@@ -30,6 +30,7 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
+import org.eclipse.tcf.debug.ITCFLaunchProjectBuilder;
import org.eclipse.tcf.internal.debug.Activator;
import org.eclipse.tcf.internal.debug.model.ITCFConstants;
import org.eclipse.tcf.internal.debug.model.TCFLaunch;
@@ -52,6 +53,9 @@ public class TCFLaunchDelegate extends LaunchConfigurationDelegate {
public static final String
ATTR_PEER_ID = ITCFConstants.ID_TCF_DEBUG_MODEL + ".PeerID",
ATTR_PROJECT_NAME = ITCFConstants.ID_TCF_DEBUG_MODEL + ".ProjectName",
+ ATTR_BUILD_BEFORE_LAUNCH = ITCFConstants.ID_TCF_DEBUG_MODEL + ".BuildBeforeLaunch",
+ ATTR_PROJECT_BUILD_CONFIG_ID = ITCFConstants.ID_TCF_DEBUG_MODEL + ".ProjectBuildConfigID",
+ ATTR_PROJECT_BUILD_CONFIG_AUTO = ITCFConstants.ID_TCF_DEBUG_MODEL + ".ProjectBuildConfigAuto",
ATTR_LOCAL_PROGRAM_FILE = ITCFConstants.ID_TCF_DEBUG_MODEL + ".LocalProgramFile",
ATTR_REMOTE_PROGRAM_FILE = ITCFConstants.ID_TCF_DEBUG_MODEL + ".ProgramFile",
ATTR_COPY_TO_REMOTE_FILE = ITCFConstants.ID_TCF_DEBUG_MODEL + ".CopyToRemote",
@@ -73,6 +77,10 @@ public class TCFLaunchDelegate extends LaunchConfigurationDelegate {
ATTR_ATTACH_PATH = ITCFConstants.ID_TCF_DEBUG_MODEL + ".Attach",
ATTR_USE_CONTEXT_FILTER = ITCFConstants.ID_TCF_DEBUG_MODEL + ".UseContextFilter";
+ public static final int
+ BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING = 0,
+ BUILD_BEFORE_LAUNCH_DISABLED = 1;
+
public static final String
FILES_CONTEXT_FULL_NAME = "Context",
FILES_CONTEXT_ID = "ContextID",
@@ -237,7 +245,8 @@ public class TCFLaunchDelegate extends LaunchConfigurationDelegate {
Element root = null;
try {
root = DebugPlugin.parseDocument(s);
- } catch (CoreException e) {
+ }
+ catch (CoreException e) {
// The memento does not represent a XML string
}
if (root == null) return;
@@ -330,6 +339,26 @@ public class TCFLaunchDelegate extends LaunchConfigurationDelegate {
return program_path.toOSString();
}
+ @Override
+ protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
+ ITCFLaunchProjectBuilder builder = TCFLaunchProjectBuilder.getLaunchProjectBuilder(configuration);
+ if (builder != null) return builder.getBuildOrder(configuration, mode);
+ String name = configuration.getAttribute(ATTR_PROJECT_NAME, "");
+ if (name.length() == 0) return null;
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ if (project == null) return null;
+ return new IProject[]{ project };
+ }
+
+ @Override
+ public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
+ int build = configuration.getAttribute(ATTR_BUILD_BEFORE_LAUNCH, BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING);
+ if (build == BUILD_BEFORE_LAUNCH_DISABLED) return false;
+ ITCFLaunchProjectBuilder builder = TCFLaunchProjectBuilder.getLaunchProjectBuilder(configuration);
+ if (builder != null) return builder.buildForLaunch(configuration, mode, monitor);
+ return super.buildForLaunch(configuration, mode, monitor);
+ }
+
/**
* Create new TCF launch object.
* @return new TCFLaunch object
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchProjectBuilder.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchProjectBuilder.java
new file mode 100644
index 000000000..b35cee394
--- /dev/null
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchProjectBuilder.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Xilinx, 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:
+ * Xilinx - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.internal.debug.launch;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.tcf.debug.ITCFLaunchProjectBuilder;
+import org.eclipse.tcf.internal.debug.Activator;
+import org.osgi.framework.Bundle;
+
+/**
+ * TCF implements building of a project before launching a debug session.
+ * Default build logic might not work properly for some project type, e.g. CDT projects.
+ * TCF clients can implement ITCFLaunchProjectBuilder to override default launch behavior.
+ */
+public class TCFLaunchProjectBuilder {
+
+ public static ITCFLaunchProjectBuilder getLaunchProjectBuilder(ILaunchConfiguration configuration) {
+ try {
+ String project = configuration.getAttribute(TCFLaunchDelegate.ATTR_PROJECT_NAME, "");
+ if (project.length() == 0) return null;
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.PLUGIN_ID, "launch_project_builder");
+ if (point == null) return null;
+ IExtension[] extensions = point.getExtensions();
+ for (IExtension extension : extensions) {
+ try {
+ Bundle bundle = Platform.getBundle(extension.getNamespaceIdentifier());
+ bundle.start(Bundle.START_TRANSIENT);
+ IConfigurationElement[] e = extension.getConfigurationElements();
+ for (int j = 0; j < e.length; j++) {
+ String nm = e[j].getName();
+ if (nm.equals("class")) { //$NON-NLS-1$
+ Class<?> c = bundle.loadClass(e[j].getAttribute("name")); //$NON-NLS-1$
+ ITCFLaunchProjectBuilder builder = (ITCFLaunchProjectBuilder)c.newInstance();
+ if (builder.isSupportedProject(project)) return builder;
+ }
+ }
+ }
+ catch (Throwable x) {
+ Activator.log("Cannot access launch project builder extension points", x);
+ }
+ }
+ }
+ catch (Exception x) {
+ Activator.log("Cannot access launch project builder extension points", x);
+ }
+ return null;
+ }
+}

Back to the top