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

cleanup CDT extensions interfaces

This commit is contained in:
David Inglis 2003-02-19 19:29:04 +00:00
parent 03dea5e8ec
commit 0099e3903e
12 changed files with 270 additions and 161 deletions

View file

@ -1,3 +1,15 @@
2003-02-19 David Inglis
* src/org/eclipse/cdt/core/CCorePlugin.java
* src/org/eclipse/cdt/core/ICDescriptor.java
* src/org/eclipse/cdt/core/ICExtensionReference.java
* src/org/eclipse/cdt/core/ICOwner.java
* src/org/eclipse/cdt/internal/core/CDescriptor.java
* src/org/eclipse/cdt/internal/core/CDescriptorManager.java
* src/org/eclipse/cdt/internal/core/CExtensionReference.java
* src/org/eclipse/cdt/internal/core/make/MakeProject.java
General cleanup of CDT extensions interfaces from review with Alain.
2003-02-17 Doug Schaefer
Merged in Sam Robb's source for the build model. The source can be

View file

@ -207,8 +207,12 @@ public class CCorePlugin extends Plugin {
return fDescriptorManager.getDescriptor(project);
}
public void mapCProjectOwner(IProject project, String id) throws CoreException {
fDescriptorManager.configure(project, id);
public void mapCProjectOwner(IProject project, String id, boolean override) throws CoreException {
if ( !override ) {
fDescriptorManager.configure(project, id);
} else {
fDescriptorManager.convert(project, id);
}
}
/**
@ -242,7 +246,7 @@ public class CCorePlugin extends Plugin {
// Add C Nature ... does not add duplicates
CProjectNature.addCNature(projectHandle, new SubProgressMonitor(monitor, 1));
mapCProjectOwner(projectHandle, projectID);
mapCProjectOwner(projectHandle, projectID, false);
} finally {
//monitor.done();
}

View file

@ -5,13 +5,17 @@
package org.eclipse.cdt.core;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
public interface ICDescriptor {
public ICOwnerInfo getProjectOwner();
public String getPlatform();
public IProject getProject();
public ICExtensionReference[] get(String name);
public ICExtensionReference[] get(String name, boolean update);
public ICExtensionReference create(String name, String id);
public void remove(ICExtensionReference extension);
public ICExtensionReference[] get(String extensionPoint);
public ICExtensionReference[] get(String extensionPoint, boolean update) throws CoreException;
public ICExtensionReference create(String extensionPoint, String id) throws CoreException;
public void remove(ICExtensionReference extension) throws CoreException;
public void remove(String extensionPoint) throws CoreException;
}

View file

@ -4,9 +4,34 @@
*/
package org.eclipse.cdt.core;
import org.eclipse.core.runtime.CoreException;
public interface ICExtensionReference {
public String getExtension();
/**
* Return the extension point of this reference.
* @return String
*/
public String getExtension();
/**
* Return the extension ID of this reference.
* @return String
*/
public String getID();
/**
* Sets a name/value data pair on this reference in the .cdtproject file
*/
public void setExtensionData(String key, String value);
public String getExtensionData(String key);
/**
* Gets a value of the key from the .cdtproject file set by setExtensionData()
*/
public String getExtensionData(String key);
/**
* Creates the executable extension for the reference.
*/
public ICExtension createExtension() throws CoreException;
}

View file

@ -4,7 +4,9 @@
*/
package org.eclipse.cdt.core;
import org.eclipse.core.runtime.CoreException;
public interface ICOwner {
public void configure(ICDescriptor cproject);
public void update(ICDescriptor cproject, String extensionID);
public void configure(ICDescriptor cproject) throws CoreException;
public void update(ICDescriptor cproject, String extensionID) throws CoreException;
}

View file

@ -16,7 +16,6 @@ import java.util.Map.Entry;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.xerces.dom.DocumentImpl;
import org.apache.xml.serialize.Method;
@ -25,13 +24,18 @@ import org.apache.xml.serialize.Serializer;
import org.apache.xml.serialize.SerializerFactory;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.ICExtension;
import org.eclipse.cdt.core.ICExtensionReference;
import org.eclipse.cdt.core.ICOwnerInfo;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IPluginRegistry;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@ -40,7 +44,6 @@ import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class CDescriptor implements ICDescriptor {
/* constants */
@ -49,42 +52,15 @@ public class CDescriptor implements ICDescriptor {
private IProject fProject;
private HashMap extMap = new HashMap(4);
private HashMap extInfoMap = new HashMap(4);
final static String DESCRIPTION_FILE_NAME = ".cdtproject";
private final static String PROJECT_DESCRIPTION = "cdtproject";
private final static String PROJECT_EXTENSION = "extension";
private final static String PROJECT_EXTENSION_ATTRIBUTE = "attribute";
private boolean fDirty;
private boolean autoSave;
protected void readCDTProject(IPath projectLocation) {
FileInputStream file = null;
try {
file = new FileInputStream(projectLocation.toFile());
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = parser.parse(file);
Node node = document.getFirstChild();
if (node.getNodeName().equals(PROJECT_DESCRIPTION))
fOwner = readProjectDescription(node);
}
catch (IOException e) {
}
catch (SAXException e) {
}
catch (ParserConfigurationException e) {
}
finally {
if (file != null) {
try {
file.close();
}
catch (IOException e) {
}
}
}
}
protected CDescriptor(IProject project, String id) throws CoreException {
fProject = project;
IPath projectLocation = project.getDescription().getLocation();
@ -98,16 +74,28 @@ public class CDescriptor implements ICDescriptor {
if (descriptionPath.toFile().exists()) {
IStatus status;
readCDTProject(descriptionPath);
if ( fOwner.getID().equals(id)) {
status = new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, CCorePlugin.STATUS_CDTPROJECT_EXISTS, "CDTProject already exisits", (Throwable)null);
if (fOwner.getID().equals(id)) {
status =
new Status(
IStatus.WARNING,
CCorePlugin.PLUGIN_ID,
CCorePlugin.STATUS_CDTPROJECT_EXISTS,
"CDTProject already exisits",
(Throwable) null);
} else {
status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, CCorePlugin.STATUS_CDTPROJECT_MISMATCH, "CDTProject already exisits but does not match owner ID of creator", (Throwable)null);
status =
new Status(
IStatus.ERROR,
CCorePlugin.PLUGIN_ID,
CCorePlugin.STATUS_CDTPROJECT_MISMATCH,
"CDTProject already exisits but does not match owner ID of creator",
(Throwable) null);
}
throw new CoreException(status);
}
fOwner = new COwner(id);
}
protected CDescriptor(IProject project) throws CoreException {
fProject = project;
IPath projectLocation = project.getDescription().getLocation();
@ -119,20 +107,67 @@ public class CDescriptor implements ICDescriptor {
IPath descriptionPath = projectLocation.append(DESCRIPTION_FILE_NAME);
if (!descriptionPath.toFile().exists()) {
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "CDTProject file not found", (Throwable)null);
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "CDTProject file not found", (Throwable) null);
throw new CoreException(status);
}
readCDTProject(descriptionPath);
}
protected CDescriptor(IProject project, COwner owner) throws CoreException {
fProject = project;
IPath projectLocation = project.getDescription().getLocation();
final boolean isDefaultLocation = projectLocation == null;
if (isDefaultLocation) {
projectLocation = getProjectDefaultLocation(project);
}
IPath descriptionPath = projectLocation.append(DESCRIPTION_FILE_NAME);
if (!descriptionPath.toFile().exists()) {
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "CDTProject file not found", (Throwable) null);
throw new CoreException(status);
}
fOwner = owner;
readProjectExtensions(getCDTProjectNode(descriptionPath));
}
protected Node getCDTProjectNode(IPath descriptionPath) throws CoreException {
FileInputStream file = null;
try {
file = new FileInputStream(descriptionPath.toFile());
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = parser.parse(file);
Node node = document.getFirstChild();
if (node.getNodeName().equals(PROJECT_DESCRIPTION))
return node;
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "Missing cdtproject element", null);
throw new CoreException(status);
} catch (Exception e) {
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, e.getLocalizedMessage(), e);
throw new CoreException(status);
} finally {
if (file != null) {
try {
file.close();
} catch (IOException e) {
}
}
}
}
protected void readCDTProject(IPath projectLocation) throws CoreException {
Node node = getCDTProjectNode(projectLocation);
fOwner = readProjectDescription(node);
}
protected IPath getProjectDefaultLocation(IProject project) {
return Platform.getLocation().append(project.getFullPath());
}
public ICOwnerInfo getProjectOwner() {
return fOwner;
}
public String getPlatform() {
return fOwner.getPlatform();
}
@ -144,46 +179,45 @@ public class CDescriptor implements ICDescriptor {
public ICExtensionReference[] get(String extensionID) {
return (CExtensionReference[]) extMap.get(extensionID);
}
public ICExtensionReference[] get(String extensionID, boolean update) {
ICExtensionReference[] ext = get(extensionID);
if ( (ext == null || ext.length == 0) && update) {
if ((ext == null || ext.length == 0) && update) {
try {
fOwner.update(fProject, this, extensionID);
saveInfo();
ext = get(extensionID);
}
catch (CoreException e) {
} catch (CoreException e) {
}
}
return ext;
}
public ICExtensionReference create(String name, String id) {
CExtensionReference extensions[] = (CExtensionReference[]) extMap.get(name);
if ( extensions == null ) {
public ICExtensionReference create(String extensionPoint, String extensionID) throws CoreException {
CExtensionReference extensions[] = (CExtensionReference[]) extMap.get(extensionPoint);
if (extensions == null) {
extensions = new CExtensionReference[1];
extMap.put(name, extensions);
extMap.put(extensionPoint, extensions);
} else {
CExtensionReference[] newExtensions = new CExtensionReference[extensions.length + 1];
System.arraycopy(extensions, 0, newExtensions, 0, extensions.length);
extensions = newExtensions;
extMap.put(name, extensions);
extMap.put(extensionPoint, extensions);
}
setDirty();
extensions[extensions.length-1] = new CExtensionReference(this, name, id);
return extensions[extensions.length-1];
extensions[extensions.length - 1] = new CExtensionReference(this, extensionPoint, extensionID);
return extensions[extensions.length - 1];
}
public void remove(ICExtensionReference ext) {
public void remove(ICExtensionReference ext) throws CoreException {
CExtensionReference extensions[] = (CExtensionReference[]) extMap.get(ext.getExtension());
for( int i = 0; i < extensions.length; i++ ) {
if ( extensions[i] == ext ) {
System.arraycopy(extensions, i, extensions, i+1, extensions.length - 1 - i);
for (int i = 0; i < extensions.length; i++) {
if (extensions[i] == ext) {
System.arraycopy(extensions, i, extensions, i + 1, extensions.length - 1 - i);
CExtensionReference[] newExtensions = new CExtensionReference[extensions.length - 1];
System.arraycopy(extensions, 0, newExtensions, 0, extensions.length);
extensions = newExtensions;
if ( extensions.length == 0 ) {
if (extensions.length == 0) {
extMap.put(ext.getExtension(), null);
} else {
extMap.put(ext.getExtension(), extensions);
@ -193,9 +227,17 @@ public class CDescriptor implements ICDescriptor {
}
}
public void remove(String extensionPoint) throws CoreException {
CExtensionReference extensions[] = (CExtensionReference[]) extMap.get(extensionPoint);
if (extensions != null) {
extMap.put(extensionPoint, null);
setDirty();
}
}
public CExtensionInfo getInfo(CExtensionReference cProjectExtension) {
CExtensionInfo info = (CExtensionInfo) extInfoMap.get(cProjectExtension);
if ( info == null ) {
if (info == null) {
info = new CExtensionInfo();
extInfoMap.put(cProjectExtension, info);
}
@ -210,52 +252,49 @@ public class CDescriptor implements ICDescriptor {
}
return null;
}
protected String getString(Node target, String tagName) {
Node node = searchNode(target, tagName);
return node != null ? (node.getFirstChild() == null ? null : node.getFirstChild().getNodeValue()) : null;
}
private COwner readProjectDescription(Node node) {
private COwner readProjectDescription(Node node) throws CoreException {
COwner owner = null;
NamedNodeMap attrib = node.getAttributes();
try {
owner = new COwner(attrib.getNamedItem("id").getNodeValue());
}
catch (CoreException e) {
return null;
}
owner = new COwner(attrib.getNamedItem("id").getNodeValue());
readProjectExtensions(node);
return owner;
}
private void readProjectExtensions(Node node) {
private void readProjectExtensions(Node node) throws CoreException {
NodeList list = node.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
if ( list.item(i).getNodeName().equals(PROJECT_EXTENSION) ) {
if (list.item(i).getNodeName().equals(PROJECT_EXTENSION)) {
NamedNodeMap attrib = list.item(i).getAttributes();
ICExtensionReference ext = create(attrib.getNamedItem("point").getNodeValue(), attrib.getNamedItem("id").getNodeValue());
ICExtensionReference ext =
create(attrib.getNamedItem("point").getNodeValue(), attrib.getNamedItem("id").getNodeValue());
NodeList extAttrib = list.item(i).getChildNodes();
for( int j = 0; j < extAttrib.getLength(); j++) {
if ( extAttrib.item(j).getNodeName().equals(PROJECT_EXTENSION_ATTRIBUTE) ) {
for (int j = 0; j < extAttrib.getLength(); j++) {
if (extAttrib.item(j).getNodeName().equals(PROJECT_EXTENSION_ATTRIBUTE)) {
attrib = extAttrib.item(j).getAttributes();
ext.setExtensionData(attrib.getNamedItem("key").getNodeValue(), attrib.getNamedItem("value").getNodeValue());
ext.setExtensionData(
attrib.getNamedItem("key").getNodeValue(),
attrib.getNamedItem("value").getNodeValue());
}
}
}
}
}
}
protected void saveInfo() throws CoreException {
String xml;
if ( !isDirty() ) {
if (!isDirty()) {
return;
}
try {
xml = getAsXML();
}
catch (IOException e) {
IStatus s= new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, e.getMessage(), e);
} catch (IOException e) {
IStatus s = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, e.getMessage(), e);
throw new CoreException(s);
}
@ -270,24 +309,24 @@ public class CDescriptor implements ICDescriptor {
fDirty = false;
}
protected void setDirty() {
protected void setDirty() throws CoreException {
fDirty = true;
if (isAutoSave())
saveInfo();
}
protected boolean isDirty() {
return fDirty;
}
protected String serializeDocument(Document doc) throws IOException {
ByteArrayOutputStream s= new ByteArrayOutputStream();
ByteArrayOutputStream s = new ByteArrayOutputStream();
OutputFormat format = new OutputFormat();
format.setIndenting(true);
format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$
Serializer serializer =
SerializerFactory.getSerializerFactory(Method.XML).makeSerializer(
new OutputStreamWriter(s, "UTF8"), //$NON-NLS-1$
format);
format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$
Serializer serializer = SerializerFactory.getSerializerFactory(Method.XML).makeSerializer(new OutputStreamWriter(s, "UTF8"), //$NON-NLS-1$
format);
serializer.asDOMSerializer().serialize(doc);
return s.toString("UTF8"); //$NON-NLS-1$
}
@ -299,25 +338,50 @@ public class CDescriptor implements ICDescriptor {
doc.appendChild(configRootElement);
configRootElement.setAttribute("id", fOwner.getID()); //$NON-NLS-1$
Iterator extIterator = extMap.values().iterator();
while( extIterator.hasNext() ) {
while (extIterator.hasNext()) {
CExtensionReference extension[] = (CExtensionReference[]) extIterator.next();
for( int i = 0; i < extension.length; i ++ ) {
for (int i = 0; i < extension.length; i++) {
configRootElement.appendChild(element = doc.createElement(PROJECT_EXTENSION));
element.setAttribute("point", extension[i].getExtension());
element.setAttribute("id", extension[i].getID());
CExtensionInfo info = (CExtensionInfo) extInfoMap.get(extension[i]);
if ( info != null ) {
if (info != null) {
Iterator attribIterator = info.getAttributes().entrySet().iterator();
while( attribIterator.hasNext() ) {
while (attribIterator.hasNext()) {
Entry entry = (Entry) attribIterator.next();
Element extAttributes = doc.createElement(PROJECT_EXTENSION_ATTRIBUTE);
extAttributes.setAttribute("key", (String)entry.getKey());
extAttributes.setAttribute("value", (String)entry.getValue());
extAttributes.setAttribute("key", (String) entry.getKey());
extAttributes.setAttribute("value", (String) entry.getValue());
element.appendChild(extAttributes);
}
}
}
}
return serializeDocument(doc);
}
}
public boolean isAutoSave() {
return autoSave;
}
public void setAutoSave(boolean autoSave) {
this.autoSave = autoSave;
}
protected ICExtension createExtensions(ICExtensionReference ext) throws CoreException {
InternalCExtension cExtension = null;
IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
IExtensionPoint extensionPoint = pluginRegistry.getExtensionPoint(ext.getExtension());
IExtension extension = extensionPoint.getExtension(ext.getID());
IConfigurationElement element[] = extension.getConfigurationElements();
for (int i = 0; i < element.length; i++) {
if (element[i].getName().equalsIgnoreCase("cextension")) {
cExtension = (InternalCExtension) element[i].createExecutableExtension("run");
cExtension.setExtenionReference(ext);
cExtension.setProject(fProject);
break;
}
}
return (ICExtension) cExtension;
}
}

View file

@ -4,13 +4,10 @@
*/
package org.eclipse.cdt.internal.core;
import java.util.ArrayList;
import java.util.HashMap;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.ICExtension;
import org.eclipse.cdt.core.ICExtensionReference;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@ -20,14 +17,7 @@ import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPluginRegistry;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
public class CDescriptorManager implements IResourceChangeListener {
@ -128,52 +118,43 @@ public class CDescriptorManager implements IResourceChangeListener {
COwner cowner = new COwner(id);
cowner.configure(project, cproject);
cproject.saveInfo();
cproject.setAutoSave(true);
fDescriptorMap.put(project, cproject);
}
public synchronized void convert(IProject project, String id) throws CoreException {
CDescriptor cproject;
if ( fDescriptorMap == null ) {
fDescriptorMap = new HashMap();
}
COwner cowner = new COwner(id);
cproject = new CDescriptor(project, cowner);
cowner.configure(project, cproject);
cproject.saveInfo();
cproject.setAutoSave(true);
fDescriptorMap.put(project, cproject);
}
public ICExtension[] createExtensions(String extensionID, IProject project) throws CoreException {
ArrayList extensionList = new ArrayList(1);
ICDescriptor cDescriptor = getDescriptor(project);
ICExtensionReference ext[] = cDescriptor.get(extensionID, true);
IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
for( int i = 0; i < ext.length; i++ ) {
IExtensionPoint extensionPoint = pluginRegistry.getExtensionPoint(ext[i].getExtension());
IExtension extension = extensionPoint.getExtension(ext[i].getID());
IConfigurationElement element[] = extension.getConfigurationElements();
for( int j = 0; j < element.length; j++ ) {
if ( element[j].getName().equalsIgnoreCase("run") ) {
InternalCExtension cExtension = (InternalCExtension) element[i].createExecutableExtension("class");
cExtension.setExtenionReference(ext[i]);
cExtension.setProject(project);
extensionList.add(cExtension);
break;
}
}
}
return (ICExtension[]) extensionList.toArray(new ICExtension[extensionList.size()]);
}
/**
/**
* Must remove an existing .cdtproject file before we generate a new one when converting
*/
public static void removeExistingCdtProjectFile(IProject project){
IFile file = project.getFile(CDescriptor.DESCRIPTION_FILE_NAME);
IProgressMonitor monitor = new NullProgressMonitor();
// update the resource content
if ((file != null) && file.exists()) {
try{
file.delete(true, monitor);
// remove reference from the fDescriptorMap
if (fDescriptorMap != null){
fDescriptorMap.remove(project);
}
project.refreshLocal(1, monitor);
}catch(CoreException ce){
CCorePlugin.log(ce);
}
}
}
// public static void removeExistingCdtProjectFile(IProject project){
// IFile file = project.getFile(CDescriptor.DESCRIPTION_FILE_NAME);
// IProgressMonitor monitor = new NullProgressMonitor();
//
// // update the resource content
// if ((file != null) && file.exists()) {
// try{
// file.delete(true, monitor);
// // remove reference from the fDescriptorMap
// if (fDescriptorMap != null){
// fDescriptorMap.remove(project);
// }
//
// project.refreshLocal(1, monitor);
// }catch(CoreException ce){
// CCorePlugin.log(ce);
// }
// }
// }
}

View file

@ -4,7 +4,9 @@
*/
package org.eclipse.cdt.internal.core;
import org.eclipse.cdt.core.ICExtension;
import org.eclipse.cdt.core.ICExtensionReference;
import org.eclipse.core.runtime.CoreException;
public class CExtensionReference implements ICExtensionReference {
private CDescriptor fDescriptor;
@ -36,5 +38,9 @@ public class CExtensionReference implements ICExtensionReference {
public String getExtensionData(String key) {
return getInfo().getAttribute(key);
}
public ICExtension createExtension() throws CoreException {
return fDescriptor.createExtensions(this);
}
}

View file

@ -8,15 +8,17 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.ICExtensionReference;
import org.eclipse.cdt.core.ICOwner;
import org.eclipse.core.runtime.CoreException;
public class MakeProject implements ICOwner {
public void configure(ICDescriptor cproject) {
public void configure(ICDescriptor cproject) throws CoreException {
cproject.remove(CCorePlugin.BUILDER_MODEL_ID);
ICExtensionReference ext = cproject.create(CCorePlugin.BUILDER_MODEL_ID, CCorePlugin.PLUGIN_ID + ".makeBuilder");
ext.setExtensionData("command", "make");
}
public void update(ICDescriptor cproject, String extensionID) {
public void update(ICDescriptor cproject, String extensionID) throws CoreException {
if ( extensionID.equals(CCorePlugin.BUILDER_MODEL_ID ) ) {
ICExtensionReference ext = cproject.create(CCorePlugin.BUILDER_MODEL_ID, CCorePlugin.PLUGIN_ID + ".makeBuilder");
ext.setExtensionData("command", "make");

View file

@ -1,3 +1,8 @@
2003-02-19 David Inglis
* src/org/eclipse/cdt/ui/wizards/conversion/ConversionWizard.java
* src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeConversionWizard.java
Due to CDT extensions interface cleanup.
2003-02-17 Doug Schaefer
Merged in Sam Robb's source for the build model. The source can be

View file

@ -124,11 +124,12 @@ public abstract class ConversionWizard
*
* @see org.eclipse.cdt.ui.wizards.CProjectWizard#doRun(IProgressMonitor)
*/
protected void doRun(IProgressMonitor monitor) {
protected void doRun(IProgressMonitor monitor) throws CoreException {
try{
mainPage.doRun(monitor, getProjectID());
} catch (CoreException ce){
CCorePlugin.log(ce);
throw ce;
} finally{
doRunEpilogue(monitor);
monitor.isCanceled();
@ -138,9 +139,7 @@ public abstract class ConversionWizard
* Return the type of project that it is being converted to
* The default if a make project
*/
public String getProjectID() {
return CCorePlugin.PLUGIN_ID + ".make";//$NON-NLS-1$
}
public abstract String getProjectID();
/**
* Method addPages allows subclasses to add as many pages as they need. Overwrite

View file

@ -5,6 +5,7 @@ package org.eclipse.cdt.ui.wizards.conversion;
* All Rights Reserved.
*/
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.ui.CUIPlugin;
/**
@ -85,4 +86,8 @@ public class ConvertToStdMakeConversionWizard extends ConversionWizard {
addPage(mainPage);
}
public String getProjectID() {
return CCorePlugin.PLUGIN_ID + ".make";//$NON-NLS-1$
}
}