From b6dc71f4426a65e4f020670c2d03055fbebfa478 Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Tue, 2 Feb 2016 16:42:06 -0500 Subject: [PATCH] Qt - cleanup build cases. Add method to GDBLaunch. Clean up cases when Qt installs aren't registered for a given config. Fix bug on first scanner info request in build config. Clean up the Qt Run launch delegate in extension. Also added a method to GDBLaunch to allow subclasses to override what the default gdb path is. Change-Id: Icf158633e1c1327cc87ce59c1605bb26258f8708 --- .../cdt/build/core/CBuildConfiguration.java | 4 ++- .../cdt/dsf/gdb/launching/GdbLaunch.java | 29 +++++++++++++------ qt/org.eclipse.cdt.qt.core/plugin.xml | 15 ++++------ .../build/QtBuildConfigurationFactory.java | 7 ++++- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/CBuildConfiguration.java b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/CBuildConfiguration.java index 6a5f4c5e2c9..10a64b8f0bc 100644 --- a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/CBuildConfiguration.java +++ b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/CBuildConfiguration.java @@ -155,7 +155,9 @@ public abstract class CBuildConfiguration extends PlatformObject { } public void clearScannerInfoCache() throws CoreException { - scannerInfoCache.clear(); + if (scannerInfoCache != null) { + scannerInfoCache.clear(); + } } public Collection getConsoleParsers() throws CoreException { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java index c89ec00a000..3f3a37c86fe 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java @@ -437,28 +437,39 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr super.launchRemoved(launch); } + /** + * Get the default GDB path if not specified in the launch or launch config. + * + * @since 5.0 + */ + protected String getDefaultGDBPath() { + return Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID, + IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND, + IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT, null); + } + /** * Returns the path to gdb. * * @since 5.0 */ public IPath getGDBPath() { - String defaultGdbCommand = Platform.getPreferencesService().getString(GdbPlugin.PLUGIN_ID, - IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND, - IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT, null); - - IPath retVal = new Path(defaultGdbCommand); try { String gdb = getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME); if (gdb == null) { gdb = getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, - defaultGdbCommand); + getDefaultGDBPath()); + } + if (gdb != null) { + gdb = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(gdb, false); + return new Path(gdb); + } else { + return null; } - gdb = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(gdb, false); - retVal = new Path(gdb); } catch (CoreException e) { + GdbPlugin.log(e.getStatus()); + return null; } - return retVal; } /** diff --git a/qt/org.eclipse.cdt.qt.core/plugin.xml b/qt/org.eclipse.cdt.qt.core/plugin.xml index 0e6de1a7d7d..e7a5bc5ab1a 100644 --- a/qt/org.eclipse.cdt.qt.core/plugin.xml +++ b/qt/org.eclipse.cdt.qt.core/plugin.xml @@ -185,27 +185,22 @@ + public="true" + sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator" + sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"> - - diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationFactory.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationFactory.java index 6e9a589f483..5467b3d85f7 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationFactory.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationFactory.java @@ -27,6 +27,8 @@ import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdapterFactory; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.launchbar.core.target.ILaunchTarget; import org.eclipse.launchbar.core.target.ILaunchTargetManager; @@ -147,7 +149,10 @@ public class QtBuildConfigurationFactory implements IAdapterFactory { } } } - return null; + + // No appropriate Qt Install + throw new CoreException( + new Status(IStatus.ERROR, Activator.ID, "No appropriate Qt SDK found for target " + target.getId())); } public static class Cleanup implements IResourceChangeListener {