mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
1. Update for the external settings provider
2. some tests update
This commit is contained in:
parent
b8400b2770
commit
6d90042969
9 changed files with 87 additions and 4 deletions
|
@ -14,7 +14,7 @@ import junit.framework.Test;
|
|||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.model.failedTests.FailedDeclaratorsTest;
|
||||
import org.eclipse.cdt.core.settings.model.CConfigurationDescriptionReferenceTests;
|
||||
import org.eclipse.cdt.core.settings.model.CProjectDescriptionTests;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -46,7 +46,10 @@ public class AllCoreTests {
|
|||
suite.addTest(DeclaratorsTests.suite());
|
||||
suite.addTest(FailedDeclaratorsTest.suite());
|
||||
suite.addTest(CPathEntryTest.suite());
|
||||
suite.addTest(CConfigurationDescriptionReferenceTests.suite());
|
||||
// suite.addTest(CConfigurationDescriptionReferenceTests.suite());
|
||||
//the CProjectDescriptionTests now groups all New Project Model related tests
|
||||
//which includes the CConfigurationDescriptionReferenceTests
|
||||
suite.addTest(CProjectDescriptionTests.suite());
|
||||
suite.addTest(ASTCacheTests.suite());
|
||||
return suite;
|
||||
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.settings.model;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
public class CProjectDescriptionTests {
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(suite());
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(CProjectDescriptionTests.class.getName());
|
||||
|
||||
// Just add more test cases here as you create them for
|
||||
// each class being tested
|
||||
suite.addTest(CConfigurationDescriptionReferenceTests.suite());
|
||||
suite.addTest(ExternalSettingsProviderTests.suite());
|
||||
return suite;
|
||||
|
||||
}
|
||||
}
|
|
@ -459,6 +459,11 @@ class MockConfig implements ICConfigurationDescription {
|
|||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void updateExternalSettingsProviders(String[] ids) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -365,4 +365,6 @@ public interface ICConfigurationDescription extends ICSettingContainer, ICSettin
|
|||
void setExternalSettingsProviderIds(String ids[]);
|
||||
|
||||
String[] getExternalSettingsProviderIds();
|
||||
|
||||
void updateExternalSettingsProviders(String[] ids);
|
||||
}
|
||||
|
|
|
@ -806,5 +806,12 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
|||
CCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void updateExternalSettingsProviders(String[] ids) {
|
||||
try {
|
||||
getSpecSettings().updateExternalSettingsProviders(ids);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -482,4 +482,10 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
|||
throw ExceptionFactory.createIsReadOnlyException();
|
||||
fSpecSettings.setExternalSettingsProviderIds(ids);
|
||||
}
|
||||
|
||||
public void updateExternalSettingsProviders(String[] ids) {
|
||||
if(!fInitializing)
|
||||
throw ExceptionFactory.createIsReadOnlyException();
|
||||
fSpecSettings.updateExternalSettingsProviders(ids);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -927,5 +927,8 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
|
|||
public void setExternalSettingsProviderIds(String ids[]){
|
||||
ExtensionContainerFactory.setReferencedProviderIds(fCfg, ids);
|
||||
}
|
||||
|
||||
|
||||
public void updateExternalSettingsProviders(String[] ids){
|
||||
ExtensionContainerFactory.updateReferencedProviderIds(fCfg, ids);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -581,6 +581,7 @@ public class CExternalSettingsManager implements ICExternalSettingsListener, ICP
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean containerContentsChanged(ICfgContainer cr, CContainerRef ref, DeltaInfo deltaInfo){
|
||||
return processContainerChange(OP_CHANGED, cr, ref, deltaInfo);
|
||||
}
|
||||
|
@ -710,6 +711,11 @@ public class CExternalSettingsManager implements ICExternalSettingsListener, ICP
|
|||
}
|
||||
}
|
||||
|
||||
public void containerContentsChanged(ICConfigurationDescription cfg, CContainerRef cr){
|
||||
CfgContainer ccr = new CfgContainer(cfg);
|
||||
containerContentsChanged(ccr, cr, null);
|
||||
}
|
||||
|
||||
public void addContainer(ICConfigurationDescription cfg, CContainerRef cr){
|
||||
CfgContainer ccr = new CfgContainer(cfg);
|
||||
processContainerChange(OP_ADDED, ccr, cr, null);
|
||||
|
|
|
@ -198,10 +198,30 @@ public class ExtensionContainerFactory extends CExternalSettingContainerFactory
|
|||
}
|
||||
}
|
||||
|
||||
public static void updateReferencedProviderIds(ICConfigurationDescription cfg, String ids[]){
|
||||
Set newIdsSet = new HashSet(Arrays.asList(ids));
|
||||
Set oldIdsSet = new HashSet(Arrays.asList(getReferencedProviderIds(cfg)));
|
||||
Set newIdsSetCopy = new HashSet(newIdsSet);
|
||||
newIdsSetCopy.removeAll(oldIdsSet);
|
||||
newIdsSet.removeAll(newIdsSetCopy);
|
||||
|
||||
if(newIdsSet.size() != 0){
|
||||
for(Iterator iter = newIdsSet.iterator(); iter.hasNext();){
|
||||
providerChanged(cfg, (String)iter.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void createReference(ICConfigurationDescription cfg, String id){
|
||||
CContainerRef cr = createContainerRef(id);
|
||||
CExternalSettingsManager.getInstance().addContainer(cfg, cr);
|
||||
}
|
||||
|
||||
private static void providerChanged(ICConfigurationDescription cfg, String id){
|
||||
CContainerRef cr = createContainerRef(id);
|
||||
CExternalSettingsManager.getInstance().containerContentsChanged(cfg, cr);
|
||||
|
||||
}
|
||||
|
||||
private static void removeReference(ICConfigurationDescription cfg, String id){
|
||||
CContainerRef cr = createContainerRef(id);
|
||||
|
|
Loading…
Add table
Reference in a new issue