Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2017-08-08 19:04:53 -0400
committerJeff Johnston2017-08-09 12:33:13 -0400
commitb3c51334632274b3e00b996fa8ca21015ceee852 (patch)
tree8cc83be64f4b3d9f1c10fbc90342fe3be14527a0
parent3982641456a96bc2be7badf121ed7c175483f0ae (diff)
downloadorg.eclipse.cdt-containerbuild.tar.gz
org.eclipse.cdt-containerbuild.tar.xz
org.eclipse.cdt-containerbuild.zip
Fix issues found with new version of CommandLauncherFactory extensioncontainerbuild
- have setLanguageSettingEntries() and getLanguageSettingEntries() methods look for best factory to use (one that has highest priority) which matches getCommandLauncher() logic - fix loadCommandLauncherFactoryExtensions() typo Change-Id: I524a41727778c4d0235bdcc9d28d74d44a02f1f6 Signed-off-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java31
1 files changed, 21 insertions, 10 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java
index 080419f689..ad70f104cc 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java
@@ -165,6 +165,7 @@ public class CommandLauncherManager {
}
+
/**
* Get a command launcher.
*
@@ -228,7 +229,7 @@ public class CommandLauncherManager {
IExtension[] extensions = extension.getExtensions();
for (IExtension ext : extensions) {
try {
- IConfigurationElement element[] = extension.getConfigurationElements();
+ IConfigurationElement element[] = ext.getConfigurationElements();
for (IConfigurationElement element2 : element) {
if (element2.getName().equalsIgnoreCase("factory")) { //$NON-NLS-1$
ICommandLauncherFactory factory = (ICommandLauncherFactory) element2.createExecutableExtension("class"); //$NON-NLS-1$
@@ -252,26 +253,36 @@ public class CommandLauncherManager {
}
}
- public void setLanguageSettingEntries(IProject project, List<? extends ICLanguageSettingEntry> entries) {
+ private ICommandLauncherFactory getBestFactory(IProject project) {
+ // loop through list of factories and return launcher returned with
+ // highest priority
+ int highestPriority = -1;
+ ICommandLauncherFactory bestLauncherFactory = null;
for (ICommandLauncherFactory factory : factories) {
ICommandLauncher launcher = factory.getCommandLauncher(project);
if (launcher != null) {
- factory.registerLanguageSettingEntries(project, entries);
+ if (priorityMapping.get(factory) > highestPriority) {
+ bestLauncherFactory = factory;
+ }
}
}
-
+ return bestLauncherFactory;
+ }
+
+ public void setLanguageSettingEntries(IProject project, List<? extends ICLanguageSettingEntry> entries) {
+ ICommandLauncherFactory factory = getBestFactory(project);
+ if (factory != null) {
+ factory.registerLanguageSettingEntries(project, entries);
+ }
}
public List<ICLanguageSettingEntry> getLanguageSettingEntries(IProject project, List<ICLanguageSettingEntry> entries) {
List<ICLanguageSettingEntry> verifiedEntries = entries;
- for (ICommandLauncherFactory factory : factories) {
- ICommandLauncher launcher = factory.getCommandLauncher(project);
- if (launcher != null) {
- verifiedEntries = factory.verifyLanguageSettingEntries(project, entries);
- }
+ ICommandLauncherFactory factory = getBestFactory(project);
+ if (factory != null) {
+ verifiedEntries = factory.verifyLanguageSettingEntries(project, entries);
}
return verifiedEntries;
}
-
}

Back to the top