Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e140e2f0bc02f06c49eb6399394506a7f4c621c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
/*******************************************************************************
 * Copyright (c) 2007, 2012 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
 * James Blackburn (Broadcom Corp.)
 * Baltasar Belyavsky (Texas Instruments) - bug 340219: Project metadata files are saved unnecessarily
 *******************************************************************************/
package org.eclipse.cdt.internal.core.settings.model;

import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;

import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.ICSettingBase;
import org.eclipse.cdt.core.settings.model.ICSettingContainer;
import org.eclipse.cdt.core.settings.model.ICSettingObject;
import org.eclipse.cdt.core.settings.model.ICSettingsStorage;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.WriteAccessException;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.QualifiedName;

public class CProjectDescription implements ICProjectDescription, ICDataProxyContainer {
	private static final String ACTIVE_CFG = "activeConfiguration"; //$NON-NLS-1$
	private static final QualifiedName ACTIVE_CFG_PROPERTY = new QualifiedName(CCorePlugin.PLUGIN_ID, ACTIVE_CFG);
	private static final String SETTING_CFG = "settingConfiguration"; //$NON-NLS-1$
	private static final QualifiedName SETTING_CFG_PROPERTY = new QualifiedName(CCorePlugin.PLUGIN_ID, SETTING_CFG);

	private CfgIdPair fActiveCfgInfo;
	private CfgIdPair fSettingCfgInfo;
	private CProjectDescriptionPreferences fPrefs;
//	private ICConfigurationDescription fActiveCfg;
//	private String fActiveCfgId;
//	private ICConfigurationDescription fIndexCfg;
//	private String fIndexCfgId;
	private volatile IProject fProject;
	private final ICSettingsStorage fStorage;
	private final ICStorageElement fRootStorageElement;
	private final HashMap<String, ICConfigurationDescription> fCfgMap = new LinkedHashMap<String, ICConfigurationDescription>();
	private boolean fIsReadOnly;
	private boolean fIsModified;
	private HashMap<QualifiedName, Object> fPropertiesMap;
	private boolean fIsLoading;
	private boolean fIsApplying;
	private boolean fIsCreating;

	private class CfgIdPair {
		private String fId;
		private ICConfigurationDescription fCfg;
		private QualifiedName fPersistanceName;
		private boolean fNeedsPersistance;
		private boolean fIsCfgModified;

		CfgIdPair(CfgIdPair base){
			fId = base.fId;
			fPersistanceName = base.fPersistanceName;
		}

		CfgIdPair(QualifiedName persistanceName){
			fPersistanceName = persistanceName;
		}

		public String getId(){
			if(fId == null){
				fId = load();
				if(fId == null){
					fId = getFirstCfgId();
					if(fId != null){
						fNeedsPersistance = true;
					}
				}
			}
			return fId;
		}

		public ICConfigurationDescription getConfiguration() {
			if(fCfg == null){
				String id = getId();
				if(id != null){
					fCfg = getConfigurationById(id);
					if(fCfg == null){
						fId = getFirstCfgId();
						if(fId != null){
							fCfg = getConfigurationById(fId);
							fNeedsPersistance = true;
						}
					}
				}
			}
			return fCfg;
		}

		public void setConfiguration(ICConfigurationDescription cfg){
			if(cfg.getProjectDescription() != CProjectDescription.this)
				throw new IllegalArgumentException();

			if(cfg.getId().equals(getId()))
				return;

			fCfg = cfg;
			fId = cfg.getId();
			fIsCfgModified = true;
			fNeedsPersistance = true;
		}

		public void configurationRemoved(ICConfigurationDescription cfg){
			if(cfg.getProjectDescription() != CProjectDescription.this)
				throw new IllegalArgumentException();

			if(!cfg.getId().equals(getId()))
				return;

			fIsCfgModified = true;
			fCfg = null;
			getConfiguration();
		}

		private String load(){
			try {
				return getProject().getPersistentProperty(fPersistanceName);
			} catch (CoreException e) {
				CCorePlugin.log(e);
			}
			return null;
		}

		private boolean store(String oldId, boolean force){
			if(force || fIsCfgModified || fNeedsPersistance || oldId == null || !oldId.equals(fId)){
				try {
					getProject().setPersistentProperty(fPersistanceName, fId);
					fIsCfgModified = false;
					fNeedsPersistance = false;
					return true;
				} catch (CoreException e) {
					CCorePlugin.log(e);
				}
			}
			return false;
		}

	}

	public CProjectDescription(IProject project, ICSettingsStorage storage, ICStorageElement element, boolean loading, boolean isCreating) throws CoreException {
		fProject = project;
		fStorage = storage;
		fRootStorageElement = element;
		fIsReadOnly = loading;
		fIsLoading = loading;
		fActiveCfgInfo = new CfgIdPair(ACTIVE_CFG_PROPERTY);
		fSettingCfgInfo = new CfgIdPair(SETTING_CFG_PROPERTY);
		fIsCreating = isCreating;
		ICStorageElement el = null;
		CProjectDescriptionManager mngr = CProjectDescriptionManager.getInstance();
		if(loading){
			Map<String, ICStorageElement> cfgStorMap = mngr.createCfgStorages(this);

			for (ICStorageElement sel : cfgStorMap.values()) {
				CConfigurationDescriptionCache cache = new CConfigurationDescriptionCache(sel, this);
				configurationCreated(cache);
			}

			el = getStorage(CProjectDescriptionManager.MODULE_ID, false);
		}

		fPrefs = new CProjectDescriptionPreferences(el,
				(CProjectDescriptionPreferences)mngr.getProjectDescriptionWorkspacePreferences(false),
				false);

		fPropertiesMap = new HashMap<QualifiedName, Object>();
	}

	public void updateProject(IProject project){
		fProject = project;
	}

	public void loadDatas(){
		if(!fIsReadOnly || !fIsLoading)
			return;

		for(Iterator<ICConfigurationDescription> iter = fCfgMap.values().iterator(); iter.hasNext();){
			CConfigurationDescriptionCache cache = (CConfigurationDescriptionCache)iter.next();
			try {
				cache.loadData();
			} catch (CoreException e) {
				CCorePlugin.log(e);
				iter.remove();
			}
		}

//		doneInitializing();

//		fIsLoading = false;
	}

	public boolean applyDatas(SettingsContext context){
		if(!fIsReadOnly || !fIsApplying)
			return false;

		boolean modified = false;
		for (Iterator<ICConfigurationDescription> iter = fCfgMap.values().iterator(); iter.hasNext();) {
			CConfigurationDescriptionCache cache = (CConfigurationDescriptionCache)iter.next();
			try {
				if(cache.applyData(context))
					modified = true;
			} catch (CoreException e) {
				CCorePlugin.log(e);
				e.printStackTrace();
				iter.remove();
			}
		}

//		doneInitializing();

//		fIsApplying = false;

		return modified;
	}

	/**
	 * Called when the read-only project description has / is being set
	 * fIsApplying => false
	 * setModified (false)
	 * set the ICSettingsStorage to readonly
	 */
	public void doneApplying(){
		doneInitializing();
		fIsApplying = false;

		try {
			getStorageBase().setReadOnly(true, false);
		} catch (CoreException e1) {
			CCorePlugin.log(e1);
		}

		setModified(false);
	}

	public void doneLoading(){
		doneInitializing();
		fIsLoading = false;
	}

	public void setLoading(boolean loading){
		fIsLoading = loading;
	}

	private void doneInitializing(){
		for (ICConfigurationDescription cfg : fCfgMap.values()) {
			// FIXME How and why are we down casting to a CConfigurationDescriptionCache. Comments, please!
			CConfigurationDescriptionCache cache = (CConfigurationDescriptionCache)cfg;
			cache.doneInitialization();
		}

		if(fIsReadOnly)
			fPrefs.setReadOnly(true);
	}

	public boolean isLoading(){
		return fIsLoading;
	}

	public boolean isApplying(){
		return fIsApplying;
	}

	/**
	 * Create a project description based on another project description
	 *
	 * @param base
	 * @param saving
	 * @param storage
	 * @param el
	 * @param isCreating
	 */
	public CProjectDescription(CProjectDescription base, boolean saving, ICSettingsStorage storage, ICStorageElement el, boolean isCreating) {
		fActiveCfgInfo = new CfgIdPair(base.fActiveCfgInfo);
		fSettingCfgInfo = new CfgIdPair(base.fSettingCfgInfo);
		fProject = base.fProject;
		fStorage = storage;
		fRootStorageElement = el;
		fIsReadOnly = saving;
		fIsLoading = base.fIsLoading;
		fIsApplying = saving || base.fIsApplying;
		fIsCreating = isCreating;

		fPrefs = new CProjectDescriptionPreferences(base.fPrefs, (CProjectDescriptionPreferences)CProjectDescriptionManager.getInstance().getProjectDescriptionWorkspacePreferences(false), false);

		for(Iterator<ICConfigurationDescription> iter = base.fCfgMap.values().iterator(); iter.hasNext();){
			try {
				IInternalCCfgInfo cfgDes = (IInternalCCfgInfo)iter.next();
				if(fIsReadOnly){
					CConfigurationData baseData = cfgDes.getConfigurationData(false);
					CConfigurationDescriptionCache baseCache = null;
					if(baseData instanceof CConfigurationDescriptionCache){
						baseCache = (CConfigurationDescriptionCache)baseData;
						baseData = baseCache.getConfigurationData();
					}
					CConfigurationDescriptionCache cache = new CConfigurationDescriptionCache((ICConfigurationDescription)cfgDes, baseData, baseCache, cfgDes.getSpecSettings(), this, null);
					configurationCreated(cache);
				} else {
					CConfigurationData baseData = cfgDes.getConfigurationData(false);
					CConfigurationDescription cfg = new CConfigurationDescription(baseData, this);
					configurationCreated(cfg);
				}
			} catch (CoreException e){
				CCorePlugin.log(e);
			}
		}

		@SuppressWarnings("unchecked")
		HashMap<QualifiedName, Object> cloneMap = (HashMap<QualifiedName, Object>)base.fPropertiesMap.clone();
		fPropertiesMap = cloneMap;
	}

	/**
	 * Convert the current CConfigurationDescriptions to cached versions
	 * This occurs during the SetCProjectDescription Operation
	 */
	void switchToCachedConfigurationDescriptions() throws CoreException {

		for (Map.Entry<String, ICConfigurationDescription> e : fCfgMap.entrySet()) {
			if (e.getValue() instanceof CConfigurationDescription) {
				CConfigurationDescription cfgDes = (CConfigurationDescription)e.getValue();
				CConfigurationData baseData = ((IInternalCCfgInfo)cfgDes).getConfigurationData(false);
				CConfigurationDescriptionCache baseCache = null;
				if(baseData instanceof CConfigurationDescriptionCache){
					baseCache = (CConfigurationDescriptionCache)baseData;
					baseData = baseCache.getConfigurationData();
				}
				CConfigurationDescriptionCache cache = new CConfigurationDescriptionCache(cfgDes, baseData, baseCache,
						cfgDes.getSpecSettings(), this, null);
				e.setValue(cache);
			}
		}
	}

	void configurationCreated(ICConfigurationDescription des){
		fCfgMap.put(des.getId(), des);
	}

	@Override
	public ICConfigurationDescription createConfiguration(String id, String name,
			ICConfigurationDescription base) throws CoreException{
		if(fIsReadOnly)
			throw ExceptionFactory.createIsReadOnlyException();
		CConfigurationDescription cfg = new CConfigurationDescription(id, name, base, this);
		configurationCreated(cfg);
		return cfg;
	}

	@Override
	public ICConfigurationDescription getActiveConfiguration() {
		return fActiveCfgInfo.getConfiguration();
	}

	private String getFirstCfgId(){
		if(!fCfgMap.isEmpty()){
			return fCfgMap.keySet().iterator().next();
		}
		return null;
	}

	@Override
	public ICConfigurationDescription getConfigurationById(String id) {
		return fCfgMap.get(id);
	}

	@Override
	public ICConfigurationDescription getConfigurationByName(String name) {
		for(Iterator<ICConfigurationDescription> iter = fCfgMap.values().iterator(); iter.hasNext();){
			ICConfigurationDescription cfg = iter.next();
			if(name.equals(cfg.getName()))
				return cfg;
		}
		return null;
	}

	@Override
	public ICConfigurationDescription[] getConfigurations() {
		return fCfgMap.values().toArray(new ICConfigurationDescription[fCfgMap.size()]);
	}

	@Override
	public void removeConfiguration(String name) throws WriteAccessException {
		if(fIsReadOnly)
			throw ExceptionFactory.createIsReadOnlyException();


		CConfigurationDescription cfgDes = (CConfigurationDescription)getConfigurationByName(name);
		if(cfgDes != null){
			cfgDes.removeConfiguration();
		}

	}

	void configurationRemoved(CConfigurationDescription des){
		fCfgMap.remove(des.getId());
		fIsModified = true;

		fActiveCfgInfo.configurationRemoved(des);
		fSettingCfgInfo.configurationRemoved(des);
	}

	@Override
	public void removeConfiguration(ICConfigurationDescription cfg) throws WriteAccessException {
		if(fIsReadOnly)
			throw ExceptionFactory.createIsReadOnlyException();

		((CConfigurationDescription)cfg).removeConfiguration();
	}

	@Override
	public void setActiveConfiguration(
			ICConfigurationDescription cfg) throws WriteAccessException {
		if(fIsReadOnly)
			throw ExceptionFactory.createIsReadOnlyException();
		if(cfg == null)
			throw new NullPointerException();

		fActiveCfgInfo.setConfiguration(cfg);

		if(getConfigurationRelations() == CONFIGS_LINK_SETTINGS_AND_ACTIVE)
			fSettingCfgInfo.setConfiguration(cfg);

	}

	@Override
	public IProject getProject() {
		return fProject;
	}

	@Override
	public ICStorageElement getStorage(String moduleId, boolean create) throws CoreException {
		return getStorageBase().getStorage(moduleId, create);
	}

	@Override
	public ICStorageElement importStorage(String id, ICStorageElement el) throws UnsupportedOperationException, CoreException {
		return getStorageBase().importStorage(id, el);
	}

//	public boolean containsStorage(String id) throws CoreException {
//		return getStorageBase().containsStorage(id);
//	}

	@Override
	public ICSettingObject[] getChildSettings() {
		return getConfigurations();
	}

	@Override
	public ICConfigurationDescription getConfiguration() {
		return null;
	}

	@Override
	public String getId() {
		//TODO:
		return null;
	}

	@Override
	public final int getType() {
		return ICSettingBase.SETTING_PROJECT;
	}

	@Override
	public String getName() {
		return fProject.getName();
	}

	@Override
	public ICSettingContainer getParent() {
		return null;
	}

	@Override
	public boolean isValid() {
		return /*fProject.exists() &&*/ fCfgMap.size() > 0;
	}

	@Override
	public void updateChild(CDataProxy child, boolean write) {
		if(write){
			try {
				String oldId = child.getId();
				CConfigurationDescription cfgDes = ((CConfigurationDescription)child);
				cfgDes.doWritable();
				updateMap(cfgDes, oldId);
			} catch (CoreException e) {
				CCorePlugin.log(e);
			}
		}
	}

	void updateMap(CConfigurationDescription des, String oldId){
		if(!oldId.equals(des.getId())){
			fCfgMap.remove(oldId);
			fCfgMap.put(des.getId(), des);
		}
	}

	public ICStorageElement getRootStorageElement() throws CoreException {
		if (fRootStorageElement == null)
			throw ExceptionFactory.createCoreException("CProjectDescription ICStorageElement == null"); //$NON-NLS-1$

//		if(fRootStorageElement == null){
//			fRootStorageElement = CProjectDescriptionManager.getInstance().createStorage(fProject, true, true, isReadOnly());
//		}
		return fRootStorageElement;
	}

//	ICStorageElement doGetCachedRootStorageElement(){
//		return fRootStorageElement;
//	}

	ICSettingsStorage getStorageBase() throws CoreException{
		if(fStorage == null)
//			fStorage = new CStorage((InternalXmlStorageElement)getRootStorageElement());
			throw ExceptionFactory.createCoreException("CProjectDescription ICSettingsStorage == null"); //$NON-NLS-1$
		return fStorage;
	}

	@Override
	public ICConfigurationDescription createConfiguration(String buildSystemId, CConfigurationData data) throws CoreException {
		if(fIsReadOnly)
			throw ExceptionFactory.createIsReadOnlyException();
		CConfigurationDescription cfg = new CConfigurationDescription(data, buildSystemId, this);
		configurationCreated(cfg);
		return cfg;
	}

	public CConfigurationDescription createConvertedConfiguration(String id, String name, ICStorageElement el) throws CoreException{
		if(fIsReadOnly)
			throw ExceptionFactory.createIsReadOnlyException();
		CConfigurationDescription cfg = new CConfigurationDescription(id, name, el, this);
		configurationCreated(cfg);
		return cfg;
	}

	boolean needsDescriptionPersistence() {
		if(fIsModified)
			return true;

		if(fPrefs.isModified())
			return true;

		if(fStorage.isModified())
			return true;

		for(ICConfigurationDescription cfgDes : fCfgMap.values())
			if(cfgDes.isModified())
				return true;

		return false;
	}

	@Override
	public boolean isModified() {
		if(needsDescriptionPersistence())
			return true;

		if(needsActiveCfgPersistence())
			return true;

		if(needsSettingCfgPersistence())
			return true;

		return false;
	}

	private void setModified(boolean modified){
		fIsModified = modified;

		if(!modified){
			fActiveCfgInfo.fIsCfgModified = false;

			fSettingCfgInfo.fIsCfgModified = false;

			fPrefs.setModified(false);

			//no need to do that for config cache since they always maintain the "isModified == false"
		}
	}

	@Override
	public boolean isReadOnly() {
		return fIsReadOnly && !(fIsLoading || fIsApplying);
	}

	@Override
	public void setReadOnly(boolean readOnly, boolean keepModify) {
		fIsReadOnly = readOnly;
		try {
			getStorageBase().setReadOnly(readOnly, keepModify);
		} catch (CoreException e) {
			CCorePlugin.log(e);
		}
	}

	public ICSettingObject getChildSettingById(String id) {
		return getConfigurationById(id);
	}

	@Override
	public ICConfigurationDescription getDefaultSettingConfiguration(){
		if(getConfigurationRelations() == CONFIGS_LINK_SETTINGS_AND_ACTIVE)
			return getActiveConfiguration();

		return fSettingCfgInfo.getConfiguration();
	}

	@Override
	public void setDefaultSettingConfiguration(ICConfigurationDescription cfg) throws WriteAccessException {
		if(fIsReadOnly)
			throw ExceptionFactory.createIsReadOnlyException();
		if(cfg == null)
			throw new NullPointerException();

		fSettingCfgInfo.setConfiguration(cfg);

		if(getConfigurationRelations() == CONFIGS_LINK_SETTINGS_AND_ACTIVE)
			fActiveCfgInfo.setConfiguration(cfg);
	}

	@Override
	public Object getSessionProperty(QualifiedName name) {
		return fPropertiesMap.get(name);
	}

	@Override
	public void setSessionProperty(QualifiedName name, Object value) {
		if(value != null)
			fPropertiesMap.put(name, value);
		else
			fPropertiesMap.remove(name);

		fIsModified = true;
	}

	@Override
	public void removeStorage(String id) throws CoreException {
		getStorageBase().removeStorage(id);
	}

	void switchToCachedAppliedData(CProjectDescription appliedCache){
		if(fIsReadOnly)
			return;

		ICConfigurationDescription[] cfgs = appliedCache.getConfigurations();
		for(int i = 0; i < cfgs.length; i++){
			CConfigurationDescriptionCache cfgCache = (CConfigurationDescriptionCache)cfgs[i];
			CConfigurationDescription des = (CConfigurationDescription)getChildSettingById(cfgCache.getId());
			if(des != null){
				des.setData(cfgCache);
//				ICResourceDescription rcDes = des.getResourceDescription(new Path("dd"), false);
//				rcDes = des.getResourceDescription(new Path("dd"), false);
//				ICBuildSetting bs = des.getBuildSetting();
//				ICLanguageSetting lss[] = ((ICFolderDescription)rcDes).getLanguageSettings();
			}
		}
	}

	boolean checkPersistActiveCfg(String oldId, boolean force){
		return fActiveCfgInfo.store(oldId, force);
	}

	boolean checkPersistSettingCfg(String oldId, boolean force){
		return fSettingCfgInfo.store(oldId, force);
	}

	boolean needsActiveCfgPersistence(){
		return fActiveCfgInfo.fIsCfgModified;
	}

	boolean needsSettingCfgPersistence(){
		return fSettingCfgInfo.fIsCfgModified;
	}

	CProjectDescriptionPreferences getPreferences(){
		return fPrefs;
	}

	@Override
	public int getConfigurationRelations() {
		return fPrefs.getConfigurationRelations();
	}

	@Override
	public boolean isDefaultConfigurationRelations() {
		return fPrefs.isDefaultConfigurationRelations();
	}

	@Override
	public void setConfigurationRelations(int status) {
		fPrefs.setConfigurationRelations(status);
	}

	@Override
	public void useDefaultConfigurationRelations() {
		fPrefs.useDefaultConfigurationRelations();
	}

	@Override
	public boolean isCdtProjectCreating() {
		return fIsCreating;
	}

	@Override
	public void setCdtProjectCreated() {
		if(!fIsCreating)
			return;

		if(fIsReadOnly)
			throw ExceptionFactory.createIsReadOnlyException();

		fIsCreating = false;
		fIsModified = true;
	}

	public void touch() throws WriteAccessException {
		if(fIsReadOnly)
			throw ExceptionFactory.createIsReadOnlyException();

		fIsModified = true;
	}


}

Back to the top