1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Bug #190131 : Hiding configurations group in property page

This commit is contained in:
Oleg Krasilnikov 2008-03-25 15:58:25 +00:00
parent 7bd2f84e6a
commit 5c7a3c6f61

View file

@ -234,6 +234,7 @@ implements
protected void contentForCDT(Composite composite) { protected void contentForCDT(Composite composite) {
GridData gd; GridData gd;
if (showsConfig()) {
// Add a config selection area // Add a config selection area
Group configGroup = ControlFactory.createGroup(composite, EMPTY_STR, 1); Group configGroup = ControlFactory.createGroup(composite, EMPTY_STR, 1);
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
@ -309,10 +310,10 @@ implements
} }
}); });
} }
}
// Update the contents of the configuration widget // Update the contents of the configuration widget
populateConfigurations(); populateConfigurations();
if (excludeFromBuildCheck != null) { if (excludeFromBuildCheck != null) {
excludeFromBuildCheck.setSelection(getResDesc().isExcluded()); excludeFromBuildCheck.setSelection(getResDesc().isExcluded());
} }
@ -544,19 +545,32 @@ implements
} }
private void populateConfigurations() { private void populateConfigurations() {
// Do nothing if widget not created yet.
if (configSelector == null) return;
// Do not re-read if list already created by another page // Do not re-read if list already created by another page
if (cfgDescs == null) { if (cfgDescs == null) {
cfgDescs = CDTPropertyManager.getProjectDescription(this, getProject()).getConfigurations(); cfgDescs = CDTPropertyManager.getProjectDescription(this, getProject()).getConfigurations();
if (cfgDescs == null || cfgDescs.length == 0) return; if (cfgDescs == null || cfgDescs.length == 0) return;
Arrays.sort(cfgDescs, CDTListComparator.getInstance()); Arrays.sort(cfgDescs, CDTListComparator.getInstance());
} else { } else {
// just register in CDTPropertyManager; // just register in CDTPropertyManager;
CDTPropertyManager.getProjectDescription(this, getProject()); CDTPropertyManager.getProjectDescription(this, getProject());
} }
// Do nothing if widget not created yet.
if (configSelector == null) {
if (cfgDescs != null && cfgDescs.length > 0) {
for (int i = 0; i < cfgDescs.length; ++i) {
if (cfgIndex == -1 && cfgDescs[i].isActive())
cfgIndex = i;
}
if (cfgIndex < 0) {
cfgIndex = 0;
}
cfgChanged(cfgDescs[cfgIndex]);
}
return;
}
// Clear and replace the contents of the selector widget // Clear and replace the contents of the selector widget
configSelector.removeAll(); configSelector.removeAll();
for (int i = 0; i < cfgDescs.length; ++i) { for (int i = 0; i < cfgDescs.length; ++i) {
@ -697,6 +711,9 @@ implements
populateConfigurations(); populateConfigurations();
if (cfgDescs == null || cfgDescs.length == 0) return null; if (cfgDescs == null || cfgDescs.length == 0) return null;
} }
if (cfgDescs.length == 0) {
return null;
}
resd = getResDesc(cfgDescs[cfgIndex]); resd = getResDesc(cfgDescs[cfgIndex]);
} }
return resd; return resd;
@ -734,12 +751,14 @@ implements
protected void cfgChanged(ICConfigurationDescription _cfgd) { protected void cfgChanged(ICConfigurationDescription _cfgd) {
CConfigurationStatus st = _cfgd.getConfigurationStatus(); CConfigurationStatus st = _cfgd.getConfigurationStatus();
if (errPane != null && errMessage != null) {
if (st.isOK()) { if (st.isOK()) {
errPane.setVisible(false); errPane.setVisible(false);
} else { } else {
errMessage.setText(st.getMessage()); errMessage.setText(st.getMessage());
errPane.setVisible(true); errPane.setVisible(true);
} }
}
resd = getResDesc(_cfgd); resd = getResDesc(_cfgd);
@ -779,6 +798,13 @@ implements
*/ */
abstract protected boolean isSingle(); abstract protected boolean isSingle();
/**
* Defines whether the configurations control is shown or not.
* Subclasses may override this.
* @return true, if the configurations control should be shown (default); false otherwise
*/
protected boolean showsConfig() { return true; }
/** /**
* Apply specified method to all tabs * Apply specified method to all tabs
*/ */