blob: 33b605ee209b77b704b520b1a7e07b276b0b5878 (
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
|
/*******************************************************************************
* 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.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICFileDescription;
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
import org.eclipse.cdt.core.settings.model.ICSettingContainer;
import org.eclipse.cdt.core.settings.model.ICSettingObject;
import org.eclipse.cdt.core.settings.model.WriteAccessException;
import org.eclipse.cdt.core.settings.model.extension.CFileData;
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultFileData;
import org.eclipse.core.runtime.IPath;
public class CFileDescriptionCache extends CDefaultFileData implements
ICFileDescription, ICachedData {
private CConfigurationDescriptionCache fCfg;
private ResourceDescriptionHolder fRcDesHolder;
public CFileDescriptionCache(CFileData base, CConfigurationDescriptionCache cfg) {
super(base.getId(), base.getPath(), cfg, null);
fCfg = cfg;
fCfg.addResourceDescription(this);
copyDataFrom(base, true);
}
protected CLanguageData copyLanguageData(CLanguageData data, boolean clone) {
return new CLanguageSettingCache(data, this);
}
public void setExcluded(boolean excluded) throws WriteAccessException {
throw ExceptionFactory.createIsReadOnlyException();
}
public boolean canExclude(boolean exclude) {
return exclude == isExcluded();
}
public void setName(String name) throws WriteAccessException{
throw ExceptionFactory.createIsReadOnlyException();
}
public void setPath(IPath path) throws WriteAccessException{
throw ExceptionFactory.createIsReadOnlyException();
}
public ICConfigurationDescription getConfiguration() {
return fCfg;
}
public ICSettingContainer getParent() {
return fCfg;
}
public ICLanguageSetting getLanguageSetting() {
return (ICLanguageSetting)fLanguageData;
}
public ICSettingObject[] getChildSettings() {
return new ICSettingObject[]{(ICSettingObject)fLanguageData};
}
public boolean isReadOnly() {
return true;
}
private ResourceDescriptionHolder getRcDesHolder(){
if(fRcDesHolder == null)
fRcDesHolder = fCfg.createHolderForRc(getPath());
return fRcDesHolder;
}
public ICFolderDescription getParentFolderDescription() {
return getRcDesHolder().getParentFolderDescription();
}
public IPath getPath() {
return ResourceDescriptionHolder.normalizePath(super.getPath());
}
public boolean hasCustomSettings() {
return true;
}
public boolean isExcluded() {
return fCfg.isExcluded(getPath());
}
}
|