mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Unexport feature added
This commit is contained in:
parent
f7d244ff58
commit
82d511bba1
3 changed files with 65 additions and 2 deletions
|
@ -240,6 +240,12 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
|
||||||
*/
|
*/
|
||||||
protected void buttonPressed(int i) {}
|
protected void buttonPressed(int i) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks state of existing button.
|
||||||
|
*
|
||||||
|
* @param i - button index
|
||||||
|
* @return - true if button exists and enabled
|
||||||
|
*/
|
||||||
protected boolean buttonIsEnabled(int i) {
|
protected boolean buttonIsEnabled(int i) {
|
||||||
if (buttons == null || buttons.length <= i )
|
if (buttons == null || buttons.length <= i )
|
||||||
return false;
|
return false;
|
||||||
|
@ -247,11 +253,30 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
|
||||||
return buttons[i].isEnabled();
|
return buttons[i].isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes state of existing button.
|
||||||
|
* Does nothing if index is invalid
|
||||||
|
*
|
||||||
|
* @param i - button index
|
||||||
|
* @param state - required state
|
||||||
|
*/
|
||||||
protected void buttonSetEnabled(int i, boolean state) {
|
protected void buttonSetEnabled(int i, boolean state) {
|
||||||
if (buttons == null || buttons.length <= i ) return;
|
if (buttons == null || buttons.length <= i ) return;
|
||||||
buttons[i].setEnabled(state);
|
buttons[i].setEnabled(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes text of existing button
|
||||||
|
* Does nothing if index is invalid
|
||||||
|
*
|
||||||
|
* @param i - button index
|
||||||
|
* @param text - text to display
|
||||||
|
*/
|
||||||
|
protected void buttonSetText(int i, String text) {
|
||||||
|
if (buttons == null || buttons.length <= i ) return;
|
||||||
|
buttons[i].setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
/**********************************************
|
/**********************************************
|
||||||
* Utility methods for unified widget creation
|
* Utility methods for unified widget creation
|
||||||
**********************************************/
|
**********************************************/
|
||||||
|
|
|
@ -176,6 +176,12 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
ICLanguageSettingEntry ent = (ICLanguageSettingEntry)(table.getItem(index).getData());
|
ICLanguageSettingEntry ent = (ICLanguageSettingEntry)(table.getItem(index).getData());
|
||||||
if (ent.isBuiltIn() || ent.isReadOnly()) canEdit = false;
|
if (ent.isBuiltIn() || ent.isReadOnly()) canEdit = false;
|
||||||
if (ent.isReadOnly()) canDelete = false;
|
if (ent.isReadOnly()) canDelete = false;
|
||||||
|
if (exported.contains(ent))
|
||||||
|
buttonSetText(3, UIMessages.getString("AbstractLangsListTab.4")); //$NON-NLS-1$
|
||||||
|
else
|
||||||
|
buttonSetText(3, UIMessages.getString("AbstractLangsListTab.2")); //$NON-NLS-1$
|
||||||
|
} else {
|
||||||
|
buttonSetText(3, UIMessages.getString("AbstractLangsListTab.2")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
boolean canMoveUp = canDelete && index > 0;
|
boolean canMoveUp = canDelete && index > 0;
|
||||||
boolean canMoveDown = canDelete && (index < table.getItemCount() - 1);
|
boolean canMoveDown = canDelete && (index < table.getItemCount() - 1);
|
||||||
|
@ -367,10 +373,14 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
lang.setSettingEntries(getKind(), incs);
|
lang.setSettingEntries(getKind(), incs);
|
||||||
update();
|
update();
|
||||||
break;
|
break;
|
||||||
case 3: // export
|
case 3: // toggle export
|
||||||
if (n == -1) return;
|
if (n == -1) return;
|
||||||
old = (ICLanguageSettingEntry)(table.getItem(n).getData());
|
old = (ICLanguageSettingEntry)(table.getItem(n).getData());
|
||||||
|
if (exported.contains(old)) {
|
||||||
|
deleteExportSetting(old);
|
||||||
|
} else {
|
||||||
page.getResDesc().getConfiguration().createExternalSetting(new String[] {lang.getId()}, null, null, new ICLanguageSettingEntry[] {old});
|
page.getResDesc().getConfiguration().createExternalSetting(new String[] {lang.getId()}, null, null, new ICLanguageSettingEntry[] {old});
|
||||||
|
}
|
||||||
updateExport();
|
updateExport();
|
||||||
update();
|
update();
|
||||||
break;
|
break;
|
||||||
|
@ -395,6 +405,33 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void deleteExportSetting(ICSettingEntry ent) {
|
||||||
|
// if (ent.isReadOnly() || ent.isBuiltIn()) continue;
|
||||||
|
ICConfigurationDescription cfg = getResDesc().getConfiguration();
|
||||||
|
ICExternalSetting[] vals = cfg.getExternalSettings();
|
||||||
|
if (!(vals == null || vals.length == 0)) {
|
||||||
|
for (int i=0; i<vals.length; i++) {
|
||||||
|
ICSettingEntry[] ents = vals[i].getEntries(getKind());
|
||||||
|
if (ents == null || ents.length == 0) continue;
|
||||||
|
for (int j=0; j<ents.length; j++) {
|
||||||
|
if (ents[j].equalsByName(ent)) {
|
||||||
|
ICSettingEntry[] arr = new ICSettingEntry[ents.length - 1];
|
||||||
|
int index = 0;
|
||||||
|
for (int k=0; k<ents.length; k++)
|
||||||
|
if (k != j) arr[index++] = ents[k];
|
||||||
|
cfg.removeExternalSetting(vals[i]);
|
||||||
|
cfg.createExternalSetting(vals[i].getCompatibleLanguageIds(),
|
||||||
|
vals[i].getCompatibleContentTypeIds(),
|
||||||
|
vals[i].getCompatibleExtensions(),
|
||||||
|
arr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds entry to all configurations
|
* Adds entry to all configurations
|
||||||
* @param ent - entry to add
|
* @param ent - entry to add
|
||||||
|
|
|
@ -406,6 +406,7 @@ AbstractLangsListTab.0=Show built-in values
|
||||||
AbstractLangsListTab.1=Languages
|
AbstractLangsListTab.1=Languages
|
||||||
AbstractLangsListTab.2=Export
|
AbstractLangsListTab.2=Export
|
||||||
AbstractLangsListTab.3=\ [exp]
|
AbstractLangsListTab.3=\ [exp]
|
||||||
|
AbstractLangsListTab.4=Unexport
|
||||||
AbstractPrefPage.0=Preference settings will be applied to new projects\n
|
AbstractPrefPage.0=Preference settings will be applied to new projects\n
|
||||||
AbstractPrefPage.1=only in case when there was no toolchains selected.
|
AbstractPrefPage.1=only in case when there was no toolchains selected.
|
||||||
AbstractExportTab.0=[All]
|
AbstractExportTab.0=[All]
|
||||||
|
|
Loading…
Add table
Reference in a new issue