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

only support one platform from project for now.

This commit is contained in:
David Inglis 2002-09-23 17:08:16 +00:00
parent d36366a47c
commit f3e97df34a
5 changed files with 22 additions and 57 deletions

View file

@ -7,10 +7,10 @@ CProblemMarker.name=C Problem
CBuildCommand.name=C Builder Command
CBuildConsole.name=C Builder Console
CProjectInfo.name=C Project Info
CProject.name=C Project
CBuilder.name=C Build Model
ProcessList.name=Process List
makeprojectowner.name=Make Project
makeproject.name=Make Project
genericmake.name=Generic Make
makebuildmodel.name=Make Builder

View file

@ -26,7 +26,7 @@
<extension-point id="CBuildCommand" name="%CBuildCommand.name"/>
<extension-point id="CBuildConsole" name="%CBuildConsole.name"/>
<extension-point id="CProjectOwner" name="%CProjectOwner.name"/>
<extension-point id="CProject" name="%CProject.name"/>
<extension-point id="CBuildModel" name="%CBuilder.name"/>
<extension-point id="ProcessList" name="%ProcessList.name" schema="schema/ProcessList.exsd"/>
@ -89,16 +89,12 @@
</extension>
<extension
id="make"
name="%makeprojectowner.name"
point="org.eclipse.cdt.core.CProjectOwner">
<platform
architecture="*"
name="%genericmake.name"
id="*">
</platform>
<run
name="%makeproject.name"
point="org.eclipse.cdt.core.CProject">
<cproject
platform="local"
class="org.eclipse.cdt.internal.core.make.MakeProject">
</run>
</cproject>
</extension>
<extension
id="makeBuilder"

View file

@ -7,6 +7,5 @@ package org.eclipse.cdt.core;
public interface ICOwnerInfo {
public String getID();
public String getName();
public String[] getPlatforms();
public String[] getArchitectures(String platform);
public String getPlatform();
}

View file

@ -47,13 +47,11 @@ public class CDescriptor implements ICDescriptor {
private static final String[] EMPTY_STRING_ARRAY = new String[0];
private COwner fOwner;
private IProject fProject;
private String fPlatform = "*";
private HashMap extMap = new HashMap(4);
private HashMap extInfoMap = new HashMap(4);
private final String DESCRIPTION_FILE_NAME = ".cdtproject";
private final String PROJECT_DESCRIPTION = "cdtproject";
private final String PROJECT_PLATFORM = "platform";
private final String PROJECT_EXTENSION = "extension";
private final String PROJECT_EXTENSION_ATTRIBUTE = "attribute";
@ -136,7 +134,7 @@ public class CDescriptor implements ICDescriptor {
}
public String getPlatform() {
return fPlatform;
return fOwner.getPlatform();
}
public IProject getProject() {
@ -227,9 +225,6 @@ public class CDescriptor implements ICDescriptor {
catch (CoreException e) {
return null;
}
fPlatform = getString(node, PROJECT_PLATFORM);
if ( fPlatform == null )
fPlatform = "*";
readProjectExtensions(node);
return owner;
}
@ -303,10 +298,6 @@ public class CDescriptor implements ICDescriptor {
Element configRootElement = doc.createElement(PROJECT_DESCRIPTION);
doc.appendChild(configRootElement);
configRootElement.setAttribute("id", fOwner.getID()); //$NON-NLS-1$
element= doc.createElement(PROJECT_PLATFORM);
element.appendChild(doc.createTextNode(fPlatform));
if ( element != null )
configRootElement.appendChild(element);
Iterator extIterator = extMap.values().iterator();
while( extIterator.hasNext() ) {
CExtensionReference extension[] = (CExtensionReference[]) extIterator.next();

View file

@ -20,11 +20,12 @@ import org.eclipse.core.runtime.Status;
public class COwner implements ICOwnerInfo {
String ownerID;
String fPlatform;
IExtension extension;
public COwner(String id) throws CoreException {
ownerID = id;
IExtensionPoint extpoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint("CProjectOwner");
IExtensionPoint extpoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint("CProject");
if (extpoint != null) {
extension = extpoint.getExtension(ownerID);
} else {
@ -41,45 +42,23 @@ public class COwner implements ICOwnerInfo {
return extension == null ? null : extension.getLabel();
}
public String[] getPlatforms() {
IConfigurationElement element[] = extension.getConfigurationElements();
String platforms[] = new String[element.length];
for( int i = 0; i < element.length; i++ ) {
platforms[i] = element[i].getAttribute("id");
}
return platforms;
}
public String getPlatformName(String platform) {
IConfigurationElement element[] = extension.getConfigurationElements();
String platforms[] = new String[element.length];
for( int i = 0; i < element.length; i++ ) {
if ( platform.equals(element[i].getAttribute("id")) ) {
return element[i].getAttribute("name");
}
}
return "";
}
public String[] getArchitectures(String platform) {
IConfigurationElement element[] = extension.getConfigurationElements();
String platforms[] = new String[element.length];
for( int i = 0; i < element.length; i++ ) {
if ( platform.equals(element[i].getAttribute("id")) ) {
StringTokenizer stoken = new StringTokenizer(element[i].getAttribute("architecture"), ",");
String[] archs = new String[stoken.countTokens()];
for( int j = 0; j < archs.length; j++ ) {
archs[i] = stoken.nextToken();
public String getPlatform() {
if ( fPlatform == null ) {
IConfigurationElement element[] = extension.getConfigurationElements();
for( int i = 0; i < element.length; i++ ) {
if ( element[i].getName().equalsIgnoreCase("cproject") ) {
fPlatform = element[i].getAttribute("platform");
break;
}
}
}
return new String[0];
return fPlatform;
}
void configure(IProject project, ICDescriptor cproject) throws CoreException {
IConfigurationElement element[] = extension.getConfigurationElements();
for( int i = 0; i < element.length; i++ ) {
if ( element[i].getName().equalsIgnoreCase("run") ) {
if ( element[i].getName().equalsIgnoreCase("cproject") ) {
ICOwner owner = (ICOwner) element[i].createExecutableExtension("class");
owner.configure(cproject);
return;
@ -92,7 +71,7 @@ public class COwner implements ICOwnerInfo {
void update(IProject project, ICDescriptor cproject, String extensionID) throws CoreException {
IConfigurationElement element[] = extension.getConfigurationElements();
for( int i = 0; i < element.length; i++ ) {
if ( element[i].getName().equalsIgnoreCase("run") ) {
if ( element[i].getName().equalsIgnoreCase("cproject") ) {
ICOwner owner = (ICOwner) element[i].createExecutableExtension("class");
owner.update(cproject, extensionID);
return;