diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/LanguageMappingConfiguration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/LanguageMappingConfiguration.java deleted file mode 100644 index 55fdf694e12..00000000000 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/LanguageMappingConfiguration.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM 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: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.core.language; - -import java.util.Collections; -import java.util.Map; -import java.util.TreeMap; - -/** - * Provides programmatic access to language mappings for a project. - * - *
- * EXPERIMENTAL. This class or interface has been added as - * part of a work in progress. There is no guarantee that this API will work or - * that it will remain the same. Please do not use this API without consulting - * with the CDT team. - *
- * - * @since 4.0 - */ -public class LanguageMappingConfiguration { - - /** - * Project-wide mappings. - */ - private Map fProjectMappings; - - /** - * Creates a newLanguageMappingConfiguration
with no
- * mappings defined.
- */
- public LanguageMappingConfiguration() {
- fProjectMappings = new TreeMap();
- }
-
- /**
- * Returns a read-only copy of the project-wide language mappings.
- * @return a read-only copy of the project-wide language mappings.
- */
- public Map getProjectMappings() {
- return Collections.unmodifiableMap(fProjectMappings);
- }
-
- /**
- * Replaces the existing language mappings with the given
- * mappings. The given mappings should be between content type ids
- * (String
) and language ids (String
)
- * @param projectMappings
- */
- public void setProjectMappings(Map/*+ * EXPERIMENTAL. This class or interface has been added as + * part of a work in progress. There is no guarantee that this API will work or + * that it will remain the same. Please do not use this API without consulting + * with the CDT team. + *
+ * + * @since 4.0 + */ +public class ProjectLanguageConfiguration { + + /** + * Project-wide content type mappings. + */ + private Map fContentTypeMappings; + + /** + * Per-file mappings. + */ + private Map fFileMappings; + + /** + * Creates a newProjectLanguageConfiguration
with no
+ * language mappings defined.
+ */
+ public ProjectLanguageConfiguration() {
+ fContentTypeMappings = new TreeMap();
+ fFileMappings = new TreeMap();
+ }
+
+ /**
+ * Returns a read-only copy of the project-wide content-type-specific language mappings.
+ * @return a read-only copy of the project-wide content-type-specific language mappings.
+ */
+ public Map getContentTypeMappings() {
+ return Collections.unmodifiableMap(fContentTypeMappings);
+ }
+
+ /**
+ * Returns the language id that is mapped to the given content type.
+ * @param contentTypeId
+ * @return
+ */
+ public String getLanguageForContentType(String contentTypeId) {
+ return (String) fContentTypeMappings.get(contentTypeId);
+ }
+
+ /**
+ * Returns the language id that is mapped to the given file.
+ * @param file
+ * @return
+ */
+ public String getLanguageForFile(IFile file) {
+ return (String) fFileMappings.get(file.getProjectRelativePath().toPortableString());
+ }
+
+ /**
+ * Returns the language id that is mapped to the given file.
+ * @param path
+ * @return
+ */
+ public String getLanguageForFile(String path) {
+ return (String) fFileMappings.get(path);
+ }
+
+
+ /**
+ * Replaces the existing content-type-specific language mappings with the given
+ * mappings. The given mappings should be between content type ids
+ * (String
) and language ids (String
)
+ * @param mappings
+ */
+ public void setContentTypeMappings(Map/*String
) and language ids (String
)
+ * @param projectMappings
+ */
+ public void setFileMappings(Map/*WorkspaceLanguageConfiguration
with no
+ * language mappings defined.
+ */
+ public WorkspaceLanguageConfiguration() {
+ fMappings = new TreeMap();
+ }
+
+ /**
+ * Maps a content type id to a language id.
+ * @param contentType
+ * @param language
+ */
+ public void addWorkspaceMapping(String contentType, String language) {
+ fMappings.put(contentType, language);
+ }
+
+ /**
+ * Removes the given content type mapping (if it exists).
+ * @param contentType
+ */
+ public void removeWorkspaceMapping(String contentType) {
+ fMappings.remove(contentType);
+ }
+
+ /**
+ * Replaces the existing language mappings with the given
+ * mappings. The given mappings should be between content type ids
+ * (String
) and language ids (String
)
+ * @param projectMappings
+ */
+ public void setWorkspaceMappings(Map/*Platform
.
+ * @return all of the languages registered with the Platform
.
+ */
public ILanguage[] getRegisteredLanguages() {
cacheAllLanguages();
ILanguage[] languages = new ILanguage[fLanguageCache.size()];
@@ -357,25 +366,68 @@ public class LanguageManager {
fIsFullyCached = true;
}
- public LanguageMappingConfiguration getLanguageMappingConfiguration(IProject project) throws CoreException {
- LanguageMappingConfiguration mappings = (LanguageMappingConfiguration) fLanguageConfigurationCache.get(project);
- if (mappings != null) {
- return mappings;
- }
-
- LanguageMappingStore store = new LanguageMappingStore(project);
- mappings = store.decodeMappings();
- fLanguageConfigurationCache.put(project, mappings);
- return mappings;
- }
-
- public void storeLanguageMappingConfiguration(IProject project) throws CoreException {
- LanguageMappingConfiguration mappings = (LanguageMappingConfiguration) fLanguageConfigurationCache.get(project);
- LanguageMappingStore store = new LanguageMappingStore(project);
- store.storeMappings(mappings);
+ /**
+ * Returns the language configuration for the workspace.
+ * @return
+ * @throws CoreException
+ * @since 4.0
+ */
+ public WorkspaceLanguageConfiguration getWorkspaceLanguageConfiguration() throws CoreException {
+ // TODO: Implement this.
+ return new WorkspaceLanguageConfiguration();
}
/**
+ * Saves the workspace language configuration to persistent storage and notifies
+ * all ILanguageMappingChangeListeners
of changes.
+ * @param affectedContentTypes
+ * @throws CoreException
+ * @since 4.0
+ */
+ public void storeWorkspaceLanguageConfiguration(IContentType[] affectedContentTypes) throws CoreException {
+ // TODO: Implement this.
+ }
+
+ /**
+ * Returns the language configuration for the given project.
+ * @param project
+ * @return
+ * @throws CoreException
+ * @since 4.0
+ */
+ public ProjectLanguageConfiguration getLanguageConfiguration(IProject project) throws CoreException {
+ synchronized (this) {
+ ProjectLanguageConfiguration mappings = (ProjectLanguageConfiguration) fLanguageConfigurationCache.get(project);
+ if (mappings != null) {
+ return mappings;
+ }
+
+ LanguageMappingStore store = new LanguageMappingStore(project);
+ mappings = store.decodeMappings();
+ fLanguageConfigurationCache.put(project, mappings);
+ return mappings;
+ }
+ }
+
+ /**
+ * Saves the language configuration for the given project to persistent
+ * storage and notifies all ILanguageMappingChangeListeners
+ * of changes.
+ * @param project
+ * @param affectedContentTypes
+ * @throws CoreException
+ * @since 4.0
+ */
+ public void storeLanguageMappingConfiguration(IProject project, IContentType[] affectedContentTypes) throws CoreException {
+ ProjectLanguageConfiguration mappings = (ProjectLanguageConfiguration) fLanguageConfigurationCache.get(project);
+ LanguageMappingStore store = new LanguageMappingStore(project);
+ store.storeMappings(mappings);
+
+ // TODO: Notify listeners that the language mappings have changed.
+ }
+
+ /**
+ * Returns an ILanguage representing the language to be used for the given file.
* @since 4.0
* @return an ILanguage representing the language to be used for the given file
* @param fullPathToFile the full path to the file for which the language is requested
@@ -396,37 +448,25 @@ public class LanguageManager {
String contentTypeID = contentType.getId();
- // TODO: other mappings would go here
-
- // Project-level mappings
- LanguageMappingConfiguration mappings = getLanguageMappingConfiguration(project);
- if (mappings != null) {
- String id = (String) mappings.getProjectMappings().get(contentTypeID);
- if (id != null) {
- return getLanguage(id);
- }
- }
-
- // Content type mappings
- return getLanguageForContentTypeID(contentTypeID);
+ return computeLanguage(project, fullPathToFile, contentTypeID);
}
/**
- * @since 4.0
+ * Returns an ILanguage representing the language to be used for the given file.
* @return an ILanguage representing the language to be used for the given file
* @param pathToFile the path to the file for which the language is requested.
* The path can be either workspace or project relative.
* @param project the project that this file should be parsed in context of. This field is optional and may
* be set to null. If the project is null then this method tries to determine the project context via workspace APIs.
* @throws CoreException
- * * TODO: implement other mapping levels besides project level and content type level
+ * @since 4.0
*/
public ILanguage getLanguageForFile(IPath pathToFile, IProject project) throws CoreException {
return getLanguageForFile(pathToFile, project, null);
}
/**
- * @since 4.0
+ * Returns an ILanguage representing the language to be used for the given file.
* @return an ILanguage representing the language to be used for the given file
* @param pathToFile the path to the file for which the language is requested.
* The path can be either workspace or project relative.
@@ -434,7 +474,7 @@ public class LanguageManager {
* be set to null. If the project is null then this method tries to determine the project context via workspace APIs.
* @param contentTypeID id of the content type, may be null
.
* @throws CoreException
- * * TODO: implement other mapping levels besides project level and content type level
+ * @since 4.0
*/
public ILanguage getLanguageForFile(IPath pathToFile, IProject project, String contentTypeID) throws CoreException {
if (project == null) {
@@ -452,27 +492,15 @@ public class LanguageManager {
contentTypeID= ct.getId();
}
- // TODO: other mappings would go here
-
- // Project-level mappings
- LanguageMappingConfiguration mappings = getLanguageMappingConfiguration(project);
- if (mappings != null) {
- String id = (String) mappings.getProjectMappings().get(contentTypeID);
- if (id != null) {
- return getLanguage(id);
- }
- }
-
- // Content type mappings
- return getLanguageForContentTypeID(contentTypeID);
+ return computeLanguage(project, pathToFile.toPortableString(), contentTypeID);
}
/**
- * @since 4.0
+ * Returns an ILanguage representing the language to be used for the given file.
* @return an ILanguage representing the language to be used for the given file
* @param file the file for which the language is requested
* @throws CoreException
- * TODO: implement other mapping levels besides project level and content type level
+ * @since 4.0
*/
public ILanguage getLanguageForFile(IFile file) throws CoreException {
return getLanguageForFile(file, null);
@@ -480,12 +508,12 @@ public class LanguageManager {
/**
- * @since 4.0
+ * Returns an ILanguage representing the language to be used for the given file.
* @return an ILanguage representing the language to be used for the given file
* @param file the file for which the language is requested
* @param contentTypeID id of the content type, may be null
.
* @throws CoreException
- * TODO: implement other mapping levels besides project level and content type level
+ * @since 4.0
*/
public ILanguage getLanguageForFile(IFile file, String contentTypeId) throws CoreException {
IProject project = file.getProject();
@@ -499,19 +527,89 @@ public class LanguageManager {
contentTypeId= contentType.getId();
}
- // TODO: other mappings would go here
-
- // Project-level mappings
- LanguageMappingConfiguration mappings = getLanguageMappingConfiguration(project);
+ return computeLanguage(project, file.getProjectRelativePath().toPortableString(), contentTypeId);
+ }
+
+ private ILanguage computeLanguage(IProject project, String filePath, String contentTypeId) throws CoreException {
+ ProjectLanguageConfiguration mappings = getLanguageConfiguration(project);
if (mappings != null) {
- String id = (String) mappings.getProjectMappings().get(contentTypeId);
+ // File-level mappings
+ String id = mappings.getLanguageForFile(filePath);
+ if (id != null) {
+ return getLanguage(id);
+ }
+
+ // Project-level mappings
+ id = mappings.getLanguageForContentType(contentTypeId);
if (id != null) {
return getLanguage(id);
}
}
+ // Workspace mappings
+ WorkspaceLanguageConfiguration workspaceMappings = getWorkspaceLanguageConfiguration();
+ String id = workspaceMappings.getLanguageForContentType(contentTypeId);
+ if (id != null) {
+ return getLanguage(id);
+ }
+
// Content type mappings
return getLanguageForContentTypeID(contentTypeId);
}
+
+ /**
+ * Adds a listener that will be notified of changes in language mappings.
+ *
+ * @param listener the ILanguageMappingChangeListener to add
+ */
+ public void registerLanguageChangeListener(ILanguageMappingChangeListener listener) {
+ fLanguageChangeListeners.add(listener);
+ }
+
+ /**
+ * Removes a language mapping change listener.
+ *
+ * @param listener the ILanguageMappingChangeListener to remove.
+ */
+ public void unregisterLanguageChangeListener(ILanguageMappingChangeListener listener) {
+ fLanguageChangeListeners.remove(listener);
+ }
+
+ /**
+ * Notifies all language mappings change listeners of a change in the mappings.
+ *
+ * @param event the ILanguageMappingsChange event to be broadcast.
+ */
+ public void notifyLanguageChangeListeners(ILanguageMappingChangeEvent event) {
+ Object[] listeners = fLanguageChangeListeners.getListeners();
+
+ for (int i= 0; i < listeners.length; i++) {
+ ILanguageMappingChangeListener listener = (ILanguageMappingChangeListener) listeners[i];
+ listener.handleLanguageMappingChangeEvent(event);
+ }
+ }
+ /**
+ * Saves the language configuration for the given file to persistent
+ * storage and notifies all ILanguageMappingChangeListeners
+ * of changes.
+ * @param file
+ * @throws CoreException
+ * @since 4.0
+ */
+ public void storeLanguageMappingConfiguration(IFile file) throws CoreException {
+ IProject project = file.getProject();
+ synchronized (this) {
+ ProjectLanguageConfiguration mappings = (ProjectLanguageConfiguration) fLanguageConfigurationCache.get(project);
+ LanguageMappingStore store = new LanguageMappingStore(project);
+ store.storeMappings(mappings);
+ }
+
+ // Notify listeners that the language mappings have changed.
+ LanguageMappingChangeEvent event = new LanguageMappingChangeEvent();
+ event.setType(LanguageMappingChangeEvent.TYPE_FILE);
+ event.setProject(project);
+ event.setFile(file);
+ notifyLanguageChangeListeners(event);
+ }
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/LanguageMappingChangeEvent.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/LanguageMappingChangeEvent.java
new file mode 100644
index 00000000000..ebd057a1fce
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/LanguageMappingChangeEvent.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.core.model;
+
+import java.net.URI;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.content.IContentType;
+
+/**
+ * A minimal implementation of ILanguageMappingsChangeEvent.
+ *
+ * @author crecoskie
+ */
+public class LanguageMappingChangeEvent implements ILanguageMappingChangeEvent {
+
+ private int fType;
+ private IProject fProject;
+ private IFile fFile;
+ private IPath fPath;
+ private String fFileName;
+ private IContentType[] fContentTypes;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.model.ILanguageMappingsChangeEvent#getAffectedContentTypes()
+ */
+ public IContentType[] getAffectedContentTypes() {
+ return fContentTypes;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.model.ILanguageMappingsChangeEvent#getFile()
+ */
+ public IFile getFile() {
+ return fFile;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.model.ILanguageMappingsChangeEvent#getFilename()
+ */
+ public String getFilename() {
+
+ // if the filename has been set, use it. otherwise get the path from
+ // either the IFile or the IPath if we have one
+
+ if(fFileName != null)
+ return fFileName;
+ else {
+ if(fFile != null)
+ {
+ IPath location = fFile.getLocation();
+ if(location != null)
+ return location.toString();
+ else {
+ // use the URI if there is one
+ URI uri = fFile.getLocationURI();
+
+ if(uri != null)
+ return uri.toString();
+ }
+
+ }
+ else { // no file, use path
+ if(fPath != null)
+ return fPath.toString();
+
+ }
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.model.ILanguageMappingsChangeEvent#getPath()
+ */
+ public IPath getPath() {
+
+ if(fPath != null)
+ return fPath;
+
+ else { // try to get the path from the file if we have one
+ if(fFile != null)
+ {
+ IPath location = fFile.getLocation();
+ return location;
+ }
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.model.ILanguageMappingsChangeEvent#getProject()
+ */
+ public IProject getProject() {
+
+ if(fProject != null)
+ return fProject;
+
+ else { // try to get the project from the file if we have one
+
+ if(fFile != null)
+ return fFile.getProject();
+
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.model.ILanguageMappingsChangeEvent#getType()
+ */
+ public int getType() {
+ return fType;
+ }
+
+ /**
+ * Sets the associated IContentTypes for this event. The provided array will be returned
+ * subsequently by getAffectedContentTypes.
+ *
+ * @param affectedContentTypes
+ */
+ public void setAffectedContentTypes(IContentType[] affectedContentTypes) {
+ fContentTypes = affectedContentTypes;
+ }
+
+ /**
+ * Sets the associated IFile for this event. This file will be returned subsequently
+ * by getFile().
+ *
+ * @param file the IFile to set
+ */
+ public void setFile(IFile file) {
+ fFile = file;
+ }
+
+ /**
+ * Sets the associated String filename for this event. This filename will be returned subsequently
+ * by getFileName().
+ *
+ * @param fileName the fFileName to set
+ */
+ public void setFileName(String fileName) {
+ fFileName = fileName;
+ }
+
+ /**
+ * Sets the associated IPath for this event. This path will be returned subsequently
+ * by getPath().
+ *
+ * @param path the IPath to set
+ */
+ public void setPath(IPath path) {
+ fPath = path;
+ }
+
+ /**
+ * Sets the associated project for this event. This project will be returned subsequently
+ * by getProject().
+ *
+ * @param project the IProject to set
+ */
+ public void setProject(IProject project) {
+ fProject = project;
+ }
+
+ /**
+ * Sets the type of this event. This type will be returned by getType().
+ *
+ * @param type the type to set
+ * @see ILanguageMappingChangeEvent.TYPE_WORKSPACE
+ * @see ILanguageMappingChangeEvent.TYPE_PROJECT
+ * @see ILanguageMappingChangeEvent.TYPE_FILE
+ */
+ public void setType(int type) {
+ fType = type;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/LanguageMappingStore.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/LanguageMappingStore.java
index 6ac7152bfdd..88ed2147ba2 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/LanguageMappingStore.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/LanguageMappingStore.java
@@ -17,7 +17,7 @@ import java.util.Map.Entry;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.language.LanguageMappingConfiguration;
+import org.eclipse.cdt.core.language.ProjectLanguageConfiguration;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.w3c.dom.Document;
@@ -42,14 +42,14 @@ public class LanguageMappingStore {
fProject = project;
}
- public LanguageMappingConfiguration decodeMappings() throws CoreException {
- LanguageMappingConfiguration config = new LanguageMappingConfiguration();
+ public ProjectLanguageConfiguration decodeMappings() throws CoreException {
+ ProjectLanguageConfiguration config = new ProjectLanguageConfiguration();
ICDescriptor descriptor = getProjectDescription();
Element rootElement = descriptor.getProjectData(LANGUAGE_MAPPING_ID);
if (rootElement == null) {
return config;
}
- config.setProjectMappings(decodeProjectMappings(rootElement));
+ config.setContentTypeMappings(decodeProjectMappings(rootElement));
return config;
}
@@ -73,11 +73,11 @@ public class LanguageMappingStore {
return decodedMappings;
}
- public void storeMappings(LanguageMappingConfiguration config) throws CoreException {
+ public void storeMappings(ProjectLanguageConfiguration config) throws CoreException {
ICDescriptor descriptor = getProjectDescription();
Element rootElement = descriptor.getProjectData(LANGUAGE_MAPPING_ID);
clearChildren(rootElement);
- addProjectMappings(config.getProjectMappings(), rootElement);
+ addProjectMappings(config.getContentTypeMappings(), rootElement);
descriptor.saveProjectData();
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectLanguageMappingPropertyPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectLanguageMappingPropertyPage.java
index 4ea1ed6aea5..89f4e436bf1 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectLanguageMappingPropertyPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/ProjectLanguageMappingPropertyPage.java
@@ -17,6 +17,7 @@ import java.util.Map.Entry;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.content.IContentTypeManager;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.preference.PreferencePage;
@@ -36,7 +37,7 @@ import org.eclipse.swt.widgets.TableItem;
import org.eclipse.ui.dialogs.PropertyPage;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.language.LanguageMappingConfiguration;
+import org.eclipse.cdt.core.language.ProjectLanguageConfiguration;
import org.eclipse.cdt.core.model.LanguageManager;
@@ -45,7 +46,7 @@ import org.eclipse.cdt.internal.ui.preferences.PreferencesMessages;
public class ProjectLanguageMappingPropertyPage extends PropertyPage {
private static final int MINIMUM_COLUMN_WIDTH = 150;
- private LanguageMappingConfiguration fMappings;
+ private ProjectLanguageConfiguration fMappings;
private Table fTable;
private HashMap fContentTypeNamesToIDsMap;
@@ -118,14 +119,14 @@ public class ProjectLanguageMappingPropertyPage extends PropertyPage {
public void handleEvent(Event event) {
ContentTypeMappingDialog dialog = new ContentTypeMappingDialog(
getShell());
- dialog.setContentTypeFilter(fMappings.getProjectMappings()
+ dialog.setContentTypeFilter(fMappings.getContentTypeMappings()
.keySet());
dialog.setBlockOnOpen(true);
if (dialog.open() == Window.OK) {
String contentType = dialog.getContentTypeID();
String language = dialog.getLanguageID();
- fMappings.addProjectMapping(contentType, language);
+ fMappings.addContentTypeMapping(contentType, language);
refreshMappings();
}
}
@@ -141,7 +142,7 @@ public class ProjectLanguageMappingPropertyPage extends PropertyPage {
for (int i = 0; i < selection.length; i++) {
fMappings
- .removeProjectMapping((String) fContentTypeNamesToIDsMap
+ .removeContentTypeMapping((String) fContentTypeNamesToIDsMap
.get(selection[i].getText(0)));
}
@@ -155,7 +156,7 @@ public class ProjectLanguageMappingPropertyPage extends PropertyPage {
private void refreshMappings() {
fTable.removeAll();
- Iterator mappings = fMappings.getProjectMappings().entrySet()
+ Iterator mappings = fMappings.getContentTypeMappings().entrySet()
.iterator();
IContentTypeManager contentTypeManager = Platform
@@ -179,20 +180,21 @@ public class ProjectLanguageMappingPropertyPage extends PropertyPage {
private void fetchMappings() {
try {
fMappings = LanguageManager.getInstance()
- .getLanguageMappingConfiguration(getProject());
+ .getLanguageConfiguration(getProject());
} catch (CoreException e) {
CCorePlugin.log(e);
}
}
protected void performDefaults() {
- fMappings = new LanguageMappingConfiguration();
+ fMappings = new ProjectLanguageConfiguration();
}
public boolean performOk() {
try {
+ IContentType[] affectedContentTypes = null;
LanguageManager.getInstance().storeLanguageMappingConfiguration(
- getProject());
+ getProject(), affectedContentTypes);
return true;
} catch (CoreException e) {
CCorePlugin.log(e);