mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
made scanner info seperate from build info
This commit is contained in:
parent
36fd016fbb
commit
16a1cd62be
8 changed files with 198 additions and 204 deletions
|
@ -16,11 +16,11 @@
|
|||
</requires>
|
||||
|
||||
<extension
|
||||
id="MakeBuildManager"
|
||||
id="MakeScannerProvider"
|
||||
point="org.eclipse.cdt.core.ScannerInfoProvider">
|
||||
<cextension>
|
||||
<run
|
||||
class="org.eclipse.cdt.make.core.MakeBuildManager">
|
||||
class="org.eclipse.cdt.make.core.MakeScannerProvider">
|
||||
</run>
|
||||
</cextension>
|
||||
</extension>
|
||||
|
|
|
@ -11,13 +11,8 @@ package org.eclipse.cdt.make.core;
|
|||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||
import org.eclipse.core.resources.ICommand;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
|
@ -47,10 +42,7 @@ public class BuildInfoFactory {
|
|||
private static final String BUILD_AUTO_ENABLED = PREFIX + ".enableAutoBuild";
|
||||
private static final String BUILD_ARGUMENTS = PREFIX + ".buildArguments";
|
||||
|
||||
private abstract static class Store implements IMakeBuilderInfo, IScannerInfo {
|
||||
// List of include paths
|
||||
protected List pathList;
|
||||
protected List symbolList;
|
||||
private abstract static class Store implements IMakeBuilderInfo {
|
||||
|
||||
public void setUseDefaultBuildCmd(boolean on) throws CoreException {
|
||||
putValue(USE_DEFAULT_BUILD_CMD, new Boolean(on).toString());
|
||||
|
@ -143,68 +135,6 @@ public class BuildInfoFactory {
|
|||
return getString(BUILD_TARGET_FULL);
|
||||
}
|
||||
|
||||
public void setPreprocessorSymbols(String[] symbols) {
|
||||
// Clear out any existing symbols and add the new stuff
|
||||
getSymbolList().clear();
|
||||
getSymbolList().addAll(Arrays.asList(symbols));
|
||||
}
|
||||
|
||||
public void setIncludePaths(String[] paths) {
|
||||
// Clear the existing list and add the paths
|
||||
getPathList().clear();
|
||||
getPathList().addAll(Arrays.asList(paths));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths()
|
||||
*/
|
||||
public String[] getIncludePaths() {
|
||||
return (String[])getPathList().toArray(new String[getPathList().size()]);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths()
|
||||
*/
|
||||
public Map getDefinedSymbols() {
|
||||
// Return the defined symbols for the default configuration
|
||||
HashMap symbols = new HashMap();
|
||||
String[] symbolList = getPreprocessorSymbols();
|
||||
for (int i = 0; i < symbolList.length; ++i) {
|
||||
String symbol = symbolList[i];
|
||||
if (symbol.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
String key = new String();
|
||||
String value = new String();
|
||||
int index = symbol.indexOf("=");
|
||||
if (index != -1) {
|
||||
key = symbol.substring(0, index).trim();
|
||||
value = symbol.substring(index + 1).trim();
|
||||
} else {
|
||||
key = symbol.trim();
|
||||
}
|
||||
symbols.put(key, value);
|
||||
}
|
||||
return symbols;
|
||||
}
|
||||
|
||||
protected List getPathList() {
|
||||
if (pathList == null) {
|
||||
pathList = new ArrayList();
|
||||
}
|
||||
return pathList;
|
||||
}
|
||||
|
||||
public String[] getPreprocessorSymbols() {
|
||||
return (String[])getSymbolList().toArray(new String[getSymbolList().size()]);
|
||||
}
|
||||
|
||||
protected List getSymbolList() {
|
||||
if (symbolList == null) {
|
||||
symbolList = new ArrayList();
|
||||
}
|
||||
return symbolList;
|
||||
}
|
||||
|
||||
public boolean getBoolean(String property) {
|
||||
return Boolean.valueOf(getString(property)).booleanValue();
|
||||
|
|
|
@ -27,9 +27,6 @@ public interface IMakeBuilderInfo {
|
|||
String getIncrementalBuildTarget();
|
||||
boolean isFullBuildEnabled();
|
||||
String getFullBuildTarget();
|
||||
|
||||
public String[] getPreprocessorSymbols();
|
||||
public String[] getIncludePaths();
|
||||
|
||||
void setBuildLocation(IPath location) throws CoreException;
|
||||
void setStopOnError(boolean on) throws CoreException;
|
||||
|
@ -43,8 +40,5 @@ public interface IMakeBuilderInfo {
|
|||
void setIncrementalBuildTarget(String target) throws CoreException;
|
||||
void setFullBuildEnable(boolean enabled) throws CoreException;
|
||||
void setFullBuildTarget(String target) throws CoreException;
|
||||
|
||||
public void setPreprocessorSymbols(String[] symbols);
|
||||
public void setIncludePaths(String[] paths);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.eclipse.core.runtime.SubProgressMonitor;
|
|||
|
||||
public class MakeProjectNature implements IProjectNature {
|
||||
|
||||
private IMakeBuilderInfo fBuildInfo;
|
||||
public final static String NATURE_ID = MakeCorePlugin.getUniqueIdentifier() + ".makeNature";
|
||||
private IProject fProject;
|
||||
|
||||
|
@ -103,21 +102,22 @@ public class MakeProjectNature implements IProjectNature {
|
|||
public void configure() throws CoreException {
|
||||
addBuildSpec();
|
||||
IMakeBuilderInfo info = BuildInfoFactory.create(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID, false);
|
||||
fBuildInfo.setBuildLocation(info.getBuildLocation());
|
||||
IMakeBuilderInfo projectInfo = BuildInfoFactory.create(getProject(), MakeBuilder.BUILDER_ID);
|
||||
projectInfo.setBuildLocation(info.getBuildLocation());
|
||||
|
||||
|
||||
fBuildInfo.setUseDefaultBuildCmd(info.isDefaultBuildCmd());
|
||||
fBuildInfo.setStopOnError(info.isStopOnError());
|
||||
fBuildInfo.setBuildCommand(info.getBuildCommand());
|
||||
projectInfo.setUseDefaultBuildCmd(info.isDefaultBuildCmd());
|
||||
projectInfo.setStopOnError(info.isStopOnError());
|
||||
projectInfo.setBuildCommand(info.getBuildCommand());
|
||||
|
||||
fBuildInfo.setAutoBuildEnable(info.isAutoBuildEnable());
|
||||
fBuildInfo.setAutoBuildTarget(info.getAutoBuildTarget());
|
||||
projectInfo.setAutoBuildEnable(info.isAutoBuildEnable());
|
||||
projectInfo.setAutoBuildTarget(info.getAutoBuildTarget());
|
||||
|
||||
fBuildInfo.setIncrementalBuildEnable(info.isIncrementalBuildEnabled());
|
||||
fBuildInfo.setIncrementalBuildTarget(info.getIncrementalBuildTarget());
|
||||
projectInfo.setIncrementalBuildEnable(info.isIncrementalBuildEnabled());
|
||||
projectInfo.setIncrementalBuildTarget(info.getIncrementalBuildTarget());
|
||||
|
||||
fBuildInfo.setFullBuildEnable(info.isFullBuildEnabled());
|
||||
fBuildInfo.setFullBuildTarget(info.getFullBuildTarget());
|
||||
projectInfo.setFullBuildEnable(info.isFullBuildEnabled());
|
||||
projectInfo.setFullBuildTarget(info.getFullBuildTarget());
|
||||
}
|
||||
|
||||
public void removeBuildSpec() throws CoreException {
|
||||
|
@ -142,10 +142,6 @@ public class MakeProjectNature implements IProjectNature {
|
|||
* @see IProjectNature#setProject
|
||||
*/
|
||||
public void setProject(IProject project) {
|
||||
try {
|
||||
fProject = project;
|
||||
fBuildInfo = MakeBuildManager.getBuildInfo(fProject, true);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
fProject = project;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Created on Aug 14, 2003
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
package org.eclipse.cdt.make.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
||||
/**
|
||||
* @author David
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class MakeScannerInfo implements IScannerInfo {
|
||||
private IProject project;
|
||||
private ArrayList symbolList;
|
||||
private ArrayList pathList;
|
||||
|
||||
MakeScannerInfo(IProject project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
IProject getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void update() throws CoreException {
|
||||
MakeScannerProvider.updateScannerInfo(this);
|
||||
}
|
||||
|
||||
public synchronized void setPreprocessorSymbols(String[] symbols) {
|
||||
// Clear out any existing symbols and add the new stuff
|
||||
getSymbolList().clear();
|
||||
getSymbolList().addAll(Arrays.asList(symbols));
|
||||
}
|
||||
|
||||
public synchronized void setIncludePaths(String[] paths) {
|
||||
// Clear the existing list and add the paths
|
||||
getPathList().clear();
|
||||
getPathList().addAll(Arrays.asList(paths));
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths()
|
||||
*/
|
||||
public synchronized String[] getIncludePaths() {
|
||||
return (String[])getPathList().toArray(new String[getPathList().size()]);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths()
|
||||
*/
|
||||
public synchronized Map getDefinedSymbols() {
|
||||
// Return the defined symbols for the default configuration
|
||||
HashMap symbols = new HashMap();
|
||||
String[] symbolList = getPreprocessorSymbols();
|
||||
for (int i = 0; i < symbolList.length; ++i) {
|
||||
String symbol = symbolList[i];
|
||||
if (symbol.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
String key = new String();
|
||||
String value = new String();
|
||||
int index = symbol.indexOf("=");
|
||||
if (index != -1) {
|
||||
key = symbol.substring(0, index).trim();
|
||||
value = symbol.substring(index + 1).trim();
|
||||
} else {
|
||||
key = symbol.trim();
|
||||
}
|
||||
symbols.put(key, value);
|
||||
}
|
||||
return symbols;
|
||||
}
|
||||
|
||||
protected List getPathList() {
|
||||
if (pathList == null) {
|
||||
pathList = new ArrayList();
|
||||
}
|
||||
return pathList;
|
||||
}
|
||||
|
||||
public synchronized String[] getPreprocessorSymbols() {
|
||||
return (String[])getSymbolList().toArray(new String[getSymbolList().size()]);
|
||||
}
|
||||
|
||||
protected List getSymbolList() {
|
||||
if (symbolList == null) {
|
||||
symbolList = new ArrayList();
|
||||
}
|
||||
return symbolList;
|
||||
}
|
||||
}
|
|
@ -33,15 +33,14 @@ import org.w3c.dom.Document;
|
|||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
public class MakeBuildManager extends AbstractCExtension implements IScannerInfoProvider {
|
||||
public class MakeScannerProvider extends AbstractCExtension implements IScannerInfoProvider {
|
||||
|
||||
// This is the id of the IScannerInfoProvider extension point entry
|
||||
public static final String INTERFACE_IDENTITY = MakeCorePlugin.getUniqueIdentifier() + ".MakeBuildManager";
|
||||
public static final String INTERFACE_IDENTITY = MakeCorePlugin.getUniqueIdentifier() + ".MakeScannerProvider";
|
||||
|
||||
// Name we will use to store build property with the project
|
||||
private static final QualifiedName buildInfoProperty
|
||||
= new QualifiedName(MakeCorePlugin.getUniqueIdentifier(), "makeBuildInfo");
|
||||
private static final String ID = MakeCorePlugin.getUniqueIdentifier() + ".makeBuildInfo";
|
||||
private static final QualifiedName scannerInfoProperty = new QualifiedName(MakeCorePlugin.getUniqueIdentifier(), "makeBuildInfo");
|
||||
private static final String CDESCRIPTOR_ID = MakeCorePlugin.getUniqueIdentifier() + ".makeScannerInfo";
|
||||
|
||||
public static final String INCLUDE_PATH = "includePath";
|
||||
public static final String PATH = "path";
|
||||
|
@ -49,117 +48,82 @@ public class MakeBuildManager extends AbstractCExtension implements IScannerInfo
|
|||
public static final String SYMBOL = "symbol";
|
||||
|
||||
// Listeners interested in build model changes
|
||||
private static Map buildModelListeners;
|
||||
private static Map listeners;
|
||||
|
||||
/**
|
||||
* @param project
|
||||
* @return
|
||||
*/
|
||||
private static IMakeBuilderInfo findBuildInfo(IResource resource, boolean create) throws CoreException {
|
||||
IMakeBuilderInfo buildInfo = null;
|
||||
private static MakeScannerProvider defaultProvider;
|
||||
|
||||
public static MakeScannerProvider getDefault() {
|
||||
if ( defaultProvider == null) {
|
||||
defaultProvider = new MakeScannerProvider();
|
||||
}
|
||||
return defaultProvider;
|
||||
}
|
||||
|
||||
public MakeScannerInfo getMakeScannerInfo(IProject project) throws CoreException {
|
||||
MakeScannerInfo scannerInfo = null;
|
||||
// See if there's already one associated with the resource for this session
|
||||
buildInfo = (IMakeBuilderInfo)resource.getSessionProperty(buildInfoProperty);
|
||||
scannerInfo = (MakeScannerInfo)project.getSessionProperty(scannerInfoProperty);
|
||||
|
||||
// Try to load one for the project
|
||||
if (buildInfo == null && resource instanceof IProject) {
|
||||
buildInfo = loadBuildInfo((IProject)resource);
|
||||
if (scannerInfo == null ) {
|
||||
scannerInfo = loadScannerInfo(project);
|
||||
}
|
||||
|
||||
// There is nothing persisted for the session, or saved in a file so
|
||||
// create a build info object
|
||||
if (buildInfo != null) {
|
||||
((IProject)resource).setSessionProperty(buildInfoProperty, buildInfo);
|
||||
if (scannerInfo != null) {
|
||||
((IProject)project).setSessionProperty(scannerInfoProperty, scannerInfo);
|
||||
}
|
||||
return buildInfo;
|
||||
}
|
||||
|
||||
public static IMakeBuilderInfo getBuildInfo(IProject project) throws CoreException {
|
||||
return findBuildInfo(project, false);
|
||||
}
|
||||
|
||||
public static IMakeBuilderInfo getBuildInfo(IProject project, boolean create) throws CoreException {
|
||||
return findBuildInfo(project, create);
|
||||
return scannerInfo;
|
||||
}
|
||||
|
||||
/*
|
||||
* @return
|
||||
*/
|
||||
private static synchronized Map getBuildModelListeners() {
|
||||
if (buildModelListeners == null) {
|
||||
buildModelListeners = new HashMap();
|
||||
private synchronized static Map getListeners() {
|
||||
if (listeners == null) {
|
||||
listeners = new HashMap();
|
||||
}
|
||||
return buildModelListeners;
|
||||
return listeners;
|
||||
}
|
||||
|
||||
public static void setPreprocessorSymbols(IProject project, String[] symbols)
|
||||
throws CoreException
|
||||
{
|
||||
// Get the information for the project
|
||||
IMakeBuilderInfo info = getBuildInfo(project);
|
||||
// Set the new information
|
||||
if (info != null) {
|
||||
String[] oldSymbols = info.getPreprocessorSymbols();
|
||||
if (!Arrays.equals(oldSymbols, symbols)) {
|
||||
info.setPreprocessorSymbols(symbols);
|
||||
// Alert the listeners
|
||||
setScannerInfoDirty(project, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void setIncludePaths(IProject project, String[] paths)
|
||||
throws CoreException
|
||||
{
|
||||
// Get the build info for the project
|
||||
IMakeBuilderInfo info = getBuildInfo(project);
|
||||
if (info != null) {
|
||||
String[] oldPaths = info.getIncludePaths();
|
||||
if (!Arrays.equals(oldPaths, paths)) {
|
||||
info.setIncludePaths(paths);
|
||||
setScannerInfoDirty(project, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param project
|
||||
* @param info
|
||||
*/
|
||||
private static void setScannerInfoDirty(IProject project, IMakeBuilderInfo info) {
|
||||
private static void notifyInfoListeners(IProject project, IScannerInfo info) {
|
||||
// Call in the cavalry
|
||||
List listeners = (List) getBuildModelListeners().get(project);
|
||||
List listeners = (List)getListeners().get(project);
|
||||
if (listeners == null) {
|
||||
return;
|
||||
}
|
||||
ListIterator iter = listeners.listIterator();
|
||||
while (iter.hasNext()) {
|
||||
((IScannerInfoChangeListener)iter.next()).changeNotification(project, (IScannerInfo) info);
|
||||
((IScannerInfoChangeListener)iter.next()).changeNotification(project, (IScannerInfo)info);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.IScannerInfoProvider#getScannerInformation(org.eclipse.core.resources.IResource)
|
||||
*/
|
||||
public IScannerInfo getScannerInformation(IResource resource) {
|
||||
IMakeBuilderInfo info;
|
||||
try {
|
||||
info = getBuildInfo((IProject)resource);
|
||||
} catch (CoreException e) {
|
||||
return null;
|
||||
}
|
||||
return (IScannerInfo)info;
|
||||
public IScannerInfo getScannerInformation(IResource resource) {
|
||||
IScannerInfo info = null;
|
||||
try {
|
||||
info = getMakeScannerInfo((IProject)resource);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
/*
|
||||
* Loads the build file and parses the nodes for build information. The
|
||||
* information is then associated with the resource for the duration of
|
||||
* the session.
|
||||
*/
|
||||
private static IMakeBuilderInfo loadBuildInfo(IProject project) throws CoreException {
|
||||
private MakeScannerInfo loadScannerInfo(IProject project) throws CoreException {
|
||||
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project);
|
||||
IMakeBuilderInfo buildInfo = BuildInfoFactory.create(project, MakeBuilder.BUILDER_ID);
|
||||
Node child = descriptor.getProjectData(ID).getFirstChild();
|
||||
Node child = descriptor.getProjectData(CDESCRIPTOR_ID).getFirstChild();
|
||||
ArrayList includes = new ArrayList();
|
||||
ArrayList symbols = new ArrayList();
|
||||
while (child != null) {
|
||||
|
@ -172,9 +136,10 @@ public class MakeBuildManager extends AbstractCExtension implements IScannerInfo
|
|||
}
|
||||
child = child.getNextSibling();
|
||||
}
|
||||
buildInfo.setIncludePaths((String[]) includes.toArray(new String[includes.size()]));
|
||||
buildInfo.setPreprocessorSymbols((String[]) symbols.toArray(new String[symbols.size()]));
|
||||
return buildInfo;
|
||||
MakeScannerInfo info = new MakeScannerInfo(project);
|
||||
info.setIncludePaths((String[])includes.toArray(new String[includes.size()]));
|
||||
info.setPreprocessorSymbols((String[])symbols.toArray(new String[symbols.size()]));
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -187,9 +152,9 @@ public class MakeBuildManager extends AbstractCExtension implements IScannerInfo
|
|||
*
|
||||
* @param resource
|
||||
*/
|
||||
public static void removeBuildInfo(IResource resource) {
|
||||
public static void removeScannerInfo(IResource resource) {
|
||||
try {
|
||||
resource.setSessionProperty(buildInfoProperty, null);
|
||||
resource.setSessionProperty(scannerInfoProperty, null);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
|
@ -202,11 +167,13 @@ public class MakeBuildManager extends AbstractCExtension implements IScannerInfo
|
|||
*
|
||||
* @param project
|
||||
*/
|
||||
public static void saveBuildInfo(IProject project) throws CoreException {
|
||||
static void updateScannerInfo(MakeScannerInfo scannerInfo) throws CoreException {
|
||||
IProject project = scannerInfo.getProject();
|
||||
|
||||
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project);
|
||||
|
||||
Element rootElement = descriptor.getProjectData(ID);
|
||||
|
||||
|
||||
Element rootElement = descriptor.getProjectData(CDESCRIPTOR_ID);
|
||||
|
||||
// Clear out all current children
|
||||
// Note: Probably would be a better idea to merge in the data
|
||||
Node child = rootElement.getFirstChild();
|
||||
|
@ -214,20 +181,19 @@ public class MakeBuildManager extends AbstractCExtension implements IScannerInfo
|
|||
rootElement.removeChild(child);
|
||||
child = rootElement.getFirstChild();
|
||||
}
|
||||
|
||||
|
||||
// Save the build info
|
||||
IMakeBuilderInfo buildInfo = getBuildInfo(project);
|
||||
if (buildInfo != null) {
|
||||
if (scannerInfo != null) {
|
||||
// Serialize the include paths
|
||||
Document doc = rootElement.getOwnerDocument();
|
||||
ListIterator iter = Arrays.asList(buildInfo.getIncludePaths()).listIterator();
|
||||
while (iter.hasNext()){
|
||||
ListIterator iter = Arrays.asList(scannerInfo.getIncludePaths()).listIterator();
|
||||
while (iter.hasNext()) {
|
||||
Element pathElement = doc.createElement(INCLUDE_PATH);
|
||||
pathElement.setAttribute(PATH, (String)iter.next());
|
||||
rootElement.appendChild(pathElement);
|
||||
}
|
||||
// Now do the same for the symbols
|
||||
iter = Arrays.asList(buildInfo.getPreprocessorSymbols()).listIterator();
|
||||
iter = Arrays.asList(scannerInfo.getPreprocessorSymbols()).listIterator();
|
||||
while (iter.hasNext()) {
|
||||
Element symbolElement = doc.createElement(DEFINED_SYMBOL);
|
||||
symbolElement.setAttribute(SYMBOL, (String)iter.next());
|
||||
|
@ -235,6 +201,7 @@ public class MakeBuildManager extends AbstractCExtension implements IScannerInfo
|
|||
}
|
||||
descriptor.saveProjectData();
|
||||
}
|
||||
notifyInfoListeners(project, scannerInfo);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -250,8 +217,8 @@ public class MakeBuildManager extends AbstractCExtension implements IScannerInfo
|
|||
return;
|
||||
}
|
||||
// Get listeners for this resource
|
||||
Map map = getBuildModelListeners();
|
||||
List list = (List) map.get(project);
|
||||
Map map = getListeners();
|
||||
List list = (List)map.get(project);
|
||||
if (list == null) {
|
||||
// Create a new list
|
||||
list = new ArrayList();
|
||||
|
@ -276,8 +243,8 @@ public class MakeBuildManager extends AbstractCExtension implements IScannerInfo
|
|||
return;
|
||||
}
|
||||
// Remove the listener
|
||||
Map map = getBuildModelListeners();
|
||||
List list = (List) map.get(project);
|
||||
Map map = getListeners();
|
||||
List list = (List)map.get(project);
|
||||
if (list != null && !list.isEmpty()) {
|
||||
// The list is not empty so try to remove listener
|
||||
list.remove(listener);
|
|
@ -14,7 +14,7 @@ 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.cdt.make.core.MakeBuildManager;
|
||||
import org.eclipse.cdt.make.core.MakeScannerProvider;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
@ -25,7 +25,7 @@ public class MakeProject implements ICOwner {
|
|||
ICExtensionReference ext = cproject.create(CCorePlugin.BUILDER_MODEL_ID, MakeCorePlugin.getUniqueIdentifier() + ".makeBuilder");
|
||||
ext.setExtensionData("command", "make");
|
||||
cproject.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
|
||||
cproject.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, MakeBuildManager.INTERFACE_IDENTITY);
|
||||
cproject.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, MakeScannerProvider.INTERFACE_IDENTITY);
|
||||
}
|
||||
|
||||
public void update(ICDescriptor cproject, String extensionID) throws CoreException {
|
||||
|
@ -34,7 +34,7 @@ public class MakeProject implements ICOwner {
|
|||
ext.setExtensionData("command", "make");
|
||||
}
|
||||
if ( extensionID.equals(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID)) {
|
||||
cproject.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, MakeBuildManager.INTERFACE_IDENTITY);
|
||||
cproject.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, MakeScannerProvider.INTERFACE_IDENTITY);
|
||||
}
|
||||
if ( extensionID.equals(CCorePlugin.BINARY_PARSER_UNIQ_ID)) {
|
||||
cproject.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, CCorePlugin.PLUGIN_ID + ".Elf");
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.eclipse.cdt.make.ui;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.util.SWTUtil;
|
||||
import org.eclipse.cdt.make.core.IMakeBuilderInfo;
|
||||
import org.eclipse.cdt.make.core.MakeBuildManager;
|
||||
import org.eclipse.cdt.make.core.MakeScannerInfo;
|
||||
import org.eclipse.cdt.make.core.MakeScannerProvider;
|
||||
import org.eclipse.cdt.ui.AbstractCOptionPage;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||
|
@ -252,13 +252,14 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
|
|||
}
|
||||
if (getContainer().getProject() != null) {
|
||||
// Store the paths and symbols
|
||||
monitor.beginTask("Setting Include Paths", 1);
|
||||
MakeBuildManager.setIncludePaths(getContainer().getProject(), getPathListContents());
|
||||
|
||||
monitor.beginTask("Setting Defined Symbols", 1);
|
||||
MakeBuildManager.setPreprocessorSymbols(getContainer().getProject(), getSymbolListContents());
|
||||
|
||||
MakeBuildManager.saveBuildInfo(getContainer().getProject());
|
||||
monitor.beginTask("Setting Scanner Info", 3);
|
||||
MakeScannerInfo info = MakeScannerProvider.getDefault().getMakeScannerInfo(getContainer().getProject());
|
||||
info.setIncludePaths(getPathListContents());
|
||||
monitor.worked(1);
|
||||
info.setPreprocessorSymbols(getSymbolListContents());
|
||||
monitor.worked(1);
|
||||
info.update();
|
||||
monitor.done();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -394,7 +395,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
|
|||
createSymbolListControl(composite, tabColumns);
|
||||
createSymbolListButtons(composite);
|
||||
enableSymbolButtons();
|
||||
|
||||
|
||||
setPathListContents();
|
||||
pathList.select(0);
|
||||
enablePathButtons();
|
||||
|
@ -586,8 +587,9 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
|
|||
|
||||
private void setPathListContents() {
|
||||
if (getContainer().getProject() != null) {
|
||||
MakeScannerInfo info;
|
||||
try {
|
||||
IMakeBuilderInfo info = MakeBuildManager.getBuildInfo(getContainer().getProject());
|
||||
info = MakeScannerProvider.getDefault().getMakeScannerInfo(getContainer().getProject());
|
||||
pathList.setItems(info.getIncludePaths());
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
|
@ -596,8 +598,9 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
|
|||
|
||||
private void setSymbolListContents() {
|
||||
if (getContainer().getProject() != null) {
|
||||
MakeScannerInfo info;
|
||||
try {
|
||||
IMakeBuilderInfo info = MakeBuildManager.getBuildInfo(getContainer().getProject());
|
||||
info = MakeScannerProvider.getDefault().getMakeScannerInfo(getContainer().getProject());
|
||||
symbolList.setItems(info.getPreprocessorSymbols());
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue