mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +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;
|
||||
|
||||
protected IResourceInfo[] fRis = null;
|
||||
private int activeCfg = 0;
|
||||
|
||||
public MultiResourceInfo(IResourceInfo[] 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)
|
||||
|
@ -57,28 +67,28 @@ public class MultiResourceInfo extends MultiItemsHolder implements
|
|||
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getCLanguageDatas()
|
||||
*/
|
||||
public CLanguageData[] getCLanguageDatas() {
|
||||
return fRis[0].getCLanguageDatas();
|
||||
return fRis[activeCfg].getCLanguageDatas();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getKind()
|
||||
*/
|
||||
public int getKind() {
|
||||
return fRis[0].getKind();
|
||||
return fRis[activeCfg].getKind();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getParent()
|
||||
*/
|
||||
public IConfiguration getParent() {
|
||||
return fRis[0].getParent();
|
||||
return fRis[activeCfg].getParent();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getPath()
|
||||
*/
|
||||
public IPath getPath() {
|
||||
return fRis[0].getPath();
|
||||
return fRis[activeCfg].getPath();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -86,15 +96,14 @@ public class MultiResourceInfo extends MultiItemsHolder implements
|
|||
*/
|
||||
public CResourceData getResourceData() {
|
||||
System.out.println("Strange call: MultiResourceInfo.getResourceData()"); //$NON-NLS-1$
|
||||
return fRis[0].getResourceData();
|
||||
return fRis[activeCfg].getResourceData();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getTools()
|
||||
*/
|
||||
public ITool[] getTools() {
|
||||
System.out.println("Strange call: MultiResourceInfo.getTools()"); //$NON-NLS-1$
|
||||
return fRis[0].getTools();
|
||||
return fRis[activeCfg].getTools();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -295,42 +304,42 @@ public class MultiResourceInfo extends MultiItemsHolder implements
|
|||
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#supportsBuild(boolean)
|
||||
*/
|
||||
public boolean supportsBuild(boolean managed) {
|
||||
return fRis[0].supportsBuild(managed);
|
||||
return fRis[activeCfg].supportsBuild(managed);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getBaseId()
|
||||
*/
|
||||
public String getBaseId() {
|
||||
return fRis[0].getBaseId();
|
||||
return fRis[activeCfg].getBaseId();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getId()
|
||||
*/
|
||||
public String getId() {
|
||||
return fRis[0].getId();
|
||||
return fRis[activeCfg].getId();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getManagedBuildRevision()
|
||||
*/
|
||||
public String getManagedBuildRevision() {
|
||||
return fRis[0].getManagedBuildRevision();
|
||||
return fRis[activeCfg].getManagedBuildRevision();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
return fRis[0].getName();
|
||||
return fRis[activeCfg].getName();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getVersion()
|
||||
*/
|
||||
public PluginVersionIdentifier getVersion() {
|
||||
return fRis[0].getVersion();
|
||||
return fRis[activeCfg].getVersion();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -346,7 +355,7 @@ public class MultiResourceInfo extends MultiItemsHolder implements
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -165,8 +167,7 @@ public class MultiConfigDescription extends MultiItemsHolder implements
|
|||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getDescription()
|
||||
*/
|
||||
public String getDescription() {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getDescription()");
|
||||
return null;
|
||||
return "Multi Configuration"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -189,16 +190,20 @@ public class MultiConfigDescription extends MultiItemsHolder implements
|
|||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getFileDescriptions()
|
||||
*/
|
||||
public ICFileDescription[] getFileDescriptions() {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getFileDescriptions()");
|
||||
return null;
|
||||
ArrayList<ICFileDescription> lst = new ArrayList<ICFileDescription>();
|
||||
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)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getFolderDescriptions()
|
||||
*/
|
||||
public ICFolderDescription[] getFolderDescriptions() {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getFolderDescription()");
|
||||
return null;
|
||||
ArrayList<ICFolderDescription> lst = new ArrayList<ICFolderDescription>();
|
||||
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)
|
||||
|
@ -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)
|
||||
*/
|
||||
public ICResourceDescription getResourceDescription(IPath path,
|
||||
boolean exactPath) {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getResourceDescription()");
|
||||
return null;
|
||||
boolean isForFolder) {
|
||||
ArrayList<ICResourceDescription> lst = new ArrayList<ICResourceDescription>();
|
||||
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)
|
||||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getResourceDescriptions()
|
||||
*/
|
||||
public ICResourceDescription[] getResourceDescriptions() {
|
||||
System.out.println("Bad multi access: MultiConfigDescription.getResourceDescriptions()");
|
||||
return null;
|
||||
ArrayList<ICResourceDescription> lst = new ArrayList<ICResourceDescription>();
|
||||
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)
|
||||
|
@ -269,7 +295,7 @@ public class MultiConfigDescription extends MultiItemsHolder implements
|
|||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getSessionProperty(org.eclipse.core.runtime.QualifiedName)
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -369,7 +395,7 @@ public class MultiConfigDescription extends MultiItemsHolder implements
|
|||
*/
|
||||
public void setConfigurationData(String buildSystemId,
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -377,7 +403,7 @@ public class MultiConfigDescription extends MultiItemsHolder implements
|
|||
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#setDescription(java.lang.String)
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -62,9 +62,10 @@ public class MultiResourceDescription extends MultiItemsHolder implements ICMult
|
|||
public IPath getPath() {
|
||||
IPath p = fRess[0].getPath();
|
||||
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()))
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
return p;
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
|
|
|
@ -708,16 +708,20 @@ implements
|
|||
IResource res = (IResource)ad;
|
||||
IPath p = res.getProjectRelativePath();
|
||||
if (isForFolder() || isForFile()) {
|
||||
out = cf.getResourceDescription(p, false);
|
||||
if (! p.equals(out.getPath()) ) {
|
||||
try {
|
||||
if (isForFolder())
|
||||
out = cf.createFolderDescription(p, (ICFolderDescription)out);
|
||||
else
|
||||
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$
|
||||
if (isMultiCfg()) {
|
||||
out = cf.getResourceDescription(p, isForFolder()); // sic !
|
||||
} else {
|
||||
out = cf.getResourceDescription(p, false);
|
||||
if (! p.equals(out.getPath()) ) {
|
||||
try {
|
||||
if (isForFolder())
|
||||
out = cf.createFolderDescription(p, (ICFolderDescription)out);
|
||||
else
|
||||
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