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:
parent
f9aa9d90d7
commit
dbdf6703ef
1 changed files with 35 additions and 39 deletions
|
@ -107,14 +107,9 @@ public class RefsTab extends AbstractCPropertyTab {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Class which represents "Active" configuration
|
||||
class ActiveCfg {
|
||||
IProject project;
|
||||
private static class ActiveCfg {
|
||||
public ActiveCfg(IProject _project) {
|
||||
project = _project;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -148,12 +143,10 @@ public class RefsTab extends AbstractCPropertyTab {
|
|||
for (int j=0; j<cfgs.length; j++) {
|
||||
if (cfgs[j].getChecked()) {
|
||||
String cfgId = EMPTY_STR;
|
||||
if (j > 0) { // cfgs[0] is "Active": has no cfg Id
|
||||
Object ob = cfgs[j].getData();
|
||||
if (ob instanceof ICConfigurationDescription) {
|
||||
cfgId = ((ICConfigurationDescription)ob).getId();
|
||||
}
|
||||
}
|
||||
refs.put(element.getText(), cfgId);
|
||||
break;
|
||||
}
|
||||
|
@ -166,35 +159,39 @@ public class RefsTab extends AbstractCPropertyTab {
|
|||
private void initData() {
|
||||
tree.removeAll();
|
||||
IProject p = page.getProject();
|
||||
if (p == null) return;
|
||||
IProject[] ps = p.getWorkspace().getRoot().getProjects();
|
||||
if (p == null)
|
||||
return;
|
||||
|
||||
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;
|
||||
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 name = prj.getName();
|
||||
String ref = null;
|
||||
ti = new TreeItem(tree, SWT.NONE);
|
||||
TreeItem ti = new TreeItem(tree, SWT.NONE);
|
||||
ti.setText(name);
|
||||
ti.setData(ps[i]);
|
||||
ti.setData(prj);
|
||||
if (refs.containsKey(name)) {
|
||||
ref = refs.get(name);
|
||||
ti.setChecked(true);
|
||||
}
|
||||
TreeItem ti1;
|
||||
if (!prj.equals(p)) {
|
||||
// [ Active ] config in the tree
|
||||
ti1 = new TreeItem(ti, SWT.NONE);
|
||||
ti1.setText(ACTIVE);
|
||||
ti1.setData(new ActiveCfg(ps[i]));
|
||||
ti1.setData(new ActiveCfg(prj));
|
||||
if (EMPTY_STR.equals(ref))
|
||||
ti1.setChecked(true);
|
||||
}
|
||||
// Name configurations in the tree
|
||||
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.setText(cfg.getName());
|
||||
ti1.setData(cfg);
|
||||
|
@ -203,7 +200,6 @@ public class RefsTab extends AbstractCPropertyTab {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue