mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 15:25:49 +02:00
Bug #226562 : edit/delete buttons enabled while nothing is selected
This commit is contained in:
parent
29abe81d9e
commit
fb2df943e3
2 changed files with 18 additions and 14 deletions
|
@ -240,8 +240,12 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
} else {
|
} else {
|
||||||
buttonSetText(3, UIMessages.getString("AbstractLangsListTab.2")); //$NON-NLS-1$
|
buttonSetText(3, UIMessages.getString("AbstractLangsListTab.2")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
boolean canMoveUp = canEdit && index > 0 && !ent.isBuiltIn();
|
boolean canMoveUp = false;
|
||||||
boolean canMoveDown = canEdit && (index < table.getItemCount() - 1) && !ent.isBuiltIn();
|
boolean canMoveDown = false;
|
||||||
|
if (ent != null) {
|
||||||
|
canMoveUp = canEdit && index > 0 && !ent.isBuiltIn();
|
||||||
|
canMoveDown = canEdit && (index < table.getItemCount() - 1) && !ent.isBuiltIn();
|
||||||
|
}
|
||||||
if (canMoveDown && showBIButton.getSelection()) {
|
if (canMoveDown && showBIButton.getSelection()) {
|
||||||
ent = (ICLanguageSettingEntry)(table.getItem(index+1).getData());
|
ent = (ICLanguageSettingEntry)(table.getItem(index+1).getData());
|
||||||
if (ent.isBuiltIn()) canMoveDown = false; // cannot exchange with built in
|
if (ent.isBuiltIn()) canMoveDown = false; // cannot exchange with built in
|
||||||
|
@ -318,8 +322,8 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
|
|
||||||
shownEntries = getIncs();
|
shownEntries = getIncs();
|
||||||
tv.setInput(shownEntries.toArray(new Object[shownEntries.size()]));
|
tv.setInput(shownEntries.toArray(new Object[shownEntries.size()]));
|
||||||
if (table.getItemCount() > x) table.select(x);
|
if (table.getItemCount() > x) table.setSelection(x);
|
||||||
else if (table.getItemCount() > 0) table.select(0);
|
else if (table.getItemCount() > 0) table.setSelection(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLbs(lb1, lb2);
|
updateLbs(lb1, lb2);
|
||||||
|
@ -546,6 +550,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
table.setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteExportSetting(ICSettingEntry ent) {
|
private void deleteExportSetting(ICSettingEntry ent) {
|
||||||
|
@ -655,8 +660,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
return IMG_MK;
|
return IMG_MK;
|
||||||
if ((le.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0)
|
if ((le.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0)
|
||||||
return IMG_WS;
|
return IMG_WS;
|
||||||
else
|
return IMG_FS;
|
||||||
return IMG_FS;
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String getText(Object element) {
|
public String getText(Object element) {
|
||||||
|
@ -687,8 +691,8 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
if (le.isBuiltIn()) return null; // built in
|
if (le.isBuiltIn()) return null; // built in
|
||||||
if (le.isReadOnly()) // read only
|
if (le.isReadOnly()) // read only
|
||||||
return JFaceResources.getFontRegistry().getItalic(JFaceResources.DIALOG_FONT);
|
return JFaceResources.getFontRegistry().getItalic(JFaceResources.DIALOG_FONT);
|
||||||
else // normal
|
// normal
|
||||||
return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);
|
return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,8 +704,8 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
ICFolderDescription foDes = (ICFolderDescription)rcDes;
|
ICFolderDescription foDes = (ICFolderDescription)rcDes;
|
||||||
if (foDes instanceof ICMultiFolderDescription) {
|
if (foDes instanceof ICMultiFolderDescription) {
|
||||||
return getLS((ICMultiFolderDescription)foDes);
|
return getLS((ICMultiFolderDescription)foDes);
|
||||||
} else
|
}
|
||||||
return foDes.getLanguageSettings();
|
return foDes.getLanguageSettings();
|
||||||
case ICSettingBase.SETTING_FILE:
|
case ICSettingBase.SETTING_FILE:
|
||||||
ICFileDescription fiDes = (ICFileDescription)rcDes;
|
ICFileDescription fiDes = (ICFileDescription)rcDes;
|
||||||
ICLanguageSetting ls = fiDes.getLanguageSetting();
|
ICLanguageSetting ls = fiDes.getLanguageSetting();
|
||||||
|
@ -757,8 +761,8 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
ICLanguageSettingEntry[] out = new ICLanguageSettingEntry[res.length];
|
ICLanguageSettingEntry[] out = new ICLanguageSettingEntry[res.length];
|
||||||
System.arraycopy(res, 0, out, 0, res.length);
|
System.arraycopy(res, 0, out, 0, res.length);
|
||||||
return Arrays.asList(out);
|
return Arrays.asList(out);
|
||||||
} else
|
}
|
||||||
return lang.getSettingEntriesList(kind);
|
return lang.getSettingEntriesList(kind);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICLanguageSetting[] conv2LS(Object[] ob) {
|
private ICLanguageSetting[] conv2LS(Object[] ob) {
|
||||||
|
|
|
@ -82,9 +82,9 @@ public class SymbolTab extends AbstractLangsListTab {
|
||||||
Collections.sort(shownEntries, CDTListComparator.getInstance());
|
Collections.sort(shownEntries, CDTListComparator.getInstance());
|
||||||
tv.setInput(shownEntries.toArray(new Object[shownEntries.size()]));
|
tv.setInput(shownEntries.toArray(new Object[shownEntries.size()]));
|
||||||
if (table.getItemCount() > x)
|
if (table.getItemCount() > x)
|
||||||
table.select(x);
|
table.setSelection(x);
|
||||||
else if (table.getItemCount() > 0)
|
else if (table.getItemCount() > 0)
|
||||||
table.select(0);
|
table.setSelection(0);
|
||||||
}
|
}
|
||||||
updateLbs(lb1, lb2);
|
updateLbs(lb1, lb2);
|
||||||
updateButtons();
|
updateButtons();
|
||||||
|
|
Loading…
Add table
Reference in a new issue