1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

clean up getProcessList and schemas for CProject & CBuildConsole

This commit is contained in:
David Inglis 2004-03-25 19:53:34 +00:00
parent 7f918c42c3
commit ca24825bd8
3 changed files with 39 additions and 18 deletions

View file

@ -1,3 +1,14 @@
2004-03-25 David Inglis
Fixed up getProcessList to filter on platform.
* src/org/eclipse/cdt/core/CCorePlugin.java
Added schemas for CProject & CBuildConsole
* plugin.xml
2004-03-25 Hoda Amer 2004-03-25 Hoda Amer
Joined effort with Bogdan: Added a TimeOut class to core.utils Joined effort with Bogdan: Added a TimeOut class to core.utils
that implements a thread to control parser timeout. that implements a thread to control parser timeout.

View file

@ -22,11 +22,11 @@
</requires> </requires>
<extension-point id="CProject" name="%CProject.name"/> <extension-point id="CProject" name="%CProject.name" schema="schema/CProject.exsd"/>
<!-- =================================================================================== --> <!-- =================================================================================== -->
<!-- Extension Point:(work in progress) IConsole, customize a C Build console output --> <!-- Extension Point:(work in progress) IConsole, customize a C Build console output -->
<!-- =================================================================================== --> <!-- =================================================================================== -->
<extension-point id="CBuildConsole" name="%CBuildConsole.name"/> <extension-point id="CBuildConsole" name="%CBuildConsole.name" schema="schema/CBuildConsole.exsd"/>
<!-- =================================================================================== --> <!-- =================================================================================== -->
<!-- Extension Point: IProcessList, returns a list of running processes --> <!-- Extension Point: IProcessList, returns a list of running processes -->
<!-- =================================================================================== --> <!-- =================================================================================== -->

View file

@ -33,6 +33,7 @@ import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
import org.eclipse.cdt.internal.core.search.indexing.SourceIndexer; import org.eclipse.cdt.internal.core.search.indexing.SourceIndexer;
import org.eclipse.cdt.internal.core.search.matching.MatchLocator; import org.eclipse.cdt.internal.core.search.matching.MatchLocator;
import org.eclipse.cdt.internal.core.search.processing.JobManager; import org.eclipse.cdt.internal.core.search.processing.JobManager;
import org.eclipse.core.boot.BootLoader;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspace;
@ -449,7 +450,7 @@ public class CCorePlugin extends Plugin {
for (int i = 0; i < extensions.length; i++) { for (int i = 0; i < extensions.length; i++) {
IConfigurationElement[] configElements = extensions[i].getConfigurationElements(); IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
for (int j = 0; j < configElements.length; j++) { for (int j = 0; j < configElements.length; j++) {
String builderID = configElements[j].getAttribute("builderID"); //$NON-NLS-1$ String builderID = configElements[j].getAttribute("id"); //$NON-NLS-1$
if ((id == null && builderID == null) || (id != null && id.equals(builderID))) { if ((id == null && builderID == null) || (id != null && id.equals(builderID))) {
return (IConsole) configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ return (IConsole) configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
} }
@ -739,28 +740,37 @@ public class CCorePlugin extends Plugin {
convertProjectFromCtoCC(projectHandle, monitor); convertProjectFromCtoCC(projectHandle, monitor);
} }
// Extract the builder from the .cdtproject. /**
// public ICBuilder[] getBuilders(IProject project) throws CoreException { * Get the IProcessList contributed interface for the platform.
// ICExtension extensions[] = fDescriptorManager.createExtensions(BUILDER_MODEL_ID, project); * @return IProcessList
// ICBuilder builders[] = new ICBuilder[extensions.length]; */
// System.arraycopy(extensions, 0, builders, 0, extensions.length); public IProcessList getProcessList() throws CoreException {
// return builders;
// }
public IProcessList getProcessList() {
IExtensionPoint extension = getDescriptor().getExtensionPoint("ProcessList"); //$NON-NLS-1$ IExtensionPoint extension = getDescriptor().getExtensionPoint("ProcessList"); //$NON-NLS-1$
if (extension != null) { if (extension != null) {
IExtension[] extensions = extension.getExtensions(); IExtension[] extensions = extension.getExtensions();
IConfigurationElement[] configElements = extensions[0].getConfigurationElements(); IConfigurationElement defaultContributor = null;
if (configElements.length != 0) { for (int i = 0; i < extensions.length; i++) {
try { IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
return (IProcessList) configElements[0].createExecutableExtension("class"); //$NON-NLS-1$ for (int j = 0; j < configElements.length; j++) {
} catch (CoreException e) { if (configElements[j].getName().equals("processList")) { //$NON-NLS-1$
log(e); String platform = configElements[j].getAttribute("platform"); //$NON-NLS-1$
if (platform == null ) { // first contrbutor found with not platform will be default.
if (defaultContributor == null) {
defaultContributor = configElements[j];
} }
} else if (platform.equals(BootLoader.getOS())) {
// found explicit contributor for this platform.
return (IProcessList) configElements[0].createExecutableExtension("class"); //$NON-NLS-1$
}
}
}
}
if ( defaultContributor != null) {
return (IProcessList) defaultContributor.createExecutableExtension("class"); //$NON-NLS-1$
} }
} }
return null; return null;
} }
/** /**