View | Details | Raw Unified | Return to bug 179098
Collapse All | Expand All

(-)src/org/eclipse/cdt/internal/ui/language/ProjectLanguageMappingPropertyPage.java (-1 / +1 lines)
Lines 37-45 Link Here
37
import org.eclipse.ui.dialogs.PropertyPage;
37
import org.eclipse.ui.dialogs.PropertyPage;
38
38
39
import org.eclipse.cdt.core.CCorePlugin;
39
import org.eclipse.cdt.core.CCorePlugin;
40
import org.eclipse.cdt.core.language.LanguageMappingConfiguration;
40
import org.eclipse.cdt.core.model.LanguageManager;
41
import org.eclipse.cdt.core.model.LanguageManager;
41
42
42
import org.eclipse.cdt.internal.core.language.LanguageMappingConfiguration;
43
43
44
import org.eclipse.cdt.internal.ui.preferences.PreferencesMessages;
44
import org.eclipse.cdt.internal.ui.preferences.PreferencesMessages;
45
45
(-)model/org/eclipse/cdt/internal/core/language/LanguageMappingConfiguration.java (-41 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - Initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.cdt.internal.core.language;
12
13
import java.util.Collections;
14
import java.util.Map;
15
import java.util.TreeMap;
16
17
public class LanguageMappingConfiguration {
18
19
	private Map fProjectMappings;
20
21
	public LanguageMappingConfiguration() {
22
		fProjectMappings = new TreeMap();
23
	}
24
	
25
	public Map getProjectMappings() {
26
		return Collections.unmodifiableMap(fProjectMappings);
27
	}
28
29
	public void setProjectMappings(Map projectMappings) {
30
		fProjectMappings = projectMappings;
31
	}
32
33
	public void addProjectMapping(String contentType, String language) {
34
		fProjectMappings.put(contentType, language);
35
	}
36
37
	public void removeProjectMapping(String contentType) {
38
		fProjectMappings.remove(contentType);
39
	}
40
41
}
(-)model/org/eclipse/cdt/internal/core/language/LanguageMappingStore.java (+1 lines)
Lines 17-22 Link Here
17
17
18
import org.eclipse.cdt.core.CCorePlugin;
18
import org.eclipse.cdt.core.CCorePlugin;
19
import org.eclipse.cdt.core.ICDescriptor;
19
import org.eclipse.cdt.core.ICDescriptor;
20
import org.eclipse.cdt.core.language.LanguageMappingConfiguration;
20
import org.eclipse.core.resources.IProject;
21
import org.eclipse.core.resources.IProject;
21
import org.eclipse.core.runtime.CoreException;
22
import org.eclipse.core.runtime.CoreException;
22
import org.w3c.dom.Document;
23
import org.w3c.dom.Document;
(-)model/org/eclipse/cdt/core/model/LanguageManager.java (-1 / +1 lines)
Lines 22-29 Link Here
22
22
23
import org.eclipse.cdt.core.CCorePlugin;
23
import org.eclipse.cdt.core.CCorePlugin;
24
import org.eclipse.cdt.core.dom.ILinkage;
24
import org.eclipse.cdt.core.dom.ILinkage;
25
import org.eclipse.cdt.core.language.LanguageMappingConfiguration;
25
import org.eclipse.cdt.internal.core.CContentTypes;
26
import org.eclipse.cdt.internal.core.CContentTypes;
26
import org.eclipse.cdt.internal.core.language.LanguageMappingConfiguration;
27
import org.eclipse.cdt.internal.core.language.LanguageMappingStore;
27
import org.eclipse.cdt.internal.core.language.LanguageMappingStore;
28
import org.eclipse.cdt.internal.core.model.LanguageDescriptor;
28
import org.eclipse.cdt.internal.core.model.LanguageDescriptor;
29
import org.eclipse.cdt.internal.core.model.TranslationUnit;
29
import org.eclipse.cdt.internal.core.model.TranslationUnit;
(-)model/org/eclipse/cdt/core/language/LanguageMappingConfiguration.java (+69 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - Initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.cdt.core.language;
12
13
import java.util.Collections;
14
import java.util.Map;
15
import java.util.TreeMap;
16
17
/**
18
 * Provides programmatic access to language mappings for a project.
19
 */
20
public class LanguageMappingConfiguration {
21
22
	/**
23
	 * Project-wide mappings.
24
	 */
25
	private Map fProjectMappings;
26
27
	/**
28
	 * Creates a new <code>LanguageMappingConfiguration</code> with no
29
	 * mappings defined.
30
	 */
31
	public LanguageMappingConfiguration() {
32
		fProjectMappings = new TreeMap();
33
	}
34
	
35
	/**
36
	 * Returns a read-only copy of the project-wide language mappings.
37
	 * @return a read-only copy of the project-wide language mappings.
38
	 */
39
	public Map getProjectMappings() {
40
		return Collections.unmodifiableMap(fProjectMappings);
41
	}
42
43
	/**
44
	 * Replaces the existing language mappings with the given
45
	 * mappings.  The given mappings should be between content type ids
46
	 * (<code>String</code>) and language ids (<code>String</code>)
47
	 * @param projectMappings
48
	 */
49
	public void setProjectMappings(Map/*<String, String>*/ projectMappings) {
50
		fProjectMappings = new TreeMap(projectMappings);
51
	}
52
53
	/**
54
	 * Maps a content type id to a language id.
55
	 * @param contentType
56
	 * @param language
57
	 */
58
	public void addProjectMapping(String contentType, String language) {
59
		fProjectMappings.put(contentType, language);
60
	}
61
62
	/**
63
	 * Removes the given content type mapping (if it exists).
64
	 * @param contentType
65
	 */
66
	public void removeProjectMapping(String contentType) {
67
		fProjectMappings.remove(contentType);
68
	}
69
}

Return to bug 179098