Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorAlena Laskavaia2008-12-12 14:19:36 +0000
committerAlena Laskavaia2008-12-12 14:19:36 +0000
commiteff3096b2891da51703ec50db5ae9c8ccc3658cf (patch)
treeaf8250a96a04574d9aea32b3fd89125ade3a284e /build
parent2b7f9a4f655b1732e42c16456c4f33bff57c75c8 (diff)
downloadorg.eclipse.cdt-eff3096b2891da51703ec50db5ae9c8ccc3658cf.tar.gz
org.eclipse.cdt-eff3096b2891da51703ec50db5ae9c8ccc3658cf.tar.xz
org.eclipse.cdt-eff3096b2891da51703ec50db5ae9c8ccc3658cf.zip
242403 - applied patch to solve ClassCastException
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiResourceInfo.java26
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties1
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsUI.java45
3 files changed, 52 insertions, 20 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiResourceInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiResourceInfo.java
index 1d02c115fe5..7a91af78cdd 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiResourceInfo.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiResourceInfo.java
@@ -15,10 +15,12 @@ import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
import org.eclipse.cdt.core.settings.model.extension.CResourceData;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.OptionStringValue;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.PluginVersionIdentifier;
@@ -228,25 +230,33 @@ public abstract class MultiResourceInfo extends MultiItemsHolder implements
String sid = getSuperClassId(option);
for (int i=0; i<fRis.length; i++) {
- ITool[] ts = fRis[i].getTools();
- for (int j=0; j<ts.length; j++) {
+ IHoldsOptions[] hos;
+ if (parent instanceof ITool)
+ hos = fRis[i].getTools();
+ else if (parent instanceof IToolChain)
+ // If parent is an IToolChain then the resource infos must be at folder level
+ hos = new IHoldsOptions[] {((IFolderInfo)fRis[i]).getToolChain()};
+ else // Shouldn't happen
+ throw new BuildException(ManagedMakeMessages.getString("MultiResourceInfo.MultiResourceInfo.UnhandledIHoldsOptionsType")); //$NON-NLS-1$
+
+ for (int j=0; j<hos.length; j++) {
if (ext != null &&
- ! ext.equals(ts[j].getDefaultInputExtension()))
+ ! ext.equals(((ITool)hos[j]).getDefaultInputExtension()))
continue;
- IOption op2 = ts[j].getOptionBySuperClassId(sid);
+ IOption op2 = hos[j].getOptionBySuperClassId(sid);
if (op2 != null) {
switch (mode) {
case MODE_BOOL:
- op = fRis[i].setOption(ts[j], op2, ((Boolean)value).booleanValue());
+ op = fRis[i].setOption(hos[j], op2, ((Boolean)value).booleanValue());
break;
case MODE_STR:
- op = fRis[i].setOption(ts[j], op2, (String)value);
+ op = fRis[i].setOption(hos[j], op2, (String)value);
break;
case MODE_SAR:
- op = fRis[i].setOption(ts[j], op2, (String[])value);
+ op = fRis[i].setOption(hos[j], op2, (String[])value);
break;
case MODE_OSV:
- op = fRis[i].setOption(ts[j], op2, (OptionStringValue[])value);
+ op = fRis[i].setOption(hos[j], op2, (OptionStringValue[])value);
break;
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
index c2905ea1e35..26801a935c7 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
@@ -159,6 +159,7 @@ CommonBuilder.22=Building referenced configurations..
CommonBuilder.23=Buildfile generation error occurred..
CommonBuilder.24=Build stopped..
MakeBuilder.buildError=
+MultiResourceInfo.MultiResourceInfo.UnhandledIHoldsOptionsType=Unhandled parent type: not ITool nor IToolChain
ResourceChangeHandler2.0=project build settings update job
ToolInfo.0=conversion failure
ToolInfo.1=the tool is removed
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsUI.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsUI.java
index 62070c734e5..e8e742ca570 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsUI.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsUI.java
@@ -30,6 +30,7 @@ import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.core.MultiResourceInfo;
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
@@ -53,8 +54,10 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
new HashMap<String, FieldEditor>();
private IOptionCategory category;
private IHoldsOptions optionHolder;
+ /** Option Holders involved */
private IHoldsOptions[] ohs;
- private int curr;
+ /** The index of the current IHoldsOptions in ohs */
+ private int curr = -1;
private Map<FieldEditor, Composite> fieldEditorsToParentMap =
new HashMap<FieldEditor, Composite>();
@@ -69,25 +72,43 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
MultiResourceInfo mri = (MultiResourceInfo)info;
IResourceInfo[] ris = (IResourceInfo[])mri.getItems();
String id = category.getId();
- String ext = ((ITool)optionHolder).getDefaultInputExtension();
- ArrayList<ITool> lst = new ArrayList<ITool>();
- for (int i=0; i<ris.length; i++) {
- ITool[] ts = ris[i].getTools();
- for (int j=0; j<ts.length; j++) {
- IOptionCategory op = ts[j].getOptionCategory(id);
- if (op != null) {
- if (ext.equals(ts[j].getDefaultInputExtension()))
- lst.add(ts[j]);
+
+ /*
+ * Collect together all the IHoldsOptions (ITools & IToolChains)
+ * from the MultiResourceInfo's set of selected configs
+ * which contain the option category and accept the input type
+ * of this option holder.
+ */
+ ArrayList<IHoldsOptions> lst = new ArrayList<IHoldsOptions>();
+ if (optionHolder instanceof ITool) {
+ String ext = ((ITool)optionHolder).getDefaultInputExtension();
+ for (int i=0; i<ris.length; i++) {
+ ITool[] ts = ris[i].getTools();
+ for (int j=0; j<ts.length; j++) {
+ IOptionCategory op = ts[j].getOptionCategory(id);
+ if (op != null) {
+ if (ext.equals(ts[j].getDefaultInputExtension())) {
+ lst.add(ts[j]);
+ }
+ }
}
- }
+ }
+ } else if (optionHolder instanceof IToolChain) {
+ for (int i=0; i<ris.length; i++) {
+ IToolChain tc = ris[i].getParent().getToolChain();
+ IOptionCategory op = tc.getOptionCategory(id);
+ if (op != null)
+ lst.add(tc);
+ }
}
+
ohs = (IHoldsOptions[])lst.toArray(new IHoldsOptions[lst.size()]);
for (int i=0; i<ohs.length; i++) {
if (ohs[i].equals(optionHolder)) {
curr = i;
break;
}
- }
+ }
} else {
ohs = null;
curr = 0;

Back to the top