1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 14:15:23 +02:00

Bug #182450 : Multi-cfg

Bug #217253 : Project Wizard head
This commit is contained in:
Oleg Krasilnikov 2008-01-31 16:22:58 +00:00
parent 952046381e
commit bb44d4020d
51 changed files with 460 additions and 396 deletions

View file

@ -31,7 +31,7 @@ public interface IScannerConfigBuilderInfo2 {
String getSelectedProfileId();
void setSelectedProfileId(String profileId);
List getProfileIdList();
List<String> getProfileIdList();
// SCD profile - buildOutputProvider options
boolean isBuildOutputFileActionEnabled();
@ -44,7 +44,7 @@ public interface IScannerConfigBuilderInfo2 {
void setBuildOutputParserEnabled(boolean enable);
// SCD profile - scanner info provider options
List getProviderIdList();
List<String> getProviderIdList();
// void addSIProvider(String providerId);
// void removeSIProvider(String providerId);

View file

@ -21,7 +21,7 @@ public interface IScannerConfigBuilderInfo2Set {
*
* @return InfoContext - to IScannerConfigBuilderInfo2 map
*/
Map getInfoMap();
Map<InfoContext, Object> getInfoMap();
IScannerConfigBuilderInfo2 getInfo(InfoContext context);

View file

@ -534,9 +534,10 @@ public class ScannerConfigInfoFactory2 {
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getSIProviderIdList()
*/
public List getProviderIdList() {
@SuppressWarnings("unchecked")
public List<String> getProviderIdList() {
ProfileOptions po = (ProfileOptions) profileOptionsMap.get(selectedProfile);
return (po != null) ? new ArrayList(po.providerOptionsMap.keySet()) : new ArrayList(0);
return (po != null) ? new ArrayList<String>(po.providerOptionsMap.keySet()) : new ArrayList<String>(0);
}
/* (non-Javadoc)

View file

@ -3735,9 +3735,9 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
* Generic function for getting the list of converters for the given Build Object
*/
public static Map getConversionElements(IBuildObject buildObj) {
public static Map<String, IConfigurationElement> getConversionElements(IBuildObject buildObj) {
Map conversionTargets = new HashMap();
Map<String, IConfigurationElement> conversionTargets = new HashMap<String, IConfigurationElement>();
// Get the Converter Extension Point
IExtensionPoint extensionPoint = Platform.getExtensionRegistry()

View file

@ -1213,4 +1213,18 @@ public class MultiConfiguration extends MultiItemsHolder implements
CCorePlugin.log(e);
}
}
public String getBuildAttribute(String name, String defValue) {
String res = defValue;
IBuilder b = fCfgs[0].getBuilder();
if (b != null)
res = b.getBuildAttribute(name, defValue);
for (int i=1; i<fCfgs.length; i++) {
b = fCfgs[i].getBuilder();
if (b != null)
if (! res.equals(b.getBuildAttribute(name, defValue)))
return defValue;
}
return res;
}
}

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -63,7 +63,7 @@ IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate, IMenuCreator {
private static final String DLG_TEXT = Messages.getString("BuildAllAction.6");//$NON-NLS-1$
private static final String DLG_TITLE = Messages.getString("BuildAllAction.7");//$NON-NLS-1$
protected ArrayList projects = null;
protected ArrayList<IProject> projects = null;
private ActionContributionItem it_all = null;
private ActionContributionItem it_sel = null;
@ -87,7 +87,7 @@ IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate, IMenuCreator {
if (prjd == null) continue;
ICConfigurationDescription[] cfgds = prjd.getConfigurations();
if (cfgds != null && cfgds.length > 0) {
if (projects == null) projects = new ArrayList();
if (projects == null) projects = new ArrayList<IProject>();
projects.add(prj);
}
}
@ -174,12 +174,15 @@ IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate, IMenuCreator {
}
public void run() {
if (projects == null || projects.isEmpty()) return;
Iterator it = projects.iterator();
if (projects == null || projects.isEmpty())
return;
Iterator<IProject> it = projects.iterator();
if (forAll) {
while(it.hasNext()) processProject((IProject)it.next());
while(it.hasNext())
processProject((IProject)it.next());
} else {
if (it.hasNext()) processProject((IProject)it.next());
if (it.hasNext())
processProject((IProject)it.next());
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 Texas Instruments Incorporated and others.
* Copyright (c) 2006, 2008 Texas Instruments Incorporated and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -147,9 +147,9 @@ public class BuildFilesAction extends ActionDelegate implements
*
* @return a list of resources
*/
private List getSelectedBuildableFiles() {
private List<IFile> getSelectedBuildableFiles() {
List files = new LinkedList();
List<IFile> files = new LinkedList<IFile>();
ISelectionService selectionService = workbenchWindow
.getSelectionService();
@ -157,7 +157,7 @@ public class BuildFilesAction extends ActionDelegate implements
if (selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
for (Iterator elements = structuredSelection.iterator(); elements
for (Iterator<?> elements = structuredSelection.iterator(); elements
.hasNext();) {
IFile file = convertToIFile(elements.next());
if (file != null) {
@ -182,9 +182,9 @@ public class BuildFilesAction extends ActionDelegate implements
}
private static final class BuildFilesJob extends Job {
private final List files;
private final List<IFile> files;
BuildFilesJob(List filesToBuild) {
BuildFilesJob(List<IFile> filesToBuild) {
super(
ManagedMakeMessages
.getResourceString("BuildFilesAction.buildingSelectedFiles")); //$NON-NLS-1$
@ -197,7 +197,7 @@ public class BuildFilesAction extends ActionDelegate implements
*/
protected IStatus run(IProgressMonitor monitor) {
Iterator iterator = files.iterator();
Iterator<IFile> iterator = files.iterator();
GeneratedMakefileBuilder builder = new GeneratedMakefileBuilder();
@ -251,7 +251,7 @@ public class BuildFilesAction extends ActionDelegate implements
*/
public void run(IAction action) {
List selectedFiles = getSelectedBuildableFiles();
List<IFile> selectedFiles = getSelectedBuildableFiles();
Job buildFilesJob = new BuildFilesJob(selectedFiles);
@ -283,7 +283,7 @@ public class BuildFilesAction extends ActionDelegate implements
return false;
}
for (Iterator elements = structuredSelection.iterator(); elements
for (Iterator<?> elements = structuredSelection.iterator(); elements
.hasNext();) {
IFile file = convertToIFile(elements.next());
if (file != null) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 Texas Instruments Incorporated and others.
* Copyright (c) 2006, 2008 Texas Instruments Incorporated and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -147,9 +147,9 @@ public class CleanFilesAction extends ActionDelegate implements
*
* @return a list of resources
*/
private List getSelectedBuildableFiles() {
private List<IFile> getSelectedBuildableFiles() {
List files = new LinkedList();
List<IFile> files = new LinkedList<IFile>();
ISelectionService selectionService = workbenchWindow
.getSelectionService();
@ -157,7 +157,7 @@ public class CleanFilesAction extends ActionDelegate implements
if (selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
for (Iterator elements = structuredSelection.iterator(); elements
for (Iterator<?> elements = structuredSelection.iterator(); elements
.hasNext();) {
IFile file = convertToIFile(elements.next());
if (file != null) {
@ -180,11 +180,11 @@ public class CleanFilesAction extends ActionDelegate implements
}
private static final class CleanFilesJob extends Job {
private final List files;
private final List<IFile> files;
protected Vector generationProblems;
protected Vector<?> generationProblems;
private CleanFilesJob(String name, List filesToBuild) {
private CleanFilesJob(String name, List<IFile> filesToBuild) {
super(name);
files = filesToBuild;
}
@ -217,7 +217,7 @@ public class CleanFilesAction extends ActionDelegate implements
ManagedMakeMessages
.getResourceString("CleanFilesAction.cleaningFiles"), files.size()); //$NON-NLS-1$
Iterator iterator = files.iterator();
Iterator<IFile> iterator = files.iterator();
// clean each file
while (iterator.hasNext() && !monitor.isCanceled()) {
@ -254,7 +254,7 @@ public class CleanFilesAction extends ActionDelegate implements
*/
public void run(IAction action) {
List selectedFiles = getSelectedBuildableFiles();
List<IFile> selectedFiles = getSelectedBuildableFiles();
CleanFilesJob job = new CleanFilesJob(
ManagedMakeMessages
@ -288,7 +288,7 @@ public class CleanFilesAction extends ActionDelegate implements
return false;
}
for (Iterator elements = structuredSelection.iterator(); elements
for (Iterator<?> elements = structuredSelection.iterator(); elements
.hasNext();) {
IFile file = convertToIFile(elements.next());
if (file != null) {

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -43,7 +43,7 @@ public class ConvertTargetDialog extends Dialog {
final private String title;
protected List convertersList;
private IProject project;
private Map conversionElements;
private Map<String, IConfigurationElement> conversionElements;
private IConfigurationElement selectedConversionElement;
private static boolean isConversionSuccessful = false;
@ -173,9 +173,9 @@ public class ConvertTargetDialog extends Dialog {
b.setEnabled(convertersList.getSelectionIndex() != -1);
}
private Map getConversionElements() {
private Map<String, IConfigurationElement> getConversionElements() {
if (conversionElements == null) {
conversionElements = new HashMap();
conversionElements = new HashMap<String, IConfigurationElement>();
}
return conversionElements;
}

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -46,6 +46,7 @@ public class ArtifactTab extends AbstractCBuildPropertyTab {
private IBuildObjectProperties fProperties;
private IBuildPropertyValue[] values;
private ITool tTool;
private boolean canModify = true;
public void createControls(Composite parent) {
super.createControls(parent);
@ -68,7 +69,8 @@ public class ArtifactTab extends AbstractCBuildPropertyTab {
t2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
t2.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
fCfg.setArtifactName(t2.getText());
if (canModify)
fCfg.setArtifactName(t2.getText());
}} );
Label l3 = new Label(usercomp, SWT.NONE);
l3.setLayoutData(new GridData(GridData.BEGINNING));
@ -77,7 +79,8 @@ public class ArtifactTab extends AbstractCBuildPropertyTab {
t3.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
t3.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
fCfg.setArtifactExtension(t3.getText());
if (canModify)
fCfg.setArtifactExtension(t3.getText());
}} );
l4 = new Label(usercomp, SWT.NONE);
@ -87,11 +90,12 @@ public class ArtifactTab extends AbstractCBuildPropertyTab {
t4.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
t4.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if(tTool != null)
tTool.setOutputPrefixForPrimaryOutput(t4.getText());
else if (fCfg instanceof IMultiConfiguration)
((IMultiConfiguration)fCfg).setOutputPrefixForPrimaryOutput(t4.getText());
if (canModify) {
if(tTool != null)
tTool.setOutputPrefixForPrimaryOutput(t4.getText());
else if (fCfg instanceof IMultiConfiguration)
((IMultiConfiguration)fCfg).setOutputPrefixForPrimaryOutput(t4.getText());
}
}} );
updateData(getResDesc());
}
@ -145,31 +149,40 @@ public class ArtifactTab extends AbstractCBuildPropertyTab {
}
String s = fCfg.getArtifactName();
if (s == null || s.trim().length() == 0) {
if (! page.isMultiCfg() && (s == null || s.trim().length() == 0)) {
s = getResDesc().getConfiguration().getProjectDescription().getName();
getCfg().setArtifactName(CWizardHandler.removeSpaces(s));
}
t2.setText(s);
canModify = false;
t2.setText(s);
t3.setText(fCfg.getArtifactExtension());
tTool = fCfg.calculateTargetTool();
if(tTool != null){
if (l4 != null) l4.setVisible(true);
if (t4 != null) {
t4.setVisible(true);
t4.setText(tTool.getOutputPrefix());
}
} else if (page.isMultiCfg()) {
if (l4 != null) l4.setVisible(true);
if (page.isMultiCfg()) {
if (l4 != null)
l4.setVisible(true);
if (t4 != null) {
t4.setVisible(true);
t4.setText(((IMultiConfiguration)fCfg).getToolOutputPrefix());
}
} else {
if (l4 != null) l4.setVisible(false);
if (t4 != null) t4.setVisible(false);
tTool = fCfg.calculateTargetTool();
if(tTool != null){
if (l4 != null)
l4.setVisible(true);
if (t4 != null) {
t4.setVisible(true);
t4.setText(tTool.getOutputPrefix());
}
} else {
if (l4 != null)
l4.setVisible(false);
if (t4 != null)
t4.setVisible(false);
}
}
canModify = true;
}
public void performApply(ICResourceDescription src, ICResourceDescription dst) {

View file

@ -18,6 +18,7 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IMultiConfiguration;
import org.eclipse.cdt.managedbuilder.internal.buildmodel.BuildProcessManager;
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
import org.eclipse.cdt.managedbuilder.internal.core.MultiConfiguration;
import org.eclipse.cdt.newmake.core.IMakeBuilderInfo;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
@ -64,6 +65,7 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
private IBuilder bldr;
private IConfiguration icfg;
private boolean canModify = true;
protected final int cpuNumber = BuildProcessManager.checkCPUNumber();
@ -153,7 +155,8 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
t_autoBuild = setupBlock(g4, b_autoBuild);
t_autoBuild.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, t_autoBuild.getText());
if (canModify)
setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, t_autoBuild.getText());
}} );
t_autoBuild.getAccessible().addAccessibleListener(makeTargetLabelAccessibleListener);
setupLabel(g4, Messages.getString("BuilderSettingsTab.18"), 3, GridData.BEGINNING); //$NON-NLS-1$
@ -161,14 +164,16 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
t_cmdBuild = setupBlock(g4, b_cmdBuild);
t_cmdBuild.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, t_cmdBuild.getText());
if (canModify)
setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, t_cmdBuild.getText());
}} );
t_cmdBuild.getAccessible().addAccessibleListener(makeTargetLabelAccessibleListener);
b_cmdClean = setupCheck(g4, Messages.getString("BuilderSettingsTab.20"), 1, GridData.BEGINNING); //$NON-NLS-1$
t_cmdClean = setupBlock(g4, b_cmdClean);
t_cmdClean.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_CLEAN, t_cmdClean.getText());
if (canModify)
setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_CLEAN, t_cmdClean.getText());
}} );
t_cmdClean.getAccessible().addAccessibleListener(makeTargetLabelAccessibleListener);
}
@ -242,7 +247,7 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
*/
protected void updateButtons() {
bldr = icfg.getEditableBuilder();
canModify = false;
int[] extStates = calc3states(page, icfg, 1);
if (extStates != null) {
@ -290,9 +295,17 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
b_parallelNum.setSelection(!getParallelDef(icfg));
}
}
t_autoBuild.setText(bldr.getBuildAttribute(IBuilder.BUILD_TARGET_AUTO, EMPTY_STR));
t_cmdBuild.setText(bldr.getBuildAttribute(IBuilder.BUILD_TARGET_INCREMENTAL, EMPTY_STR));
t_cmdClean.setText(bldr.getBuildAttribute(IBuilder.BUILD_TARGET_CLEAN, EMPTY_STR));
if (page.isMultiCfg()) {
MultiConfiguration mc = (MultiConfiguration)icfg;
t_autoBuild.setText(mc.getBuildAttribute(IBuilder.BUILD_TARGET_AUTO, EMPTY_STR));
t_cmdBuild.setText(mc.getBuildAttribute(IBuilder.BUILD_TARGET_INCREMENTAL, EMPTY_STR));
t_cmdClean.setText(mc.getBuildAttribute(IBuilder.BUILD_TARGET_CLEAN, EMPTY_STR));
} else {
t_autoBuild.setText(bldr.getBuildAttribute(IBuilder.BUILD_TARGET_AUTO, EMPTY_STR));
t_cmdBuild.setText(bldr.getBuildAttribute(IBuilder.BUILD_TARGET_INCREMENTAL, EMPTY_STR));
t_cmdClean.setText(bldr.getBuildAttribute(IBuilder.BUILD_TARGET_CLEAN, EMPTY_STR));
}
boolean external = ! isInternalBuilderEnabled();
boolean parallel = b_parallel.getSelection();
@ -314,6 +327,7 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
checkPressed(b_cmdBuild, false);
checkPressed(b_cmdClean, false);
}
canModify = true;
}
/**

View file

@ -39,15 +39,16 @@ import org.eclipse.swt.widgets.Text;
public class BuildStepsTab extends AbstractCBuildPropertyTab {
Combo combo;
Text preCmd;
Text preDes;
Text postCmd;
Text postDes;
ITool tool;
IConfiguration config;
ICResourceDescription cfgdescr;
IFileInfo rcfg;
private Combo combo;
private Text preCmd;
private Text preDes;
private Text postCmd;
private Text postDes;
private ITool tool;
private IConfiguration config;
private ICResourceDescription cfgdescr;
private IFileInfo rcfg;
private boolean canModify = true;
private static final String label1 = Messages.getString("BuildStepsTab.0"); //$NON-NLS-1$
private static final String label2 = Messages.getString("BuildStepsTab.1"); //$NON-NLS-1$
@ -94,14 +95,18 @@ public class BuildStepsTab extends AbstractCBuildPropertyTab {
preCmd = setupText(g1, 1, GridData.FILL_HORIZONTAL);
preCmd.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
getCfg().setPrebuildStep(preCmd.getText());
if (canModify &&
!preCmd.getText().equals(getCfg().getPrebuildStep()))
getCfg().setPrebuildStep(preCmd.getText());
}});
setupLabel(g1, label2, 1, GridData.BEGINNING);
preDes = setupText(g1, 1, GridData.FILL_HORIZONTAL);
preDes.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
getCfg().setPreannouncebuildStep(preDes.getText());
if (canModify &&
!preDes.getText().equals(getCfg().getPreannouncebuildStep()))
getCfg().setPreannouncebuildStep(preDes.getText());
}});
Group g2 = setupGroup (usercomp, Messages.getString("BuildStepsTab.3"), 1, GridData.FILL_HORIZONTAL); //$NON-NLS-1$
@ -109,14 +114,18 @@ public class BuildStepsTab extends AbstractCBuildPropertyTab {
postCmd = setupText(g2, 1, GridData.FILL_HORIZONTAL);
postCmd.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
getCfg().setPostbuildStep(postCmd.getText());
if (canModify &&
!postCmd.getText().equals(getCfg().getPostbuildStep()))
getCfg().setPostbuildStep(postCmd.getText());
}});
setupLabel(g2, label2, 1, GridData.BEGINNING);
postDes = setupText(g2, 1, GridData.FILL_HORIZONTAL);
postDes.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
getCfg().setPostannouncebuildStep(postDes.getText());
if (canModify &&
!postDes.getText().equals(getCfg().getPostannouncebuildStep()))
getCfg().setPostannouncebuildStep(postDes.getText());
}});
}
@ -138,9 +147,10 @@ public class BuildStepsTab extends AbstractCBuildPropertyTab {
preCmd = setupText(g1, 1, GridData.FILL_HORIZONTAL);
preCmd.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (page.isForProject())
getCfg().setPrebuildStep(preCmd.getText());
else {
// if (page.isForProject())
// getCfg().setPrebuildStep(preCmd.getText());
// else
if (canModify && tool != null) {
IInputType[] ein = tool.getInputTypes();
if (ein != null && ein.length > 0) {
IAdditionalInput[] add = ein[0].getAdditionalInputs();
@ -155,9 +165,10 @@ public class BuildStepsTab extends AbstractCBuildPropertyTab {
preDes = setupText(g1, 1, GridData.FILL_HORIZONTAL);
preDes.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (page.isForProject())
getCfg().setPreannouncebuildStep(preDes.getText());
else {
// if (page.isForProject())
// getCfg().setPreannouncebuildStep(preDes.getText());
// else {
if (canModify && tool != null) {
IOutputType[] out = tool.getOutputTypes();
if (valid(out))
out[0].setOutputNames(preDes.getText());
@ -168,9 +179,10 @@ public class BuildStepsTab extends AbstractCBuildPropertyTab {
postCmd = setupText(g1, 1, GridData.FILL_HORIZONTAL);
postCmd.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (page.isForProject())
getCfg().setPostbuildStep(postCmd.getText());
else
// if (page.isForProject())
// getCfg().setPostbuildStep(postCmd.getText());
// else
if (canModify && tool != null)
tool.setToolCommand(postCmd.getText());
}});
@ -178,9 +190,10 @@ public class BuildStepsTab extends AbstractCBuildPropertyTab {
postDes = setupText(g1, 1, GridData.FILL_HORIZONTAL);
postDes.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (page.isForProject())
getCfg().setPostannouncebuildStep(postDes.getText());
else
// if (page.isForProject())
// getCfg().setPostannouncebuildStep(postDes.getText());
// else
if (canModify && tool != null)
tool.setAnnouncement(postDes.getText());
}});
}
@ -192,7 +205,8 @@ public class BuildStepsTab extends AbstractCBuildPropertyTab {
update();
}
private void update() {
private void update() {
canModify = false; // avoid changing
if (page.isForProject()) {
preCmd.setText(config.getPrebuildStep());
preDes.setText(config.getPreannouncebuildStep());
@ -227,6 +241,7 @@ public class BuildStepsTab extends AbstractCBuildPropertyTab {
postDes.setText(EMPTY_STR);
}
}
canModify = true;
}
private ITool getRcbsTool(IFileInfo rcConfig){

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2007 IBM Corporation and others.
* Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -101,7 +101,7 @@ public class BuildToolSettingUI extends AbstractToolSettingUI {
private ITool fTool;
// Map that holds all user object options and its values
private HashMap<String, String> userObjsMap;
private HashMap<IOption, String> userObjsMap;
public BuildToolSettingUI(AbstractCBuildPropertyTab page,
IResourceInfo info, ITool _tool) {
@ -111,7 +111,7 @@ public class BuildToolSettingUI extends AbstractToolSettingUI {
this.fTool = _tool;
buildPropPage = page;
stringOptionsMap = new HashMap<String, String>();
userObjsMap = new HashMap<String, String>();
userObjsMap = new HashMap<IOption, String>();
}
/* (non-Javadoc)
@ -364,21 +364,18 @@ public class BuildToolSettingUI extends AbstractToolSettingUI {
}
}
// "OBJECTS" type
Set<String> objSet = userObjsMap.keySet();
Set<IOption> objSet = userObjsMap.keySet();
for (int s = 0; s < objSet.size(); s++) {
Iterator iterator = objSet.iterator();
while (iterator.hasNext()) {
Object key = iterator.next();
String val = (String) userObjsMap.get(key);
for (IOption op : objSet) {
String val = (String) userObjsMap.get(op);
ArrayList<String> list = new ArrayList<String>();
String[] vals = parseString(val);
for (int t = 0; t < vals.length; t++) {
if (alloptions.indexOf(vals[t]) != -1)
list.add(vals[t]);
for (String v : parseString(val)) {
if (alloptions.indexOf(v) != -1)
list.add(v);
}
String listArr[] = new String[list.size()];
list.toArray(listArr);
setOption(((IOption) key), listArr);
setOption(op, listArr);
}
}
// Now update the preference store with parsed options
@ -418,12 +415,10 @@ public class BuildToolSettingUI extends AbstractToolSettingUI {
case IOption.PREPROCESSOR_SYMBOLS :
case IOption.LIBRARIES :
ArrayList<String> newList = new ArrayList<String>();
for (int i = 0; i < optionsList.size(); i++) {
for (String s : optionsList) {
if (opt.getCommand() != null
&& ((String) optionsList.get(i)).startsWith(opt
.getCommand())) {
newList.add(((String) optionsList.get(i))
.substring(opt.getCommand().length()));
&& s.startsWith(opt.getCommand())) {
newList.add(s.substring(opt.getCommand().length()));
}
}
String[] strlist = new String[newList.size()];

View file

@ -17,6 +17,7 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IMultiConfiguration;
import org.eclipse.cdt.managedbuilder.internal.core.Builder;
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
import org.eclipse.cdt.managedbuilder.internal.core.MultiConfiguration;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
import org.eclipse.core.runtime.CoreException;
@ -55,6 +56,7 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
private IBuilder bldr;
private IConfiguration icfg;
private boolean canModify = true;
public void createControls(Composite parent) {
super.createControls(parent);
@ -79,6 +81,8 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
t_buildCmd = setupBlock(g1, b_useDefault);
t_buildCmd.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (! canModify)
return;
String fullCommand = t_buildCmd.getText().trim();
String buildCommand = parseMakeCommand(fullCommand);
String buildArgs = fullCommand.substring(buildCommand.length()).trim();
@ -101,7 +105,8 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
t_dir = setupText(group_dir, 1, GridData.FILL_HORIZONTAL);
t_dir.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
setBuildPath(t_dir.getText());
if (canModify)
setBuildPath(t_dir.getText());
}} );
Composite c = new Composite(group_dir, SWT.NONE);
setupControl(c, 2, GridData.FILL_HORIZONTAL);
@ -126,6 +131,7 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
protected void updateButtons() {
bldr = icfg.getEditableBuilder();
canModify = false; // avoid extra update from modifyListeners
int[] extStates = BuildBehaviourTab.calc3states(page, icfg, 0);
b_genMakefileAuto.setEnabled(icfg.supportsBuild(true));
@ -183,6 +189,7 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
if (external) { // just set relatet text widget state,
checkPressed(b_useDefault, false); // do not update
}
canModify = true;
}
Button setupBottomButton(Composite c, String name) {
@ -384,7 +391,7 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
if (icfg instanceof Configuration)
return ((Configuration)icfg).isInternalBuilderEnabled();
if (icfg instanceof IMultiConfiguration)
return ((IMultiConfiguration)icfg).isInternalBuilderEnabled();
return ((MultiConfiguration)icfg).isInternalBuilderEnabled();
return false;
}

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -13,7 +13,6 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -82,11 +81,11 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
private Group scGroup;
private ICfgScannerConfigBuilderInfo2Set cbi;
private Map baseInfoMap;
private Map<InfoContext, Object> baseInfoMap;
private IScannerConfigBuilderInfo2 buildInfo;
private CfgInfoContext iContext;
private List pagesList = null;
private List visibleProfilesList = null;
private List<DiscoveryProfilePageConfiguration> pagesList = null;
private List<String> visibleProfilesList = null;
private IPath configPath;
private AbstractDiscoveryPage[] realPages;
protected SashForm sashForm;
@ -172,7 +171,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
profileComboBox.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int x = profileComboBox.getSelectionIndex();
String s = (String)visibleProfilesList.get(x);
String s = visibleProfilesList.get(x);
buildInfo.setSelectedProfileId(s);
handleDiscoveryProfileChanged();
}
@ -188,10 +187,10 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
public void updateData(ICResourceDescription rcfg) {
if (page.isMultiCfg()) {
usercomp.setVisible(false);
setAllVisible(false, null);
return;
} else {
usercomp.setVisible(true);
setAllVisible(true, null);
configPath = rcfg.getPath();
IConfiguration cfg = getCfg(rcfg.getConfiguration());
cbi = CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(cfg);
@ -210,13 +209,11 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
if (scopeComboBox != null)
scopeComboBox.select(cbi.isPerRcTypeDiscovery() ? 0 : 1);
Map m = cbi.getInfoMap();
Iterator it = m.keySet().iterator();
Map<CfgInfoContext, IScannerConfigBuilderInfo2> m = cbi.getInfoMap();
int pos = resTable.getSelectionIndex();
resTable.removeAll();
while (it.hasNext()) {
for (CfgInfoContext ic : m.keySet()) {
String s = null;
CfgInfoContext ic = (CfgInfoContext)it.next();
IResourceInfo rci = ic.getResourceInfo();
if (rci == null) { // per configuration
s = ic.getConfiguration().getName();
@ -276,9 +273,9 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
scProblemReportingEnabledButton.setSelection(buildInfo.isProblemReportingEnabled());
profileComboBox.removeAll();
List profilesList = buildInfo.getProfileIdList();
List<String> profilesList = buildInfo.getProfileIdList();
Collections.sort(profilesList, CDTListComparator.getInstance());
visibleProfilesList = new ArrayList(profilesList.size());
visibleProfilesList = new ArrayList<String>(profilesList.size());
if (realPages != null && realPages.length > 0) {
for (int i=0; i<realPages.length; i++) {
@ -292,12 +289,10 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
realPages = new AbstractDiscoveryPage[profilesList.size()];
String[] labels = new String[profilesList.size()];
String[] profiles = new String[profilesList.size()];
Iterator it = profilesList.iterator();
int counter = 0;
int pos = 0;
String savedId = buildInfo.getSelectedProfileId();
while (it.hasNext()) {
String profileId = (String)it.next();
for (String profileId : profilesList) {
if (!cbi.isProfileSupported(iContext, profileId))
continue;
visibleProfilesList.add(profileId);
@ -305,8 +300,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
if (profileId.equals(savedId))
pos = counter;
buildInfo.setSelectedProfileId(profileId); // needs to create page
for (Iterator it2 = pagesList.iterator(); it2.hasNext(); ) {
DiscoveryProfilePageConfiguration p = (DiscoveryProfilePageConfiguration)it2.next();
for (DiscoveryProfilePageConfiguration p : pagesList) {
if (p != null && p.profId.equals(profileId)) {
AbstractDiscoveryPage pg = p.getPage();
if (pg != null) {
@ -400,7 +394,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
*
*/
private void initializeProfilePageMap() {
pagesList = new ArrayList(5);
pagesList = new ArrayList<DiscoveryProfilePageConfiguration>(5);
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(
NAMESPACE, POINT);
if (point == null) return;
@ -488,7 +482,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
}
private void clearChangedDiscoveredInfos(){
List changedContexts = checkChanges();
List<CfgInfoContext> changedContexts = checkChanges();
IProject project = getProject();
for(int i = 0; i < changedContexts.size(); i++){
CfgInfoContext c = (CfgInfoContext)changedContexts.get(i);
@ -497,14 +491,14 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
}
}
private List checkChanges(){
private List<CfgInfoContext> checkChanges(){
if(cbi == null || baseInfoMap == null)
return new ArrayList(0);
return new ArrayList<CfgInfoContext>(0);
Map<CfgInfoContext, IScannerConfigBuilderInfo2> cfgInfoMap = cbi.getInfoMap();
HashMap<InfoContext, Object> baseCopy = new HashMap<InfoContext, Object>(baseInfoMap);
List<CfgInfoContext> list = new ArrayList<CfgInfoContext>();
for(Map.Entry entry : cfgInfoMap.entrySet()){
for(Map.Entry<CfgInfoContext, IScannerConfigBuilderInfo2> entry : cfgInfoMap.entrySet()){
CfgInfoContext cic = (CfgInfoContext)entry.getKey();
InfoContext c = cic.toInfoContext();
if(c == null)
@ -553,7 +547,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
return true;
}
private boolean listEqual(List<Object> l1, List<Object> l2) {
private boolean listEqual(List<String> l1, List<String> l2) {
if (l1 == null && l2 == null) return true;
if (l2 == null || l2 == null) return false;
if (l1.size() != l2.size()) return false;
@ -561,9 +555,8 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
// since it's most probable, try it first.
if (l1.equals(l2)) return true;
// order may differ...
Iterator<Object> it = l1.iterator();
while (it.hasNext())
if (!l2.contains(it.next())) return false;
for (String s : l1)
if (!l2.contains(s)) return false;
return true;
}

View file

@ -171,10 +171,10 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
protected void updateData(ICResourceDescription rcfg) {
if (page.isMultiCfg()) {
usercomp.setVisible(false);
setAllVisible(false, null);
return;
} else {
usercomp.setVisible(true);
setAllVisible(true, null);
}
cfg = getCfg(rcfg.getConfiguration());
ri = cfg.getResourceInfo(rcfg.getPath(), false);

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -66,9 +66,9 @@ public abstract class AbstractCWizard extends CNewWizard {
// Check for platform compatibility
ITargetPlatform tp = tc.getTargetPlatform();
if (tp != null) {
List osList = Arrays.asList(tc.getOSList());
List<String> osList = Arrays.asList(tc.getOSList());
if (osList.contains(ALL) || osList.contains(os)) {
List archList = Arrays.asList(tc.getArchList());
List<String> archList = Arrays.asList(tc.getArchList());
if (archList.contains(ALL) || archList.contains(arch))
return true; // OS and ARCH fits
}

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -82,13 +82,12 @@ public class CDTConfigWizardPage extends WizardPage {
if (getDefault || table == null || !isVisited())
its = getDefaultCfgs(handler);
else {
ArrayList out = new ArrayList(table.getItemCount());
TableItem[] tis = table.getItems();
for (int i=0; i < tis.length; i++) {
if (tis[i].getChecked())
out.add(tis[i].getData());
ArrayList<CfgHolder> out = new ArrayList<CfgHolder>(table.getItemCount());
for (TableItem ti : table.getItems()) {
if (ti.getChecked())
out.add((CfgHolder)ti.getData());
}
its = (CfgHolder[])out.toArray(new CfgHolder[out.size()]);
its = out.toArray(new CfgHolder[out.size()]);
}
return its;
}
@ -189,19 +188,18 @@ public class CDTConfigWizardPage extends WizardPage {
* @return
*/
static public CfgHolder[] getDefaultCfgs(MBSWizardHandler handler) {
IToolChain[] tcs = handler.getSelectedToolChains();
String id = handler.getPropertyId();
IProjectType pt = handler.getProjectType();
ArrayList out = new ArrayList(tcs.length * 2);
for (int i=0; i < tcs.length; i++) {
ArrayList<CfgHolder> out = new ArrayList<CfgHolder>();
for (IToolChain tc : handler.getSelectedToolChains()){
CfgHolder[] cfgs = null;
if (id != null)
cfgs = CfgHolder.cfgs2items(ManagedBuildManager.getExtensionConfigurations(tcs[i], MBSWizardHandler.ARTIFACT, id));
cfgs = CfgHolder.cfgs2items(ManagedBuildManager.getExtensionConfigurations(tc, MBSWizardHandler.ARTIFACT, id));
else if (pt != null)
cfgs = CfgHolder.cfgs2items(ManagedBuildManager.getExtensionConfigurations(tcs[i], pt));
cfgs = CfgHolder.cfgs2items(ManagedBuildManager.getExtensionConfigurations(tc, pt));
else { // Create default configuration for StdProject
cfgs = new CfgHolder[1];
cfgs[0] = new CfgHolder(tcs[i], null);
cfgs[0] = new CfgHolder(tc, null);
}
if (cfgs == null) return null;
@ -210,7 +208,7 @@ public class CDTConfigWizardPage extends WizardPage {
out.add(cfgs[j]);
}
}
return (CfgHolder[])out.toArray(new CfgHolder[out.size()]);
return out.toArray(new CfgHolder[out.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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -158,7 +158,7 @@ public class CfgHolder {
*/
public static CfgHolder[] reorder(CfgHolder[] its) {
ArrayList ls = new ArrayList(its.length);
ArrayList<CfgHolder> ls = new ArrayList<CfgHolder>(its.length);
boolean found = true;
while (found) {
found = false;
@ -185,7 +185,7 @@ public class CfgHolder {
}
}
}
return (CfgHolder[])ls.toArray(new CfgHolder[ls.size()]);
return ls.toArray(new CfgHolder[ls.size()]);
}
@ -193,10 +193,11 @@ public class CfgHolder {
* Note that null configurations are ignored !
*/
public static IConfiguration[] items2cfgs(CfgHolder[] its) {
ArrayList lst = new ArrayList(its.length);
for (int i=0; i<its.length; i++)
if (its[i].cfg != null) lst.add(its[i].cfg);
return (IConfiguration[])lst.toArray(new IConfiguration[lst.size()]);
ArrayList<IConfiguration> lst = new ArrayList<IConfiguration>(its.length);
for (CfgHolder h : its)
if (h.cfg != null)
lst.add(h.cfg);
return lst.toArray(new IConfiguration[lst.size()]);
}
public IConfiguration getTcCfg() {

View file

@ -582,7 +582,7 @@ public class MBSWizardHandler extends CWizardHandler {
* @
*/
public void updatePreferred(List prefs) {
public void updatePreferred(List<String> prefs) {
int x = table.getItemCount();
for (int i=0; i<x; i++) {
TableItem ti = table.getItem(i);

View file

@ -31,7 +31,7 @@ public interface ICLanguageSetting extends ICSettingObject {
ICLanguageSettingEntry[] getSettingEntries(int kind);
List getSettingEntriesList(int kind);
List<ICLanguageSettingEntry> getSettingEntriesList(int kind);
// ICLanguageSettingEntry[] getResolvedSettingEntries();
@ -39,7 +39,7 @@ public interface ICLanguageSetting extends ICSettingObject {
void setSettingEntries(int kind, ICLanguageSettingEntry[] entries);
void setSettingEntries(int kind, List entriesList);
void setSettingEntries(int kind, List<ICLanguageSettingEntry> entriesList);
// void changeEntries(ICLanguageSettingEntryInfo[] added, ICLanguageSettingEntry[] removed);

View file

@ -13,7 +13,6 @@ package org.eclipse.cdt.core.settings.model.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@ -24,7 +23,6 @@ import org.eclipse.cdt.core.settings.model.ICLibraryFileEntry;
import org.eclipse.cdt.core.settings.model.ICLibraryPathEntry;
import org.eclipse.cdt.core.settings.model.ICMacroEntry;
import org.eclipse.cdt.core.settings.model.ICMacroFileEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
public class EntryStore {
private KindBasedStore fStore = new KindBasedStore();
@ -39,40 +37,35 @@ public class EntryStore {
}
public EntryStore(EntryStore base, boolean preserveReadOnly){
int kinds[] = KindBasedStore.getLanguageEntryKinds();
int kind;
for(int i = 0; i < kinds.length; i++){
kind = kinds[i];
ArrayList list = (ArrayList)fStore.get(kind);
for(int kind : KindBasedStore.getLanguageEntryKinds()){
ArrayList<?> list = (ArrayList<?>)fStore.get(kind);
if(list != null)
fStore.put(kind, (ArrayList)list.clone());
fStore.put(kind, (ArrayList<?>)list.clone());
}
fPreserveReadOnly = preserveReadOnly;
}
@SuppressWarnings("unchecked")
public ICLanguageSettingEntry[] getEntries(){
int kinds[] = KindBasedStore.getLanguageEntryKinds();
List result = new ArrayList();
List list;
for(int i = 0; i < kinds.length; i++){
list = (List)fStore.get(kinds[i]);
List<ICLanguageSettingEntry> result = new ArrayList<ICLanguageSettingEntry>();
List<ICLanguageSettingEntry> list;
for(int k: KindBasedStore.getLanguageEntryKinds()){
list = (List<ICLanguageSettingEntry>)fStore.get(k);
if(list != null)
result.addAll(list);
}
return (ICLanguageSettingEntry[])result.toArray(new ICLanguageSettingEntry[result.size()]);
return result.toArray(new ICLanguageSettingEntry[result.size()]);
}
public boolean containsEntriesList(int kind){
List list = getEntriesList(kind, false);
List<?> list = getEntriesList(kind, false);
return list != null;
}
public ICLanguageSettingEntry[] getEntries(int kind){
List list = getEntriesList(kind);
// if(list != null){
List<ICLanguageSettingEntry> list = getEntriesList(kind);
if(list == null)
list = new ArrayList(0);
list = new ArrayList<ICLanguageSettingEntry>(0);
switch(kind){
case ICLanguageSettingEntry.INCLUDE_PATH:
return (ICLanguageSettingEntry[])list.toArray(new ICIncludePathEntry[list.size()]);
@ -89,25 +82,24 @@ public class EntryStore {
default:
throw new IllegalArgumentException();
}
// }
// return null;
}
public List getEntriesList(int kind){
List list = getEntriesList(kind, false);
public List<ICLanguageSettingEntry> getEntriesList(int kind){
List<ICLanguageSettingEntry> list = getEntriesList(kind, false);
if(list != null)
return new ArrayList(list);
return new ArrayList(0);
return new ArrayList<ICLanguageSettingEntry>(list);
return new ArrayList<ICLanguageSettingEntry>(0);
}
private void setEntriesList(int kind, List list){
private void setEntriesList(int kind, List<ICLanguageSettingEntry> list){
fStore.put(kind, list);
}
private List getEntriesList(int kind, boolean create){
List list = (List)fStore.get(kind);
@SuppressWarnings("unchecked")
private List<ICLanguageSettingEntry> getEntriesList(int kind, boolean create){
List<ICLanguageSettingEntry> list = (List<ICLanguageSettingEntry>)fStore.get(kind);
if(list == null && create){
fStore.put(kind, list = new ArrayList());
fStore.put(kind, list = new ArrayList<ICLanguageSettingEntry>());
}
return list;
}
@ -117,7 +109,7 @@ public class EntryStore {
// }
public void addEntry(int pos, ICLanguageSettingEntry entry){
List list = getEntriesList(entry.getKind(), true);
List<ICLanguageSettingEntry> list = getEntriesList(entry.getKind(), true);
if(pos >= list.size())
list.add(entry);
else
@ -131,19 +123,21 @@ public class EntryStore {
}
public void storeEntries(int kind, ICLanguageSettingEntry[] entries){
storeEntries(kind, entries != null ? Arrays.asList(entries) : new ArrayList());
storeEntries(kind,
entries != null ?
Arrays.asList(entries) :
new ArrayList<ICLanguageSettingEntry>());
}
public void storeEntries(int kind, List list){
List newList = new ArrayList(list);
public void storeEntries(int kind, List<ICLanguageSettingEntry> list){
List<ICLanguageSettingEntry> newList = new ArrayList<ICLanguageSettingEntry>(list);
// newList.addAll(Arrays.asList(entries));
if(fPreserveReadOnly){
List oldList = getEntriesList(kind, false);
List<ICLanguageSettingEntry> oldList = getEntriesList(kind, false);
if(oldList != null){
Set ro = getReadOnlySet(oldList);
Set<ICLanguageSettingEntry> ro = getReadOnlySet(oldList);
ro.removeAll(newList);
for(Iterator iter = oldList.iterator(); iter.hasNext();){
Object o = iter.next();
for(ICLanguageSettingEntry o : oldList){
if(ro.contains(o))
newList.add(o);
}
@ -152,10 +146,9 @@ public class EntryStore {
setEntriesList(kind, newList);
}
private Set getReadOnlySet(List entries){
Set set = new HashSet();
for(Iterator iter = entries.iterator(); iter.hasNext();){
ICSettingEntry entry = (ICSettingEntry)iter.next();
private Set<ICLanguageSettingEntry> getReadOnlySet(List<ICLanguageSettingEntry> entries){
Set<ICLanguageSettingEntry> set = new HashSet<ICLanguageSettingEntry>();
for(ICLanguageSettingEntry entry : entries){
if(entry.isReadOnly())
set.add(entry);
}
@ -163,14 +156,16 @@ public class EntryStore {
}
public void addEntry(ICLanguageSettingEntry entry){
List list = getEntriesList(entry.getKind(), true);
List<ICLanguageSettingEntry> list = getEntriesList(entry.getKind(), true);
list.add(entry);
}
@SuppressWarnings("unchecked")
public void trimToSize(){
int kinds[] = KindBasedStore.getLanguageEntryKinds();
for(int i = 0; i < kinds.length; i++){
ArrayList list = (ArrayList)fStore.get(kinds[i]);
ArrayList<ICLanguageSettingEntry> list =
(ArrayList<ICLanguageSettingEntry>)fStore.get(kinds[i]);
if(list != null)
list.trimToSize();
}

View file

@ -11,7 +11,6 @@
package org.eclipse.cdt.internal.core.settings.model;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
@ -62,11 +61,11 @@ public class CLanguageSetting extends CDataProxy implements
return data.getEntries(kind);
}
public List getSettingEntriesList(int kind) {
public List<ICLanguageSettingEntry> getSettingEntriesList(int kind) {
CLanguageData data = getCLanguageData(false);
ICLanguageSettingEntry entries[] = data.getEntries(kind);
int size = entries != null ? entries.length : 0;
List arrayList = new ArrayList(size);
List<ICLanguageSettingEntry> arrayList = new ArrayList<ICLanguageSettingEntry>(size);
for(int i = 0; i < size; i++){
arrayList.add(entries[i]);
}
@ -290,7 +289,7 @@ public class CLanguageSetting extends CDataProxy implements
return result;
}
public void setSettingEntries(int kind, List list) {
public void setSettingEntries(int kind, List<ICLanguageSettingEntry> list) {
CLanguageData data = getCLanguageData(true);
EntryStore store = new EntryStore();
// KindBasedStore nameSetStore = new KindBasedStore();
@ -298,8 +297,7 @@ public class CLanguageSetting extends CDataProxy implements
if(list != null){
if(list.size() != 0){
for(Iterator iter = list.iterator(); iter.hasNext();){
ICLanguageSettingEntry entry = (ICLanguageSettingEntry)iter.next();
for(ICLanguageSettingEntry entry : list){
eKind = entry.getKind();
if((kind & eKind) != 0 && (data.getSupportedEntryKinds() & eKind) != 0){
store.addEntry(entry);
@ -307,9 +305,9 @@ public class CLanguageSetting extends CDataProxy implements
}
} else {
int kinds[] = KindBasedStore.getLanguageEntryKinds();
for(int i = 0; i < kinds.length; i++){
if((kinds[i] & kind) != 0){
store.storeEntries(kinds[i], new ICLanguageSettingEntry[0]);
for(int k : kinds){
if((k & kind) != 0){
store.storeEntries(k, new ICLanguageSettingEntry[0]);
}
}
}

View file

@ -113,7 +113,7 @@ public class CLanguageSettingCache extends CDefaultLanguageData implements
return fStore.getEntries(kind);
}
public List getSettingEntriesList(int kind) {
public List<ICLanguageSettingEntry> getSettingEntriesList(int kind) {
// int kinds[] = KindBasedStore.getSupportedKinds();
// List list = new ArrayList();
// for(int i = 0; i < kinds.length; i++){
@ -135,7 +135,7 @@ public class CLanguageSettingCache extends CDefaultLanguageData implements
throw ExceptionFactory.createIsReadOnlyException();
}
public void setSettingEntries(int kind, List entriesList) {
public void setSettingEntries(int kind, List<ICLanguageSettingEntry> entriesList) {
throw ExceptionFactory.createIsReadOnlyException();
}

View file

@ -26,12 +26,12 @@ import org.eclipse.cdt.core.settings.model.MultiItemsHolder;
* Normally, they should have the same name.
*/
public class MultiLanguageSetting extends MultiItemsHolder implements ICLanguageSetting {
private static final Comparator comp = CDTListComparator.getInstance();
private static final Comparator<Object> comp = CDTListComparator.getInstance();
ICLanguageSetting[] items = null;
ICConfigurationDescription cfgd = null;
public MultiLanguageSetting(List data, ICConfigurationDescription cf) {
public MultiLanguageSetting(List<ICLanguageSetting> data, ICConfigurationDescription cf) {
items = (ICLanguageSetting[])data.toArray(new ICLanguageSetting[data.size()]);
cfgd = cf;
}
@ -73,7 +73,7 @@ public class MultiLanguageSetting extends MultiItemsHolder implements ICLanguage
/* (non-Javadoc)
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#getSettingEntriesList(int)
*/
public List getSettingEntriesList(int kind) {
public List<ICLanguageSettingEntry> getSettingEntriesList(int kind) {
return Arrays.asList(getSettingEntries(kind));
}
@ -125,7 +125,7 @@ public class MultiLanguageSetting extends MultiItemsHolder implements ICLanguage
/* (non-Javadoc)
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#setSettingEntries(int, java.util.List)
*/
public void setSettingEntries(int kind, List entriesList) {
public void setSettingEntries(int kind, List<ICLanguageSettingEntry> entriesList) {
for (int i=0; i<items.length; i++)
items[i].setSettingEntries(kind, entriesList);
}

View file

@ -23,11 +23,13 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@ -95,11 +97,13 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
public static final String WORKSPACE_FILE_DIALOG_MSG = UIMessages.getString("BrowseEntryDialog.wsp.file.dlg.msg"); //$NON-NLS-1$
public static final String WORKSPACE_FILE_DIALOG_ERR = UIMessages.getString("BrowseEntryDialog.wsp.file.dlg.err"); //$NON-NLS-1$
public static final String WORKSPACE_DIR_DIALOG_ERR = UIMessages.getString("BrowseEntryDialog.wsp.dir.dlg.err"); //$NON-NLS-1$
public static final String BACKGROUND_TEXT_DEFAULT = UIMessages.getString("AbstractCPropertyTab.2"); //$NON-NLS-1$
public static final int TRI_UNKNOWN = 2;
public static final int TRI_YES = 1;
public static final int TRI_NO = 0;
private CLabel background;
protected Composite usercomp; // space where user can create widgets
protected Composite buttoncomp; // space for buttons on the right
private Button[] buttons; // buttons in buttoncomp
@ -121,10 +125,13 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
* @param parent
*/
protected void createControls(Composite parent) {
parent.setLayout(new GridLayout(2, false));
usercomp = new Composite(parent, SWT.NONE);
parent.setLayout(new FillLayout());
background = new CLabel(parent, SWT.CENTER | SWT.SHADOW_NONE);
background.setText(BACKGROUND_TEXT_DEFAULT);
background.setLayout(new GridLayout(2, false));
usercomp = new Composite(background, SWT.NONE);
usercomp.setLayoutData(new GridData(GridData.FILL_BOTH));
buttoncomp = new Composite(parent, SWT.NONE);
buttoncomp = new Composite(background, SWT.NONE);
GridData d = new GridData(GridData.END);
d.widthHint = 1;
buttoncomp.setLayoutData(d);
@ -600,4 +607,27 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
}
}
/**
* Utility method to show/hide working panes
* When panes are hidden, message becomes visible
*
* @param visible - true or false
* @param msg - text to be shown instead of panes
*/
protected void setAllVisible(boolean visible, String msg) {
if (!visible)
setBackgroundText(msg);
usercomp.setVisible(visible);
buttoncomp.setVisible(visible);
}
/**
* Allows changing message on background pane,
* which becomes visible after usercomp hidden
*
* @param s - text to display or null for default
*/
protected void setBackgroundText(String s) {
background.setText(s == null ? BACKGROUND_TEXT_DEFAULT : s);
}
}

View file

@ -66,11 +66,11 @@ public abstract class AbstractExportTab extends AbstractCPropertyTab {
public static final Image IMG_MK = CPluginImages.get(CPluginImages.IMG_OBJS_MACRO);
private static final String ALL = UIMessages.getString("AbstractExportTab.0"); //$NON-NLS-1$
private static final String LIST = UIMessages.getString("AbstractExportTab.1"); //$NON-NLS-1$
private static Map names_l = new HashMap();
private static Map names_t = new HashMap();
private static Map<String, String> names_l = new HashMap<String, String>();
private static Map<String, String> names_t = new HashMap<String, String>();
private static String[] names_ls;
private static String[] names_ts;
private List namesList;
private List<String> namesList;
static {
ILanguage[] ls = lm.getRegisteredLanguages();
@ -171,20 +171,20 @@ public abstract class AbstractExportTab extends AbstractCPropertyTab {
int x = table.getSelectionIndex();
if (x == -1) x = 0;
namesList = new ArrayList();
ArrayList lst = new ArrayList();
namesList = new ArrayList<String>();
ArrayList<ExtData> lst = new ArrayList<ExtData>();
ICExternalSetting[] vals = cfg.getExternalSettings();
if (vals == null || vals.length == 0) {
tv.setInput(null);
updateButtons();
return;
}
for (int i=0; i<vals.length; i++) {
ICSettingEntry[] ents = vals[i].getEntries(getKind());
for (ICExternalSetting v : vals) {
ICSettingEntry[] ents = v.getEntries(getKind());
if (ents == null || ents.length == 0) continue;
for (int j=0; j<ents.length; j++) {
lst.add(new ExtData(vals[i], ents[j]));
namesList.add(ents[j].getName());
for (ICSettingEntry se : ents) {
lst.add(new ExtData(v, se));
namesList.add(se.getName());
}
}
Collections.sort(lst, CDTListComparator.getInstance());
@ -201,13 +201,10 @@ public abstract class AbstractExportTab extends AbstractCPropertyTab {
public void updateData(ICResourceDescription rcfg) {
if (rcfg == null) return;
if (page.isMultiCfg()) {
usercomp.setVisible(false);
buttoncomp.setVisible(false);
setAllVisible(false, null);
} else {
if (! usercomp.getVisible()) {
usercomp.setVisible(true);
buttoncomp.setVisible(true);
}
if (! usercomp.getVisible())
setAllVisible(true, null);
cfg = rcfg.getConfiguration();
update();
}
@ -279,27 +276,27 @@ public abstract class AbstractExportTab extends AbstractCPropertyTab {
old = (ExtData)(its[t].getData());
if (old.entry.isReadOnly() || old.entry.isBuiltIn()) continue;
ICSettingEntry[] ls = old.setting.getEntries(getKind());
ArrayList lst = new ArrayList();
ArrayList<ICSettingEntry> lst = new ArrayList<ICSettingEntry>();
outer:
for (int x=0; x<ls.length; x++) {
for (ICSettingEntry se : ls) {
for (int y=t; y<its.length; y++) {
if (its[y] == null) break;
Object ob = its[y].getData();
if (ob != null && (ob instanceof ExtData)) {
ExtData ex = (ExtData)ob;
if (ls[x].equals(ex.entry)) {
if (se.equals(ex.entry)) {
checked[y] = true;
continue outer;
}
}
}
lst.add(ls[x]);
lst.add(se);
}
cfg.removeExternalSetting(old.setting);
cfg.createExternalSetting(old.setting.getCompatibleLanguageIds(),
old.setting.getCompatibleContentTypeIds(),
old.setting.getCompatibleExtensions(),
(ICLanguageSettingEntry[])lst.toArray(new ICLanguageSettingEntry[lst.size()]));
lst.toArray(new ICLanguageSettingEntry[lst.size()]));
}
update();
break;

View file

@ -13,7 +13,6 @@ package org.eclipse.cdt.ui.newui;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@ -72,8 +71,8 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
protected boolean toAllLang = false;
protected ICLanguageSetting lang;
protected LinkedList incs;
protected ArrayList exported;
protected LinkedList<ICLanguageSettingEntry> incs;
protected ArrayList<ICSettingEntry> exported;
protected SashForm sashForm;
protected final static String[] BUTTONS = {ADD_STR, EDIT_STR, DEL_STR,
@ -261,21 +260,18 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
if (x == -1) x = 0;
else x += shift; // used only for UP/DOWN
incs = new LinkedList();
List lst = getSettingEntriesList(getKind());
incs = new LinkedList<ICLanguageSettingEntry>();
List<ICLanguageSettingEntry> lst = getSettingEntriesList(getKind());
if (lst != null) {
Iterator it = lst.iterator();
while (it.hasNext()) {
ICLanguageSettingEntry ent = (ICLanguageSettingEntry)it.next();
if (!ent.isBuiltIn()) incs.add(ent);
for (ICLanguageSettingEntry ent : lst) {
if (!ent.isBuiltIn())
incs.add(ent);
}
if (showBIButton.getSelection()) {
ArrayList lstS = new ArrayList();
it = lst.iterator();
while (it.hasNext()) {
ICLanguageSettingEntry ent = (ICLanguageSettingEntry)it.next();
if (ent.isBuiltIn()) lstS.add(ent);
}
ArrayList<ICLanguageSettingEntry> lstS = new ArrayList<ICLanguageSettingEntry>();
for (ICLanguageSettingEntry ent : lst)
if (ent.isBuiltIn())
lstS.add(ent);
incs.addAll(lstS);
}
}
@ -329,14 +325,14 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
}
private void updateExport() {
exported = new ArrayList();
exported = new ArrayList<ICSettingEntry>();
ICExternalSetting[] vals = getResDesc().getConfiguration().getExternalSettings();
if (!(vals == null || vals.length == 0)) {
for (int i=0; i<vals.length; i++) {
ICSettingEntry[] ents = vals[i].getEntries(getKind());
for (ICExternalSetting v : vals) {
ICSettingEntry[] ents = v.getEntries(getKind());
if (ents == null || ents.length == 0) continue;
for (int j=0; j<ents.length; j++)
exported.add(ents[j]);
for (ICSettingEntry en : ents)
exported.add(en);
}
}
}
@ -407,8 +403,8 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
int x = incs.indexOf(old);
if (x < 0) break;
if (i == 6) x++; // "down" simply means "up underlying item"
old = (ICLanguageSettingEntry)incs.get(x);
ICLanguageSettingEntry old2 = (ICLanguageSettingEntry)incs.get(x - 1);
old = incs.get(x);
ICLanguageSettingEntry old2 = incs.get(x - 1);
incs.remove(x);
incs.remove(x - 1);
incs.add(x - 1, old);
@ -462,12 +458,11 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
continue;
if (!toAllCfgs && !(cur_cfg.equals(rcfg)))
continue;
ICLanguageSetting [] ls = getLangSetting(rcfg);
for (int j = 0; j < ls.length; j++ ) {
if (id == ls[j].getName() || toAllLang) {
List lst = ls[j].getSettingEntriesList(getKind());
for (ICLanguageSetting l : getLangSetting(rcfg)) {
if (id == l.getName() || toAllLang) {
List<ICLanguageSettingEntry> lst = l.getSettingEntriesList(getKind());
lst.add(ent);
ls[j].setSettingEntries(getKind(), lst);
l.setSettingEntries(getKind(), lst);
}
}
}
@ -486,7 +481,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
for (int i=0; i<tis.length; i++) {
Object ob = tis[i].getData();
if (ob != null && ob instanceof ICLanguageSetting) {
((ICLanguageSetting)ob).setSettingEntries(getKind(), (List)null);
((ICLanguageSetting)ob).setSettingEntries(getKind(), (List<ICLanguageSettingEntry>)null);
}
}
updateData(this.getResDesc());
@ -568,13 +563,13 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
return false;
}
private void setSettingEntries(int kind, List incs, boolean toAll) {
private void setSettingEntries(int kind, List<ICLanguageSettingEntry> incs, boolean toAll) {
if (page.isMultiCfg()) {
((ICMultiResourceDescription)getResDesc()).setSettingEntries(lang, kind, incs, toAll);
} else
lang.setSettingEntries(kind, incs);
}
private List getSettingEntriesList(int kind) {
private List<ICLanguageSettingEntry> getSettingEntriesList(int kind) {
return lang.getSettingEntriesList(kind);
}
}

View file

@ -68,8 +68,8 @@ public class BinaryParsTab extends AbstractCPropertyTab {
private static final String ATTR_VALUE = "value"; //$NON-NLS-1$
private static final String ATTR_VALUE_PRIVATE = "private"; //$NON-NLS-1$
protected Map configMap;
protected Map fParserPageMap = null;
protected Map<String, BinaryParserConfiguration> configMap;
protected Map<String, BinaryParserPageConfiguration> fParserPageMap = null;
protected Table table;
protected CheckboxTableViewer tv;
protected Composite parserGroup;
@ -185,7 +185,7 @@ public class BinaryParsTab extends AbstractCPropertyTab {
ids = CoreModelUtil.getBinaryParserIds(cfgs);
}
Object[] data = new Object[configMap.size()];
HashMap clone = new HashMap(configMap);
HashMap<String, BinaryParserConfiguration> clone = new HashMap<String, BinaryParserConfiguration>(configMap);
// add checked elements
int i;
for (i=0; i<ids.length; i++) {
@ -214,7 +214,7 @@ public class BinaryParsTab extends AbstractCPropertyTab {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, CCorePlugin.BINARY_PARSER_SIMPLE_ID);
if (point != null) {
IExtension[] exts = point.getExtensions();
configMap = new HashMap(exts.length);
configMap = new HashMap<String, BinaryParserConfiguration>(exts.length);
for (int i = 0; i < exts.length; i++) {
if (isExtensionVisible(exts[i])) {
configMap.put(exts[i].getUniqueIdentifier(), new BinaryParserConfiguration(exts[i]));
@ -224,7 +224,7 @@ public class BinaryParsTab extends AbstractCPropertyTab {
}
private void initializeParserPageMap() {
fParserPageMap = new HashMap(5);
fParserPageMap = new HashMap<String, BinaryParserPageConfiguration>(5);
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, "BinaryParserPage"); //$NON-NLS-1$
IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
@ -281,11 +281,11 @@ public class BinaryParsTab extends AbstractCPropertyTab {
}
protected String[] getBinaryParserIDs() {
return (String[]) configMap.keySet().toArray(new String[configMap.keySet().size()]);
return configMap.keySet().toArray(new String[configMap.keySet().size()]);
}
protected ICOptionPage getBinaryParserPage(String parserID) {
BinaryParserPageConfiguration configElement = (BinaryParserPageConfiguration) fParserPageMap.get(parserID);
BinaryParserPageConfiguration configElement = fParserPageMap.get(parserID);
if (configElement != null) {
try {
return configElement.getPage();

View file

@ -54,7 +54,7 @@ public class CDTPrefUtil {
public static final String NULL = "NULL"; //$NON-NLS-1$
private static final IPreferenceStore pref = CUIPlugin.getDefault().getPreferenceStore();
private static final String DELIMITER = " "; //$NON-NLS-1$
private static LinkedList preferredTCs = null;
private static LinkedList<String> preferredTCs = null;
// low-level methods
public static boolean getBool(String key) { return pref.getBoolean(key); }
@ -66,9 +66,9 @@ public class CDTPrefUtil {
// up-level methods
public static void readPreferredTCs() {
preferredTCs = new LinkedList(Arrays.asList(getStr(KEY_PREFTC).split(DELIMITER)));
preferredTCs = new LinkedList<String>(Arrays.asList(getStr(KEY_PREFTC).split(DELIMITER)));
}
public static List getPreferredTCs() {
public static List<String> getPreferredTCs() {
if (preferredTCs == null) readPreferredTCs();
return preferredTCs;
}

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -46,7 +46,7 @@ import org.eclipse.cdt.ui.CUIPlugin;
*/
public class CDTPropertyManager {
private static ArrayList pages = new ArrayList();
private static ArrayList<Object> pages = new ArrayList<Object>();
private static ICProjectDescription prjd = null;
private static boolean saveDone = false;
private static IProject project = null;

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -27,8 +27,8 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@ -55,7 +55,7 @@ public abstract class CLocationTab extends AbstractCPropertyTab {
Label label;
TreeViewer tree;
ArrayList src;
ArrayList<_Entry> src;
ICResourceDescription cfgd;
ICProject cprj;
@ -71,17 +71,21 @@ public abstract class CLocationTab extends AbstractCPropertyTab {
public String[] getExts() {
IPath[] p = getExtPaths();
if (p == null || p.length == 0) return new String[0];
if (p == null || p.length == 0)
return new String[0];
String[] s = new String[p.length];
for (int i=0; i<p.length; i++) s[i] = p[i].toOSString();
for (int i=0; i<p.length; i++)
s[i] = p[i].toOSString();
return s;
}
public String toString() {
String[] s = getExts();
if (s.length == 0) return UIMessages.getString("CLocationTab.0"); //$NON-NLS-1$
if (s.length == 0)
return UIMessages.getString("CLocationTab.0"); //$NON-NLS-1$
String x = UIMessages.getString("CLocationTab.1"); //$NON-NLS-1$
for (int i=0; i< s.length; i++) x = x + s[i] + UIMessages.getString("CLocationTab.2"); //$NON-NLS-1$
for (int i=0; i< s.length; i++)
x = x + s[i] + UIMessages.getString("CLocationTab.2"); //$NON-NLS-1$
x = x.substring(0, x.length() - 2) + UIMessages.getString("CLocationTab.3"); //$NON-NLS-1$
return x;
}
@ -114,11 +118,7 @@ public abstract class CLocationTab extends AbstractCPropertyTab {
label.setLayoutData(new GridData(GridData.BEGINNING));
tree = new TreeViewer(usercomp);
tree.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
tree.getTree().addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// TODO Auto-generated method stub
}
tree.getTree().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateButtons();
}});
@ -240,11 +240,9 @@ public abstract class CLocationTab extends AbstractCPropertyTab {
usercomp.setVisible(true);
cfgd = _cfgd;
ICExclusionPatternPathEntry[] ent = getEntries(cfgd);
src = new ArrayList(ent.length);
for (int i=0; i<ent.length; i++) {
src.add(new _Entry(ent[i]));
}
src = new ArrayList<_Entry>();
for (ICExclusionPatternPathEntry e : getEntries(cfgd))
src.add(new _Entry(e));
tree.setInput(src);
// get CProject
IAdaptable ad = page.getElement();

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -69,7 +69,7 @@ public class EnvironmentTab extends AbstractCPropertyTab {
private Table table;
private TableViewer tv;
private ArrayList data = new ArrayList();
private ArrayList<TabData> data = new ArrayList<TabData>();
private Button b1, b2;
private ICConfigurationDescription cfgd = null;
@ -162,9 +162,10 @@ public class EnvironmentTab extends AbstractCPropertyTab {
tv = new TableViewer(table);
tv.setContentProvider(new IStructuredContentProvider() {
@SuppressWarnings("unchecked")
public Object[] getElements(Object inputElement) {
if (inputElement != null && inputElement instanceof ArrayList) {
ArrayList ar = (ArrayList)inputElement;
ArrayList<Object> ar = (ArrayList)inputElement;
return ar.toArray(new TabData[0]);
}
return null;

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -36,10 +36,10 @@ import org.eclipse.cdt.core.settings.model.ICResourceDescription;
public class ErrorParsTab extends AbstractCPropertyTab {
protected HashMap mapParsers = new HashMap();
protected Table table;
protected CheckboxTableViewer tv;
ICConfigurationDescription cfgd;
private HashMap<String, String> mapParsers = new HashMap<String, String>();
private Table table;
private CheckboxTableViewer tv;
private ICConfigurationDescription cfgd;
public void createControls(Composite parent) {
super.createControls(parent);
@ -146,12 +146,12 @@ public class ErrorParsTab extends AbstractCPropertyTab {
((ICMultiConfigDescription)cfgd).getErrorParserIDs() :
cfgd.getBuildSetting().getErrorParserIDs();
ArrayList data = new ArrayList(mapParsers.size());
ArrayList checked = new ArrayList(ss.length);
HashMap cloneMap = new HashMap(mapParsers);
ArrayList<TableData> data = new ArrayList<TableData>(mapParsers.size());
ArrayList<TableData> checked = new ArrayList<TableData>(ss.length);
HashMap<String, String> cloneMap = new HashMap<String, String>(mapParsers);
// add checked elements
for (int i=0; i<ss.length; i++) {
String s = (String)cloneMap.get(ss[i]);
String s = cloneMap.get(ss[i]);
if (s != null) {
TableData d = new TableData(ss[i],s);
data.add(d);
@ -163,7 +163,7 @@ public class ErrorParsTab extends AbstractCPropertyTab {
Iterator it = cloneMap.keySet().iterator();
while (it.hasNext()) {
String s = (String)it.next();
data.add(new TableData(s, (String)cloneMap.get(s)));
data.add(new TableData(s, cloneMap.get(s)));
}
tv.setInput(data.toArray());
tv.setCheckedElements(checked.toArray());
@ -193,12 +193,12 @@ public class ErrorParsTab extends AbstractCPropertyTab {
private void saveChecked() {
Object[] objs = tv.getCheckedElements();
ArrayList lst = new ArrayList();
ArrayList<String> lst = new ArrayList<String>();
if (objs != null) {
for (int i=0; i<objs.length; i++)
lst.add(((TableData)objs[i]).key);
for (Object ob : objs)
lst.add(((TableData)ob).key);
}
String[] s = (String[])lst.toArray(new String[lst.size()]);
String[] s = lst.toArray(new String[lst.size()]);
if (cfgd instanceof ICMultiConfigDescription)
((ICMultiConfigDescription)cfgd).setErrorParserIDs(s);
else

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2007 QNX Software Systems and others.
* Copyright (c) 2004, 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -110,10 +110,9 @@ public class ExPatternDialog extends StatusDialog {
fCurrSourceFolder= (IContainer) res;
}
ArrayList elements= new ArrayList(pattern.length);
for (int i= 0; i < pattern.length; i++) {
elements.add(pattern[i].toString());
}
ArrayList<String> elements= new ArrayList<String>(pattern.length);
for (IPath p : pattern)
elements.add(p.toString());
fExclusionPatternList.setElements(elements);
fExclusionPatternList.selectFirstElement();
fExclusionPatternList.enableButton(IDX_ADD_MULTIPLE, fCurrSourceFolder != null);

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -74,22 +74,22 @@ public class ManageConfigSelector {
* @return array with only new-style projects included
*/
public static IProject[] getProjects(Object[] obs) {
ArrayList lst = new ArrayList();
ArrayList<IProject> lst = new ArrayList<IProject>();
if (obs != null) {
for (int i=0; i<obs.length; i++) {
for (Object ob : obs) {
IProject prj = null;
// Extract project from selection
if (obs[i] instanceof ICElement) { // for C/C++ view
prj = ((ICElement)obs[i]).getCProject().getProject();
} else if (obs[i] instanceof IResource) { // for other views
prj = ((IResource)obs[i]).getProject();
if (ob instanceof ICElement) { // for C/C++ view
prj = ((ICElement)ob).getCProject().getProject();
} else if (ob instanceof IResource) { // for other views
prj = ((IResource)ob).getProject();
/* get project from Include folder elements */
} else if (obs[i] instanceof IncludeRefContainer) {
ICProject fCProject = ((IncludeRefContainer)obs[i]).getCProject();
} else if (ob instanceof IncludeRefContainer) {
ICProject fCProject = ((IncludeRefContainer)ob).getCProject();
if (fCProject != null)
prj = fCProject.getProject();
} else if (obs[i] instanceof IncludeReferenceProxy) {
IncludeRefContainer irc = ((IncludeReferenceProxy)obs[i]).getIncludeRefContainer();
} else if (ob instanceof IncludeReferenceProxy) {
IncludeRefContainer irc = ((IncludeReferenceProxy)ob).getIncludeRefContainer();
if (irc != null) {
ICProject fCProject = irc.getCProject();
if (fCProject != null)
@ -103,7 +103,7 @@ public class ManageConfigSelector {
lst.add(prj);
}
}
return (IProject[])lst.toArray(new IProject[lst.size()]);
return lst.toArray(new IProject[lst.size()]);
}
private static void readMgrs() {
@ -118,7 +118,7 @@ public class ManageConfigSelector {
if (extensions == null)
return;
ArrayList list = new ArrayList();
ArrayList<IConfigManager> list = new ArrayList<IConfigManager>();
for (int i = 0; i < extensions.length; ++i) {
IConfigurationElement[] elements = extensions[i].getConfigurationElements();
for (int k = 0; k < elements.length; k++) {
@ -134,6 +134,6 @@ public class ManageConfigSelector {
}
}
list.add(ManageConfigRunner.getDefault()); // Default manager
mgrs = (IConfigManager[]) list.toArray(new IConfigManager[list.size()]);
mgrs = list.toArray(new IConfigManager[list.size()]);
}
}

View file

@ -403,6 +403,7 @@ DiscoveredScannerConfigurationContainerPage.initialization.error.message=Error i
AbstractCPropertyTab.0=Select build variable
AbstractCPropertyTab.1=Variables...
AbstractCPropertyTab.2=This tab is not supported in multi-configuration mode
AbstractPage.0=Unknown element selected
AbstractPage.1=This file has no properties to display
AbstractPage.12=Manage configurations

View file

@ -117,20 +117,17 @@ public class RefsTab extends AbstractCPropertyTab {
public void updateData(ICResourceDescription cfgd) {
if (page.isMultiCfg()) {
usercomp.setVisible(false);
buttoncomp.setVisible(false);
setAllVisible(false, null);
} else {
if ( !usercomp.getVisible()) {
usercomp.setVisible(true);
buttoncomp.setVisible(true);
}
if ( !usercomp.getVisible())
setAllVisible(true, null);
initData();
}
}
private void saveChecked() {
TreeItem[] tr = tree.getItems();
Map refs = new HashMap();
Map<String, String> refs = new HashMap<String, String>();
for (int i=0; i<tr.length; i++) {
if (tr[i].getChecked()) {
TreeItem[] cfgs = tr[i].getItems();

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -74,8 +74,8 @@ public class SymbolTab extends AbstractLangsListTab {
int x = table.getSelectionIndex();
if (x == -1) x = 0;
ArrayList lst = new ArrayList();
incs = new LinkedList(lang.getSettingEntriesList(getKind()));
ArrayList<ICLanguageSettingEntry> lst = new ArrayList<ICLanguageSettingEntry>();
incs = new LinkedList<ICLanguageSettingEntry>(lang.getSettingEntriesList(getKind()));
if (incs != null) {
Iterator it = incs.iterator();
while (it.hasNext()) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2007 IBM Corporation and others.
* Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -32,11 +32,11 @@ public class UIMessages {
}
public static String getFormattedString(String key, String arg) {
return MessageFormat.format(getString(key), new String[] { arg });
return MessageFormat.format(getString(key), (Object[])new String[] { arg });
}
public static String getFormattedString(String key, String[] args) {
return MessageFormat.format(getString(key), args);
return MessageFormat.format(getString(key), (Object[])args);
}
public static String getString(String key) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2007 Rational Software Corporation and others.
* Copyright (c) 2002, 2008 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -77,6 +77,7 @@ implements IExecutableExtension, IWizardWithMemory
setDialogSettings(CUIPlugin.getDefault().getDialogSettings());
setNeedsProgressMonitor(true);
setForcePreviousAndNextButtons(true);
setWindowTitle(title);
wz_title = title;
wz_desc = desc;
}

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -261,7 +261,7 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
IExtension[] extensions = extensionPoint.getExtensions();
if (extensions == null) return null;
List items = new ArrayList();
List<EntryDescriptor> items = new ArrayList<EntryDescriptor>();
for (int i = 0; i < extensions.length; ++i) {
IConfigurationElement[] elements = extensions[i].getConfigurationElements();
for (int k = 0; k < elements.length; k++) {
@ -274,10 +274,9 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
return null;
}
if (w == null) return null;
w.setDependentControl(right, ls);
EntryDescriptor[] wd = w.createItems(show_sup.getSelection(), wizard);
for (int x=0; x<wd.length; x++) items.add(wd[x]);
for (EntryDescriptor ed : w.createItems(show_sup.getSelection(), wizard))
items.add(ed);
}
}
}
@ -305,15 +304,13 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
return null;
}
private static void addItemsToTree(Tree tree, List items) {
private static void addItemsToTree(Tree tree, List<EntryDescriptor> items) {
// Sorting is disabled because of users requests
// Collections.sort(items, CDTListComparator.getInstance());
ArrayList placedTreeItemsList = new ArrayList(items.size());
ArrayList placedEntryDescriptorsList = new ArrayList(items.size());
Iterator it = items.iterator();
while (it.hasNext()) {
EntryDescriptor wd = (EntryDescriptor)it.next();
ArrayList<TreeItem> placedTreeItemsList = new ArrayList<TreeItem>(items.size());
ArrayList<EntryDescriptor> placedEntryDescriptorsList = new ArrayList<EntryDescriptor>(items.size());
for (EntryDescriptor wd : items) {
if (wd.getParentId() == null) {
wd.setPath(wd.getId());
TreeItem ti = new TreeItem(tree, SWT.NONE);
@ -332,7 +329,7 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
EntryDescriptor wd1 = (EntryDescriptor)it2.next();
if (wd1.getParentId() == null) continue;
for (int i=0; i<placedEntryDescriptorsList.size(); i++) {
EntryDescriptor wd2 = (EntryDescriptor)placedEntryDescriptorsList.get(i);
EntryDescriptor wd2 = placedEntryDescriptorsList.get(i);
if (wd2.getId().equals(wd1.getParentId())) {
found = true;
wd1.setParentId(null);
@ -347,7 +344,7 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
if (h != null && !h.isApplicable(wd1))
break;
TreeItem p = (TreeItem)placedTreeItemsList.get(i);
TreeItem p = placedTreeItemsList.get(i);
TreeItem ti = new TreeItem(p, SWT.NONE);
ti.setText(wd1.getName());
ti.setData(wd1.getHandler());
@ -406,6 +403,7 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
return IMG_ITEM;
}
@SuppressWarnings("unchecked")
public List filterItems(List items) {
return items;
}

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -66,7 +66,7 @@ public class CWizardHandler implements Cloneable {
* @parame pane - parent for handler-specific data
*/
public void handleSelection() {
List preferred = CDTPrefUtil.getPreferredTCs();
List<String> preferred = CDTPrefUtil.getPreferredTCs();
if (table == null) {
table = new Table(parent, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
TableItem ti = new TableItem(table, SWT.NONE);
@ -130,7 +130,7 @@ public class CWizardHandler implements Cloneable {
* Usually, marks preferred toolchains somehow (icon, font etc)
* @param prefs - list of strings (preferred Toolchain IDs)
*/
public void updatePreferred(List prefs) {}
public void updatePreferred(List<String> prefs) {}
/**
* Creates project

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -44,6 +44,6 @@ public interface IWizardItemsListListener {
* @param items - list of EntryDescriptor objects
* @return - list with filtered items
*/
List filterItems(List items);
List<EntryDescriptor> filterItems(List items);
}

View file

@ -693,9 +693,10 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
*
* @return array of <code>IBaseClassInfo</code>
*/
protected IBaseClassInfo[] getBaseClasses() {
List classesList = fBaseClassesDialogField.getElements();
return (IBaseClassInfo[]) classesList.toArray(new IBaseClassInfo[classesList.size()]);
@SuppressWarnings("unchecked")
protected IBaseClassInfo[] getBaseClasses() {
List<IBaseClassInfo> classesList = fBaseClassesDialogField.getElements();
return classesList.toArray(new IBaseClassInfo[classesList.size()]);
}
/**

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Symbian Software Limited and others.
* Copyright (c) 2007, 2008 Symbian Software Limited and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -25,7 +25,7 @@ public interface IWizardDataPage extends IWizardPage {
* @return a map of (key,value) pairs that should be added to the
* associated project template's value store.
*/
Map/*<String, String>*/ getPageData();
Map<String, String> getPageData();
/**
* Set the page that follows this one. Implementations must ensure

View file

@ -146,9 +146,9 @@ public class ProjectSelectionPage extends WizardPage implements IWizardDataPage
}
}
private Map data = new HashMap(2);
private Map<String, String> data = new HashMap<String, String>(2);
public Map getPageData() {
public Map<String, String> getPageData() {
String cPojectName = currentCProject.getResource().getName().trim();
data.put("projectName", cPojectName); //$NON-NLS-1$
data.put("baseName", getBaseName(cPojectName)); //$NON-NLS-1$

View file

@ -30,16 +30,16 @@ public class NewProjectCreationPage extends WizardNewProjectCreationPage impleme
private static final String ERROR_SUFFIX_TOO_LONG = Messages.getString("NewProjectCreationPage.1"); //$NON-NLS-1$
private static final Status OK_STATUS = new Status(IStatus.OK, CUIPlugin.getPluginId(), 0, "", null); //$NON-NLS-1$
private Map data;
private Map<String, String> data;
private IWizardPage next;
public NewProjectCreationPage(String name) {
super(name);
data= new HashMap();
data= new HashMap<String, String>();
this.setDescription(Messages.getString("NewProjectCreationPage.3")); //$NON-NLS-1$
}
public Map getPageData() {
public Map<String, String> getPageData() {
String projName = super.getProjectName().trim();
data.put("projectName", projName); //$NON-NLS-1$
data.put("baseName", getBaseName(projName)); //$NON-NLS-1$

View file

@ -131,7 +131,7 @@ public abstract class UIPage extends DialogPage {
*
* @return HashMap. The data contained in the widgets on this page.
*/
public Map/*<String, String>*/ getPageData() {
public Map<String, String> getPageData() {
return uiElement.getValues();
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Symbian Software Limited and others.
* Copyright (c) 2007, 2008 Symbian Software Limited and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -40,7 +40,7 @@ public class UIWizardPage extends UIPage implements IWizardDataPage, PatternEven
* This map will contain reference to the source widgets, which has generated the
* SWT events. If this map contains an event source, the error message will not be cleared.
*/
HashMap/*<Object, String>*/ validInvalid;
HashMap<Object, String> validInvalid;
/**
* Page Name
@ -77,7 +77,7 @@ public class UIWizardPage extends UIPage implements IWizardDataPage, PatternEven
public UIWizardPage(String title, String pageName, UIElement uiElement, Map/*<String, String>*/ valueStore) {
super(title, uiElement, valueStore);
name = pageName;
validInvalid = new HashMap/*<Object, String>*/();
validInvalid = new HashMap<Object, String>();
isPageComplete = uiElement.isValid();
}
@ -312,13 +312,12 @@ public class UIWizardPage extends UIPage implements IWizardDataPage, PatternEven
* @return
*/
private String getErrorString() {
Iterator iterator = validInvalid.keySet().iterator();
Iterator<Object> iterator = validInvalid.keySet().iterator();
String message = ""; //$NON-NLS-1$
// only display one error message at a time
if (iterator.hasNext()) {
message = (String) validInvalid.get(iterator.next());
message = validInvalid.get(iterator.next());
}
return message;
}

View file

@ -74,7 +74,7 @@ public abstract class UIElement {
* get The values as a HashMap. This method is called recursively on all the childrens, if the UIElement instance on which this mehtod called is a GenericUIElementGroup.
* @return HashMap.
*/
public abstract Map/*<String, String>*/ getValues();
public abstract Map<String, String> getValues();
/**
* This method adds UIWidets to UIComposite. This method is called