mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
- Added the ability to add arbitrary XML data to the
cdtproject file. - Used to store the data that had been put in the cdtbuild file for Standard Make projects. - Cleaned up some of the exception handling in the StandardBuildManager.
This commit is contained in:
parent
c52d8ebf71
commit
6a897468ed
7 changed files with 131 additions and 91 deletions
|
@ -107,7 +107,7 @@ public class StandardBuildTests extends TestCase {
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkDefaultProjectSettings(IProject project) {
|
private void checkDefaultProjectSettings(IProject project) throws Exception {
|
||||||
assertNotNull(project);
|
assertNotNull(project);
|
||||||
|
|
||||||
// There should not be any include path or defined symbols for the project
|
// There should not be any include path or defined symbols for the project
|
||||||
|
@ -128,7 +128,7 @@ public class StandardBuildTests extends TestCase {
|
||||||
assertEquals(EMPTY_STRING, info.getIncrementalBuildArguments());
|
assertEquals(EMPTY_STRING, info.getIncrementalBuildArguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkOverriddenProjectSettings(IProject project) {
|
private void checkOverriddenProjectSettings(IProject project) throws Exception {
|
||||||
assertNotNull(project);
|
assertNotNull(project);
|
||||||
|
|
||||||
// Check that the new stuff is there
|
// Check that the new stuff is there
|
||||||
|
@ -232,7 +232,7 @@ public class StandardBuildTests extends TestCase {
|
||||||
removeProject(PROJECT_NAME);
|
removeProject(PROJECT_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testProjectConversion() {
|
public void testProjectConversion() throws Exception {
|
||||||
// Open the project
|
// Open the project
|
||||||
IProject project = null;
|
IProject project = null;
|
||||||
try {
|
try {
|
||||||
|
@ -280,7 +280,7 @@ public class StandardBuildTests extends TestCase {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void testProjectCreation () {
|
public void testProjectCreation() throws Exception {
|
||||||
// Create a new project
|
// Create a new project
|
||||||
IProject project = null;
|
IProject project = null;
|
||||||
try {
|
try {
|
||||||
|
@ -303,7 +303,7 @@ public class StandardBuildTests extends TestCase {
|
||||||
checkDefaultProjectSettings(project);
|
checkDefaultProjectSettings(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testProjectSettings() {
|
public void testProjectSettings() throws Exception {
|
||||||
// Get the project
|
// Get the project
|
||||||
IProject project = null;
|
IProject project = null;
|
||||||
try {
|
try {
|
||||||
|
@ -342,7 +342,7 @@ public class StandardBuildTests extends TestCase {
|
||||||
checkOverriddenProjectSettings(project);
|
checkOverriddenProjectSettings(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testScannerListenerInterface() {
|
public void testScannerListenerInterface() throws Exception {
|
||||||
// Get the project
|
// Get the project
|
||||||
IProject project = null;
|
IProject project = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package org.eclipse.cdt.core.build.standard;
|
package org.eclipse.cdt.core.build.standard;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStreamWriter;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -11,16 +7,9 @@ import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
|
||||||
|
|
||||||
import org.apache.xerces.dom.DocumentImpl;
|
|
||||||
import org.apache.xml.serialize.Method;
|
|
||||||
import org.apache.xml.serialize.OutputFormat;
|
|
||||||
import org.apache.xml.serialize.Serializer;
|
|
||||||
import org.apache.xml.serialize.SerializerFactory;
|
|
||||||
import org.eclipse.cdt.core.BuildInfoFactory;
|
import org.eclipse.cdt.core.BuildInfoFactory;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.ICDescriptor;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
|
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
||||||
|
@ -30,9 +19,9 @@ import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||||
|
@ -49,18 +38,16 @@ public class StandardBuildManager implements IScannerInfoProvider {
|
||||||
// Name we will use to store build property with the project
|
// Name we will use to store build property with the project
|
||||||
private static final QualifiedName buildInfoProperty
|
private static final QualifiedName buildInfoProperty
|
||||||
= new QualifiedName(CCorePlugin.PLUGIN_ID, "standardBuildInfo");
|
= new QualifiedName(CCorePlugin.PLUGIN_ID, "standardBuildInfo");
|
||||||
|
private static final String ID = CCorePlugin.PLUGIN_ID + ".standardBuildInfo";
|
||||||
|
|
||||||
// Listeners interested in build model changes
|
// Listeners interested in build model changes
|
||||||
private static Map buildModelListeners;
|
private static Map buildModelListeners;
|
||||||
|
|
||||||
private static final String FILE_NAME = ".cdtbuild";
|
|
||||||
private static final String ROOT_ELEM_NAME = "StandardProjectBuildInfo";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param project
|
* @param project
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static IStandardBuildInfo findBuildInfo(IResource resource, boolean create) {
|
private static IStandardBuildInfo findBuildInfo(IResource resource, boolean create) throws CoreException {
|
||||||
IStandardBuildInfo buildInfo = null;
|
IStandardBuildInfo buildInfo = null;
|
||||||
// See if there's already one associated with the resource for this session
|
// See if there's already one associated with the resource for this session
|
||||||
try {
|
try {
|
||||||
|
@ -87,11 +74,11 @@ public class StandardBuildManager implements IScannerInfoProvider {
|
||||||
return buildInfo;
|
return buildInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IStandardBuildInfo getBuildInfo(IProject project) {
|
public static IStandardBuildInfo getBuildInfo(IProject project) throws CoreException {
|
||||||
return findBuildInfo(project, false);
|
return findBuildInfo(project, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IStandardBuildInfo getBuildInfo(IProject project, boolean create) {
|
public static IStandardBuildInfo getBuildInfo(IProject project, boolean create) throws CoreException {
|
||||||
return findBuildInfo(project, create);
|
return findBuildInfo(project, create);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +95,7 @@ public class StandardBuildManager implements IScannerInfoProvider {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.IScannerInfoProvider#managesResource(org.eclipse.core.resources.IResource)
|
* @see org.eclipse.cdt.core.parser.IScannerInfoProvider#managesResource(org.eclipse.core.resources.IResource)
|
||||||
*/
|
*/
|
||||||
public boolean managesResource(IResource resource) {
|
public boolean managesResource(IResource resource) throws CoreException {
|
||||||
/*
|
/*
|
||||||
* Answers true if this project has a build info associated with it
|
* Answers true if this project has a build info associated with it
|
||||||
*/
|
*/
|
||||||
|
@ -129,7 +116,9 @@ public class StandardBuildManager implements IScannerInfoProvider {
|
||||||
return info == null ? false : true;
|
return info == null ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPreprocessorSymbols(IProject project, String[] symbols) {
|
public static void setPreprocessorSymbols(IProject project, String[] symbols)
|
||||||
|
throws CoreException
|
||||||
|
{
|
||||||
// Get the information for the project
|
// Get the information for the project
|
||||||
IStandardBuildInfo info = getBuildInfo(project);
|
IStandardBuildInfo info = getBuildInfo(project);
|
||||||
// Set the new information
|
// Set the new information
|
||||||
|
@ -143,7 +132,9 @@ public class StandardBuildManager implements IScannerInfoProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setIncludePaths(IProject project, String[] paths) {
|
public static void setIncludePaths(IProject project, String[] paths)
|
||||||
|
throws CoreException
|
||||||
|
{
|
||||||
// Get the build info for the project
|
// Get the build info for the project
|
||||||
IStandardBuildInfo info = getBuildInfo(project);
|
IStandardBuildInfo info = getBuildInfo(project);
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
|
@ -177,25 +168,10 @@ public class StandardBuildManager implements IScannerInfoProvider {
|
||||||
* information is then associated with the resource for the duration of
|
* information is then associated with the resource for the duration of
|
||||||
* the session.
|
* the session.
|
||||||
*/
|
*/
|
||||||
private static IStandardBuildInfo loadBuildInfo(IProject project) {
|
private static IStandardBuildInfo loadBuildInfo(IProject project) throws CoreException {
|
||||||
IStandardBuildInfo buildInfo = null;
|
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project);
|
||||||
IFile file = project.getFile(FILE_NAME);
|
IStandardBuildInfo buildInfo = BuildInfoFactory.create(project, descriptor.getProjectData(ID));
|
||||||
if (!file.exists())
|
project.setSessionProperty(buildInfoProperty, buildInfo);
|
||||||
return null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
InputStream stream = file.getContents();
|
|
||||||
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
|
||||||
Document document = parser.parse(stream);
|
|
||||||
Node rootElement = document.getFirstChild();
|
|
||||||
if (rootElement.getNodeName().equals(ROOT_ELEM_NAME)) {
|
|
||||||
buildInfo = BuildInfoFactory.create(project, (Element)rootElement);
|
|
||||||
project.setSessionProperty(buildInfoProperty, buildInfo);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
buildInfo = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return buildInfo;
|
return buildInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,38 +200,25 @@ public class StandardBuildManager implements IScannerInfoProvider {
|
||||||
*
|
*
|
||||||
* @param project
|
* @param project
|
||||||
*/
|
*/
|
||||||
public static void saveBuildInfo(IProject project) {
|
public static void saveBuildInfo(IProject project) throws CoreException {
|
||||||
// Create document
|
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project);
|
||||||
Document doc = new DocumentImpl();
|
|
||||||
Element rootElement = doc.createElement(ROOT_ELEM_NAME);
|
Element rootElement = descriptor.getProjectData(ID);
|
||||||
doc.appendChild(rootElement);
|
|
||||||
|
// Clear out all current children
|
||||||
|
// Note: Probably would be a better idea to merge in the data
|
||||||
|
NodeList nodes = rootElement.getChildNodes();
|
||||||
|
for (int i = 0; i < nodes.getLength(); ++i) {
|
||||||
|
Node node = nodes.item(i);
|
||||||
|
if (node instanceof Element)
|
||||||
|
rootElement.removeChild(nodes.item(i));
|
||||||
|
}
|
||||||
|
|
||||||
// Save the build info
|
// Save the build info
|
||||||
IStandardBuildInfo buildInfo = getBuildInfo(project);
|
IStandardBuildInfo buildInfo = getBuildInfo(project);
|
||||||
if (buildInfo != null)
|
if (buildInfo != null)
|
||||||
buildInfo.serialize(doc, rootElement);
|
buildInfo.serialize(rootElement.getOwnerDocument(), rootElement);
|
||||||
|
descriptor.saveProjectData();
|
||||||
// Save the document
|
|
||||||
ByteArrayOutputStream s = new ByteArrayOutputStream();
|
|
||||||
OutputFormat format = new OutputFormat();
|
|
||||||
format.setIndenting(true);
|
|
||||||
format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$
|
|
||||||
String xml = null;
|
|
||||||
try {
|
|
||||||
Serializer serializer = SerializerFactory.getSerializerFactory(Method.XML).makeSerializer(new OutputStreamWriter(s, "UTF8"), format);
|
|
||||||
serializer.asDOMSerializer().serialize(doc);
|
|
||||||
xml = s.toString("UTF8"); //$NON-NLS-1$
|
|
||||||
IFile rscFile = project.getFile(FILE_NAME);
|
|
||||||
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
|
|
||||||
// update the resource content
|
|
||||||
if (rscFile.exists()) {
|
|
||||||
rscFile.setContents(inputStream, IResource.FORCE, null);
|
|
||||||
} else {
|
|
||||||
rscFile.create(inputStream, IResource.FORCE, null);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.eclipse.cdt.core.parser;
|
package org.eclipse.cdt.core.parser;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||||
|
@ -31,7 +32,7 @@ public interface IScannerInfoProvider {
|
||||||
* @param resource
|
* @param resource
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean managesResource(IResource resource);
|
public boolean managesResource(IResource resource) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The receiver will no longer notify the listener specified in
|
* The receiver will no longer notify the listener specified in
|
||||||
|
|
|
@ -296,8 +296,11 @@ public class CProjectNature implements IProjectNature {
|
||||||
* @see IProjectNature#setProject
|
* @see IProjectNature#setProject
|
||||||
*/
|
*/
|
||||||
public void setProject(IProject project) {
|
public void setProject(IProject project) {
|
||||||
fProject= project;
|
try {
|
||||||
fBuildInfo = StandardBuildManager.getBuildInfo(fProject, true);
|
fProject= project;
|
||||||
|
fBuildInfo = StandardBuildManager.getBuildInfo(fProject, true);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.core;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
public interface ICDescriptor {
|
public interface ICDescriptor {
|
||||||
public ICOwnerInfo getProjectOwner();
|
public ICOwnerInfo getProjectOwner();
|
||||||
|
@ -27,4 +28,7 @@ public interface ICDescriptor {
|
||||||
|
|
||||||
public void setPathEntries(ICPathEntry[] entries) throws CoreException;
|
public void setPathEntries(ICPathEntry[] entries) throws CoreException;
|
||||||
public ICPathEntry[] getPathEntries();
|
public ICPathEntry[] getPathEntries();
|
||||||
|
|
||||||
|
public Element getProjectData(String id) throws CoreException;
|
||||||
|
public void saveProjectData() throws CoreException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Map.Entry;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import org.apache.xerces.dom.DocumentImpl;
|
import org.apache.xerces.dom.DocumentImpl;
|
||||||
import org.apache.xml.serialize.Method;
|
import org.apache.xml.serialize.Method;
|
||||||
|
@ -60,6 +61,7 @@ public class CDescriptor implements ICDescriptor {
|
||||||
private IProject fProject;
|
private IProject fProject;
|
||||||
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 Document dataDoc;
|
||||||
|
|
||||||
static final String DESCRIPTION_FILE_NAME = ".cdtproject";
|
static final String DESCRIPTION_FILE_NAME = ".cdtproject";
|
||||||
private static final char[][] NO_CHAR_CHAR = new char[0][];
|
private static final char[][] NO_CHAR_CHAR = new char[0][];
|
||||||
|
@ -67,6 +69,9 @@ public class CDescriptor implements ICDescriptor {
|
||||||
private static final String PROJECT_EXTENSION = "extension";
|
private static final String PROJECT_EXTENSION = "extension";
|
||||||
private static final String PROJECT_EXTENSION_ATTRIBUTE = "attribute";
|
private static final String PROJECT_EXTENSION_ATTRIBUTE = "attribute";
|
||||||
private static final String PATH_ENTRY = "cpathentry";
|
private static final String PATH_ENTRY = "cpathentry";
|
||||||
|
private static final String PROJECT_DATA = "data";
|
||||||
|
private static final String PROJECT_DATA_ITEM = "item";
|
||||||
|
private static final String PROJECT_DATA_ID = "id";
|
||||||
|
|
||||||
private boolean fDirty;
|
private boolean fDirty;
|
||||||
private boolean autoSave;
|
private boolean autoSave;
|
||||||
|
@ -328,6 +333,8 @@ public class CDescriptor implements ICDescriptor {
|
||||||
if (entry != null) {
|
if (entry != null) {
|
||||||
pathEntries.add(entry);
|
pathEntries.add(entry);
|
||||||
}
|
}
|
||||||
|
} else if (childNode.getNodeName().equals(PROJECT_DATA)) {
|
||||||
|
decodeProjectData((Element)childNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,6 +457,7 @@ public class CDescriptor implements ICDescriptor {
|
||||||
configRootElement.setAttribute("id", fOwner.getID()); //$NON-NLS-1$
|
configRootElement.setAttribute("id", fOwner.getID()); //$NON-NLS-1$
|
||||||
encodeProjectExtensions(doc, configRootElement);
|
encodeProjectExtensions(doc, configRootElement);
|
||||||
encodePathEntries(doc, configRootElement);
|
encodePathEntries(doc, configRootElement);
|
||||||
|
encodeProjectData(doc, configRootElement);
|
||||||
return serializeDocument(doc);
|
return serializeDocument(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,4 +553,55 @@ public class CDescriptor implements ICDescriptor {
|
||||||
}
|
}
|
||||||
return (ICExtension) cExtension;
|
return (ICExtension) cExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The project data allows for the storage of any structured information
|
||||||
|
// into the cdtproject file.
|
||||||
|
private Document getProjectDataDoc() throws CoreException {
|
||||||
|
if (dataDoc == null) {
|
||||||
|
try {
|
||||||
|
dataDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
|
||||||
|
} catch (ParserConfigurationException e) {
|
||||||
|
throw new CoreException(
|
||||||
|
new Status(
|
||||||
|
IStatus.ERROR,
|
||||||
|
CCorePlugin.PLUGIN_ID,
|
||||||
|
IStatus.ERROR,
|
||||||
|
"getProjectDataDoc",
|
||||||
|
e));
|
||||||
|
}
|
||||||
|
Element rootElem = dataDoc.createElement(PROJECT_DATA);
|
||||||
|
dataDoc.appendChild(rootElem);
|
||||||
|
}
|
||||||
|
return dataDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void decodeProjectData(Element data) throws CoreException {
|
||||||
|
Document doc = getProjectDataDoc();
|
||||||
|
doc.getDocumentElement().appendChild(doc.importNode(data, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Element getProjectData(String id) throws CoreException {
|
||||||
|
NodeList nodes = getProjectDataDoc().getDocumentElement().getElementsByTagName(PROJECT_DATA_ITEM);
|
||||||
|
for (int i = 0; i < nodes.getLength(); ++i) {
|
||||||
|
Element element = (Element)nodes.item(i);
|
||||||
|
if (element.getAttribute(PROJECT_DATA_ID).equals(id))
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not found, make a new one
|
||||||
|
Element element = dataDoc.createElement(PROJECT_DATA_ITEM);
|
||||||
|
element.setAttribute(PROJECT_DATA_ID, id);
|
||||||
|
dataDoc.getDocumentElement().appendChild(element);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveProjectData() throws CoreException {
|
||||||
|
setDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void encodeProjectData(Document doc, Element root) {
|
||||||
|
// Don't create or encode the doc if it isn't there already
|
||||||
|
if (dataDoc != null)
|
||||||
|
root.appendChild(doc.importNode(dataDoc.getDocumentElement(), true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,14 +265,18 @@ public class BuildPathInfoBlock implements IWizardTab {
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
}
|
}
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
// Store the paths and symbols
|
try {
|
||||||
monitor.beginTask("Setting Include Paths", 1);
|
// Store the paths and symbols
|
||||||
StandardBuildManager.setIncludePaths(project, getPathListContents());
|
monitor.beginTask("Setting Include Paths", 1);
|
||||||
|
StandardBuildManager.setIncludePaths(project, getPathListContents());
|
||||||
|
|
||||||
monitor.beginTask("Setting Defined Symbols", 1);
|
monitor.beginTask("Setting Defined Symbols", 1);
|
||||||
StandardBuildManager.setPreprocessorSymbols(project, getSymbolListContents());
|
StandardBuildManager.setPreprocessorSymbols(project, getSymbolListContents());
|
||||||
|
|
||||||
StandardBuildManager.saveBuildInfo(project);
|
StandardBuildManager.saveBuildInfo(project);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// Should probably tell someone
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,15 +593,21 @@ public class BuildPathInfoBlock implements IWizardTab {
|
||||||
|
|
||||||
private void setPathListContents() {
|
private void setPathListContents() {
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
IStandardBuildInfo info = StandardBuildManager.getBuildInfo(project);
|
try {
|
||||||
pathList.setItems(info.getIncludePaths());
|
IStandardBuildInfo info = StandardBuildManager.getBuildInfo(project);
|
||||||
|
pathList.setItems(info.getIncludePaths());
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSymbolListContents() {
|
private void setSymbolListContents() {
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
IStandardBuildInfo info = StandardBuildManager.getBuildInfo(project);
|
try {
|
||||||
symbolList.setItems(info.getPreprocessorSymbols());
|
IStandardBuildInfo info = StandardBuildManager.getBuildInfo(project);
|
||||||
|
symbolList.setItems(info.getPreprocessorSymbols());
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue