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,11 +143,9 @@ 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,41 +159,44 @@ 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++) { String ref = null;
TreeItem ti = new TreeItem(tree, SWT.NONE);
if (!p.equals(ps[i])) { ti.setText(name);
ti.setData(prj);
ICConfigurationDescription[] cfgs = page.getCfgsReadOnly(ps[i]); if (refs.containsKey(name)) {
if (cfgs == null || cfgs.length == 0) continue; ref = refs.get(name);
ti.setChecked(true);
String name = ps[i].getName(); }
String ref = null; TreeItem ti1;
ti = new TreeItem(tree, SWT.NONE); if (!prj.equals(p)) {
ti.setText(name); // [ Active ] config in the tree
ti.setData(ps[i]);
if (refs.containsKey(name)) {
ref = refs.get(name);
ti.setChecked(true);
}
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);
for (ICConfigurationDescription cfg : cfgs) { }
ti1 = new TreeItem(ti, SWT.NONE); // Name configurations in the tree
ti1.setText(cfg.getName()); for (ICConfigurationDescription cfg : cfgs) {
ti1.setData(cfg); // Don't include self configuration
if (cfg.getId().equals(ref)) { if (prj.equals(p) && cfg.getId().equals(page.getResDesc().getConfiguration().getId()))
ti1.setChecked(true); continue;
} ti1 = new TreeItem(ti, SWT.NONE);
ti1.setText(cfg.getName());
ti1.setData(cfg);
if (cfg.getId().equals(ref)) {
ti1.setChecked(true);
} }
} }
} }