mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
RESOLVED - bug 185465: LanguageMapping issues
https://bugs.eclipse.org/bugs/show_bug.cgi?id=185465 Patch from Gerhard Schaber
This commit is contained in:
parent
437d474f59
commit
8e63fb5452
2 changed files with 27 additions and 6 deletions
|
@ -163,7 +163,6 @@ public class LanguageMappingStore {
|
||||||
Iterator entries = contentTypeMappings.entrySet().iterator();
|
Iterator entries = contentTypeMappings.entrySet().iterator();
|
||||||
while (entries.hasNext()) {
|
while (entries.hasNext()) {
|
||||||
Entry entry = (Entry) entries.next();
|
Entry entry = (Entry) entries.next();
|
||||||
Element mapping = document.createElement(CONTENT_TYPE_MAPPING);
|
|
||||||
|
|
||||||
String configuration = (String) entry.getKey();
|
String configuration = (String) entry.getKey();
|
||||||
Iterator contentTypeEntries = ((Map) entry.getValue()).entrySet().iterator();
|
Iterator contentTypeEntries = ((Map) entry.getValue()).entrySet().iterator();
|
||||||
|
@ -172,6 +171,7 @@ public class LanguageMappingStore {
|
||||||
String contentType = (String) configurationEntry.getKey();
|
String contentType = (String) configurationEntry.getKey();
|
||||||
String language = (String) configurationEntry.getValue();
|
String language = (String) configurationEntry.getValue();
|
||||||
|
|
||||||
|
Element mapping = document.createElement(CONTENT_TYPE_MAPPING);
|
||||||
mapping.setAttribute(ATTRIBUTE_CONTENT_TYPE, contentType);
|
mapping.setAttribute(ATTRIBUTE_CONTENT_TYPE, contentType);
|
||||||
mapping.setAttribute(ATTRIBUTE_CONFIGURATION, configuration);
|
mapping.setAttribute(ATTRIBUTE_CONFIGURATION, configuration);
|
||||||
mapping.setAttribute(ATTRIBUTE_LANGUAGE, language);
|
mapping.setAttribute(ATTRIBUTE_LANGUAGE, language);
|
||||||
|
@ -194,7 +194,7 @@ public class LanguageMappingStore {
|
||||||
serializer.transform(source, result);
|
serializer.transform(source, result);
|
||||||
String encodedMappings = buffer.getBuffer().toString();
|
String encodedMappings = buffer.getBuffer().toString();
|
||||||
|
|
||||||
Preferences node = CCorePlugin.getDefault().getPluginPreferences();;
|
Preferences node = CCorePlugin.getDefault().getPluginPreferences();
|
||||||
node.setValue(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS, encodedMappings);
|
node.setValue(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS, encodedMappings);
|
||||||
CCorePlugin.getDefault().savePluginPreferences();
|
CCorePlugin.getDefault().savePluginPreferences();
|
||||||
} catch (ParserConfigurationException e) {
|
} catch (ParserConfigurationException e) {
|
||||||
|
@ -205,7 +205,7 @@ public class LanguageMappingStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorkspaceLanguageConfiguration decodeWorkspaceMappings() throws CoreException {
|
public WorkspaceLanguageConfiguration decodeWorkspaceMappings() throws CoreException {
|
||||||
Preferences node = CCorePlugin.getDefault().getPluginPreferences();;
|
Preferences node = CCorePlugin.getDefault().getPluginPreferences();
|
||||||
String encodedMappings = node.getString(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS);
|
String encodedMappings = node.getString(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS);
|
||||||
WorkspaceLanguageConfiguration config = new WorkspaceLanguageConfiguration();
|
WorkspaceLanguageConfiguration config = new WorkspaceLanguageConfiguration();
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Group;
|
import org.eclipse.swt.widgets.Group;
|
||||||
import org.eclipse.ui.dialogs.PropertyPage;
|
import org.eclipse.ui.dialogs.PropertyPage;
|
||||||
|
|
||||||
|
@ -70,10 +71,30 @@ public class ProjectLanguageMappingPropertyPage extends PropertyPage {
|
||||||
fetchWorkspaceMappings();
|
fetchWorkspaceMappings();
|
||||||
fInheritedMappingWidget.createContents(group, null);
|
fInheritedMappingWidget.createContents(group, null);
|
||||||
fInheritedMappingsChangeListener = new ILanguageMappingChangeListener() {
|
fInheritedMappingsChangeListener = new ILanguageMappingChangeListener() {
|
||||||
public void handleLanguageMappingChangeEvent(ILanguageMappingChangeEvent event) {
|
public void handleLanguageMappingChangeEvent(final ILanguageMappingChangeEvent event) {
|
||||||
if (event.getType() == ILanguageMappingChangeEvent.TYPE_WORKSPACE) {
|
if (event.getType() == ILanguageMappingChangeEvent.TYPE_WORKSPACE) {
|
||||||
fetchWorkspaceMappings();
|
if (ProjectLanguageMappingPropertyPage.this.isControlCreated()) {
|
||||||
fInheritedMappingWidget.refreshMappings();
|
Display.getDefault().asyncExec(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
if (!ProjectLanguageMappingPropertyPage.this.getControl().isDisposed()) {
|
||||||
|
fetchWorkspaceMappings();
|
||||||
|
fInheritedMappingWidget.refreshMappings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (event.getType() == ILanguageMappingChangeEvent.TYPE_PROJECT) {
|
||||||
|
if (ProjectLanguageMappingPropertyPage.this.isControlCreated()) {
|
||||||
|
Display.getDefault().asyncExec(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
if (!ProjectLanguageMappingPropertyPage.this.getControl().isDisposed()) {
|
||||||
|
fetchMappings(event.getProject());
|
||||||
|
fMappingWidget.refreshMappings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue