mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 09:15:38 +02:00
Fix: apply in Multi-config mode
This commit is contained in:
parent
879d4c3661
commit
83a13921ac
6 changed files with 67 additions and 24 deletions
|
@ -96,7 +96,6 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#calculateTargetTool()
|
||||
*/
|
||||
public ITool calculateTargetTool() {
|
||||
System.out.println("Strange multi access: MultiConfiguration.calculateTargetTool()"); //$NON-NLS-1$
|
||||
return curr().calculateTargetTool();
|
||||
}
|
||||
|
||||
|
@ -1056,7 +1055,6 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
* @see org.eclipse.cdt.managedbuilder.core.IBuildObjectPropertiesContainer#getBuildProperties()
|
||||
*/
|
||||
public IBuildObjectProperties getBuildProperties() {
|
||||
System.out.println("Strange multi access: MultiConfiguration.getBuildProperties()"); //$NON-NLS-1$
|
||||
return curr().getBuildProperties();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,5 +14,5 @@ import java.util.List;
|
|||
|
||||
public interface ICMultiResourceDescription extends ICResourceDescription, ICMultiItemsHolder {
|
||||
|
||||
void setSettingEntries(ICLanguageSetting lang, int kind, List incs, boolean toAll);
|
||||
void setSettingEntries(ICLanguageSetting lang, int kind, List<ICLanguageSettingEntry> incs, boolean toAll);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
package org.eclipse.cdt.core.settings.model;
|
||||
|
||||
import org.eclipse.cdt.internal.core.settings.model.MultiConfigDescription;
|
||||
import org.eclipse.cdt.internal.core.settings.model.MultiFileDescription;
|
||||
import org.eclipse.cdt.internal.core.settings.model.MultiFolderDescription;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -35,13 +37,6 @@ public abstract class MultiItemsHolder implements ICMultiItemsHolder {
|
|||
*
|
||||
* @param rds - array of cfg.descs
|
||||
*
|
||||
* @param mode - string list display and write mode
|
||||
* @see DMODE_CONJUNCTION
|
||||
* @see DMODE_EMPTY
|
||||
* @see DMODE_ALL
|
||||
* @see WMODE_DIFF
|
||||
* @see WMODE_CURRENT
|
||||
*
|
||||
* @return multiple cfg.description or single cfg.desc.
|
||||
*/
|
||||
public static ICConfigurationDescription createCDescription(ICConfigurationDescription[] rds) {
|
||||
|
@ -52,4 +47,32 @@ public abstract class MultiItemsHolder implements ICMultiItemsHolder {
|
|||
else
|
||||
return new MultiConfigDescription(rds);
|
||||
}
|
||||
/**
|
||||
* This method is put here to prevent UI from
|
||||
* accessing constructors in "internal" dirs.
|
||||
*
|
||||
* Creates multiple resource description, it
|
||||
* can be either MultiFile or MultiFolder.
|
||||
* If there's 1 description in array,
|
||||
* it's returned itself.
|
||||
*
|
||||
* @param rds - array of resource descs
|
||||
*
|
||||
* @return multiple res.description or single res.desc.
|
||||
*/
|
||||
public static ICResourceDescription createRDescription(ICResourceDescription[] rds) {
|
||||
if (rds == null || rds.length == 0)
|
||||
return null;
|
||||
else if (rds.length == 1)
|
||||
return rds[0];
|
||||
else if (rds[0] instanceof ICFolderDescription) {
|
||||
ICFolderDescription[] fds = new ICFolderDescription[rds.length];
|
||||
System.arraycopy(rds, 0, fds, 0, rds.length);
|
||||
return new MultiFolderDescription(fds);
|
||||
} else {
|
||||
ICFileDescription[] fds = new ICFileDescription[rds.length];
|
||||
System.arraycopy(rds, 0, fds, 0, rds.length);
|
||||
return new MultiFileDescription(fds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
|||
import org.eclipse.cdt.core.settings.model.ICFileDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiResourceDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingContainer;
|
||||
|
@ -190,8 +191,7 @@ public abstract class MultiResourceDescription extends MultiItemsHolder implemen
|
|||
return fRess;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setSettingEntries(ICLanguageSetting lang, int kind, List incs, boolean toAll) {
|
||||
public void setSettingEntries(ICLanguageSetting lang, int kind, List<ICLanguageSettingEntry> incs, boolean toAll) {
|
||||
for (int i=0; i<fRess.length; i++) {
|
||||
if (fRess[i] instanceof ICFolderDescription) {
|
||||
String n = lang.getName();
|
||||
|
|
|
@ -63,6 +63,7 @@ import org.eclipse.cdt.core.settings.model.ICFolderDescription;
|
|||
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiFolderDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
|
||||
import org.eclipse.cdt.core.settings.model.ICMultiResourceDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||
|
@ -85,6 +86,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
|||
protected LinkedList<ICLanguageSettingEntry> incs;
|
||||
protected ArrayList<ICSettingEntry> exported;
|
||||
protected SashForm sashForm;
|
||||
protected ICLanguageSetting [] ls; // all languages known
|
||||
|
||||
protected final static String[] BUTTONS = {ADD_STR, EDIT_STR, DEL_STR,
|
||||
UIMessages.getString("AbstractLangsListTab.2"), //$NON-NLS-1$
|
||||
|
@ -341,7 +343,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
|||
updateExport();
|
||||
langTree.removeAll();
|
||||
TreeItem firstItem = null;
|
||||
ICLanguageSetting []ls = getLangSetting(cfg);
|
||||
ls = getLangSetting(cfg);
|
||||
if (ls != null) {
|
||||
Arrays.sort(ls, CDTListComparator.getInstance());
|
||||
for (int i=0; i<ls.length; i++) {
|
||||
|
@ -564,18 +566,33 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
|||
}
|
||||
|
||||
protected void performApply(ICResourceDescription src, ICResourceDescription dst) {
|
||||
ICLanguageSetting [] sr = getLangSetting(src);
|
||||
ICLanguageSetting [] ds = getLangSetting(dst);
|
||||
if (sr == null || ds == null || sr.length != ds.length) return;
|
||||
if (page.isMultiCfg()) {
|
||||
// TODO: Apply for multi !
|
||||
|
||||
ICLanguageSetting [] sr = ls;
|
||||
if (dst instanceof ICMultiItemsHolder) {
|
||||
for (Object ob : ((ICMultiItemsHolder)dst).getItems()) {
|
||||
if (ob instanceof ICResourceDescription) {
|
||||
ICLanguageSetting [] ds = getLangSetting((ICResourceDescription)ob);
|
||||
if (ds == null || sr.length != ds.length) return;
|
||||
for (int i=0; i<sr.length; i++) {
|
||||
ICLanguageSettingEntry[] ents = null;
|
||||
ents = sr[i].getSettingEntries(getKind());
|
||||
ds[i].setSettingEntries(getKind(), ents);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ICLanguageSetting [] sr = getLangSetting(src);
|
||||
ICLanguageSetting [] ds = getLangSetting(dst);
|
||||
if (sr == null || ds == null || sr.length != ds.length) return;
|
||||
for (int i=0; i<sr.length; i++) {
|
||||
ds[i].setSettingEntries(getKind(), sr[i].getSettingEntries(getKind()));
|
||||
ICLanguageSettingEntry[] ents = null;
|
||||
ents = sr[i].getSettingEntries(getKind());
|
||||
ds[i].setSettingEntries(getKind(), ents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void performDefaults() {
|
||||
TreeItem[] tis = langTree.getItems();
|
||||
for (int i=0; i<tis.length; i++) {
|
||||
|
|
|
@ -466,9 +466,14 @@ implements
|
|||
|
||||
if (needs) {
|
||||
if (isMultiCfg()) {
|
||||
lc = resd;
|
||||
ICResourceDescription[] rds = (ICResourceDescription[])((ICMultiItemsHolder)resd).getItems();
|
||||
for (int i=0; i<rds.length; i++) {
|
||||
ICConfigurationDescription c = local_prjd.getConfigurationById(rds[i].getConfiguration().getId());
|
||||
rds[i] = getResDesc(c);
|
||||
}
|
||||
lc = MultiItemsHolder.createRDescription(rds);
|
||||
} else {
|
||||
ICConfigurationDescription c = needs ? local_prjd.getConfigurationById(resd.getConfiguration().getId()) : null;
|
||||
ICConfigurationDescription c = local_prjd.getConfigurationById(resd.getConfiguration().getId());
|
||||
lc = getResDesc(c);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue