mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Bug #216336: Multi-cfg on folder-level
This commit is contained in:
parent
80613b3223
commit
40dfc474ee
4 changed files with 80 additions and 40 deletions
|
@ -38,9 +38,19 @@ public class MultiResourceInfo extends MultiItemsHolder implements
|
||||||
private static final int MODE_COMMAND = 5;
|
private static final int MODE_COMMAND = 5;
|
||||||
|
|
||||||
protected IResourceInfo[] fRis = null;
|
protected IResourceInfo[] fRis = null;
|
||||||
|
private int activeCfg = 0;
|
||||||
|
|
||||||
public MultiResourceInfo(IResourceInfo[] ris) {
|
public MultiResourceInfo(IResourceInfo[] ris) {
|
||||||
fRis = ris;
|
fRis = ris;
|
||||||
|
for (int i=0; i<fRis.length; i++) {
|
||||||
|
if (! (fRis[i].getParent() instanceof Configuration))
|
||||||
|
continue;
|
||||||
|
Configuration cfg = (Configuration)fRis[i].getParent();
|
||||||
|
if (cfg.getConfigurationDescription().isActive()) {
|
||||||
|
activeCfg = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -57,28 +67,28 @@ public class MultiResourceInfo extends MultiItemsHolder implements
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getCLanguageDatas()
|
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getCLanguageDatas()
|
||||||
*/
|
*/
|
||||||
public CLanguageData[] getCLanguageDatas() {
|
public CLanguageData[] getCLanguageDatas() {
|
||||||
return fRis[0].getCLanguageDatas();
|
return fRis[activeCfg].getCLanguageDatas();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getKind()
|
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getKind()
|
||||||
*/
|
*/
|
||||||
public int getKind() {
|
public int getKind() {
|
||||||
return fRis[0].getKind();
|
return fRis[activeCfg].getKind();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getParent()
|
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getParent()
|
||||||
*/
|
*/
|
||||||
public IConfiguration getParent() {
|
public IConfiguration getParent() {
|
||||||
return fRis[0].getParent();
|
return fRis[activeCfg].getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getPath()
|
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getPath()
|
||||||
*/
|
*/
|
||||||
public IPath getPath() {
|
public IPath getPath() {
|
||||||
return fRis[0].getPath();
|
return fRis[activeCfg].getPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -86,15 +96,14 @@ public class MultiResourceInfo extends MultiItemsHolder implements
|
||||||
*/
|
*/
|
||||||
public CResourceData getResourceData() {
|
public CResourceData getResourceData() {
|
||||||
System.out.println("Strange call: MultiResourceInfo.getResourceData()"); //$NON-NLS-1$
|
System.out.println("Strange call: MultiResourceInfo.getResourceData()"); //$NON-NLS-1$
|
||||||
return fRis[0].getResourceData();
|
return fRis[activeCfg].getResourceData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getTools()
|
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getTools()
|
||||||
*/
|
*/
|
||||||
public ITool[] getTools() {
|
public ITool[] getTools() {
|
||||||
System.out.println("Strange call: MultiResourceInfo.getTools()"); //$NON-NLS-1$
|
return fRis[activeCfg].getTools();
|
||||||
return fRis[0].getTools();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -295,42 +304,42 @@ public class MultiResourceInfo extends MultiItemsHolder implements
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#supportsBuild(boolean)
|
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#supportsBuild(boolean)
|
||||||
*/
|
*/
|
||||||
public boolean supportsBuild(boolean managed) {
|
public boolean supportsBuild(boolean managed) {
|
||||||
return fRis[0].supportsBuild(managed);
|
return fRis[activeCfg].supportsBuild(managed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getBaseId()
|
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getBaseId()
|
||||||
*/
|
*/
|
||||||
public String getBaseId() {
|
public String getBaseId() {
|
||||||
return fRis[0].getBaseId();
|
return fRis[activeCfg].getBaseId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getId()
|
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getId()
|
||||||
*/
|
*/
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return fRis[0].getId();
|
return fRis[activeCfg].getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getManagedBuildRevision()
|
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getManagedBuildRevision()
|
||||||
*/
|
*/
|
||||||
public String getManagedBuildRevision() {
|
public String getManagedBuildRevision() {
|
||||||
return fRis[0].getManagedBuildRevision();
|
return fRis[activeCfg].getManagedBuildRevision();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getName()
|
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getName()
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return fRis[0].getName();
|
return fRis[activeCfg].getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getVersion()
|
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getVersion()
|
||||||
*/
|
*/
|
||||||
public PluginVersionIdentifier getVersion() {
|
public PluginVersionIdentifier getVersion() {
|
||||||
return fRis[0].getVersion();
|
return fRis[activeCfg].getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -346,7 +355,7 @@ public class MultiResourceInfo extends MultiItemsHolder implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRoot() {
|
public boolean isRoot() {
|
||||||
return ((ResourceInfo)fRis[0]).isRoot();
|
return ((ResourceInfo)fRis[activeCfg]).isRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.settings.model;
|
package org.eclipse.cdt.internal.core.settings.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -165,8 +167,7 @@ public class MultiConfigDescription extends MultiItemsHolder implements
|
||||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getDescription()
|
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getDescription()
|
||||||
*/
|
*/
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
System.out.println("Bad multi access: MultiConfigDescription.getDescription()");
|
return "Multi Configuration"; //$NON-NLS-1$
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -189,16 +190,20 @@ public class MultiConfigDescription extends MultiItemsHolder implements
|
||||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getFileDescriptions()
|
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getFileDescriptions()
|
||||||
*/
|
*/
|
||||||
public ICFileDescription[] getFileDescriptions() {
|
public ICFileDescription[] getFileDescriptions() {
|
||||||
System.out.println("Bad multi access: MultiConfigDescription.getFileDescriptions()");
|
ArrayList<ICFileDescription> lst = new ArrayList<ICFileDescription>();
|
||||||
return null;
|
for (int i=0; i<fCfgs.length; i++)
|
||||||
|
lst.addAll(Arrays.asList(fCfgs[i].getFileDescriptions()));
|
||||||
|
return (ICFileDescription[])lst.toArray(new ICFileDescription[lst.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getFolderDescriptions()
|
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getFolderDescriptions()
|
||||||
*/
|
*/
|
||||||
public ICFolderDescription[] getFolderDescriptions() {
|
public ICFolderDescription[] getFolderDescriptions() {
|
||||||
System.out.println("Bad multi access: MultiConfigDescription.getFolderDescription()");
|
ArrayList<ICFolderDescription> lst = new ArrayList<ICFolderDescription>();
|
||||||
return null;
|
for (int i=0; i<fCfgs.length; i++)
|
||||||
|
lst.addAll(Arrays.asList(fCfgs[i].getFolderDescriptions()));
|
||||||
|
return (ICFolderDescription[])lst.toArray(new ICFolderDescription[lst.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -242,17 +247,38 @@ public class MultiConfigDescription extends MultiItemsHolder implements
|
||||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getResourceDescription(org.eclipse.core.runtime.IPath, boolean)
|
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getResourceDescription(org.eclipse.core.runtime.IPath, boolean)
|
||||||
*/
|
*/
|
||||||
public ICResourceDescription getResourceDescription(IPath path,
|
public ICResourceDescription getResourceDescription(IPath path,
|
||||||
boolean exactPath) {
|
boolean isForFolder) {
|
||||||
System.out.println("Bad multi access: MultiConfigDescription.getResourceDescription()");
|
ArrayList<ICResourceDescription> lst = new ArrayList<ICResourceDescription>();
|
||||||
return null;
|
for (int i=0; i<fCfgs.length; i++) {
|
||||||
|
ICResourceDescription rd = fCfgs[i].getResourceDescription(path, false);
|
||||||
|
if (! path.equals(rd.getPath()) ) {
|
||||||
|
try {
|
||||||
|
if (isForFolder)
|
||||||
|
rd = fCfgs[i].createFolderDescription(path, (ICFolderDescription)rd);
|
||||||
|
else
|
||||||
|
rd = fCfgs[i].createFileDescription(path, rd);
|
||||||
|
} catch (CoreException e) {}
|
||||||
|
}
|
||||||
|
if (rd != null)
|
||||||
|
lst.add(rd);
|
||||||
|
}
|
||||||
|
if (lst.size() == 0)
|
||||||
|
return null;
|
||||||
|
if (lst.size() == 1)
|
||||||
|
return (ICResourceDescription)lst.get(0);
|
||||||
|
return new MultiResourceDescription(
|
||||||
|
(ICResourceDescription[])lst.toArray(new ICResourceDescription[lst.size()]),
|
||||||
|
getStringListMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getResourceDescriptions()
|
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getResourceDescriptions()
|
||||||
*/
|
*/
|
||||||
public ICResourceDescription[] getResourceDescriptions() {
|
public ICResourceDescription[] getResourceDescriptions() {
|
||||||
System.out.println("Bad multi access: MultiConfigDescription.getResourceDescriptions()");
|
ArrayList<ICResourceDescription> lst = new ArrayList<ICResourceDescription>();
|
||||||
return null;
|
for (int i=0; i<fCfgs.length; i++)
|
||||||
|
lst.addAll(Arrays.asList(fCfgs[i].getResourceDescriptions()));
|
||||||
|
return (ICResourceDescription[])lst.toArray(new ICResourceDescription[lst.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -269,7 +295,7 @@ public class MultiConfigDescription extends MultiItemsHolder implements
|
||||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getSessionProperty(org.eclipse.core.runtime.QualifiedName)
|
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getSessionProperty(org.eclipse.core.runtime.QualifiedName)
|
||||||
*/
|
*/
|
||||||
public Object getSessionProperty(QualifiedName name) {
|
public Object getSessionProperty(QualifiedName name) {
|
||||||
System.out.println("Bad multi access: MultiConfigDescription.getSessionProperty()");
|
System.out.println("Bad multi access: MultiConfigDescription.getSessionProperty()"); //$NON-NLS-1$
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +395,7 @@ public class MultiConfigDescription extends MultiItemsHolder implements
|
||||||
*/
|
*/
|
||||||
public void setConfigurationData(String buildSystemId,
|
public void setConfigurationData(String buildSystemId,
|
||||||
CConfigurationData data) throws WriteAccessException {
|
CConfigurationData data) throws WriteAccessException {
|
||||||
System.out.println("Bad multi access: MultiConfigDescription.getConfigurationData()");
|
System.out.println("Bad multi access: MultiConfigDescription.getConfigurationData()"); //$NON-NLS-1$
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +403,7 @@ public class MultiConfigDescription extends MultiItemsHolder implements
|
||||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#setDescription(java.lang.String)
|
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#setDescription(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public void setDescription(String des) throws WriteAccessException {
|
public void setDescription(String des) throws WriteAccessException {
|
||||||
System.out.println("Bad multi access: MultiConfigDescription.setDescription()");
|
System.out.println("Bad multi access: MultiConfigDescription.setDescription()"); //$NON-NLS-1$
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,10 @@ public class MultiResourceDescription extends MultiItemsHolder implements ICMult
|
||||||
public IPath getPath() {
|
public IPath getPath() {
|
||||||
IPath p = fRess[0].getPath();
|
IPath p = fRess[0].getPath();
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
for (int i=1; i<fRess.length; i++)
|
for (int i=1; i<fRess.length; i++) {
|
||||||
if (!p.equals(fRess[i].getPath()))
|
if (!p.equals(fRess[i].getPath()))
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
|
|
@ -708,16 +708,20 @@ implements
|
||||||
IResource res = (IResource)ad;
|
IResource res = (IResource)ad;
|
||||||
IPath p = res.getProjectRelativePath();
|
IPath p = res.getProjectRelativePath();
|
||||||
if (isForFolder() || isForFile()) {
|
if (isForFolder() || isForFile()) {
|
||||||
out = cf.getResourceDescription(p, false);
|
if (isMultiCfg()) {
|
||||||
if (! p.equals(out.getPath()) ) {
|
out = cf.getResourceDescription(p, isForFolder()); // sic !
|
||||||
try {
|
} else {
|
||||||
if (isForFolder())
|
out = cf.getResourceDescription(p, false);
|
||||||
out = cf.createFolderDescription(p, (ICFolderDescription)out);
|
if (! p.equals(out.getPath()) ) {
|
||||||
else
|
try {
|
||||||
out = cf.createFileDescription(p, out);
|
if (isForFolder())
|
||||||
} catch (CoreException e) {
|
out = cf.createFolderDescription(p, (ICFolderDescription)out);
|
||||||
System.out.println(UIMessages.getString("AbstractPage.10") + //$NON-NLS-1$
|
else
|
||||||
p.toOSString() + "\n" + e.getLocalizedMessage()); //$NON-NLS-1$
|
out = cf.createFileDescription(p, out);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
System.out.println(UIMessages.getString("AbstractPage.10") + //$NON-NLS-1$
|
||||||
|
p.toOSString() + "\n" + e.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue