mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 02:06:01 +02:00
bug 271165, language mapping dialog combo boxes should be sorted
This commit is contained in:
parent
7cf6808597
commit
679552dc61
2 changed files with 19 additions and 4 deletions
|
@ -11,7 +11,9 @@
|
|||
|
||||
package org.eclipse.cdt.internal.ui.language;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
|
@ -34,8 +36,8 @@ public abstract class ContentTypeMappingDialog extends Dialog {
|
|||
String fSelectedLanguageID;
|
||||
String fSelectedConfigurationID;
|
||||
String fSelectedConfigurationName;
|
||||
HashMap<String, String> fContentTypeNamesToIDsMap;
|
||||
HashMap<String, String> fLanguageNamesToIDsMap;
|
||||
Map<String, String> fContentTypeNamesToIDsMap;
|
||||
Map<String, String> fLanguageNamesToIDsMap;
|
||||
|
||||
public ContentTypeMappingDialog(Shell parentShell) {
|
||||
super(parentShell);
|
||||
|
@ -79,10 +81,12 @@ public abstract class ContentTypeMappingDialog extends Dialog {
|
|||
ILanguage[] languages = LanguageManager.getInstance()
|
||||
.getRegisteredLanguages();
|
||||
String[] descriptions = new String[languages.length];
|
||||
|
||||
for (int i = 0; i < descriptions.length; i++) {
|
||||
descriptions[i] = languages[i].getName();
|
||||
fLanguageNamesToIDsMap.put(descriptions[i], languages[i].getId());
|
||||
}
|
||||
Arrays.sort(descriptions);
|
||||
return descriptions;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.language;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
@ -131,18 +134,26 @@ public class ProjectContentTypeMappingDialog extends ContentTypeMappingDialog {
|
|||
private void configureContentTypes(Combo combo, ICConfigurationDescription configuration) {
|
||||
combo.removeAll();
|
||||
IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
|
||||
List<String> names = new LinkedList<String>();
|
||||
|
||||
for (int i = 0; i < fContentTypesIDs.length; i++) {
|
||||
String contentTypeId = fContentTypesIDs[i];
|
||||
String name = contentTypeManager.getContentType(contentTypeId).getName();
|
||||
|
||||
if (configuration != null) {
|
||||
String key = ProjectLanguageMappingWidget.createFilterKey(configuration.getId(), contentTypeId);
|
||||
if (!fFilteredContentTypes.contains(key)) {
|
||||
combo.add(name);
|
||||
names.add(name);
|
||||
}
|
||||
} else {
|
||||
combo.add(name);
|
||||
names.add(name);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(names);
|
||||
for(String name : names) {
|
||||
combo.add(name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue