mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-17 13:15:44 +02:00
Fix issues found with new version of CommandLauncherFactory extension
- 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>
This commit is contained in:
parent
3982641456
commit
b3c5133463
1 changed files with 21 additions and 10 deletions
|
@ -165,6 +165,7 @@ public class CommandLauncherManager {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a command launcher.
|
* Get a command launcher.
|
||||||
*
|
*
|
||||||
|
@ -228,7 +229,7 @@ public class CommandLauncherManager {
|
||||||
IExtension[] extensions = extension.getExtensions();
|
IExtension[] extensions = extension.getExtensions();
|
||||||
for (IExtension ext : extensions) {
|
for (IExtension ext : extensions) {
|
||||||
try {
|
try {
|
||||||
IConfigurationElement element[] = extension.getConfigurationElements();
|
IConfigurationElement element[] = ext.getConfigurationElements();
|
||||||
for (IConfigurationElement element2 : element) {
|
for (IConfigurationElement element2 : element) {
|
||||||
if (element2.getName().equalsIgnoreCase("factory")) { //$NON-NLS-1$
|
if (element2.getName().equalsIgnoreCase("factory")) { //$NON-NLS-1$
|
||||||
ICommandLauncherFactory factory = (ICommandLauncherFactory) element2.createExecutableExtension("class"); //$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) {
|
for (ICommandLauncherFactory factory : factories) {
|
||||||
ICommandLauncher launcher = factory.getCommandLauncher(project);
|
ICommandLauncher launcher = factory.getCommandLauncher(project);
|
||||||
if (launcher != null) {
|
if (launcher != null) {
|
||||||
|
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);
|
factory.registerLanguageSettingEntries(project, entries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ICLanguageSettingEntry> getLanguageSettingEntries(IProject project, List<ICLanguageSettingEntry> entries) {
|
public List<ICLanguageSettingEntry> getLanguageSettingEntries(IProject project, List<ICLanguageSettingEntry> entries) {
|
||||||
List<ICLanguageSettingEntry> verifiedEntries = entries;
|
List<ICLanguageSettingEntry> verifiedEntries = entries;
|
||||||
for (ICommandLauncherFactory factory : factories) {
|
ICommandLauncherFactory factory = getBestFactory(project);
|
||||||
ICommandLauncher launcher = factory.getCommandLauncher(project);
|
if (factory != null) {
|
||||||
if (launcher != null) {
|
|
||||||
verifiedEntries = factory.verifyLanguageSettingEntries(project, entries);
|
verifiedEntries = factory.verifyLanguageSettingEntries(project, entries);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return verifiedEntries;
|
return verifiedEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue