mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-20 15:35:24 +02:00
only support one platform from project for now.
This commit is contained in:
parent
d36366a47c
commit
f3e97df34a
5 changed files with 22 additions and 57 deletions
|
@ -7,10 +7,10 @@ CProblemMarker.name=C Problem
|
||||||
|
|
||||||
CBuildCommand.name=C Builder Command
|
CBuildCommand.name=C Builder Command
|
||||||
CBuildConsole.name=C Builder Console
|
CBuildConsole.name=C Builder Console
|
||||||
CProjectInfo.name=C Project Info
|
CProject.name=C Project
|
||||||
CBuilder.name=C Build Model
|
CBuilder.name=C Build Model
|
||||||
ProcessList.name=Process List
|
ProcessList.name=Process List
|
||||||
|
|
||||||
makeprojectowner.name=Make Project
|
makeproject.name=Make Project
|
||||||
genericmake.name=Generic Make
|
genericmake.name=Generic Make
|
||||||
makebuildmodel.name=Make Builder
|
makebuildmodel.name=Make Builder
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
<extension-point id="CBuildCommand" name="%CBuildCommand.name"/>
|
<extension-point id="CBuildCommand" name="%CBuildCommand.name"/>
|
||||||
<extension-point id="CBuildConsole" name="%CBuildConsole.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="CBuildModel" name="%CBuilder.name"/>
|
||||||
<extension-point id="ProcessList" name="%ProcessList.name" schema="schema/ProcessList.exsd"/>
|
<extension-point id="ProcessList" name="%ProcessList.name" schema="schema/ProcessList.exsd"/>
|
||||||
|
|
||||||
|
@ -89,16 +89,12 @@
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
id="make"
|
id="make"
|
||||||
name="%makeprojectowner.name"
|
name="%makeproject.name"
|
||||||
point="org.eclipse.cdt.core.CProjectOwner">
|
point="org.eclipse.cdt.core.CProject">
|
||||||
<platform
|
<cproject
|
||||||
architecture="*"
|
platform="local"
|
||||||
name="%genericmake.name"
|
|
||||||
id="*">
|
|
||||||
</platform>
|
|
||||||
<run
|
|
||||||
class="org.eclipse.cdt.internal.core.make.MakeProject">
|
class="org.eclipse.cdt.internal.core.make.MakeProject">
|
||||||
</run>
|
</cproject>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
id="makeBuilder"
|
id="makeBuilder"
|
||||||
|
|
|
@ -7,6 +7,5 @@ package org.eclipse.cdt.core;
|
||||||
public interface ICOwnerInfo {
|
public interface ICOwnerInfo {
|
||||||
public String getID();
|
public String getID();
|
||||||
public String getName();
|
public String getName();
|
||||||
public String[] getPlatforms();
|
public String getPlatform();
|
||||||
public String[] getArchitectures(String platform);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,13 +47,11 @@ public class CDescriptor implements ICDescriptor {
|
||||||
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||||
private COwner fOwner;
|
private COwner fOwner;
|
||||||
private IProject fProject;
|
private IProject fProject;
|
||||||
private String fPlatform = "*";
|
|
||||||
private HashMap extMap = new HashMap(4);
|
private HashMap extMap = new HashMap(4);
|
||||||
private HashMap extInfoMap = new HashMap(4);
|
private HashMap extInfoMap = new HashMap(4);
|
||||||
|
|
||||||
private final String DESCRIPTION_FILE_NAME = ".cdtproject";
|
private final String DESCRIPTION_FILE_NAME = ".cdtproject";
|
||||||
private final String PROJECT_DESCRIPTION = "cdtproject";
|
private final String PROJECT_DESCRIPTION = "cdtproject";
|
||||||
private final String PROJECT_PLATFORM = "platform";
|
|
||||||
private final String PROJECT_EXTENSION = "extension";
|
private final String PROJECT_EXTENSION = "extension";
|
||||||
private final String PROJECT_EXTENSION_ATTRIBUTE = "attribute";
|
private final String PROJECT_EXTENSION_ATTRIBUTE = "attribute";
|
||||||
|
|
||||||
|
@ -136,7 +134,7 @@ public class CDescriptor implements ICDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPlatform() {
|
public String getPlatform() {
|
||||||
return fPlatform;
|
return fOwner.getPlatform();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IProject getProject() {
|
public IProject getProject() {
|
||||||
|
@ -227,9 +225,6 @@ public class CDescriptor implements ICDescriptor {
|
||||||
catch (CoreException e) {
|
catch (CoreException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
fPlatform = getString(node, PROJECT_PLATFORM);
|
|
||||||
if ( fPlatform == null )
|
|
||||||
fPlatform = "*";
|
|
||||||
readProjectExtensions(node);
|
readProjectExtensions(node);
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
@ -303,10 +298,6 @@ public class CDescriptor implements ICDescriptor {
|
||||||
Element configRootElement = doc.createElement(PROJECT_DESCRIPTION);
|
Element configRootElement = doc.createElement(PROJECT_DESCRIPTION);
|
||||||
doc.appendChild(configRootElement);
|
doc.appendChild(configRootElement);
|
||||||
configRootElement.setAttribute("id", fOwner.getID()); //$NON-NLS-1$
|
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();
|
Iterator extIterator = extMap.values().iterator();
|
||||||
while( extIterator.hasNext() ) {
|
while( extIterator.hasNext() ) {
|
||||||
CExtensionReference extension[] = (CExtensionReference[]) extIterator.next();
|
CExtensionReference extension[] = (CExtensionReference[]) extIterator.next();
|
||||||
|
|
|
@ -20,11 +20,12 @@ import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
public class COwner implements ICOwnerInfo {
|
public class COwner implements ICOwnerInfo {
|
||||||
String ownerID;
|
String ownerID;
|
||||||
|
String fPlatform;
|
||||||
IExtension extension;
|
IExtension extension;
|
||||||
|
|
||||||
public COwner(String id) throws CoreException {
|
public COwner(String id) throws CoreException {
|
||||||
ownerID = id;
|
ownerID = id;
|
||||||
IExtensionPoint extpoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint("CProjectOwner");
|
IExtensionPoint extpoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint("CProject");
|
||||||
if (extpoint != null) {
|
if (extpoint != null) {
|
||||||
extension = extpoint.getExtension(ownerID);
|
extension = extpoint.getExtension(ownerID);
|
||||||
} else {
|
} else {
|
||||||
|
@ -41,45 +42,23 @@ public class COwner implements ICOwnerInfo {
|
||||||
return extension == null ? null : extension.getLabel();
|
return extension == null ? null : extension.getLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPlatforms() {
|
public String getPlatform() {
|
||||||
|
if ( fPlatform == null ) {
|
||||||
IConfigurationElement element[] = extension.getConfigurationElements();
|
IConfigurationElement element[] = extension.getConfigurationElements();
|
||||||
String platforms[] = new String[element.length];
|
|
||||||
for( int i = 0; i < element.length; i++ ) {
|
for( int i = 0; i < element.length; i++ ) {
|
||||||
platforms[i] = element[i].getAttribute("id");
|
if ( element[i].getName().equalsIgnoreCase("cproject") ) {
|
||||||
}
|
fPlatform = element[i].getAttribute("platform");
|
||||||
return platforms;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new String[0];
|
return fPlatform;
|
||||||
}
|
}
|
||||||
|
|
||||||
void configure(IProject project, ICDescriptor cproject) throws CoreException {
|
void configure(IProject project, ICDescriptor cproject) throws CoreException {
|
||||||
IConfigurationElement element[] = extension.getConfigurationElements();
|
IConfigurationElement element[] = extension.getConfigurationElements();
|
||||||
for( int i = 0; i < element.length; i++ ) {
|
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");
|
ICOwner owner = (ICOwner) element[i].createExecutableExtension("class");
|
||||||
owner.configure(cproject);
|
owner.configure(cproject);
|
||||||
return;
|
return;
|
||||||
|
@ -92,7 +71,7 @@ public class COwner implements ICOwnerInfo {
|
||||||
void update(IProject project, ICDescriptor cproject, String extensionID) throws CoreException {
|
void update(IProject project, ICDescriptor cproject, String extensionID) throws CoreException {
|
||||||
IConfigurationElement element[] = extension.getConfigurationElements();
|
IConfigurationElement element[] = extension.getConfigurationElements();
|
||||||
for( int i = 0; i < element.length; i++ ) {
|
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");
|
ICOwner owner = (ICOwner) element[i].createExecutableExtension("class");
|
||||||
owner.update(cproject, extensionID);
|
owner.update(cproject, extensionID);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue