1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug #182450 : Multi-config

This commit is contained in:
Oleg Krasilnikov 2008-01-29 14:49:58 +00:00
parent 4f17acd8ad
commit bb3803a605
20 changed files with 175 additions and 148 deletions

View file

@ -22,7 +22,7 @@ public interface ICfgScannerConfigBuilderInfo2Set {
void setPerRcTypeDiscovery(boolean on); void setPerRcTypeDiscovery(boolean on);
Map getInfoMap(); Map<CfgInfoContext, IScannerConfigBuilderInfo2> getInfoMap();
CfgInfoContext[] getContexts(); CfgInfoContext[] getContexts();

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others. * Copyright (c) 2007, 2008 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -21,9 +21,9 @@ import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
public class BuildListComparator extends CDTListComparator { public class BuildListComparator extends CDTListComparator {
private static final String EMPTY = ""; //$NON-NLS-1$ private static final String EMPTY = ""; //$NON-NLS-1$
private static Comparator comparator = null; private static Comparator<Object> comparator = null;
public static Comparator getInstance() { public static Comparator<Object> getInstance() {
if (comparator == null) if (comparator == null)
comparator = new BuildListComparator(); comparator = new BuildListComparator();
return comparator; return comparator;

View file

@ -397,22 +397,6 @@ public class MultiConfiguration extends MultiItemsHolder implements
*/ */
public ITool[] getFilteredTools() { public ITool[] getFilteredTools() {
ITool[] ts = curr().getFilteredTools(); ITool[] ts = curr().getFilteredTools();
/*
ITool[] ms = new ITool[ts.length];
for (int i=0; i<ts.length; i++) {
ArrayList lst = new ArrayList(fCfgs.length);
String ext = ts[i].getDefaultInputExtension();
for (int j=0; j<fCfgs.length; j++) {
ITool t = fCfgs[j].getToolFromInputExtension(ext);
if (t != null)
lst.add(t);
}
if (lst.size() > 1)
ms[i] = (ITool)new MultiTool(lst, curr);
else
ms[i] = ts[i];
}
*/
return ts; return ts;
} }
@ -583,8 +567,17 @@ public class MultiConfiguration extends MultiItemsHolder implements
*/ */
public IResourceInfo getResourceInfo(IPath path, boolean exactPath) { public IResourceInfo getResourceInfo(IPath path, boolean exactPath) {
IResourceInfo ris[] = new IResourceInfo[fCfgs.length]; IResourceInfo ris[] = new IResourceInfo[fCfgs.length];
for (int i=0; i<fCfgs.length; i++) boolean isFolder = true;
for (int i=0; i<fCfgs.length; i++) {
ris[i] = fCfgs[i].getResourceInfo(path, exactPath); ris[i] = fCfgs[i].getResourceInfo(path, exactPath);
if (! (ris[i] instanceof IFolderInfo))
isFolder = false;
}
if (isFolder) {
IFolderInfo fis[] = new IFolderInfo[ris.length];
System.arraycopy(ris, 0, fis, 0, ris.length);
return new MultiFolderInfo(fis, this);
}
return new MultiResourceInfo(ris, this); return new MultiResourceInfo(ris, this);
} }
@ -600,7 +593,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getResourceInfos() * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getResourceInfos()
*/ */
public IResourceInfo[] getResourceInfos() { public IResourceInfo[] getResourceInfos() {
ArrayList ri = new ArrayList(); ArrayList<IResourceInfo> ri = new ArrayList<IResourceInfo>();
for (int i=0; i<fCfgs.length; i++) { for (int i=0; i<fCfgs.length; i++) {
IResourceInfo[] ris = fCfgs[i].getResourceInfos(); IResourceInfo[] ris = fCfgs[i].getResourceInfos();
ri.addAll(Arrays.asList(ris)); ri.addAll(Arrays.asList(ris));

View file

@ -47,53 +47,53 @@ public class MultiFolderInfo extends MultiResourceInfo implements IFolderInfo {
} }
public ITool[] getFilteredTools() { public ITool[] getFilteredTools() {
return ((IFolderInfo)fRis[0]).getFilteredTools(); return ((IFolderInfo)fRis[curr]).getFilteredTools();
} }
public CFolderData getFolderData() { public CFolderData getFolderData() {
return ((IFolderInfo)fRis[0]).getFolderData(); return ((IFolderInfo)fRis[curr]).getFolderData();
} }
public String getOutputExtension(String resourceExtension) { public String getOutputExtension(String resourceExtension) {
return ((IFolderInfo)fRis[0]).getOutputExtension(resourceExtension); return ((IFolderInfo)fRis[curr]).getOutputExtension(resourceExtension);
} }
public ITool getTool(String id) { public ITool getTool(String id) {
return ((IFolderInfo)fRis[0]).getTool(id); return ((IFolderInfo)fRis[curr]).getTool(id);
} }
public IToolChain getToolChain() { public IToolChain getToolChain() {
return ((IFolderInfo)fRis[0]).getToolChain(); return ((IFolderInfo)fRis[curr]).getToolChain();
} }
public IModificationStatus getToolChainModificationStatus(ITool[] removed, public IModificationStatus getToolChainModificationStatus(ITool[] removed,
ITool[] added) { ITool[] added) {
return ((IFolderInfo)fRis[0]).getToolChainModificationStatus(removed, added); return ((IFolderInfo)fRis[curr]).getToolChainModificationStatus(removed, added);
} }
public ITool getToolFromInputExtension(String sourceExtension) { public ITool getToolFromInputExtension(String sourceExtension) {
return ((IFolderInfo)fRis[0]).getToolFromInputExtension(sourceExtension); return ((IFolderInfo)fRis[curr]).getToolFromInputExtension(sourceExtension);
} }
public ITool getToolFromOutputExtension(String extension) { public ITool getToolFromOutputExtension(String extension) {
return ((IFolderInfo)fRis[0]).getToolFromOutputExtension(extension); return ((IFolderInfo)fRis[curr]).getToolFromOutputExtension(extension);
} }
public ITool[] getToolsBySuperClassId(String id) { public ITool[] getToolsBySuperClassId(String id) {
return ((IFolderInfo)fRis[0]).getToolsBySuperClassId(id); return ((IFolderInfo)fRis[curr]).getToolsBySuperClassId(id);
} }
public boolean isHeaderFile(String ext) { public boolean isHeaderFile(String ext) {
return ((IFolderInfo)fRis[0]).isHeaderFile(ext); return ((IFolderInfo)fRis[curr]).isHeaderFile(ext);
} }
public boolean isToolChainCompatible(IToolChain ch) { public boolean isToolChainCompatible(IToolChain ch) {
return ((IFolderInfo)fRis[0]).isToolChainCompatible(ch); return ((IFolderInfo)fRis[curr]).isToolChainCompatible(ch);
} }
public void modifyToolChain(ITool[] removed, ITool[] added) public void modifyToolChain(ITool[] removed, ITool[] added)
throws BuildException { throws BuildException {
((IFolderInfo)fRis[0]).modifyToolChain(removed, added); ((IFolderInfo)fRis[curr]).modifyToolChain(removed, added);
} }
} }

View file

@ -38,7 +38,7 @@ 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; protected int curr = 0;
IConfiguration parent = null; IConfiguration parent = null;
public MultiResourceInfo(IResourceInfo[] ris, IConfiguration _parent) { public MultiResourceInfo(IResourceInfo[] ris, IConfiguration _parent) {
@ -49,7 +49,7 @@ public class MultiResourceInfo extends MultiItemsHolder implements
continue; continue;
Configuration cfg = (Configuration)fRis[i].getParent(); Configuration cfg = (Configuration)fRis[i].getParent();
if (cfg.getConfigurationDescription().isActive()) { if (cfg.getConfigurationDescription().isActive()) {
activeCfg = i; curr = i;
break; break;
} }
} }
@ -69,14 +69,14 @@ 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[activeCfg].getCLanguageDatas(); return fRis[curr].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[activeCfg].getKind(); return fRis[curr].getKind();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -90,7 +90,7 @@ public class MultiResourceInfo extends MultiItemsHolder implements
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getPath() * @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getPath()
*/ */
public IPath getPath() { public IPath getPath() {
return fRis[activeCfg].getPath(); return fRis[curr].getPath();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -98,14 +98,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[activeCfg].getResourceData(); return fRis[curr].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() {
return fRis[activeCfg].getTools(); return fRis[curr].getTools();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -307,42 +307,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[activeCfg].supportsBuild(managed); return fRis[curr].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[activeCfg].getBaseId(); return fRis[curr].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[activeCfg].getId(); return fRis[curr].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[activeCfg].getManagedBuildRevision(); return fRis[curr].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[activeCfg].getName(); return fRis[curr].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[activeCfg].getVersion(); return fRis[curr].getVersion();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -358,7 +358,7 @@ public class MultiResourceInfo extends MultiItemsHolder implements
} }
public boolean isRoot() { public boolean isRoot() {
return ((ResourceInfo)fRis[activeCfg]).isRoot(); return ((ResourceInfo)fRis[curr]).isRoot();
} }
} }

View file

@ -32,6 +32,7 @@ import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.core.MultiResourceInfo; import org.eclipse.cdt.managedbuilder.internal.core.MultiResourceInfo;
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
import org.eclipse.cdt.ui.newui.AbstractPage; import org.eclipse.cdt.ui.newui.AbstractPage;
import org.eclipse.jface.preference.BooleanFieldEditor; import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.DirectoryFieldEditor; import org.eclipse.jface.preference.DirectoryFieldEditor;
@ -47,12 +48,14 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
public class BuildOptionSettingsUI extends AbstractToolSettingUI { public class BuildOptionSettingsUI extends AbstractToolSettingUI {
private Map fieldsMap = new HashMap(); private Map<String, FieldEditor> fieldsMap =
new HashMap<String, FieldEditor>();
private IOptionCategory category; private IOptionCategory category;
private IHoldsOptions optionHolder; private IHoldsOptions optionHolder;
private IHoldsOptions[] ohs; private IHoldsOptions[] ohs;
private int curr; private int curr;
private Map fieldEditorsToParentMap = new HashMap(); private Map<FieldEditor, Composite> fieldEditorsToParentMap =
new HashMap<FieldEditor, Composite>();
public BuildOptionSettingsUI(AbstractCBuildPropertyTab page, public BuildOptionSettingsUI(AbstractCBuildPropertyTab page,
IResourceInfo info, IHoldsOptions optionHolder, IResourceInfo info, IHoldsOptions optionHolder,
@ -66,7 +69,7 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
IResourceInfo[] ris = (IResourceInfo[])mri.getItems(); IResourceInfo[] ris = (IResourceInfo[])mri.getItems();
String id = category.getId(); String id = category.getId();
String ext = ((ITool)optionHolder).getDefaultInputExtension(); String ext = ((ITool)optionHolder).getDefaultInputExtension();
ArrayList lst = new ArrayList(); ArrayList<ITool> lst = new ArrayList<ITool>();
for (int i=0; i<ris.length; i++) { for (int i=0; i<ris.length; i++) {
ITool[] ts = ris[i].getTools(); ITool[] ts = ris[i].getTools();
for (int j=0; j<ts.length; j++) { for (int j=0; j<ts.length; j++) {
@ -182,7 +185,7 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
// in the plugin.xml file) in the UI Combobox. This refrains the user from selecting an // in the plugin.xml file) in the UI Combobox. This refrains the user from selecting an
// invalid value and avoids issuing an error message. // invalid value and avoids issuing an error message.
String[] enumNames = opt.getApplicableValues(); String[] enumNames = opt.getApplicableValues();
Vector enumValidList = new Vector(); Vector<String> enumValidList = new Vector<String>();
for (int i = 0; i < enumNames.length; ++i) { for (int i = 0; i < enumNames.length; ++i) {
if (opt.getValueHandler().isEnumValueAppropriate(config, if (opt.getValueHandler().isEnumValueAppropriate(config,
opt.getOptionHolder(), opt, opt.getValueHandlerExtraArgument(), enumNames[i])) { opt.getOptionHolder(), opt, opt.getValueHandlerExtraArgument(), enumNames[i])) {
@ -247,6 +250,7 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jface.preference.IPreferencePage#performOk() * @see org.eclipse.jface.preference.IPreferencePage#performOk()
*/ */
@SuppressWarnings("unchecked")
public boolean performOk() { public boolean performOk() {
// Write the field editor contents out to the preference store // Write the field editor contents out to the preference store
boolean ok = super.performOk(); boolean ok = super.performOk();
@ -323,7 +327,7 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
case IOption.UNDEF_LIBRARY_PATHS: case IOption.UNDEF_LIBRARY_PATHS:
case IOption.UNDEF_LIBRARY_FILES: case IOption.UNDEF_LIBRARY_FILES:
case IOption.UNDEF_MACRO_FILES: case IOption.UNDEF_MACRO_FILES:
String[] listVal = (String[])((List)clonedOption.getValue()).toArray(new String[0]); String[] listVal = (String[])((List<String>)clonedOption.getValue()).toArray(new String[0]);
setOption = ManagedBuildManager.setOption(realCfg, realHolder, realOption, listVal); setOption = ManagedBuildManager.setOption(realCfg, realHolder, realOption, listVal);
// Reset the preference store since the Id may have changed // Reset the preference store since the Id may have changed
@ -391,8 +395,8 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
} }
} }
Collection fieldsList = fieldsMap.values(); Collection<FieldEditor> fieldsList = fieldsMap.values();
Iterator iter = fieldsList.iterator(); Iterator<FieldEditor> iter = fieldsList.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
FieldEditor editor = (FieldEditor) iter.next(); FieldEditor editor = (FieldEditor) iter.next();
if (editor instanceof TriStateBooleanFieldEditor) if (editor instanceof TriStateBooleanFieldEditor)
@ -530,7 +534,7 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
} }
} }
Iterator iter = fieldsMap.values().iterator(); Iterator<FieldEditor> iter = fieldsMap.values().iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
FieldEditor editor = (FieldEditor) iter.next(); FieldEditor editor = (FieldEditor) iter.next();
if(id == null || !id.equals(editor.getPreferenceName())) if(id == null || !id.equals(editor.getPreferenceName()))
@ -572,7 +576,7 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
boolean selectNewEnum = true; boolean selectNewEnum = true;
boolean selectDefault = false; boolean selectDefault = false;
Vector enumValidList = new Vector(); Vector<String> enumValidList = new Vector<String>();
for (int i = 0; i < enumNames.length; ++i) { for (int i = 0; i < enumNames.length; ++i) {
if (opt.getValueHandler().isEnumValueAppropriate(config, if (opt.getValueHandler().isEnumValueAppropriate(config,
opt.getOptionHolder(), opt, opt.getValueHandlerExtraArgument(), enumNames[i])) { opt.getOptionHolder(), opt, opt.getValueHandlerExtraArgument(), enumNames[i])) {
@ -629,7 +633,7 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
protected void valueChanged(boolean oldValue, boolean newValue) { protected void valueChanged(boolean oldValue, boolean newValue) {
// TODO: uncomment before M5 // TODO: uncomment before M5
//if (button.getGrayed()) //if (button.getGrayed())
// button.setGrayed(false); AbstractCPropertyTab.setGrayed(button, false);
super.valueChanged(!newValue, newValue); super.valueChanged(!newValue, newValue);
} }
protected void doLoad() { protected void doLoad() {
@ -654,8 +658,7 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
if (vals[0] > 0) if (vals[0] > 0)
gray = true; gray = true;
} }
// TODO: uncomment before M5 AbstractCPropertyTab.setGrayed(button, gray);
// button.setGrayed(gray);
button.setSelection(value); button.setSelection(value);
return; return;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others. * Copyright (c) 2007, 2008 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -247,7 +247,7 @@ public class BuildStepsTab extends AbstractCBuildPropertyTab {
} }
private ITool[] getRcbsTools(IResourceInfo rcConfig){ private ITool[] getRcbsTools(IResourceInfo rcConfig){
List list = new ArrayList(); List<ITool> list = new ArrayList<ITool>();
ITool tools[] = rcConfig.getTools(); ITool tools[] = rcConfig.getTools();
for (int i = 0; i < tools.length; i++) { for (int i = 0; i < tools.length; i++) {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2007 Intel Corporation and others. * Copyright (c) 2005 - 2008 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -126,7 +126,7 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
}; };
private boolean fShowSysMacros = false; private boolean fShowSysMacros = false;
private Set fIncorrectlyDefinedMacrosNames = new HashSet(); private Set<String> fIncorrectlyDefinedMacrosNames = new HashSet<String>();
private static final int CONTEXT = ICoreVariableContextInfo.CONTEXT_CONFIGURATION; private static final int CONTEXT = ICoreVariableContextInfo.CONTEXT_CONFIGURATION;
private TableViewer tv; private TableViewer tv;
@ -325,9 +325,10 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
/* /*
* returnes the selected user-defined macros * returnes the selected user-defined macros
*/ */
@SuppressWarnings("unchecked")
private ICdtVariable[] getSelectedUserMacros(){ private ICdtVariable[] getSelectedUserMacros(){
if(tv == null) return null; if(tv == null) return null;
List list = ((IStructuredSelection)tv.getSelection()).toList(); List<ICdtVariable> list = ((IStructuredSelection)tv.getSelection()).toList();
return (ICdtVariable[])list.toArray(new ICdtVariable[list.size()]); return (ICdtVariable[])list.toArray(new ICdtVariable[list.size()]);
} }
@ -495,7 +496,7 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
if (_vars == null) return; if (_vars == null) return;
if (cfgd == null) { if (cfgd == null) {
if (fShowSysMacros) { if (fShowSysMacros) {
List lst = new ArrayList(_vars.length); List<ICdtVariable> lst = new ArrayList<ICdtVariable>(_vars.length);
ICdtVariable[] uvars = vars.getMacros(); ICdtVariable[] uvars = vars.getMacros();
for (int i=0; i<uvars.length; i++) { for (int i=0; i<uvars.length; i++) {
lst.add(uvars[i]); lst.add(uvars[i]);
@ -517,7 +518,7 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
} }
} }
ArrayList list = new ArrayList(_vars.length); ArrayList<ICdtVariable> list = new ArrayList<ICdtVariable>(_vars.length);
for(int i = 0; i < _vars.length; i++){ for(int i = 0; i < _vars.length; i++){
if(_vars[i] != null && (fShowSysMacros || isUserVar(_vars[i]))) if(_vars[i] != null && (fShowSysMacros || isUserVar(_vars[i])))
list.add(_vars[i]); list.add(_vars[i]);
@ -633,7 +634,7 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
return page.isForProject() || page.isForPrefs(); return page.isForProject() || page.isForPrefs();
} }
private static class EnvCmp implements Comparator { private static class EnvCmp implements Comparator<Object> {
public int compare(Object a0, Object a1) { public int compare(Object a0, Object a1) {
if (a0 == null || a1 == null) if (a0 == null || a1 == null)

View file

@ -445,11 +445,9 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(getCfg(dst.getConfiguration())); CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(getCfg(dst.getConfiguration()));
cbi2.setPerRcTypeDiscovery(cbi1.isPerRcTypeDiscovery()); cbi2.setPerRcTypeDiscovery(cbi1.isPerRcTypeDiscovery());
Map m1 = cbi1.getInfoMap(); Map<CfgInfoContext, IScannerConfigBuilderInfo2> m1 = cbi1.getInfoMap();
Map m2 = cbi2.getInfoMap(); Map<CfgInfoContext, IScannerConfigBuilderInfo2> m2 = cbi2.getInfoMap();
Iterator it2 = m2.keySet().iterator(); for (CfgInfoContext ic : m2.keySet()) {
while (it2.hasNext()) {
CfgInfoContext ic = (CfgInfoContext)it2.next();
if (m1.keySet().contains(ic)) { if (m1.keySet().contains(ic)) {
IScannerConfigBuilderInfo2 bi1 = (IScannerConfigBuilderInfo2)m1.get(ic); IScannerConfigBuilderInfo2 bi1 = (IScannerConfigBuilderInfo2)m1.get(ic);
try { try {
@ -503,11 +501,10 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
if(cbi == null || baseInfoMap == null) if(cbi == null || baseInfoMap == null)
return new ArrayList(0); return new ArrayList(0);
Map cfgInfoMap = cbi.getInfoMap(); Map<CfgInfoContext, IScannerConfigBuilderInfo2> cfgInfoMap = cbi.getInfoMap();
HashMap baseCopy = new HashMap(baseInfoMap); HashMap<InfoContext, Object> baseCopy = new HashMap<InfoContext, Object>(baseInfoMap);
List list = new ArrayList(); List<CfgInfoContext> list = new ArrayList<CfgInfoContext>();
for(Iterator iter = cfgInfoMap.entrySet().iterator(); iter.hasNext();){ for(Map.Entry entry : cfgInfoMap.entrySet()){
Map.Entry entry = (Map.Entry)iter.next();
CfgInfoContext cic = (CfgInfoContext)entry.getKey(); CfgInfoContext cic = (CfgInfoContext)entry.getKey();
InfoContext c = cic.toInfoContext(); InfoContext c = cic.toInfoContext();
if(c == null) if(c == null)
@ -525,8 +522,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
if(baseCopy.size() != 0){ if(baseCopy.size() != 0){
IConfiguration cfg = cbi.getConfiguration(); IConfiguration cfg = cbi.getConfiguration();
for(Iterator iter = baseCopy.keySet().iterator(); iter.hasNext();){ for(InfoContext c : baseCopy.keySet()){
InfoContext c = (InfoContext)iter.next();
CfgInfoContext cic = CfgInfoContext.fromInfoContext(cfg, c); CfgInfoContext cic = CfgInfoContext.fromInfoContext(cfg, c);
if(cic != null) if(cic != null)
list.add(cic); list.add(cic);
@ -557,7 +553,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
return true; return true;
} }
private boolean listEqual(List l1, List l2) { private boolean listEqual(List<Object> l1, List<Object> l2) {
if (l1 == null && l2 == null) return true; if (l1 == null && l2 == null) return true;
if (l2 == null || l2 == null) return false; if (l2 == null || l2 == null) return false;
if (l1.size() != l2.size()) return false; if (l1.size() != l2.size()) return false;
@ -565,7 +561,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
// since it's most probable, try it first. // since it's most probable, try it first.
if (l1.equals(l2)) return true; if (l1.equals(l2)) return true;
// order may differ... // order may differ...
Iterator it = l1.iterator(); Iterator<Object> it = l1.iterator();
while (it.hasNext()) while (it.hasNext())
if (!l2.contains(it.next())) return false; if (!l2.contains(it.next())) return false;
return true; return true;
@ -592,10 +588,9 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
if (page.isMultiCfg()) if (page.isMultiCfg())
return; return;
cbi.setPerRcTypeDiscovery(true); cbi.setPerRcTypeDiscovery(true);
Iterator it = cbi.getInfoMap().keySet().iterator(); for (CfgInfoContext cic : cbi.getInfoMap().keySet()) {
while (it.hasNext()) {
try { try {
cbi.applyInfo((CfgInfoContext)it.next(), null); cbi.applyInfo(cic, null);
} catch (CoreException e) {} } catch (CoreException e) {}
} }
updateData(); updateData();

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2007 BitMethods Inc and others. * Copyright (c) 2004, 2008 BitMethods Inc and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -293,11 +293,11 @@ public class FileListControlFieldEditor extends FieldEditor {
private String[] parseString(String stringList) { private String[] parseString(String stringList) {
StringTokenizer tokenizer = StringTokenizer tokenizer =
new StringTokenizer(stringList, DEFAULT_SEPERATOR); new StringTokenizer(stringList, DEFAULT_SEPERATOR);
ArrayList list = new ArrayList(); ArrayList<String> list = new ArrayList<String>();
while (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) {
list.add(tokenizer.nextElement()); list.add((String)tokenizer.nextElement());
} }
return (String[]) list.toArray(new String[list.size()]); return list.toArray(new String[list.size()]);
} }
/** /**

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others. * Copyright (c) 2007, 2008 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -332,7 +332,7 @@ public class NewCfgDialog implements INewCfgDialog {
des = prj; des = prj;
ICConfigurationDescription[] descs = des.getConfigurations(); ICConfigurationDescription[] descs = des.getConfigurations();
cfgds = new IConfiguration[descs.length]; cfgds = new IConfiguration[descs.length];
ArrayList lst = new ArrayList(); ArrayList<IConfiguration> lst = new ArrayList<IConfiguration>();
for (int i = 0; i < descs.length; ++i) { for (int i = 0; i < descs.length; ++i) {
cfgds[i] = ManagedBuildManager.getConfigurationForDescription(descs[i]); cfgds[i] = ManagedBuildManager.getConfigurationForDescription(descs[i]);
IConfiguration cfg = cfgds[i]; IConfiguration cfg = cfgds[i];

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2007 Intel Corporation and others. * Copyright (c) 2005 - 2008 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -260,10 +260,10 @@ public class NewVarDialog extends Dialog {
for(int i = 0; i < vars.length; i++) for(int i = 0; i < vars.length; i++)
names[i] = vars[i].getName(); names[i] = vars[i].getName();
final Collator collator = Collator.getInstance(); final Collator collator = Collator.getInstance();
Arrays.sort(names, new Comparator() { Arrays.sort(names, new Comparator<String>() {
public int compare(final Object a, final Object b) { public int compare(final String a, final String b) {
final String strA = ((String)a).toUpperCase(); final String strA = a.toUpperCase();
final String strB = ((String)b).toUpperCase(); final String strB = b.toUpperCase();
return collator.compare(strA,strB); return collator.compare(strA,strB);
} }
}); });

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others. * Copyright (c) 2007, 2008 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -222,7 +222,7 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
c_toolchain.removeAll(); c_toolchain.removeAll();
boolean isMng = cfg.getBuilder().isManagedBuildOn(); boolean isMng = cfg.getBuilder().isManagedBuildOn();
ArrayList list = new ArrayList(); ArrayList<IToolChain> list = new ArrayList<IToolChain>();
IToolChain[] tcs = r_tcs; IToolChain[] tcs = r_tcs;
if (b_dispCompatible.getSelection() && (ri instanceof IFolderInfo)) { if (b_dispCompatible.getSelection() && (ri instanceof IFolderInfo)) {
@ -264,7 +264,7 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
IBuilder b = ManagedBuildManager.getRealBuilder(cfg.getBuilder()); IBuilder b = ManagedBuildManager.getRealBuilder(cfg.getBuilder());
int pos = -1; int pos = -1;
c_builder.removeAll(); c_builder.removeAll();
ArrayList list = new ArrayList(); ArrayList<IBuilder> list = new ArrayList<IBuilder>();
IBuilder[] bs = r_bs; IBuilder[] bs = r_bs;
@ -384,7 +384,7 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
private boolean updateCompatibleTools(ITool real) { private boolean updateCompatibleTools(ITool real) {
boolean result = false; boolean result = false;
ArrayList list = new ArrayList(); ArrayList<ITool> list = new ArrayList<ITool>();
IFileInfoModification fim = (IFileInfoModification)mod; IFileInfoModification fim = (IFileInfoModification)mod;
if (real != null) { // Current tool exists if (real != null) { // Current tool exists

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others. * Copyright (c) 2002 - 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -45,7 +45,7 @@ public class ToolListContentProvider implements ITreeContentProvider{
private ToolListElement[] createElements(IConfiguration config) { private ToolListElement[] createElements(IConfiguration config) {
IOptionCategory toolChainCategories[]; IOptionCategory toolChainCategories[];
ITool filteredTools[]; ITool filteredTools[];
List elementList = new ArrayList(); List<ToolListElement> elementList = new ArrayList<ToolListElement>();
if (config != null) { if (config != null) {
// Get the the option categories of the toolChain // Get the the option categories of the toolChain
IToolChain toolChain = config.getToolChain(); IToolChain toolChain = config.getToolChain();
@ -69,7 +69,7 @@ public class ToolListContentProvider implements ITreeContentProvider{
} }
private ToolListElement[] createElements(IResourceInfo info) { private ToolListElement[] createElements(IResourceInfo info) {
List elementList = new ArrayList(); List<ToolListElement> elementList = new ArrayList<ToolListElement>();
if (info != null) { if (info != null) {
ITool[] tools = null; ITool[] tools = null;
if(info instanceof IFolderInfo){ if(info instanceof IFolderInfo){

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2007 Intel Corporation and others. * Copyright (c) 2006, 2008 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -33,7 +33,7 @@ public class ToolListElement {
* Bookeeping variables * Bookeeping variables
*/ */
private ToolListElement parent = null; private ToolListElement parent = null;
private List childElements = null; private List<ToolListElement> childElements = null;
private IHoldsOptions optionHolder = null; private IHoldsOptions optionHolder = null;
private IOptionCategory optionCategory = null; private IOptionCategory optionCategory = null;
@ -116,7 +116,7 @@ public class ToolListElement {
public void addChildElement(ToolListElement element) { public void addChildElement(ToolListElement element) {
if (childElements == null) if (childElements == null)
childElements = new ArrayList(); childElements = new ArrayList<ToolListElement>();
childElements.add(element); childElements.add(element);
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others. * Copyright (c) 2007, 2008 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -64,9 +64,9 @@ public class ToolSelectionDialog extends Dialog {
private Button b_add, b_del, b_rep, b_all; private Button b_add, b_del, b_rep, b_all;
private CLabel errorLabel, l1; private CLabel errorLabel, l1;
private Text txt2; private Text txt2;
private ArrayList left, right; private ArrayList<ITool> left, right;
public ArrayList added, removed; public ArrayList<ITool> added, removed;
public ITool[] all, used; public ITool[] all, used;
public IFolderInfo fi; public IFolderInfo fi;
public IToolListModification mod = null; public IToolListModification mod = null;
@ -92,10 +92,10 @@ public class ToolSelectionDialog extends Dialog {
gd.heightHint = 300; gd.heightHint = 300;
composite.setLayoutData(gd); composite.setLayoutData(gd);
added = new ArrayList(); added = new ArrayList<ITool>();
removed = new ArrayList(); removed = new ArrayList<ITool>();
left = new ArrayList(); left = new ArrayList<ITool>();
right = new ArrayList(); right = new ArrayList<ITool>();
Composite c1 = new Composite(composite, SWT.NONE); Composite c1 = new Composite(composite, SWT.NONE);
c1.setLayoutData(new GridData(GridData.FILL_BOTH)); c1.setLayoutData(new GridData(GridData.FILL_BOTH));
@ -419,9 +419,7 @@ public class ToolSelectionDialog extends Dialog {
Collections.sort(left, BuildListComparator.getInstance()); Collections.sort(left, BuildListComparator.getInstance());
Iterator it = left.iterator(); for (ITool t : left) {
while(it.hasNext()) {
ITool t = (ITool)it.next();
boolean exists = false; boolean exists = false;
for (int i=0; i<all.length; i++) { for (int i=0; i<all.length; i++) {
if (all[i] != null && t.matches(all[i])) { if (all[i] != null && t.matches(all[i])) {
@ -432,9 +430,7 @@ public class ToolSelectionDialog extends Dialog {
if (!exists) removed.add(t); if (!exists) removed.add(t);
add(t, t1, !exists); add(t, t1, !exists);
} }
it = right.iterator(); for (ITool t : right) {
while(it.hasNext()) {
ITool t = (ITool)it.next();
boolean exists = false; boolean exists = false;
for (int i=0; i<used.length; i++) { for (int i=0; i<used.length; i++) {
if (t.matches(used[i])) { if (t.matches(used[i])) {
@ -458,7 +454,7 @@ public class ToolSelectionDialog extends Dialog {
if ((c & IModificationStatus.TOOLS_CONFLICT) != 0) { if ((c & IModificationStatus.TOOLS_CONFLICT) != 0) {
s = s + Messages.getString("ToolSelectionDialog.7"); //$NON-NLS-1$ s = s + Messages.getString("ToolSelectionDialog.7"); //$NON-NLS-1$
ITool[][] tools = st.getToolsConflicts(); ITool[][] tools = st.getToolsConflicts();
List conflictTools = new ArrayList(); List<String> conflictTools = new ArrayList<String>();
for (int k=0; k<t2.getItemCount(); k++) { for (int k=0; k<t2.getItemCount(); k++) {
TableItem ti = t2.getItem(k); TableItem ti = t2.getItem(k);
ITool t = (ITool)ti.getData(); ITool t = (ITool)ti.getData();
@ -474,10 +470,10 @@ public class ToolSelectionDialog extends Dialog {
} }
} }
//bug 189229 - provide more information in the error message for accessibility //bug 189229 - provide more information in the error message for accessibility
Iterator iterator = conflictTools.iterator(); Iterator<String> iterator = conflictTools.iterator();
s = s+" "+ (String)iterator.next(); //$NON-NLS-1$ s = s+" "+ iterator.next(); //$NON-NLS-1$
while (iterator.hasNext()) { while (iterator.hasNext()) {
s = s + ", " + (String)iterator.next(); //$NON-NLS-1$ s = s + ", " + iterator.next(); //$NON-NLS-1$
} }
} }
if ((c & IModificationStatus.TOOLS_DONT_SUPPORT_MANAGED_BUILD) != 0) { if ((c & IModificationStatus.TOOLS_DONT_SUPPORT_MANAGED_BUILD) != 0) {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2007 Intel Corporation and others. * Copyright (c) 2005, 2008 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -139,6 +139,7 @@ public class ToolSettingsPrefStore implements IPreferenceStore {
return getDefaultLong(name); return getDefaultLong(name);
} }
@SuppressWarnings("unchecked")
public String getString(String name) { public String getString(String name) {
if(optCategory instanceof Tool){ if(optCategory instanceof Tool){
if(optCategory.getId().equals(name)) if(optCategory.getId().equals(name))

View file

@ -67,7 +67,7 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
/* /*
* Bookeeping variables * Bookeeping variables
*/ */
private Map configToPageListMap; private Map<String, List<AbstractToolSettingUI>> configToPageListMap;
private IPreferenceStore settingsStore; private IPreferenceStore settingsStore;
private AbstractToolSettingUI currentSettingsPage; private AbstractToolSettingUI currentSettingsPage;
private ToolListElement selectedElement; private ToolListElement selectedElement;
@ -80,7 +80,7 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
super.createControls(par); super.createControls(par);
usercomp.setLayout(new GridLayout()); usercomp.setLayout(new GridLayout());
configToPageListMap = new HashMap(); configToPageListMap = new HashMap<String, List<AbstractToolSettingUI>>();
settingsStore = ToolSettingsPrefStore.getDefault(); settingsStore = ToolSettingsPrefStore.getDefault();
// Create the sash form // Create the sash form
@ -157,8 +157,8 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
currentSettingsPage = null; currentSettingsPage = null;
// Create a new settings page if necessary // Create a new settings page if necessary
List pages = getPagesForConfig(); List<AbstractToolSettingUI> pages = getPagesForConfig();
ListIterator iter = pages.listIterator(); ListIterator<AbstractToolSettingUI> iter = pages.listIterator();
while (iter.hasNext()) { while (iter.hasNext()) {
AbstractToolSettingUI page = (AbstractToolSettingUI) iter.next(); AbstractToolSettingUI page = (AbstractToolSettingUI) iter.next();
@ -211,8 +211,8 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
currentSettingsPage = null; currentSettingsPage = null;
// Create a new page if we need one // Create a new page if we need one
List pages = getPagesForConfig(); List<AbstractToolSettingUI> pages = getPagesForConfig();
ListIterator iter = pages.listIterator(); ListIterator<AbstractToolSettingUI> iter = pages.listIterator();
while (iter.hasNext()) { while (iter.hasNext()) {
AbstractToolSettingUI page = (AbstractToolSettingUI) iter.next(); AbstractToolSettingUI page = (AbstractToolSettingUI) iter.next();
if (page.isFor(tool, null)) { if (page.isFor(tool, null)) {
@ -444,6 +444,7 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
} }
} }
@SuppressWarnings("unchecked")
private void setOption(IOption op1, IOption op2, IHoldsOptions dst, IResourceInfo res){ private void setOption(IOption op1, IOption op2, IHoldsOptions dst, IResourceInfo res){
try { try {
switch (op1.getValueType()) { switch (op1.getValueType()) {
@ -475,7 +476,7 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
case IOption.UNDEF_LIBRARY_PATHS: case IOption.UNDEF_LIBRARY_PATHS:
case IOption.UNDEF_LIBRARY_FILES: case IOption.UNDEF_LIBRARY_FILES:
case IOption.UNDEF_MACRO_FILES: case IOption.UNDEF_MACRO_FILES:
String[] data = (String[])((List)op1.getValue()).toArray(new String[0]); String[] data = (String[])((List<String>)op1.getValue()).toArray(new String[0]);
ManagedBuildManager.setOption(res, dst, op2, data); ManagedBuildManager.setOption(res, dst, op2, data);
break; break;
default : default :
@ -536,11 +537,11 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
/* (non-Javadoc) /* (non-Javadoc)
* Answers the list of settings pages for the selected configuration * Answers the list of settings pages for the selected configuration
*/ */
private List getPagesForConfig() { private List<AbstractToolSettingUI> getPagesForConfig() {
if (getCfg() == null) return null; if (getCfg() == null) return null;
List pages = (List) configToPageListMap.get(getCfg().getId()); List<AbstractToolSettingUI> pages = (List<AbstractToolSettingUI>) configToPageListMap.get(getCfg().getId());
if (pages == null) { if (pages == null) {
pages = new ArrayList(); pages = new ArrayList<AbstractToolSettingUI>();
configToPageListMap.put(getCfg().getId(), pages); configToPageListMap.put(getCfg().getId(), pages);
} }
return pages; return pages;
@ -554,9 +555,9 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
* Sets the "dirty" state * Sets the "dirty" state
*/ */
public void setDirty(boolean b) { public void setDirty(boolean b) {
List pages = getPagesForConfig(); List<AbstractToolSettingUI> pages = getPagesForConfig();
if (pages == null) return; if (pages == null) return;
ListIterator iter = pages.listIterator(); ListIterator<AbstractToolSettingUI> iter = pages.listIterator();
while (iter.hasNext()) { while (iter.hasNext()) {
AbstractToolSettingUI page = (AbstractToolSettingUI) iter.next(); AbstractToolSettingUI page = (AbstractToolSettingUI) iter.next();
if (page == null) continue; if (page == null) continue;
@ -569,13 +570,13 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
*/ */
public boolean isDirty() { public boolean isDirty() {
// Check each settings page // Check each settings page
List pages = getPagesForConfig(); List<AbstractToolSettingUI> pages = getPagesForConfig();
// Make sure we have something to work on // Make sure we have something to work on
if (pages == null) { if (pages == null) {
// Nothing to do // Nothing to do
return false; return false;
} }
ListIterator iter = pages.listIterator(); ListIterator<AbstractToolSettingUI> iter = pages.listIterator();
while (iter.hasNext()) { while (iter.hasNext()) {
AbstractToolSettingUI page = (AbstractToolSettingUI) iter.next(); AbstractToolSettingUI page = (AbstractToolSettingUI) iter.next();
if (page == null) continue; if (page == null) continue;

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2007 Intel Corporation and others * Copyright (c) 2005 - 2008 Intel Corporation and others
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -17,10 +17,10 @@ import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSetting; import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
public class CDTListComparator implements Comparator { public class CDTListComparator implements Comparator<Object> {
private static Comparator comparator = null; private static Comparator<Object> comparator = null;
public static Comparator getInstance() { public static Comparator<Object> getInstance() {
if (comparator == null) if (comparator == null)
comparator = new CDTListComparator(); comparator = new CDTListComparator();
return comparator; return comparator;

View file

@ -10,6 +10,9 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.newui; package org.eclipse.cdt.ui.newui;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
@ -70,6 +73,8 @@ import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
* communication way for new CDT model pages and tabs. * communication way for new CDT model pages and tabs.
*/ */
public abstract class AbstractCPropertyTab implements ICPropertyTab { public abstract class AbstractCPropertyTab implements ICPropertyTab {
public static final Method GRAY_METHOD = getGrayEnabled();
public static final int BUTTON_WIDTH = 120; // used as hint for all push buttons public static final int BUTTON_WIDTH = 120; // used as hint for all push buttons
// commonly used button names // commonly used button names
@ -322,8 +327,7 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
setupControl(b, span, mode); setupControl(b, span, mode);
b.addSelectionListener(new SelectionAdapter() { b.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
// TODO: uncomment before M5 setGrayed((Button)event.widget, false);
//((Button)event.widget).setGrayed(false);
checkPressed(event); checkPressed(event);
}}); }});
return b; return b;
@ -535,22 +539,55 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
*/ */
public static void setTriSelection(Button b, int state) { public static void setTriSelection(Button b, int state) {
switch (state) { switch (state) {
// TODO: uncomment before M5
case TRI_NO: case TRI_NO:
// b.setGrayed(false); setGrayed(b, false);
b.setSelection(false); b.setSelection(false);
break; break;
case TRI_YES: case TRI_YES:
// b.setGrayed(false); setGrayed(b, false);
b.setSelection(true); b.setSelection(true);
break; break;
case TRI_UNKNOWN: case TRI_UNKNOWN:
b.setSelection(true); b.setSelection(true);
// b.setGrayed(true); setGrayed(b, true);
break; break;
} }
} }
/**
* This method will be simplified after M5 release,
* when Button.setGrayed() method will be accessible.
* In this case, reflection will not be required.
*
* @param b
* @param value
*/
public static void setGrayed(Button b, boolean value) {
// TODO: uncomment before M5
// b.setGrayed(value);
if (GRAY_METHOD != null)
try {
GRAY_METHOD.invoke(b, new Object[] { new Boolean(value) });
}
catch (InvocationTargetException e) {}
catch (IllegalAccessException e) {}
}
/**
* This method will be removed after M5 release,
* when Button.setGrayed() will be officially accessible.
*
* @return reference to Button.setGrayed() method
*/
private static Method getGrayEnabled() {
try {
Class cl = Class.forName("org.eclipse.swt.widgets.Button"); //$NON-NLS-1$
return cl.getMethod("setGrayed", new Class[] { boolean.class }); //$NON-NLS-1$
} catch (ClassNotFoundException e) {
return null;
} catch (NoSuchMethodException e) {
return null;
}
}
} }