mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
1. Binrayr parser settings fixes
2. bug-fixes
This commit is contained in:
parent
71628f81e4
commit
a92749a43e
16 changed files with 282 additions and 64 deletions
|
@ -2439,6 +2439,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
try {
|
||||
setLoaddedBuildInfo(proj, buildInfo);
|
||||
} catch (CoreException e) {
|
||||
ManagedBuilderCorePlugin.log(e);
|
||||
buildInfo = null;
|
||||
}
|
||||
return buildInfo;
|
||||
|
|
|
@ -274,6 +274,8 @@ public class BuilderFactory {
|
|||
|
||||
private static IBuilder createBuilder(IConfiguration cfg, Map args){
|
||||
IToolChain tCh = cfg.getToolChain();
|
||||
if(args.get(IBuilder.ID) == null)
|
||||
args.put(IBuilder.ID, ManagedBuildManager.calculateChildId(cfg.getId(), null));
|
||||
MapStorageElement el = new BuildArgsStorageElement(args, null);
|
||||
Builder builder = new Builder(tCh, el, ManagedBuildManager.getVersion().toString());
|
||||
return builder;
|
||||
|
|
|
@ -712,7 +712,7 @@ public class PathEntryTranslator {
|
|||
private IProject fProject;
|
||||
|
||||
PathEntryComposer(String projName, IProject project){
|
||||
this(new Path(projName), project);
|
||||
this(new Path(projName).makeAbsolute(), project);
|
||||
}
|
||||
|
||||
PathEntryComposer(IPath path, IProject project){
|
||||
|
@ -909,13 +909,13 @@ public class PathEntryTranslator {
|
|||
|
||||
if(addedThisSet.size() != 0){
|
||||
Map map = getEntriesMap(kind, true);
|
||||
|
||||
IPath fullPath = fProject.getFullPath().append(path);
|
||||
for(int i = 0; i < entries.length; i++){
|
||||
if(!addedThisSet.remove(entries[i]))
|
||||
continue;
|
||||
|
||||
ICLanguageSettingEntry entry = entries[i];
|
||||
map.put(entry, new PathEntryComposer(path, entry, exportedEntries.contains(entry), fProject));
|
||||
map.put(entry, new PathEntryComposer(fullPath, entry, exportedEntries.contains(entry), fProject));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2006 QNX Software Systems and others.
|
||||
* Copyright (c) 2000, 2007 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -52,6 +52,7 @@ import org.eclipse.cdt.core.resources.IPathEntryStoreListener;
|
|||
import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent;
|
||||
import org.eclipse.cdt.core.settings.model.util.PathEntryResolveInfo;
|
||||
import org.eclipse.cdt.core.settings.model.util.PathEntryResolveInfoElement;
|
||||
import org.eclipse.cdt.internal.core.settings.model.ConfigBasedPathEntryStore;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -623,6 +624,13 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
|||
op.runOperation(monitor);
|
||||
}
|
||||
|
||||
public void clearPathEntryContainer(ICProject[] affectedProjects, IPath containerPath , IProgressMonitor monitor)
|
||||
throws CModelException {
|
||||
|
||||
SetPathEntryContainerOperation op = new SetPathEntryContainerOperation(affectedProjects, containerPath);
|
||||
op.runOperation(monitor);
|
||||
}
|
||||
|
||||
public synchronized IPathEntryContainer[] getPathEntryContainers(ICProject cproject) {
|
||||
IPathEntryContainer[] pcs = NO_PATHENTRYCONTAINERS;
|
||||
Map projectContainers = (Map)Containers.get(cproject);
|
||||
|
@ -971,8 +979,20 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
|||
markerTask.setRule(rule);
|
||||
markerTask.schedule();
|
||||
}
|
||||
|
||||
private boolean needDelta(ICProject cproject){
|
||||
try {
|
||||
PathEntryStoreProxy store = (PathEntryStoreProxy)getPathEntryStore(cproject.getProject(), false);
|
||||
return store == null || !(store.getStore() instanceof ConfigBasedPathEntryStore);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ICElementDelta[] generatePathEntryDeltas(ICProject cproject, IPathEntry[] oldEntries, IPathEntry[] newEntries) {
|
||||
if(!needDelta(cproject))
|
||||
return new ICElementDelta[0];
|
||||
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
// if nothing was known before do not generate any deltas.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005 QnX Software Systems and others.
|
||||
* Copyright (c) 2005, 2007 QnX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -41,7 +41,7 @@ public class PathEntryStoreChangedOperation extends CModelOperation {
|
|||
// Clear the old cache entries.
|
||||
IPathEntry[] oldResolvedEntries = manager.removeCachedResolvedPathEntries(cproject);
|
||||
IPathEntry[] newResolvedEntries = manager.getResolvedPathEntries(cproject);
|
||||
if(needDelta(cproject.getProject())){
|
||||
// if(needDelta(cproject.getProject())){
|
||||
ICElementDelta[] deltas = manager.generatePathEntryDeltas(cproject, oldResolvedEntries, newResolvedEntries);
|
||||
if (deltas.length > 0) {
|
||||
cproject.close();
|
||||
|
@ -49,16 +49,6 @@ public class PathEntryStoreChangedOperation extends CModelOperation {
|
|||
addDelta(deltas[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
private boolean needDelta(IProject project){
|
||||
try {
|
||||
PathEntryStoreProxy store = (PathEntryStoreProxy)PathEntryManager.getDefault().getPathEntryStore(project, false);
|
||||
return !(store.getStore() instanceof ConfigBasedPathEntryStore);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.core.resources.IPathEntryStoreListener;
|
|||
import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.internal.core.settings.model.AbstractCExtensionProxy;
|
||||
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionEvent;
|
||||
import org.eclipse.cdt.internal.core.settings.model.ConfigBasedPathEntryStore;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -131,4 +132,14 @@ public class PathEntryStoreProxy extends AbstractCExtensionProxy implements IPat
|
|||
if(oldProvider != null)
|
||||
fireContentChangedEvent(getProject());
|
||||
}
|
||||
|
||||
protected boolean doHandleEvent(CProjectDescriptionEvent event) {
|
||||
IPathEntryStore oldStore = fStore;
|
||||
boolean result = super.doHandleEvent(event);
|
||||
if(!result)
|
||||
postProcessProviderChange(fStore, oldStore);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,11 +25,20 @@ public class SetPathEntryContainerOperation extends CModelOperation {
|
|||
IPathEntryContainer newContainer;
|
||||
ICProject[] affectedProjects;
|
||||
PathEntryManager fPathEntryManager;
|
||||
IPath containerPath;
|
||||
|
||||
public SetPathEntryContainerOperation(ICProject[] affectedProjects, IPathEntryContainer newContainer) {
|
||||
super(affectedProjects);
|
||||
this.affectedProjects = affectedProjects;
|
||||
this.newContainer = newContainer;
|
||||
this.containerPath = (newContainer == null) ? new Path("") : newContainer.getPath(); //$NON-NLS-1$
|
||||
fPathEntryManager = PathEntryManager.getDefault();
|
||||
}
|
||||
|
||||
public SetPathEntryContainerOperation(ICProject[] affectedProjects, IPath containerPath) {
|
||||
super(affectedProjects);
|
||||
this.affectedProjects = affectedProjects;
|
||||
this.containerPath = containerPath;
|
||||
fPathEntryManager = PathEntryManager.getDefault();
|
||||
}
|
||||
|
||||
|
@ -45,7 +54,7 @@ public class SetPathEntryContainerOperation extends CModelOperation {
|
|||
return;
|
||||
}
|
||||
|
||||
IPath containerPath = (newContainer == null) ? new Path("") : newContainer.getPath(); //$NON-NLS-1$
|
||||
// IPath containerPath = (newContainer == null) ? new Path("") : newContainer.getPath(); //$NON-NLS-1$
|
||||
final int projectLength = affectedProjects.length;
|
||||
final ICProject[] modifiedProjects = new ICProject[projectLength];
|
||||
System.arraycopy(affectedProjects, 0, modifiedProjects, 0, projectLength);
|
||||
|
@ -69,7 +78,7 @@ public class SetPathEntryContainerOperation extends CModelOperation {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (!found || newContainer == null) {
|
||||
// filter out this project - does not reference the container
|
||||
// path
|
||||
modifiedProjects[i] = null;
|
||||
|
@ -77,6 +86,7 @@ public class SetPathEntryContainerOperation extends CModelOperation {
|
|||
fPathEntryManager.containerPut(affectedProject, containerPath, newContainer);
|
||||
continue;
|
||||
}
|
||||
|
||||
IPathEntryContainer oldContainer = fPathEntryManager.containerGet(affectedProject, containerPath, true);
|
||||
if (oldContainer != null && newContainer != null && oldContainer.equals(newContainer)) {
|
||||
modifiedProjects[i] = null; // filter out this project -
|
||||
|
|
|
@ -55,7 +55,7 @@ public abstract class AbstractCExtensionProxy implements ICProjectDescriptionLis
|
|||
return fProject;
|
||||
}
|
||||
|
||||
private void checkUpdateProvider(ICProjectDescription des, boolean recreate, boolean rescan){
|
||||
private boolean checkUpdateProvider(ICProjectDescription des, boolean recreate, boolean rescan){
|
||||
Object newProvider = null;
|
||||
Object oldProvider = null;
|
||||
|
||||
|
@ -108,8 +108,11 @@ public abstract class AbstractCExtensionProxy implements ICProjectDescriptionLis
|
|||
}
|
||||
}
|
||||
|
||||
if(newProvider != null)
|
||||
if(newProvider != null){
|
||||
postProcessProviderChange(newProvider, oldProvider);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isNewStyleCfg(ICConfigurationDescription des){
|
||||
|
@ -138,6 +141,10 @@ public abstract class AbstractCExtensionProxy implements ICProjectDescriptionLis
|
|||
if(!fProject.equals(event.getProject()))
|
||||
return;
|
||||
|
||||
doHandleEvent(event);
|
||||
}
|
||||
|
||||
protected boolean doHandleEvent(CProjectDescriptionEvent event){
|
||||
boolean force = false;
|
||||
switch(event.getEventType()){
|
||||
case CProjectDescriptionEvent.LOADDED:
|
||||
|
@ -145,8 +152,10 @@ public abstract class AbstractCExtensionProxy implements ICProjectDescriptionLis
|
|||
case CProjectDescriptionEvent.APPLIED:
|
||||
ICProjectDescription des = event.getNewCProjectDescription();
|
||||
if(des != null)
|
||||
checkUpdateProvider(des, force, true);
|
||||
return checkUpdateProvider(des, force, true);
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,8 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
|||
fData = CProjectDescriptionManager.getInstance().loadData(this);
|
||||
copySettingsFrom(fData, true);
|
||||
|
||||
CProjectDescriptionManager.getInstance().reconsileBinaryParserSettings(this, true);
|
||||
CProjectDescriptionManager.getInstance().reconsileErrorParserSettings(this, true);
|
||||
((CBuildSettingCache)fBuildData).initEnvironmentCache();
|
||||
ICdtVariable vars[] = CdtVariableManager.getDefault().getVariables(this);
|
||||
fMacros = new StorableCdtVariables(vars, true);
|
||||
|
|
|
@ -48,7 +48,6 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
|
|||
private static final String OWNER_ID = "owner"; //$NON-NLS-1$
|
||||
private static final String OLD_OWNER_ID = "id"; //$NON-NLS-1$
|
||||
|
||||
private final static String EMPTY_STRING = new String();
|
||||
static final String ID = "id"; //$NON-NLS-1$
|
||||
static final String NAME = "name"; //$NON-NLS-1$
|
||||
private ICConfigurationDescription fCfg;
|
||||
|
@ -193,39 +192,39 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
|
|||
fRefInfoMap = null;
|
||||
}
|
||||
|
||||
private Map normalizeRefs(Map ref){
|
||||
for(Iterator iter = ref.entrySet().iterator(); iter.hasNext();){
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
Object projObj = entry.getKey();
|
||||
Object cfgObj = entry.getValue();
|
||||
if(projObj instanceof String && (cfgObj == null || cfgObj instanceof String)){
|
||||
String proj = ((String)projObj).trim();
|
||||
String cfg = (String)cfgObj;
|
||||
if(cfg == null)
|
||||
cfg = EMPTY_STRING;
|
||||
else
|
||||
cfg = cfg.trim();
|
||||
|
||||
if(proj.length() > 0){
|
||||
entry.setValue(cfg);
|
||||
} else {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
// private Map normalizeRefs(Map ref){
|
||||
// for(Iterator iter = ref.entrySet().iterator(); iter.hasNext();){
|
||||
// Map.Entry entry = (Map.Entry)iter.next();
|
||||
// Object projObj = entry.getKey();
|
||||
// Object cfgObj = entry.getValue();
|
||||
// if(projObj instanceof String && (cfgObj == null || cfgObj instanceof String)){
|
||||
// String proj = ((String)projObj).trim();
|
||||
// String cfg = (String)cfgObj;
|
||||
// if(cfg == null)
|
||||
// cfg = EMPTY_STRING;
|
||||
// else
|
||||
// cfg = cfg.trim();
|
||||
//
|
||||
// if(proj.length() > 0){
|
||||
// entry.setValue(cfg);
|
||||
// } else {
|
||||
// iter.remove();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return ref;
|
||||
// }
|
||||
|
||||
private String[] normalizeRef(String projName, String cfgId){
|
||||
if(projName == null || (projName = projName.trim()).length() == 0)
|
||||
return null;
|
||||
if(cfgId == null)
|
||||
cfgId = EMPTY_STRING;
|
||||
else
|
||||
cfgId = cfgId.trim();
|
||||
|
||||
return new String[] {projName, cfgId};
|
||||
}
|
||||
// private String[] normalizeRef(String projName, String cfgId){
|
||||
// if(projName == null || (projName = projName.trim()).length() == 0)
|
||||
// return null;
|
||||
// if(cfgId == null)
|
||||
// cfgId = EMPTY_STRING;
|
||||
// else
|
||||
// cfgId = cfgId.trim();
|
||||
//
|
||||
// return new String[] {projName, cfgId};
|
||||
// }
|
||||
|
||||
private ICStorageElement getSettingsStorageElement() throws CoreException{
|
||||
if(fSettingsStorageElement == null)
|
||||
|
@ -485,11 +484,32 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
|
|||
}
|
||||
|
||||
public ICConfigExtensionReference[] get(String extensionPointID) {
|
||||
CConfigExtensionReference[] refs = (CConfigExtensionReference[])getExtMap().get(extensionPointID);
|
||||
ICConfigExtensionReference[] refs = (CConfigExtensionReference[])getExtMap().get(extensionPointID);
|
||||
if (refs == null)
|
||||
refs = new ICConfigExtensionReference[0];
|
||||
|
||||
if(checkReconsile(extensionPointID, refs))
|
||||
refs = (CConfigExtensionReference[])getExtMap().get(extensionPointID);
|
||||
|
||||
if (refs == null)
|
||||
return new ICConfigExtensionReference[0];
|
||||
return (ICConfigExtensionReference[])refs.clone();
|
||||
}
|
||||
|
||||
private void reconsileExtensionSettings(){
|
||||
get(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
||||
get(CCorePlugin.ERROR_PARSER_UNIQ_ID);
|
||||
}
|
||||
|
||||
private boolean checkReconsile(String extPointId, ICConfigExtensionReference refs[]){
|
||||
if(!(((IInternalCCfgInfo)fCfg).getConfigurationData(false) instanceof CConfigurationDescriptionCache)){
|
||||
if(CCorePlugin.BINARY_PARSER_UNIQ_ID.equals(extPointId))
|
||||
return CProjectDescriptionManager.getInstance().reconsileBinaryParserExtRefs(fCfg, refs);
|
||||
else if(CCorePlugin.ERROR_PARSER_UNIQ_ID.equals(extPointId))
|
||||
return CProjectDescriptionManager.getInstance().reconsileErrorParserExtRefs(fCfg, refs);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// synchronized private ICConfigExtensionReference[] get(String extensionID, boolean update) throws CoreException {
|
||||
// ICConfigExtensionReference[] refs = get(extensionID);
|
||||
|
@ -710,6 +730,7 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
|
|||
}
|
||||
|
||||
private void copyExtensionInfo(CConfigurationSpecSettings other){
|
||||
other.reconsileExtensionSettings();
|
||||
if(other.fExtMap != null && other.fExtMap.size() != 0){
|
||||
fExtMap = (HashMap)other.fExtMap.clone();
|
||||
for(Iterator iter = fExtMap.entrySet().iterator(); iter.hasNext();){
|
||||
|
|
|
@ -47,6 +47,8 @@ import org.eclipse.cdt.core.model.ICElementDelta;
|
|||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ILanguageDescriptor;
|
||||
import org.eclipse.cdt.core.model.LanguageManager;
|
||||
import org.eclipse.cdt.core.settings.model.ICBuildSetting;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICFileDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
|
||||
|
@ -587,6 +589,7 @@ public class CProjectDescriptionManager {
|
|||
try {
|
||||
project.setSessionProperty(PROJECT_DESCRCIPTION_PROPERTY, holder);
|
||||
} catch (CoreException e){
|
||||
CCorePlugin.log(e);
|
||||
//TODO: externalize
|
||||
final ProjectInfoHolder f = holder;
|
||||
Job setDesJob = new Job("Set loadded description job"){ //$NON-NLS-1$
|
||||
|
@ -783,6 +786,100 @@ public class CProjectDescriptionManager {
|
|||
ISafeRunnable r = new DesSerializationRunnable(des, element);
|
||||
return r;
|
||||
}
|
||||
|
||||
void reconsileBinaryParserSettings(ICConfigurationDescription cfgDes, boolean toExtensionRefs){
|
||||
if(toExtensionRefs)
|
||||
reconsileBinaryParserExtRefs(cfgDes, null);
|
||||
else {
|
||||
ICTargetPlatformSetting tp = cfgDes.getTargetPlatformSetting();
|
||||
if(tp != null){
|
||||
String ids[] = getIds(cfgDes, CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
||||
tp.setBinaryParserIds(ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void reconsileErrorParserSettings(ICConfigurationDescription cfgDes, boolean toExtensionRefs){
|
||||
if(toExtensionRefs)
|
||||
reconsileErrorParserExtRefs(cfgDes, null);
|
||||
else {
|
||||
ICBuildSetting bs = cfgDes.getBuildSetting();
|
||||
if(bs != null){
|
||||
String ids[] = getIds(cfgDes, CCorePlugin.ERROR_PARSER_UNIQ_ID);
|
||||
bs.setErrorParserIDs(ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean reconsileBinaryParserExtRefs(ICConfigurationDescription cfgDes, ICConfigExtensionReference refs[]){
|
||||
ICTargetPlatformSetting tp = cfgDes.getTargetPlatformSetting();
|
||||
if(tp != null){
|
||||
String ids[] = tp.getBinaryParserIds();
|
||||
if(ids != null){
|
||||
return reconsileExtensionReferences(cfgDes, CCorePlugin.BINARY_PARSER_UNIQ_ID, refs, ids);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean reconsileErrorParserExtRefs(ICConfigurationDescription cfgDes, ICConfigExtensionReference refs[]){
|
||||
ICBuildSetting bs = cfgDes.getBuildSetting();
|
||||
if(bs != null){
|
||||
String ids[] = bs.getErrorParserIDs();
|
||||
if(ids != null){
|
||||
return reconsileExtensionReferences(cfgDes, CCorePlugin.ERROR_PARSER_UNIQ_ID, refs, ids); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private String[] getIds(ICConfigurationDescription des, String extPointId){
|
||||
return getIds(des.get(extPointId));
|
||||
}
|
||||
|
||||
private String[] getIds(ICConfigExtensionReference refs[]){
|
||||
String[] ids = new String[refs.length];
|
||||
for(int i = 0; i < refs.length; i++){
|
||||
ids[i] = refs[i].getID();
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
boolean reconsileExtensionReferences(ICConfigurationDescription des, String extPointId, String[] extIds){
|
||||
return reconsileExtensionReferences(des, extPointId, null, extIds);
|
||||
}
|
||||
|
||||
boolean reconsileExtensionReferences(ICConfigurationDescription des, String extPointId, ICConfigExtensionReference refs[], String[] extIds){
|
||||
boolean modified = false;
|
||||
if(refs == null)
|
||||
refs = des.get(extPointId);
|
||||
Set idSet = new HashSet(Arrays.asList(extIds));
|
||||
for(int i = 0; i < refs.length; i++){
|
||||
if(!idSet.remove(refs[i].getID())){
|
||||
try {
|
||||
des.remove(refs[i]);
|
||||
modified = true;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(idSet.size() != 0){
|
||||
for(Iterator iter = idSet.iterator(); iter.hasNext();){
|
||||
String id = (String)iter.next();
|
||||
try {
|
||||
des.create(extPointId, id);
|
||||
modified = true;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
void serialize(final CProjectDescription des) throws CoreException{
|
||||
ISafeRunnable r = createDesSerializationRunnable(des);
|
||||
runWspModification(r, new NullProgressMonitor());
|
||||
|
@ -2305,7 +2402,7 @@ public class CProjectDescriptionManager {
|
|||
try {
|
||||
des = loadPreference(buildSystemId);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
// CCorePlugin.log(e);
|
||||
}
|
||||
|
||||
if(des == null){
|
||||
|
|
|
@ -12,7 +12,6 @@ package org.eclipse.cdt.internal.core.settings.model;
|
|||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.IPathEntry;
|
||||
import org.eclipse.cdt.core.model.PathEntryContainerInitializer;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
@ -22,8 +21,7 @@ public class ConfigBasedEntriesContainerInitializer extends
|
|||
|
||||
public void initialize(IPath containerPath, ICProject project)
|
||||
throws CoreException {
|
||||
IPathEntry[] entries = ConfigBasedPathEntryStore.getContainerEntries(project.getProject());
|
||||
ConfigBasedPathEntryContainer container = new ConfigBasedPathEntryContainer(entries);
|
||||
ConfigBasedPathEntryContainer container = ConfigBasedPathEntryStore.createContainer(project.getProject());
|
||||
CoreModel.setPathEntryContainer(new ICProject[]{project}, container, null);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Intel Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.settings.model;
|
||||
|
||||
import org.eclipse.cdt.core.model.IPathEntry;
|
||||
|
|
|
@ -11,13 +11,16 @@
|
|||
package org.eclipse.cdt.internal.core.settings.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.ICExtensionReference;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.IPathEntry;
|
||||
import org.eclipse.cdt.core.resources.IPathEntryStore;
|
||||
import org.eclipse.cdt.core.resources.IPathEntryStoreListener;
|
||||
|
@ -29,8 +32,11 @@ import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
|||
import org.eclipse.cdt.core.settings.model.util.PathEntryTranslator;
|
||||
import org.eclipse.cdt.core.settings.model.util.PathEntryTranslator.PathEntryCollector;
|
||||
import org.eclipse.cdt.core.settings.model.util.PathEntryTranslator.ReferenceSettingsInfo;
|
||||
import org.eclipse.cdt.internal.core.model.CModelManager;
|
||||
import org.eclipse.cdt.internal.core.model.PathEntryManager;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
|
||||
public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDescriptionListener {
|
||||
|
@ -143,13 +149,37 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
|||
switch(event.getEventType()){
|
||||
case CProjectDescriptionEvent.APPLIED:{
|
||||
CProjectDescription des = (CProjectDescription)event.getNewCProjectDescription();
|
||||
CProjectDescription oldDes = (CProjectDescription)event.getOldCProjectDescription();
|
||||
IPathEntry oldCrEntries[] = null;
|
||||
if(oldDes != null){
|
||||
ICConfigurationDescription oldIndexCfg = oldDes.getIndexConfiguration();
|
||||
PathEntryCollector oldCr = getCachedCollector(oldIndexCfg);
|
||||
if(oldCr != null)
|
||||
oldCrEntries = oldCr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS);
|
||||
}
|
||||
if(des != null){
|
||||
//TODO: smart delta handling
|
||||
ICConfigurationDescription[] cfgDess = des.getConfigurations();
|
||||
for(int i = 0; i < cfgDess.length; i++){
|
||||
setCachedCollector(cfgDess[i], null);
|
||||
}
|
||||
// ICConfigurationDescription cfgDes = des.getIndexConfiguration();
|
||||
|
||||
if(oldCrEntries != null){
|
||||
PathEntryCollector newCr = getCollector(des);
|
||||
IPathEntry[] newCrEntries = newCr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS);
|
||||
if(!Arrays.equals(oldCrEntries, newCrEntries)){
|
||||
CModelManager manager = CModelManager.getDefault();
|
||||
ICProject cproject = manager.create(project);
|
||||
|
||||
|
||||
// ConfigBasedPathEntryContainer newContainer = createContainer(des);
|
||||
try {
|
||||
PathEntryManager.getDefault().clearPathEntryContainer(new ICProject[]{cproject}, ConfigBasedPathEntryContainer.CONTAINER_PATH, new NullProgressMonitor());
|
||||
} catch (CModelException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fireContentChangedEvent(fProject);
|
||||
break;
|
||||
|
@ -186,10 +216,26 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc
|
|||
}
|
||||
|
||||
public static IPathEntry[] getContainerEntries(IProject project){
|
||||
PathEntryCollector cr = getCollector(project);
|
||||
ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(project, false);
|
||||
if(des != null)
|
||||
return getContainerEntries(des);
|
||||
return new IPathEntry[0];
|
||||
}
|
||||
|
||||
public static IPathEntry[] getContainerEntries(ICProjectDescription des){
|
||||
PathEntryCollector cr = getCollector(des);
|
||||
if(cr != null)
|
||||
return cr.getEntries(PathEntryTranslator.INCLUDE_BUILT_INS);
|
||||
return new IPathEntry[0];
|
||||
}
|
||||
|
||||
public static ConfigBasedPathEntryContainer createContainer(IProject project){
|
||||
IPathEntry[] entries = getContainerEntries(project);
|
||||
return new ConfigBasedPathEntryContainer(entries);
|
||||
}
|
||||
|
||||
public static ConfigBasedPathEntryContainer createContainer(ICProjectDescription des){
|
||||
IPathEntry[] entries = getContainerEntries(des);
|
||||
return new ConfigBasedPathEntryContainer(entries);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,6 +97,7 @@ public class CCorePlugin extends Plugin {
|
|||
public static final String DEFAULT_INDEXER = PDOMFastIndexer.ID;
|
||||
|
||||
public final static String ERROR_PARSER_SIMPLE_ID = "ErrorParser"; //$NON-NLS-1$
|
||||
public final static String ERROR_PARSER_UNIQ_ID = PLUGIN_ID + "." + ERROR_PARSER_SIMPLE_ID; //$NON-NLS-1$
|
||||
|
||||
// default store for pathentry
|
||||
public final static String DEFAULT_PATHENTRY_STORE_ID = PLUGIN_ID + ".cdtPathEntryStore"; //$NON-NLS-1$
|
||||
|
|
|
@ -322,12 +322,12 @@ public class CConfigBasedDescriptorManager implements ICDescriptorManager {
|
|||
dr = findDescriptor(newDes);
|
||||
updatedCfg = newDes.getIndexConfiguration();
|
||||
if(dr != null){
|
||||
desEvent = new CDescriptorEvent(dr, CDescriptorEvent.CDTPROJECT_ADDED, 0);
|
||||
desEvent = new CDescriptorEvent(dr, CDescriptorEvent.CDTPROJECT_ADDED, CDescriptorEvent.EXTENSION_CHANGED | CDescriptorEvent.OWNER_CHANGED);
|
||||
}
|
||||
} else if(newDes == null) {
|
||||
dr = findDescriptor(oldDes);
|
||||
if(dr != null){
|
||||
desEvent = new CDescriptorEvent(dr, CDescriptorEvent.CDTPROJECT_REMOVED, 0);
|
||||
desEvent = new CDescriptorEvent(dr, CDescriptorEvent.CDTPROJECT_REMOVED, CDescriptorEvent.EXTENSION_CHANGED | CDescriptorEvent.OWNER_CHANGED);
|
||||
}
|
||||
} else {
|
||||
dr = findDescriptor(newDes);
|
||||
|
|
Loading…
Add table
Reference in a new issue