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

Bug 291887 Allow build configurations to reference other configurations in the same project

This commit is contained in:
James Blackburn 2009-10-09 14:37:11 +00:00
parent f9aa9d90d7
commit dbdf6703ef

View file

@ -107,14 +107,9 @@ public class RefsTab extends AbstractCPropertyTab {
} }
// Class which represents "Active" configuration // Class which represents "Active" configuration
class ActiveCfg { private static class ActiveCfg {
IProject project;
public ActiveCfg(IProject _project) { public ActiveCfg(IProject _project) {
project = _project;
} }
@Override @Override
public String toString() { public String toString() {
@ -148,12 +143,10 @@ public class RefsTab extends AbstractCPropertyTab {
for (int j=0; j<cfgs.length; j++) { for (int j=0; j<cfgs.length; j++) {
if (cfgs[j].getChecked()) { if (cfgs[j].getChecked()) {
String cfgId = EMPTY_STR; String cfgId = EMPTY_STR;
if (j > 0) { // cfgs[0] is "Active": has no cfg Id
Object ob = cfgs[j].getData(); Object ob = cfgs[j].getData();
if (ob instanceof ICConfigurationDescription) { if (ob instanceof ICConfigurationDescription) {
cfgId = ((ICConfigurationDescription)ob).getId(); cfgId = ((ICConfigurationDescription)ob).getId();
} }
}
refs.put(element.getText(), cfgId); refs.put(element.getText(), cfgId);
break; break;
} }
@ -166,35 +159,39 @@ public class RefsTab extends AbstractCPropertyTab {
private void initData() { private void initData() {
tree.removeAll(); tree.removeAll();
IProject p = page.getProject(); IProject p = page.getProject();
if (p == null) return; if (p == null)
IProject[] ps = p.getWorkspace().getRoot().getProjects(); return;
Map<String,String> refs = getResDesc().getConfiguration().getReferenceInfo(); Map<String,String> refs = getResDesc().getConfiguration().getReferenceInfo();
for (IProject prj : p.getWorkspace().getRoot().getProjects()) {
ICConfigurationDescription[] cfgs = page.getCfgsReadOnly(prj);
if (cfgs == null || cfgs.length == 0)
continue;
TreeItem ti, ti1; String name = prj.getName();
for (int i=0; i<ps.length; i++) {
if (!p.equals(ps[i])) {
ICConfigurationDescription[] cfgs = page.getCfgsReadOnly(ps[i]);
if (cfgs == null || cfgs.length == 0) continue;
String name = ps[i].getName();
String ref = null; String ref = null;
ti = new TreeItem(tree, SWT.NONE); TreeItem ti = new TreeItem(tree, SWT.NONE);
ti.setText(name); ti.setText(name);
ti.setData(ps[i]); ti.setData(prj);
if (refs.containsKey(name)) { if (refs.containsKey(name)) {
ref = refs.get(name); ref = refs.get(name);
ti.setChecked(true); ti.setChecked(true);
} }
TreeItem ti1;
if (!prj.equals(p)) {
// [ Active ] config in the tree
ti1 = new TreeItem(ti, SWT.NONE); ti1 = new TreeItem(ti, SWT.NONE);
ti1.setText(ACTIVE); ti1.setText(ACTIVE);
ti1.setData(new ActiveCfg(ps[i])); ti1.setData(new ActiveCfg(prj));
if (EMPTY_STR.equals(ref)) if (EMPTY_STR.equals(ref))
ti1.setChecked(true); ti1.setChecked(true);
}
// Name configurations in the tree
for (ICConfigurationDescription cfg : cfgs) { for (ICConfigurationDescription cfg : cfgs) {
// Don't include self configuration
if (prj.equals(p) && cfg.getId().equals(page.getResDesc().getConfiguration().getId()))
continue;
ti1 = new TreeItem(ti, SWT.NONE); ti1 = new TreeItem(ti, SWT.NONE);
ti1.setText(cfg.getName()); ti1.setText(cfg.getName());
ti1.setData(cfg); ti1.setData(cfg);
@ -203,7 +200,6 @@ public class RefsTab extends AbstractCPropertyTab {
} }
} }
} }
}
updateButtons(); updateButtons();
} }