1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 295571 resolve entries before exporting them

This commit is contained in:
James Blackburn 2009-11-19 11:35:39 +00:00
parent db66939f7f
commit 443be30a13

View file

@ -69,6 +69,7 @@ import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.cdt.core.settings.model.ICSettingBase; import org.eclipse.cdt.core.settings.model.ICSettingBase;
import org.eclipse.cdt.core.settings.model.ICSettingEntry; import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.MultiLanguageSetting; import org.eclipse.cdt.core.settings.model.MultiLanguageSetting;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.internal.ui.CPluginImages; import org.eclipse.cdt.internal.ui.CPluginImages;
@ -85,6 +86,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
protected ICLanguageSetting lang; protected ICLanguageSetting lang;
protected LinkedList<ICLanguageSettingEntry> shownEntries; protected LinkedList<ICLanguageSettingEntry> shownEntries;
/** A set of resolved exported entries */
protected ArrayList<ICSettingEntry> exported; protected ArrayList<ICSettingEntry> exported;
protected SashForm sashForm; protected SashForm sashForm;
protected ICLanguageSetting [] ls; // all languages known protected ICLanguageSetting [] ls; // all languages known
@ -260,7 +262,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
ent = (ICLanguageSettingEntry)(table.getItem(index).getData()); ent = (ICLanguageSettingEntry)(table.getItem(index).getData());
if (ent.isReadOnly()) canEdit = false; if (ent.isReadOnly()) canEdit = false;
if (ent.isReadOnly()) canDelete = false; if (ent.isReadOnly()) canDelete = false;
if (exported.contains(ent)) if (exported.contains(resolve(ent)))
buttonSetText(BUTTON_EXPORT_UNEXPORT, UIMessages.getString("AbstractLangsListTab.4")); //$NON-NLS-1$ buttonSetText(BUTTON_EXPORT_UNEXPORT, UIMessages.getString("AbstractLangsListTab.4")); //$NON-NLS-1$
else else
buttonSetText(BUTTON_EXPORT_UNEXPORT, UIMessages.getString("AbstractLangsListTab.2")); //$NON-NLS-1$ buttonSetText(BUTTON_EXPORT_UNEXPORT, UIMessages.getString("AbstractLangsListTab.2")); //$NON-NLS-1$
@ -550,7 +552,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
case BUTTON_EXPORT_UNEXPORT: case BUTTON_EXPORT_UNEXPORT:
if (n == -1) return; if (n == -1) return;
for (int x=ids.length-1; x>=0; x--) { for (int x=ids.length-1; x>=0; x--) {
old = (ICLanguageSettingEntry)(table.getItem(ids[x]).getData()); old = resolve((ICLanguageSettingEntry)(table.getItem(ids[x]).getData()));
if (exported.contains(old)) { if (exported.contains(old)) {
deleteExportSetting(old); deleteExportSetting(old);
} else { } else {
@ -582,6 +584,13 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
table.setFocus(); table.setFocus();
} }
/**
* @return resolved ICLanguageSettingEntry
*/
private ICLanguageSettingEntry resolve(ICLanguageSettingEntry entry) {
return CDataUtil.resolveEntries(new ICLanguageSettingEntry[] {entry}, getResDesc().getConfiguration())[0];
}
private void deleteExportSetting(ICSettingEntry ent) { private void deleteExportSetting(ICSettingEntry ent) {
// if (ent.isReadOnly() || ent.isBuiltIn()) continue; // if (ent.isReadOnly() || ent.isBuiltIn()) continue;
ICConfigurationDescription cfg = getResDesc().getConfiguration(); ICConfigurationDescription cfg = getResDesc().getConfiguration();
@ -717,7 +726,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
ICLanguageSettingEntry le = (ICLanguageSettingEntry) element; ICLanguageSettingEntry le = (ICLanguageSettingEntry) element;
if (columnIndex == 0) { if (columnIndex == 0) {
String s = le.getName(); String s = le.getName();
if (exported.contains(le)) if (exported.contains(resolve(le)))
s = s + UIMessages.getString("AbstractLangsListTab.3"); //$NON-NLS-1$ s = s + UIMessages.getString("AbstractLangsListTab.3"); //$NON-NLS-1$
return s; return s;
} }