mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 02:15:31 +02:00
run the init of completion contributor in a ISafeRunnable
This commit is contained in:
parent
67b40d2e68
commit
fd3e1ebcc0
1 changed files with 50 additions and 45 deletions
|
@ -5,18 +5,18 @@ package org.eclipse.cdt.internal.ui;
|
|||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
import org.eclipse.cdt.ui.*;
|
||||
import org.eclipse.cdt.ui.ICCompletionContributor;
|
||||
import org.eclipse.cdt.ui.IFunctionSummary;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.ICCompletionContributor;
|
||||
import org.eclipse.cdt.ui.IFunctionSummary;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.ISafeRunnable;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
|
||||
/**
|
||||
* Manages external plugins that contribute completion and function
|
||||
* info through the CCompletionContributor extension point
|
||||
|
@ -29,7 +29,6 @@ public class CCompletionContributorManager {
|
|||
public static final String CONTRIBUTION_EXTENSION = "CCompletionContributor";
|
||||
static private CCompletionContributorManager fInstance;
|
||||
|
||||
|
||||
private CCompletionContributorManager() {
|
||||
// Initialize and scan the extension points
|
||||
}
|
||||
|
@ -68,8 +67,10 @@ public class CCompletionContributorManager {
|
|||
int length = f.length + fs.length;
|
||||
IFunctionSummary[] ft = new IFunctionSummary[length];
|
||||
int j;
|
||||
for(j = 0; j < fs.length; j++) ft[j] = fs[j];
|
||||
for(j = 0; j < f.length; j++) ft[j + fs.length] = f[j];
|
||||
for (j = 0; j < fs.length; j++)
|
||||
ft[j] = fs[j];
|
||||
for (j = 0; j < f.length; j++)
|
||||
ft[j + fs.length] = f[j];
|
||||
fs = ft;
|
||||
} else {
|
||||
fs = f;
|
||||
|
@ -93,21 +94,25 @@ public class CCompletionContributorManager {
|
|||
IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
|
||||
for (int i = 0; i < elements.length; i++) {
|
||||
if (elements[i].getName().equals("provider")) {
|
||||
ICCompletionContributor c;
|
||||
|
||||
try {
|
||||
final ICCompletionContributor c;
|
||||
// Instantiate the classe
|
||||
c = (ICCompletionContributor) elements[i].createExecutableExtension("class");
|
||||
ISafeRunnable runnable = new ISafeRunnable() {
|
||||
public void run() throws Exception {
|
||||
// Initialize
|
||||
c.initialize();
|
||||
// Add to contributor list
|
||||
fCompletionContributors.add(c);
|
||||
}
|
||||
public void handleException(Throwable exception) {
|
||||
}
|
||||
};
|
||||
Platform.run(runnable);
|
||||
} catch (CoreException e) {
|
||||
System.out.println("Unable to instantiate ContributionManager extension");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue