1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 06:55:23 +02:00

Bug #182450 : Multi-configuration support

This commit is contained in:
Oleg Krasilnikov 2008-02-08 16:39:21 +00:00
parent e08ec31825
commit 95c056e27e
33 changed files with 857 additions and 611 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2006 Rational Software Corporation and others.
* Copyright (c) 2003, 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
@ -332,7 +332,7 @@ public interface IManagedBuildInfo {
*
* @return
*/
public List getTargets();
public List<ITarget> getTargets();
/**
* Returns a <code>String</code> containing the command-line invocation

View file

@ -195,7 +195,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
private static boolean projectTypesLoading = false;
// Project types defined in the manifest files
public static SortedMap<String, IProjectType> projectTypeMap;
private static List projectTypes;
private static List<IProjectType> projectTypes;
// Early configuration initialization extension elements
private static List startUpConfigElements;
// Configurations defined in the manifest files
@ -313,7 +313,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
}
// Get the project types for this project and all referenced projects
List definedTypes = null;
List<IProjectType> definedTypes = null;
// To Do
// Create the array and copy the elements over
@ -329,7 +329,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
if (definedTypes != null)
for (int i = 0; i < definedTypes.size(); ++i)
types[n++] = (IProjectType)definedTypes.get(i);
types[n++] = definedTypes.get(i);
return types;
}
@ -573,8 +573,8 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
IManagedBuildInfo buildInfo = getBuildInfo(resource);
if (buildInfo != null) {
List targets = buildInfo.getTargets();
return (ITarget[])targets.toArray(new ITarget[targets.size()]);
List<ITarget> targets = buildInfo.getTargets();
return targets.toArray(new ITarget[targets.size()]);
}
return emptyTargets;
}
@ -930,6 +930,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
* @param config
* @param option
*/
/*
private static void notifyListeners(IConfiguration config, IOption option) {
// Continue if change is something that effect the scanner
try {
@ -964,7 +965,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
((IScannerInfoChangeListener)iter.next()).changeNotification(resource, (IScannerInfo)getBuildInfo(resource));
}
}
*/
public static void initializePathEntries(IConfiguration config, IOption option){
try{
if(config.isTemporary() ||
@ -1756,7 +1757,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
*/
public static void addExtensionProjectType(ProjectType projectType) {
if (projectTypes == null) {
projectTypes = new ArrayList();
projectTypes = new ArrayList<IProjectType>();
}
projectTypes.add(projectType);
@ -3924,7 +3925,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
if (cfgDes instanceof ICMultiConfigDescription) {
ICMultiConfigDescription mcd = (ICMultiConfigDescription)cfgDes;
ICConfigurationDescription[] cfds = (ICConfigurationDescription[])mcd.getItems();
return new MultiConfiguration(cfds, mcd.getStringListMode());
return new MultiConfiguration(cfds);
}
CConfigurationData cfgData = cfgDes.getConfigurationData();

View file

@ -2551,10 +2551,10 @@ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider,
setDirty(true);
}
public Set contributeErrorParsers(Set set){
public Set<String> contributeErrorParsers(Set<String> set){
if(getErrorParserIds() != null){
if(set == null)
set = new HashSet();
set = new HashSet<String>();
String ids[] = getErrorParserList();
if(ids.length != 0)

View file

@ -925,14 +925,12 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
}
private ITool[][] getBestMatches(ITool[] tools1, ITool[] tools2){
HashSet set = new HashSet(Arrays.asList(tools2));
List list = new ArrayList(tools1.length);
for(int i = 0; i < tools1.length; i++){
ITool tool1 = tools1[i];
HashSet<ITool> set = new HashSet<ITool>(Arrays.asList(tools2));
List<ITool[]> list = new ArrayList<ITool[]>(tools1.length);
for(ITool tool1 : tools1){
ITool bestMatchTool = null;
int num = 0;
for(Iterator iter = set.iterator(); iter.hasNext();){
ITool tool2 = (ITool)iter.next();
for(ITool tool2 : set){
int extsNum = getConflictingInputExts(tool1, tool2).length;
if(extsNum > num){
bestMatchTool = tool2;

View file

@ -57,9 +57,8 @@ public class MultiConfiguration extends MultiItemsHolder implements
protected IConfiguration[] fCfgs = null;
private int curr = 0;
public MultiConfiguration(IConfiguration[] cfs, int mode) {
public MultiConfiguration(IConfiguration[] cfs) {
fCfgs = cfs;
setStringListMode(mode);
for (int i=0; i<fCfgs.length; i++)
if (((Configuration)fCfgs[i]).getConfigurationDescription().isActive()) {
curr = i;
@ -67,8 +66,8 @@ public class MultiConfiguration extends MultiItemsHolder implements
}
}
public MultiConfiguration(ICConfigurationDescription[] cfds, int mode) {
this(cfds2cfs(cfds),mode);
public MultiConfiguration(ICConfigurationDescription[] cfds) {
this(cfds2cfs(cfds));
}
public static IConfiguration[] cfds2cfs(ICConfigurationDescription[] cfgds) {

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
@ -37,7 +37,6 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
private Button enable_multi;
private Group dGrp;
private Group wGrp;
private Button d_0;
private Button d_1;
private Button d_2;
@ -78,8 +77,6 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
UIMessages.getString("PropertyMultiCfgTab.4") //$NON-NLS-1$
);
l.setForeground(BLUE);
d_0 = new Button(dGrp, SWT.RADIO);
d_0.setText(UIMessages.getString("PropertyMultiCfgTab.5")); //$NON-NLS-1$
d_1 = new Button(dGrp, SWT.RADIO);
d_1.setText(UIMessages.getString("PropertyMultiCfgTab.6")); //$NON-NLS-1$
d_2 = new Button(dGrp, SWT.RADIO);
@ -106,7 +103,6 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
enable_multi.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_MULTI));
switch (CDTPrefUtil.getInt(CDTPrefUtil.KEY_DMODE)) {
case CDTPrefUtil.DMODE_EMPTY: d_0.setSelection(true); break;
case CDTPrefUtil.DMODE_CONJUNCTION: d_1.setSelection(true); break;
case CDTPrefUtil.DMODE_DISJUNCTION: d_2.setSelection(true); break;
default: d_1.setSelection(true); break;
@ -124,9 +120,7 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
protected void performOK() {
CDTPrefUtil.setBool(CDTPrefUtil.KEY_MULTI, enable_multi.getSelection());
int x = 0;
if (d_0.getSelection())
x = CDTPrefUtil.DMODE_EMPTY;
else if (d_1.getSelection())
if (d_1.getSelection())
x = CDTPrefUtil.DMODE_CONJUNCTION;
else if (d_2.getSelection())
x = CDTPrefUtil.DMODE_DISJUNCTION;
@ -141,7 +135,6 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
protected void performDefaults() {
enable_multi.setSelection(false);
d_0.setSelection(false);
d_1.setSelection(true);
d_2.setSelection(false);
w_0.setSelection(true);
@ -150,7 +143,6 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
private void setStates() {
boolean b = enable_multi.getSelection();
d_0.setEnabled(b);
d_1.setEnabled(b);
d_2.setEnabled(b);
w_0.setEnabled(b);

View file

@ -49,7 +49,7 @@ public abstract class AbstractCBuildPropertyTab extends AbstractCPropertyTab {
public static IConfiguration getCfg(ICConfigurationDescription cfgd) {
if (cfgd instanceof ICMultiConfigDescription) {
ICConfigurationDescription[] cfds = (ICConfigurationDescription[])((ICMultiConfigDescription)cfgd).getItems();
return new MultiConfiguration(cfds, 9);
return new MultiConfiguration(cfds);
} else
return ManagedBuildManager.getConfigurationForDescription(cfgd);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 - 2008 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
@ -33,6 +33,7 @@ import org.eclipse.cdt.internal.core.cdtvariables.StorableCdtVariables;
import org.eclipse.cdt.internal.core.cdtvariables.UserDefinedVariableSupplier;
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
import org.eclipse.cdt.ui.newui.AbstractPage;
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
import org.eclipse.cdt.ui.newui.PrefPage_Abstract;
import org.eclipse.cdt.ui.newui.UIMessages;
import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
@ -63,6 +64,8 @@ import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
@ -131,6 +134,7 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
private TableViewer tv;
private Label fStatusLabel;
private Label lb1, lb2;
private static final String[] fEditableTableColumnProps = new String[] {
"editable name", //$NON-NLS-1$
@ -246,80 +250,101 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
*/
public void buttonPressed(int index){
switch(index){
case 0:{
NewVarDialog dlg = new NewVarDialog(usercomp.getShell(), null, cfgd, getVariables());
if(dlg.open() == Dialog.OK){
ICdtVariable macro = dlg.getDefinedMacro();
if(canCreate(macro)) {
case 0:
handleAddButton();
break;
case 1:
handleEditButton();
break;
case 2:
handleDelButton();
break;
}
}
private void replaceMacros() {
if (!page.isMultiCfg() ||
cfgd == null ||
CDTPrefUtil.getInt(CDTPrefUtil.KEY_WMODE) != CDTPrefUtil.WMODE_REPLACE)
return;
ICdtVariable[] vars = getVariables();
for (int i=0; i<vars.length; i++)
if (!isUserVar(vars[i]))
vars[i] = null;
for (ICConfigurationDescription c : getCfs()) {
fUserSup.deleteAll(CONTEXT, c);
for (ICdtVariable macro : vars)
if (macro != null)
fUserSup.createMacro(macro, CONTEXT, c);
}
}
private ICConfigurationDescription[] getCfs() {
if (cfgd instanceof ICMultiItemsHolder)
return (ICConfigurationDescription[])
((ICMultiItemsHolder)cfgd).getItems();
else
return new ICConfigurationDescription[] {cfgd};
}
private void addOrEdit(ICdtVariable macro, boolean forAll) {
if( ! canCreate(macro))
return;
if (cfgd != null) {
if (forAll) {
for (ICConfigurationDescription c : page.getCfgsEditable())
fUserSup.createMacro(macro, CONTEXT, c);
} else {
if (page.isMultiCfg() && cfgd instanceof ICMultiItemsHolder) {
for (ICConfigurationDescription c : getCfs())
fUserSup.createMacro(macro, CONTEXT, c);
replaceMacros();
} else
fUserSup.createMacro(macro, CONTEXT, cfgd);
}
}
else if (vars != null)
vars.createMacro(macro);
updateData();
}
private void handleAddButton() {
NewVarDialog dlg = new NewVarDialog(usercomp.getShell(), null, cfgd, getVariables());
if(dlg.open() == Dialog.OK)
addOrEdit(dlg.getDefinedMacro(), dlg.isForAllCfgs);
}
private void handleEditButton() {
ICdtVariable _vars[] = getSelectedUserMacros();
if(_vars != null && _vars.length == 1){
NewVarDialog dlg = new NewVarDialog(usercomp.getShell() ,_vars[0], cfgd, getVariables());
if(dlg.open() == Dialog.OK)
addOrEdit(dlg.getDefinedMacro(), false);
}
}
private void handleDelButton() {
ICdtVariable macros[] = getSelectedUserMacros();
if(macros != null && macros.length > 0){
if(MessageDialog.openQuestion(usercomp.getShell(),
UIMessages.getString(DELETE_CONFIRM_TITLE),
UIMessages.getString(DELETE_CONFIRM_MESSAGE))){
for(int i = 0; i < macros.length; i++){
if (cfgd != null) {
if (dlg.isForAllCfgs) {
ICConfigurationDescription[] cfgs = page.getCfgsEditable();
for (int k=0; k<cfgs.length; k++)
fUserSup.createMacro(macro, CONTEXT, cfgs[k]);
} else {
if (page.isMultiCfg() && cfgd instanceof ICMultiItemsHolder) {
ICConfigurationDescription[] cfs = (ICConfigurationDescription[])((ICMultiItemsHolder)cfgd).getItems();
for (int k=0; k<cfs.length; k++)
fUserSup.createMacro(macro, CONTEXT, cfs[k]);
} else
fUserSup.createMacro(macro, CONTEXT, cfgd);
if (page.isMultiCfg() && cfgd instanceof ICMultiItemsHolder) {
ICConfigurationDescription[] cfs = (ICConfigurationDescription[])((ICMultiItemsHolder)cfgd).getItems();
for (int k=0; k<cfs.length; k++)
fUserSup.deleteMacro(macros[i].getName(), CONTEXT, cfs[k]);
replaceMacros();
}
}
else
fUserSup.deleteMacro(macros[i].getName(), CONTEXT, cfgd);
}
else if (vars != null)
vars.createMacro(macro);
updateData();
vars.deleteMacro(macros[i].getName());
}
updateData();
}
}
break;
case 1:{
ICdtVariable _vars[] = getSelectedUserMacros();
if(_vars != null && _vars.length == 1){
NewVarDialog dlg = new NewVarDialog(usercomp.getShell() ,_vars[0], cfgd, getVariables());
if(dlg.open() == Dialog.OK){
ICdtVariable macro = dlg.getDefinedMacro();
if(canCreate(macro)) {
if (cfgd != null) {
if (page.isMultiCfg() && cfgd instanceof ICMultiItemsHolder) {
ICConfigurationDescription[] cfs = (ICConfigurationDescription[])((ICMultiItemsHolder)cfgd).getItems();
for (int k=0; k<cfs.length; k++)
fUserSup.createMacro(macro, CONTEXT, cfs[k]);
} else
fUserSup.createMacro(macro, CONTEXT, cfgd);
}
else if (vars != null)
vars.createMacro(macro);
updateData();
}
}
}
}
break;
case 2:{
ICdtVariable macros[] = getSelectedUserMacros();
if(macros != null && macros.length > 0){
if(MessageDialog.openQuestion(usercomp.getShell(),
UIMessages.getString(DELETE_CONFIRM_TITLE),
UIMessages.getString(DELETE_CONFIRM_MESSAGE))){
for(int i = 0; i < macros.length; i++){
if (cfgd != null) {
if (page.isMultiCfg() && cfgd instanceof ICMultiItemsHolder) {
ICConfigurationDescription[] cfs = (ICConfigurationDescription[])((ICMultiItemsHolder)cfgd).getItems();
for (int k=0; k<cfs.length; k++)
fUserSup.deleteMacro(macros[i].getName(), CONTEXT, cfs[k]);
}
else
fUserSup.deleteMacro(macros[i].getName(), CONTEXT, cfgd);
}
else if (vars != null)
vars.deleteMacro(macros[i].getName());
}
updateData();
}
}
}
break;
}
}
/*
@ -359,7 +384,7 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
public void createControls(Composite parent) {
super.createControls(parent);
initButtons(new String[] {ADD_STR, EDIT_STR, DEL_STR});
usercomp.setLayout(new GridLayout(1, false));
usercomp.setLayout(new GridLayout(2, true));
createTableControl();
// Create a "show parent levels" button
@ -374,13 +399,31 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
updateData(getResDesc());
}
});
// if (page.isForPrefs()) b.setVisible(false);
lb1 = new Label(usercomp, SWT.BORDER | SWT.CENTER);
lb1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
lb1.setToolTipText(UIMessages.getString("EnvironmentTab.15")); //$NON-NLS-1$
lb1.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
CDTPrefUtil.spinDMode();
updateData();
}});
fStatusLabel = new Label(usercomp, SWT.LEFT);
fStatusLabel.setFont(usercomp.getFont());
fStatusLabel.setText(EMPTY_STR);
fStatusLabel.setLayoutData(new GridData(GridData.BEGINNING));
fStatusLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));
lb2 = new Label(usercomp, SWT.BORDER | SWT.CENTER);
lb2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
lb2.setToolTipText(UIMessages.getString("EnvironmentTab.23")); //$NON-NLS-1$
lb2.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
CDTPrefUtil.spinWMode();
updateLbs(null, lb2);
}});
}
private void createTableControl(){
@ -399,8 +442,7 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
table.setLayout(tableLayout);
table.setHeaderVisible(true);
table.setLinesVisible(true);
GridData gd = new GridData(GridData.FILL_BOTH);
tableViewer.getControl().setLayoutData(gd);
tableViewer.setContentProvider(new MacroContentProvider());
tableViewer.setLabelProvider(new MacroLabelProvider());
tableViewer.setSorter(new ViewerSorter());
@ -426,8 +468,11 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
public void keyReleased(KeyEvent e){}
});
table.setLayoutData(new GridData(GridData.FILL_BOTH));
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
table.setLayoutData(gd);
}
/*
* answers whether the macro of a given name can be sreated
@ -479,7 +524,7 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
ICdtVariable[][] vs = new ICdtVariable[cfs.length][];
for (int i=0; i<cfs.length; i++)
vs[i] = vmgr.getVariables(cfs[i]);
Object[] obs = mih.getListForDisplay(vs, comparator);
Object[] obs = CDTPrefUtil.getListForDisplay(vs, comparator);
ICdtVariable[] v = new ICdtVariable[obs.length];
System.arraycopy(obs, 0, v, 0, obs.length);
return v;
@ -494,6 +539,9 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
// get variables
ICdtVariable[] _vars = getVariables();
if (_vars == null) return;
updateLbs(lb1, lb2);
if (cfgd == null) {
if (fShowSysMacros) {
List<ICdtVariable> lst = new ArrayList<ICdtVariable>(_vars.length);
@ -586,7 +634,7 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
return value;
}
public void performApply(ICResourceDescription src, ICResourceDescription dst) {
protected void performApply(ICResourceDescription src, ICResourceDescription dst) {
if (cfgd != null) {// only for project, not for prefs
if (page.isMultiCfg()) {
if (src instanceof ICMultiItemsHolder &&

View file

@ -8,13 +8,11 @@
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.settings.model;
package org.eclipse.cdt.core.model;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import org.eclipse.cdt.core.model.util.CDTListComparator;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
@ -26,8 +24,6 @@ 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<Object> comp = CDTListComparator.getInstance();
ICLanguageSetting[] items = null;
ICConfigurationDescription cfgd = null;
@ -40,34 +36,18 @@ public class MultiLanguageSetting extends MultiItemsHolder implements ICLanguage
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#getLanguageId()
*/
public String getLanguageId() {
System.out.println("Bad multi access: MultiLanguageSetting.getLanguageId()");
return null; // IDs are different.
}
private ICLanguageSettingEntry[] conv2LSE(Object[] ob) {
ICLanguageSettingEntry[] se = new ICLanguageSettingEntry[ob.length];
System.arraycopy(ob, 0, se, 0, ob.length);
return se;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#getResolvedSettingEntries(int)
*/
public ICLanguageSettingEntry[] getResolvedSettingEntries(int kind) {
ICLanguageSettingEntry[][] le = new ICLanguageSettingEntry[items.length][];
for (int i=0; i<items.length; i++)
le[i] = items[i].getResolvedSettingEntries(kind);
return conv2LSE(getListForDisplay(le, comp));
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#getSettingEntries(int)
*/
public ICLanguageSettingEntry[] getSettingEntries(int kind) {
public ICLanguageSettingEntry[][] getSettingEntriesM(int kind) {
ICLanguageSettingEntry[][] le = new ICLanguageSettingEntry[items.length][];
for (int i=0; i<items.length; i++)
le[i] = items[i].getSettingEntries(kind);
return conv2LSE(getListForDisplay(le, comp));
return le;
// return conv2LSE(getListForDisplay(le, comp));
}
/* (non-Javadoc)
@ -80,21 +60,21 @@ public class MultiLanguageSetting extends MultiItemsHolder implements ICLanguage
/* (non-Javadoc)
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#getSourceContentTypeIds()
*/
public String[] getSourceContentTypeIds() {
public String[][] getSourceContentTypeIdsM() {
String[][] ss = new String[items.length][];
for (int i=0; i<items.length; i++)
ss[i] = items[i].getSourceContentTypeIds();
return this.getStrListForDisplay(ss);
return ss;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#getSourceExtensions()
*/
public String[] getSourceExtensions() {
public String[][] getSourceExtensionsM() {
String[][] ss = new String[items.length][];
for (int i=0; i<items.length; i++)
ss[i] = items[i].getSourceExtensions();
return this.getStrListForDisplay(ss);
return ss;
}
/* (non-Javadoc)
@ -110,9 +90,7 @@ public class MultiLanguageSetting extends MultiItemsHolder implements ICLanguage
/* (non-Javadoc)
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#setLanguageId(java.lang.String)
*/
public void setLanguageId(String id) { // Do nothing
System.out.println("Bad multi access: MultiLanguageSetting.setLanguageId()");
}
public void setLanguageId(String id) {} // Do nothing
/* (non-Javadoc)
* @see org.eclipse.cdt.core.settings.model.ICLanguageSetting#setSettingEntries(int, org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry[])
@ -222,4 +200,21 @@ public class MultiLanguageSetting extends MultiItemsHolder implements ICLanguage
return items;
}
public ICLanguageSettingEntry[] getResolvedSettingEntries(int kind) {
return null;
}
public ICLanguageSettingEntry[] getSettingEntries(int kind) {
ICLanguageSettingEntry[][] ses = getSettingEntriesM(kind);
return ses[0];
}
public String[] getSourceContentTypeIds() {
return null;
}
public String[] getSourceExtensions() {
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
@ -219,7 +219,7 @@ public interface ICConfigurationDescription extends ICSettingContainer, ICSettin
*
* @return
*/
Map getReferenceInfo();
Map<String, String> getReferenceInfo();
/**
* sets the reference information for this configuration, i.e. the information on the projects/configurations
@ -231,7 +231,7 @@ public interface ICConfigurationDescription extends ICSettingContainer, ICSettin
* @throws WriteAccessException when the configuration description is read-only
* the description is read only if it was queried/returned by the {@link CoreModel#getProjectDescription(org.eclipse.core.resources.IProject, false)} call
*/
void setReferenceInfo(Map refs) throws WriteAccessException;
void setReferenceInfo(Map<String, String> refs) throws WriteAccessException;
/**
* returns an array of settings exported by this configuration

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
@ -11,6 +11,6 @@
package org.eclipse.cdt.core.settings.model;
public interface ICMultiConfigDescription extends ICConfigurationDescription, ICMultiItemsHolder {
String[] getErrorParserIDs();
String[][] getErrorParserIDs();
void setErrorParserIDs(String[] s);
}

View file

@ -0,0 +1,17 @@
/*******************************************************************************
* 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.settings.model;
import java.util.Comparator;
public interface ICMultiFolderDescription extends ICFolderDescription {
public ICLanguageSetting[][] getLanguageSettingsM(Comparator<Object> comp);
}

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
@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.core.settings.model;
import java.util.Comparator;
/**
* Implementors of this interface are intended
@ -25,74 +24,11 @@ import java.util.Comparator;
*
*/
public interface ICMultiItemsHolder {
/*
* Constants for String list display mode
*/
// display conjunction of lists entries (common ones)
public static final int DMODE_CONJUNCTION = 1;
// display empty list if item's lists are different
public static final int DMODE_EMPTY = 2;
// display all items from all lists (except doubles)
public static final int DMODE_ALL = 4;
// display modes mask
public static final int DMODES = DMODE_CONJUNCTION | DMODE_EMPTY | DMODE_ALL;
/*
* Constants for string list apply mode
*/
// write to all items the list presented now.
public static final int WMODE_CURRENT = 8;
// apply to all items all insertions/deletions made
public static final int WMODE_DIFF = 16;
// write modes mask
public static final int WMODES = WMODE_CURRENT | WMODE_DIFF;
// default setting
public static final int MODE_DEFAULT = DMODE_CONJUNCTION | WMODE_CURRENT;
/*
* General purpose objects
*/
public static final String EMPTY_STR = "";
public static final Object[] EMPTY_ARRAY = new Object[0];
/**
* Returns array of items which it holds
* @return
*/
Object[] getItems();
/**
* @see DMODE_CONJUNCTION
* @see DMODE_EMPTY
* @see DMODE_ALL
* @see WMODE_DIFF
* @see WMODE_CURRENT
* @return current string list mode (OR'ed display and write modes)
*/
int getStringListMode();
/**
* @see DMODE_CONJUNCTION
* @see DMODE_EMPTY
* @see DMODE_ALL
* @see WMODE_DIFF
* @see WMODE_CURRENT
*
* @param mode: OR'ed display and write modes
*/
void setStringListMode(int mode);
/*
* A set of methods which form an array of objects
* on a basis of 2-dim array and DISPLAY MODE
*/
String[] getStrListForDisplay(String[][] input);
String[] getStrListForDisplay(String[][] input, int mode);
// Object[] getListForDisplay(Object[][] input);
// Object[] getListForDisplay(Object[][] input, int mode);
Object[] getListForDisplay(Object[][] input, Comparator cmp);
// Object[] getListForDisplay(Object[][] input, int mode, Comparator cmp);
}

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
@ -10,12 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.core.settings.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.internal.core.settings.model.MultiConfigDescription;
/**
@ -23,126 +17,14 @@ import org.eclipse.cdt.internal.core.settings.model.MultiConfigDescription;
*
*/
public abstract class MultiItemsHolder implements ICMultiItemsHolder {
protected int fListMode = MODE_DEFAULT;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.settings.model.ICMultiItemsHolder#getItems()
*/
public abstract Object[] getItems();
/* (non-Javadoc)
* @see org.eclipse.cdt.core.settings.model.ICMultiItemsHolder#getStringListMode()
*/
public int getStringListMode() {
return fListMode;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.settings.model.ICMultiItemsHolder#setStringListMode(int)
*/
public void setStringListMode(int mode) {
int a = mode & DMODES;
int b = mode & WMODES;
if (a == DMODES || b == WMODES) { // conflicting settings;
CCorePlugin.log("Wrong string list mode: " + mode);
return;
}
else if (a == 0) // display mode not set
mode |= (fListMode & DMODES); // use existing
else if (b == 0) // write mode not set
mode |= (fListMode & WMODES); // use existing
fListMode = mode & (DMODES | WMODES);
}
public final String[] getStrListForDisplay(String[][] input) {
return getStrListForDisplay(input, getStringListMode());
}
public final String[] getStrListForDisplay(String[][] input, int mode) {
Object[] ob = getListForDisplay(input, getStringListMode(), null);
String[] ss = new String[ob.length];
System.arraycopy(ob, 0, ss, 0, ob.length);
return ss;
}
public final Object[] getListForDisplay(Object[][] input, Comparator cmp) {
return getListForDisplay(input, getStringListMode(), cmp);
}
/**
* Utility method forms string list
* according to current list display mode
*
* @param input - array of string arrays
* @return
*/
private final Object[] getListForDisplay(Object[][] input, int mode, Comparator cmp) {
if (input == null || input.length == 0)
return EMPTY_ARRAY;
if (input.length == 1) {
return (input[0] == null) ?
EMPTY_ARRAY :
input[0];
}
Object[] s1 = input[0];
if (s1 == null ||
s1.length == 0)
return EMPTY_ARRAY;
if ((mode & DMODES) == DMODE_EMPTY) {
Arrays.sort(s1, cmp);
for (int i=1; i<input.length; i++) {
Object[] s2 = input[i];
if (s2 == null ||
s2.length == 0 ||
s1.length != s2.length)
return EMPTY_ARRAY;
Arrays.sort(s2, cmp);
if (! Arrays.equals(s1, s2))
return EMPTY_ARRAY;
}
return s1; // returns sorted strings !
}
else if ((getStringListMode() & DMODES) == DMODE_CONJUNCTION)
{
ArrayList lst = new ArrayList();
for (int i=0; i<s1.length; i++) {
if (s1[i] == null)
continue;
boolean found = true;
for (int k = 1; k<input.length; k++) {
Object[] s2 = input[k];
if (s2 == null || s2.length == 0)
return EMPTY_ARRAY;
if (i == 0)
Arrays.sort(s2, cmp);
if (Arrays.binarySearch(s2, s1[i], cmp) < 0) {
found = false;
break;
}
}
if (found) {
lst.add(s1[i]);
}
}
return lst.toArray();
}
else // DMODE_ALL
{
HashSet lst = new HashSet(); // set, to avoid doubles
for (int i=0; i<input.length; i++) {
if (input[i] == null ||
input[i].length == 0)
continue;
for (int j=0; j<input[i].length; j++)
lst.add(input[i][j]);
}
s1 = lst.toArray();
Arrays.sort(s1, cmp);
return s1;
}
}
/**
* This method is put here to prevent UI from
* accessing constructors in "internal" dirs.
@ -162,12 +44,12 @@ public abstract class MultiItemsHolder implements ICMultiItemsHolder {
*
* @return multiple cfg.description or single cfg.desc.
*/
public static ICConfigurationDescription createCDescription(ICConfigurationDescription[] rds, int mode) {
public static ICConfigurationDescription createCDescription(ICConfigurationDescription[] rds) {
if (rds == null || rds.length == 0)
return null;
else if (rds.length == 1)
return rds[0];
else
return new MultiConfigDescription(rds, mode);
return new MultiConfigDescription(rds);
}
}

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
@ -251,7 +251,7 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
public CDataObject[] getChildren() {
CConfigurationData data = getConfigurationData(false);
List list = new ArrayList();
List<CDataObject> list = new ArrayList<CDataObject>();
CResourceData rcDatas[] = data.getResourceDatas();
for(int i = 0; i < rcDatas.length; i++){
list.add(rcDatas[i]);
@ -261,7 +261,7 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
CBuildData buildData = data.getBuildData();
list.add(buildData);
// TODO add other data types
return (CDataObject[])list.toArray(new CDataObject[list.size()]);
return list.toArray(new CDataObject[list.size()]);
}
public boolean isStatic() {
@ -526,16 +526,16 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
// return des;
// }
public Map getReferenceInfo() {
public Map<String, String> getReferenceInfo() {
try {
CConfigurationSpecSettings specs = getSpecSettings();
return specs.getReferenceInfo();
} catch (CoreException e) {
}
return new HashMap(0);
return new HashMap<String, String>(0);
}
public void setReferenceInfo(Map refs) {
public void setReferenceInfo(Map<String, String> refs) {
try {
CConfigurationSpecSettings specs = getSpecSettings();
specs.setReferenceInfo(refs);

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
@ -67,7 +67,7 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
private StorableCdtVariables fMacros;
private StorableEnvironment fEnvironment;
// private HashMap fRefInfoMap;
private Map fRefMapCache;
private Map<String, String> fRefMapCache;
private CExternalSettingsHolder fExtSettingsProvider = new CExternalSettingsHolder();
private boolean fIsModified;
private HashMap fSessionPropertiesMap;
@ -387,12 +387,12 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
fEnvironment = environment;
}
public Map getReferenceInfo(){
public Map<String, String> getReferenceInfo(){
if(!fCfg.isReadOnly())
return CfgExportSettingContainerFactory.getReferenceMap(fCfg);
if(fRefMapCache == null)
fRefMapCache = CfgExportSettingContainerFactory.getReferenceMap(fCfg);
return new HashMap(fRefMapCache);
return new HashMap<String, String>(fRefMapCache);
// if(fRefInfoMap == null || fRefInfoMap.size() == 0)
// return new HashMap(0);
//
@ -420,7 +420,7 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
// fIsModified = true;
// }
public void setReferenceInfo(Map ref){
public void setReferenceInfo(Map<String, String> ref){
fRefMapCache = null;
CfgExportSettingContainerFactory.setReferenceMap(fCfg, ref);
// if(isReadOnly())

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
@ -114,9 +114,9 @@ public class CfgExportSettingContainerFactory extends
return new CContainerRef(FACTORY_ID, createId(projName, cfgId));
}
public static Map getReferenceMap(ICConfigurationDescription cfg){
public static Map<String, String> getReferenceMap(ICConfigurationDescription cfg){
CContainerRef[] refs = CExternalSettingsManager.getInstance().getReferences(cfg, FACTORY_ID);
Map map = new HashMap();
Map<String, String> map = new HashMap<String, String>();
for(int i = 0; i < refs.length; i++){
try {
String[] r = parseId(refs[i].getContainerId());
@ -129,24 +129,24 @@ public class CfgExportSettingContainerFactory extends
return map;
}
public static void setReferenceMap(ICConfigurationDescription cfg, Map map){
Map cur = getReferenceMap(cfg);
Map newCopy = new HashMap(map);
public static void setReferenceMap(ICConfigurationDescription cfg, Map<String, String> map){
Map<String, String> cur = getReferenceMap(cfg);
Map<String, String> newCopy = new HashMap<String, String>(map);
for(Iterator iter = cur.entrySet().iterator(); iter.hasNext();){
Map.Entry entry = (Map.Entry)iter.next();
for(Iterator<Map.Entry<String, String>> iter = cur.entrySet().iterator(); iter.hasNext();){
Map.Entry<String, String> entry = (Map.Entry<String, String>)iter.next();
Object projName = entry.getKey();
if(newCopy.containsKey(projName) && entry.getValue().equals(newCopy.get(projName))){
iter.remove();
newCopy.remove(projName);
}
}
for(Iterator iter = cur.entrySet().iterator(); iter.hasNext();){
Map.Entry entry = (Map.Entry)iter.next();
for(Iterator<Map.Entry<String, String>> iter = cur.entrySet().iterator(); iter.hasNext();){
Map.Entry<String, String> entry = (Map.Entry<String, String>)iter.next();
removeReference(cfg, (String)entry.getKey(), (String)entry.getValue());
}
for(Iterator iter = newCopy.entrySet().iterator(); iter.hasNext();){
Map.Entry entry = (Map.Entry)iter.next();
for(Iterator<Map.Entry<String, String>> iter = newCopy.entrySet().iterator(); iter.hasNext();){
Map.Entry<String, String> entry = (Map.Entry<String, String>)iter.next();
createReference(cfg, (String)entry.getKey(), (String)entry.getValue());
}
}
@ -215,7 +215,7 @@ public class CfgExportSettingContainerFactory extends
return new String[0];
int deltaKind = delta.getDeltaKind();
List cfgIds = new ArrayList();
List<String> cfgIds = new ArrayList<String>();
switch(deltaKind){
case ICDescriptionDelta.ADDED:
case ICDescriptionDelta.REMOVED:
@ -247,9 +247,9 @@ public class CfgExportSettingContainerFactory extends
return ids;
}
public Collection collectCfgIds(ICDescriptionDelta[] deltas, Collection c){
public Collection<String> collectCfgIds(ICDescriptionDelta[] deltas, Collection<String> c){
if(c == null)
c = new ArrayList();
c = new ArrayList<String>();
for(int i = 0; i < deltas.length; i++){
ICDescriptionDelta delta = deltas[i];
int deltaKind = delta.getDeltaKind();

View file

@ -26,7 +26,6 @@ import org.eclipse.cdt.core.settings.model.ICFileDescription;
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
import org.eclipse.cdt.core.settings.model.ICMultiConfigDescription;
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.cdt.core.settings.model.ICSettingContainer;
@ -50,9 +49,8 @@ public class MultiConfigDescription extends MultiItemsHolder implements
ICConfigurationDescription[] fCfgs = null;
public MultiConfigDescription(ICConfigurationDescription[] des, int mode) {
public MultiConfigDescription(ICConfigurationDescription[] des) {
fCfgs = des;
setStringListMode(mode);
}
/* (non-Javadoc)
@ -116,11 +114,11 @@ public class MultiConfigDescription extends MultiItemsHolder implements
return null;
}
public String[] getErrorParserIDs() {
public String[][] getErrorParserIDs() {
String[][] out = new String[fCfgs.length][];
for (int i=0; i<fCfgs.length; i++)
out[i] = fCfgs[i].getBuildSetting().getErrorParserIDs();
return getStrListForDisplay(out, ICMultiItemsHolder.DMODE_CONJUNCTION);
return out;
}
public void setErrorParserIDs(String[] ids) {
@ -174,7 +172,6 @@ public class MultiConfigDescription extends MultiItemsHolder implements
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getExternalSettings()
*/
public ICExternalSetting[] getExternalSettings() {
System.out.println("Bad multi access: MultiConfigDescription.getExtSettings()");
return null;
}
@ -231,9 +228,9 @@ public class MultiConfigDescription extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#getReferenceInfo()
*/
public Map getReferenceInfo() {
public Map<String, String> getReferenceInfo() {
System.out.println("Bad multi access: MultiConfigDescription.getReferenceInfo()");
return Collections.EMPTY_MAP;
return Collections.emptyMap();
}
/* (non-Javadoc)
@ -268,12 +265,10 @@ public class MultiConfigDescription extends MultiItemsHolder implements
return (ICResourceDescription)lst.get(0);
if (isForFolder)
return new MultiFolderDescription(
(ICFolderDescription[])lst.toArray(new ICFolderDescription[lst.size()]),
getStringListMode());
(ICFolderDescription[])lst.toArray(new ICFolderDescription[lst.size()]));
else
return new MultiFileDescription(
(ICFileDescription[])lst.toArray(new ICFileDescription[lst.size()]),
getStringListMode());
(ICFileDescription[])lst.toArray(new ICFileDescription[lst.size()]));
}
/* (non-Javadoc)
@ -293,7 +288,7 @@ public class MultiConfigDescription extends MultiItemsHolder implements
ICFolderDescription[] rds = new ICFolderDescription[fCfgs.length];
for (int i=0; i<fCfgs.length; i++)
rds[i] = fCfgs[i].getRootFolderDescription();
return new MultiFolderDescription(rds, getStringListMode());
return new MultiFolderDescription(rds);
}
/* (non-Javadoc)
@ -431,7 +426,7 @@ public class MultiConfigDescription extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.core.settings.model.ICConfigurationDescription#setReferenceInfo(java.util.Map)
*/
public void setReferenceInfo(Map refs) throws WriteAccessException {
public void setReferenceInfo(Map<String, String> refs) throws WriteAccessException {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setReferenceInfo(refs);
}

View file

@ -21,8 +21,8 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
public class MultiFileDescription extends MultiResourceDescription implements
ICFileDescription {
public MultiFileDescription(ICFileDescription[] res, int mode) {
super(res, mode);
public MultiFileDescription(ICFileDescription[] res) {
super(res);
}
/* (non-Javadoc)

View file

@ -10,13 +10,12 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.settings.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import org.eclipse.cdt.core.model.util.CDTListComparator;
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
import org.eclipse.cdt.core.settings.model.ICMultiFolderDescription;
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@ -26,13 +25,10 @@ import org.eclipse.core.runtime.IPath;
*
*/
public class MultiFolderDescription extends MultiResourceDescription implements
ICFolderDescription {
ICMultiFolderDescription {
private static final Comparator<Object> comp = CDTListComparator.getInstance();
private ICLanguageSetting[] lsets = null;
public MultiFolderDescription(ICFolderDescription[] res, int mode) {
super(res, mode);
public MultiFolderDescription(ICFolderDescription[] res) {
super(res);
}
/* (non-Javadoc)
@ -70,19 +66,10 @@ public class MultiFolderDescription extends MultiResourceDescription implements
return ls0;
}
private ICLanguageSetting[] conv2LS(Object[] ob) {
ICLanguageSetting[] se = new ICLanguageSetting[ob.length];
System.arraycopy(ob, 0, se, 0, ob.length);
return se;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.settings.model.ICFolderDescription#getLanguageSettings()
*/
public ICLanguageSetting[] getLanguageSettings() {
if (lsets != null)
return lsets;
public ICLanguageSetting[][] getLanguageSettingsM(Comparator<Object> comp) {
ICLanguageSetting[][] ls = new ICLanguageSetting[fRess.length][];
for (int i=0; i<fRess.length; i++) {
if (fRess[i] instanceof ICFolderDescription) {
@ -90,21 +77,7 @@ public class MultiFolderDescription extends MultiResourceDescription implements
Arrays.sort(ls[i], comp);
}
}
ICLanguageSetting[] fs = conv2LS(getListForDisplay(ls, comp));
lsets = new ICLanguageSetting[fs.length];
for (int i=0; i<fs.length; i++) {
ArrayList<ICLanguageSetting> list = new ArrayList<ICLanguageSetting>(fRess.length);
for (int j=0; j<ls.length; j++) {
int x = Arrays.binarySearch(ls[j], fs[i], comp);
if (x >= 0)
list.add(ls[j][x]);
}
if (list.size() == 1)
lsets[i] = (ICLanguageSetting)list.get(0);
else if (list.size() > 1)
lsets[i] = new MultiLanguageSetting(list, getConfiguration());
}
return lsets;
return ls;
}
/* (non-Javadoc)
@ -137,9 +110,13 @@ public class MultiFolderDescription extends MultiResourceDescription implements
*/
public boolean isRoot() {
for (int i=0; i<fRess.length; i++)
if (! ((ICFolderDescription)fRess[0]).isRoot())
if (! ((ICFolderDescription)fRess[i]).isRoot())
return false;
return true;
}
public ICLanguageSetting[] getLanguageSettings() {
return ((ICFolderDescription)fRess[0]).getLanguageSettings();
}
}

View file

@ -31,9 +31,8 @@ public abstract class MultiResourceDescription extends MultiItemsHolder implemen
ICResourceDescription[] fRess = null;
ICConfigurationDescription fCfg = null;
public MultiResourceDescription(ICResourceDescription[] res, int mode) {
public MultiResourceDescription(ICResourceDescription[] res) {
fRess = res;
setStringListMode(mode);
}
/* (non-Javadoc)
@ -115,7 +114,7 @@ public abstract class MultiResourceDescription extends MultiItemsHolder implemen
ICConfigurationDescription[] cfgs = new ICConfigurationDescription[fRess.length];
for (int i=0; i<fRess.length; i++)
cfgs[i] = fRess[i].getConfiguration();
fCfg = new MultiConfigDescription(cfgs, getStringListMode());
fCfg = new MultiConfigDescription(cfgs);
}
return fCfg;
}

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
@ -26,7 +26,13 @@ public interface IContributedEnvironment {
int op,
String delimiter,
ICConfigurationDescription des);
IEnvironmentVariable addVariable(IEnvironmentVariable var,
ICConfigurationDescription des);
void addVariables(IEnvironmentVariable[] vars,
ICConfigurationDescription des);
IEnvironmentVariable removeVariable(String name, ICConfigurationDescription des);
void restoreDefaults(ICConfigurationDescription des);

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,11 +27,6 @@ public class ContributedEnvironment implements IContributedEnvironment{
private IEnvironmentContextInfo fBaseInfo;
private ICoreEnvironmentVariableSupplier fSuppliers[];
/* public ContributedEnvContextInfo(Object context,
ICoreEnvironmentVariableSupplier[] suppliers) {
super(context, suppliers);
}
*/
public ContributedEnvContextInfo(IEnvironmentContextInfo info) {
super(info.getContext());
fBaseInfo = info;
@ -77,7 +72,7 @@ public class ContributedEnvironment implements IContributedEnvironment{
EnvVarCollector cr = EnvironmentVariableManager.getVariables(getContextInfo(des), true);
if(cr != null){
EnvVarDescriptor collected[] = cr.toArray(true);
List vars = new ArrayList(collected.length);
List<IEnvironmentVariable> vars = new ArrayList<IEnvironmentVariable>(collected.length);
IEnvironmentVariable var;
IEnvironmentContextInfo info = new DefaultEnvironmentContextInfo(des);//getContextInfo(des);
for(int i = 0; i < collected.length; i++){
@ -86,7 +81,7 @@ public class ContributedEnvironment implements IContributedEnvironment{
if(var != null)
vars.add(var);
}
return (EnvVarDescriptor[])vars.toArray(new EnvVarDescriptor[vars.size()]);
return vars.toArray(new EnvVarDescriptor[vars.size()]);
}
return new EnvVarDescriptor[0];
}
@ -118,6 +113,21 @@ public class ContributedEnvironment implements IContributedEnvironment{
EnvironmentVariableManager.fUserSupplier);
}
public void addVariables(IEnvironmentVariable[] vars,
ICConfigurationDescription des) {
for (IEnvironmentVariable v : vars)
addVariable(v, des);
}
public IEnvironmentVariable addVariable(IEnvironmentVariable var,
ICConfigurationDescription des) {
return addVariable(var.getName(),
var.getValue(),
var.getOperation(),
var.getDelimiter(),
des);
}
public IEnvironmentVariable removeVariable(String name, ICConfigurationDescription des){
return EnvironmentVariableManager.fUserSupplier.deleteVariable(name, des);
}
@ -135,6 +145,6 @@ public class ContributedEnvironment implements IContributedEnvironment{
public void serialize(ICProjectDescription des){
EnvironmentVariableManager.fUserSupplier.storeProjectEnvironment(des, false);
}
}

View file

@ -632,4 +632,28 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
protected void setBackgroundText(String s) {
background.setText(s == null ? BACKGROUND_TEXT_DEFAULT : s);
}
protected void updateLbs(Label lb1, Label lb2) {
if (page.isMultiCfg()) {
if (lb1 != null) {
lb1.setText(CDTPrefUtil.getDMode());
lb1.setVisible(true);
}
if (lb2 != null) {
lb2.setText(CDTPrefUtil.getWMode());
lb2.setVisible(true);
}
} else {
if (lb1 != null)
lb1.setVisible(false);
if (lb2 != null)
lb2.setVisible(false);
}
}
protected boolean isWModifyMode() {
int wmode = CDTPrefUtil.getInt(CDTPrefUtil.KEY_WMODE);
return (wmode == CDTPrefUtil.WMODE_MODIFY);
}
}

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.ui.newui;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
@ -27,6 +28,8 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
@ -39,6 +42,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Tree;
@ -47,6 +51,7 @@ import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.cdt.core.model.ILanguageDescriptor;
import org.eclipse.cdt.core.model.LanguageManager;
import org.eclipse.cdt.core.model.MultiLanguageSetting;
import org.eclipse.cdt.core.model.util.CDTListComparator;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICExternalSetting;
@ -54,6 +59,7 @@ import org.eclipse.cdt.core.settings.model.ICFileDescription;
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICMultiFolderDescription;
import org.eclipse.cdt.core.settings.model.ICMultiResourceDescription;
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.cdt.core.settings.model.ICSettingBase;
@ -69,6 +75,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
protected Button showBIButton;
protected boolean toAllCfgs = false;
protected boolean toAllLang = false;
protected Label lb1, lb2;
protected ICLanguageSetting lang;
protected LinkedList<ICLanguageSettingEntry> incs;
@ -81,6 +88,8 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
protected final static String[] BUTTSYM = {ADD_STR, EDIT_STR, DEL_STR,
UIMessages.getString("AbstractLangsListTab.2")}; //$NON-NLS-1$
private static final Comparator<Object> comp = CDTListComparator.getInstance();
private final static Image IMG_FS = CPluginImages.get(CPluginImages.IMG_FILESYSTEM);
private final static Image IMG_WS = CPluginImages.get(CPluginImages.IMG_WORKSPACE);
private final static Image IMG_MK = CPluginImages.get(CPluginImages.IMG_OBJS_MACRO);
@ -88,12 +97,14 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
public void createControls(Composite parent) {
super.createControls(parent);
usercomp.setLayout(new GridLayout(1, false));
usercomp.setLayout(new GridLayout(2, true));
// Create the sash form
sashForm = new SashForm(usercomp, SWT.NONE);
sashForm.setOrientation(SWT.HORIZONTAL);
sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
sashForm.setLayoutData(gd);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
@ -102,7 +113,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
addTree(sashForm).setLayoutData(new GridData(GridData.FILL_VERTICAL));
table = new Table(sashForm, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.FULL_SELECTION);
GridData gd = new GridData(GridData.FILL_BOTH);
gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 255;
table.setLayoutData(gd);
table.setHeaderVisible(true);
@ -153,12 +164,32 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
}
});
setupLabel(usercomp, EMPTY_STR, 1, 0);
lb1 = new Label(usercomp, SWT.BORDER | SWT.CENTER);
lb1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
lb1.setToolTipText(UIMessages.getString("EnvironmentTab.15")); //$NON-NLS-1$
lb1.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
CDTPrefUtil.spinDMode();
update();
}});
showBIButton = setupCheck(usercomp, UIMessages.getString("AbstractLangsListTab.0"), 1, GridData.FILL_HORIZONTAL); //$NON-NLS-1$
showBIButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
update();
}
});
lb2 = new Label(usercomp, SWT.BORDER | SWT.CENTER);
lb2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
lb2.setToolTipText(UIMessages.getString("EnvironmentTab.23")); //$NON-NLS-1$
lb2.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
CDTPrefUtil.spinWMode();
updateLbs(null, lb2);
}});
additionalTableSet();
initButtons((getKind() == ICSettingEntry.MACRO) ? BUTTSYM : BUTTONS);
updateData(getResDesc());
@ -195,10 +226,10 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
buttonSetEnabled(0, canAdd); // add
buttonSetEnabled(1, canEdit); // edit
buttonSetEnabled(2, canDelete); // delete
buttonSetEnabled(3, canExport); // export
buttonSetEnabled(3, canExport && !page.isMultiCfg()); // export
// there is a separator instead of button #4
buttonSetEnabled(5, canMoveUp); // up
buttonSetEnabled(6, canMoveDown); // down
buttonSetEnabled(5, canMoveUp && !page.isMultiCfg()); // up
buttonSetEnabled(6, canMoveDown && !page.isMultiCfg()); // down
}
private Tree addTree(Composite comp) {
@ -260,28 +291,34 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
if (x == -1) x = 0;
else x += shift; // used only for UP/DOWN
incs = new LinkedList<ICLanguageSettingEntry>();
List<ICLanguageSettingEntry> lst = getSettingEntriesList(getKind());
if (lst != null) {
for (ICLanguageSettingEntry ent : lst) {
if (!ent.isBuiltIn())
incs.add(ent);
}
if (showBIButton.getSelection()) {
ArrayList<ICLanguageSettingEntry> lstS = new ArrayList<ICLanguageSettingEntry>();
for (ICLanguageSettingEntry ent : lst)
if (ent.isBuiltIn())
lstS.add(ent);
incs.addAll(lstS);
}
}
incs = getIncs();
tv.setInput(incs.toArray(new Object[incs.size()]));
if (table.getItemCount() > x) table.select(x);
else if (table.getItemCount() > 0) table.select(0);
}
updateLbs(lb1, lb2);
updateButtons();
}
protected LinkedList<ICLanguageSettingEntry> getIncs() {
LinkedList<ICLanguageSettingEntry> l = new LinkedList<ICLanguageSettingEntry>();
List<ICLanguageSettingEntry> lst = getSettingEntriesList(getKind());
if (lst != null) {
for (ICLanguageSettingEntry ent : lst) {
if (!ent.isBuiltIn())
l.add(ent);
}
if (showBIButton.getSelection()) {
for (ICLanguageSettingEntry ent : lst)
if (ent.isBuiltIn())
l.add(ent);
}
}
return l;
}
/**
* Called when configuration changed
* Refreshes languages list and calls table refresh.
@ -336,11 +373,82 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
}
}
}
private void performAdd(ICLanguageSettingEntry ent) {
if (ent != null) {
if ((toAllCfgs || toAllLang) && ! (getResDesc() instanceof ICMultiResourceDescription)) {
addToAll(ent);
} else {
if (isWModifyMode() && (lang instanceof MultiLanguageSetting)) {
performMulti(ent, false);
} else {
incs.add(ent);
setSettingEntries(getKind(), incs, toAllLang);
}
}
update();
}
}
private void performMulti(ICLanguageSettingEntry ent, boolean delete) {
MultiLanguageSetting ms = (MultiLanguageSetting)lang;
ICLanguageSetting[] ls = (ICLanguageSetting[])ms.getItems();
ICLanguageSettingEntry[][] es = ms.getSettingEntriesM(getKind());
for (int i=0; i<ls.length; i++) {
List<ICLanguageSettingEntry> entries =
new ArrayList<ICLanguageSettingEntry>(Arrays.asList(es[i]));
for (ICLanguageSettingEntry e : entries)
if (e.getName().equals(ent.getName())) {
entries.remove(e);
break;
}
if (!delete)
entries.add(ent);
ls[i].setSettingEntries(getKind(), entries);
}
}
private void performEdit(int n) {
if (n == -1) return;
ICLanguageSettingEntry old = (ICLanguageSettingEntry)(table.getItem(n).getData());
if (old.isReadOnly()) return;
ICLanguageSettingEntry ent = doEdit(old);
if (ent != null) {
if (isWModifyMode() && (lang instanceof MultiLanguageSetting)) {
performMulti(ent, false);
} else {
int toModify = incs.indexOf(old);
incs.remove(toModify);
incs.add(toModify, ent);
setSettingEntries(getKind(), incs, false);
}
update();
}
}
private void performDelete(int n) {
if (n == -1) return;
int[] ids = table.getSelectionIndices();
if (isWModifyMode() && (lang instanceof MultiLanguageSetting)) {
for (int x=ids.length-1; x>=0; x--) {
ICLanguageSettingEntry old = (ICLanguageSettingEntry)(table.getItem(ids[x]).getData());
performMulti(old, true);
}
} else {
for (int x=ids.length-1; x>=0; x--) {
ICLanguageSettingEntry old = (ICLanguageSettingEntry)(table.getItem(ids[x]).getData());
if (old.isReadOnly()) continue;
incs.remove(old);
}
setSettingEntries(getKind(), incs, false);
}
update();
}
/**
* Unified buttons handler
*/
public void buttonPressed(int i) {
ICLanguageSettingEntry ent;
ICLanguageSettingEntry old;
int n = table.getSelectionIndex();
int ids[] = table.getSelectionIndices();
@ -349,39 +457,13 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
case 0: // add
toAllCfgs = false;
toAllLang = false;
ent = doAdd();
if (ent != null) {
if ((toAllCfgs || toAllLang) && ! (getResDesc() instanceof ICMultiResourceDescription)) {
addToAll(ent);
} else {
incs.add(ent);
setSettingEntries(getKind(), incs, toAllLang);
}
update();
}
performAdd(doAdd());
break;
case 1: // edit
if (n == -1) return;
old = (ICLanguageSettingEntry)(table.getItem(n).getData());
if (old.isReadOnly()) return;
ent = doEdit(old);
if (ent != null) {
int toModify = incs.indexOf(old);
incs.remove(toModify);
incs.add(toModify, ent);
setSettingEntries(getKind(), incs, false);
update();
}
performEdit(n);
break;
case 2: // delete
if (n == -1) return;
for (int x=ids.length-1; x>=0; x--) {
old = (ICLanguageSettingEntry)(table.getItem(ids[x]).getData());
if (old.isReadOnly()) continue;
incs.remove(old);
}
setSettingEntries(getKind(), incs, false);
update();
performDelete(n);
break;
case 3: // toggle export
if (n == -1) return;
@ -472,8 +554,13 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
ICLanguageSetting [] sr = getLangSetting(src);
ICLanguageSetting [] ds = getLangSetting(dst);
if (sr == null || ds == null || sr.length != ds.length) return;
for (int i=0; i<sr.length; i++) {
ds[i].setSettingEntries(getKind(), sr[i].getSettingEntries(getKind()));
if (page.isMultiCfg()) {
// TODO: Apply for multi !
} else {
for (int i=0; i<sr.length; i++) {
ds[i].setSettingEntries(getKind(), sr[i].getSettingEntries(getKind()));
}
}
}
protected void performDefaults() {
@ -543,7 +630,10 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
case ICSettingBase.SETTING_CONFIGURATION:
case ICSettingBase.SETTING_FOLDER:
ICFolderDescription foDes = (ICFolderDescription)rcDes;
return foDes.getLanguageSettings();
if (foDes instanceof ICMultiFolderDescription) {
return getLS((ICMultiFolderDescription)foDes);
} else
return foDes.getLanguageSettings();
case ICSettingBase.SETTING_FILE:
ICFileDescription fiDes = (ICFileDescription)rcDes;
ICLanguageSetting ls = fiDes.getLanguageSetting();
@ -552,6 +642,28 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
return null;
}
private ICLanguageSetting[] getLS(ICMultiFolderDescription foDes) {
ICLanguageSetting[] lsets;
ICLanguageSetting[][] ls = foDes.getLanguageSettingsM(comp);
ICLanguageSetting[] fs = conv2LS(CDTPrefUtil.getListForDisplay(ls, comp));
lsets = new ICLanguageSetting[fs.length];
for (int i=0; i<fs.length; i++) {
ArrayList<ICLanguageSetting> list = new ArrayList<ICLanguageSetting>(ls.length);
for (int j=0; j<ls.length; j++) {
int x = Arrays.binarySearch(ls[j], fs[i], comp);
if (x >= 0)
list.add(ls[j][x]);
}
if (list.size() == 1)
lsets[i] = list.get(0);
else if (list.size() > 1)
lsets[i] = new MultiLanguageSetting(list, foDes.getConfiguration());
}
return lsets;
}
public boolean canBeVisible() {
if (getResDesc() == null) return true;
ICLanguageSetting [] ls = getLangSetting(getResDesc());
@ -570,6 +682,20 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
lang.setSettingEntries(kind, incs);
}
private List<ICLanguageSettingEntry> getSettingEntriesList(int kind) {
return lang.getSettingEntriesList(kind);
if (page.isMultiCfg() && lang instanceof MultiLanguageSetting) {
ICLanguageSettingEntry[][] lses = ((MultiLanguageSetting)lang).getSettingEntriesM(kind);
Object[] res = CDTPrefUtil.getListForDisplay(lses, comp);
ICLanguageSettingEntry[] out = new ICLanguageSettingEntry[res.length];
System.arraycopy(res, 0, out, 0, res.length);
return Arrays.asList(out);
} else
return lang.getSettingEntriesList(kind);
}
private ICLanguageSetting[] conv2LS(Object[] ob) {
ICLanguageSetting[] se = new ICLanguageSetting[ob.length];
System.arraycopy(ob, 0, se, 0, ob.length);
return se;
}
}

View file

@ -401,9 +401,7 @@ implements
cfgIndex = selectionIndex;
}
}
// TODO: avoid repeated update like for single cfg
cfgChanged(MultiItemsHolder.createCDescription(multiCfgs,
ICMultiItemsHolder.MODE_DEFAULT));
cfgChanged(MultiItemsHolder.createCDescription(multiCfgs));
return;
} else {
String id1 = getResDesc() == null ? null : getResDesc().getId();
@ -1013,7 +1011,9 @@ implements
return true; // Projects and folders are always applicable
}
// update views (in particular, display resource configurations)
/**
* update views (in particular, display resource configurations)
*/
public static void updateViews(IResource res) {
if (res == null) return;
IWorkbenchPartReference refs[] = CUIPlugin.getActiveWorkbenchWindow().getActivePage().getViewReferences();
@ -1023,7 +1023,10 @@ implements
((IPropertyChangeListener)part).propertyChange(new PropertyChangeEvent(res, PreferenceConstants.PREF_SHOW_CU_CHILDREN, null, null));
}
}
/**
* Adjusts form size according to contents dimensions
*/
public void resize() {
Shell sh = parentComposite.getShell();
Point p0 = sh.getLocation();
@ -1034,9 +1037,18 @@ implements
sh.setSize(p1);
}
/**
* Returns Apply button widget
* Allows public access to it.
*/
public Button getAButton() {
return getApplyButton();
}
/**
* Returns Default button widget.
* Allows public access to it.
*/
public Button getDButton() {
return getDefaultsButton();
}

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
@ -10,13 +10,17 @@
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.TreeSet;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.jface.preference.IPreferenceStore;
public class CDTPrefUtil {
// boolean keys (KEY_NO-s are to be inverted !)
@ -43,19 +47,20 @@ public class CDTPrefUtil {
public static final int DISC_NAMING_DEFAULT = DISC_NAMING_UNIQUE_OR_BOTH;
public static final String KEY_DMODE = "properties.multi.displ.mode"; //$NON-NLS-1$
public static final int DMODE_EMPTY = 1;
public static final int DMODE_CONJUNCTION = 2;
public static final int DMODE_DISJUNCTION = 4;
public static final int DMODE_CONJUNCTION = 1;
public static final int DMODE_DISJUNCTION = 2;
public static final String KEY_WMODE = "properties.multi.write.mode"; //$NON-NLS-1$
public static final int WMODE_MODIFY = 8;
public static final int WMODE_REPLACE = 16;
public static final int WMODE_MODIFY = 4;
public static final int WMODE_REPLACE = 8;
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<String> preferredTCs = null;
public static final Object[] EMPTY_ARRAY = new Object[0];
// low-level methods
public static boolean getBool(String key) { return pref.getBoolean(key); }
public static void setBool(String key, boolean val) { pref.setValue(key, val); }
@ -96,4 +101,134 @@ public class CDTPrefUtil {
}
setStr(KEY_PREFTC, b.toString().trim());
}
public static String getDMode() {
String s = null;
switch(CDTPrefUtil.getInt(CDTPrefUtil.KEY_DMODE)) {
case CDTPrefUtil.DMODE_CONJUNCTION:
s = UIMessages.getString("EnvironmentTab.17"); //$NON-NLS-1$
break;
case CDTPrefUtil.DMODE_DISJUNCTION:
s = UIMessages.getString("EnvironmentTab.18"); //$NON-NLS-1$
break;
}
return UIMessages.getString("EnvironmentTab.19") + s; //$NON-NLS-1$
}
public static String getWMode() {
String s = null;
switch(CDTPrefUtil.getInt(CDTPrefUtil.KEY_WMODE)) {
case CDTPrefUtil.WMODE_MODIFY:
s = UIMessages.getString("EnvironmentTab.20"); //$NON-NLS-1$
break;
case CDTPrefUtil.WMODE_REPLACE:
s = UIMessages.getString("EnvironmentTab.21"); //$NON-NLS-1$
break;
}
return UIMessages.getString("EnvironmentTab.22") + s; //$NON-NLS-1$
}
public static void spinDMode() {
setInt(KEY_DMODE,
((getInt(KEY_DMODE) == DMODE_CONJUNCTION) ?
DMODE_DISJUNCTION :
DMODE_CONJUNCTION));
}
public static void spinWMode() {
setInt(KEY_WMODE,
((getInt(KEY_WMODE) == WMODE_MODIFY) ?
WMODE_REPLACE :
WMODE_MODIFY));
}
public static final String[] getStrListForDisplay(String[][] input) {
return getStrListForDisplay(input, getInt(KEY_DMODE));
}
private static final String[] getStrListForDisplay(String[][] input, int mode) {
Object[] ob = getListForDisplay(input, getInt(KEY_DMODE), null);
String[] ss = new String[ob.length];
System.arraycopy(ob, 0, ss, 0, ob.length);
return ss;
}
public static final Object[] getListForDisplay(Object[][] input, Comparator<Object> cmp) {
return getListForDisplay(input, getInt(KEY_DMODE), cmp);
}
/**
* Utility method forms string list
* according to current list display mode
*
* @param input - array of string arrays
* @return
*/
private static final Object[] getListForDisplay(Object[][] input, int mode, Comparator<Object> cmp) {
if (input == null || input.length == 0)
return EMPTY_ARRAY;
if (input.length == 1) {
return (input[0] == null) ?
EMPTY_ARRAY :
input[0];
}
Object[] s1 = input[0];
if (s1 == null ||
s1.length == 0)
return EMPTY_ARRAY;
/*
if (mode == DMODE_EMPTY) {
Arrays.sort(s1, cmp);
for (int i=1; i<input.length; i++) {
Object[] s2 = input[i];
if (s2 == null ||
s2.length == 0 ||
s1.length != s2.length)
return EMPTY_ARRAY;
Arrays.sort(s2, cmp);
if (! Arrays.equals(s1, s2))
return EMPTY_ARRAY;
}
return s1; // returns sorted strings !
}
*/
if (getInt(KEY_DMODE) == DMODE_CONJUNCTION)
{
ArrayList<Object> lst = new ArrayList<Object>();
for (int i=0; i<s1.length; i++) {
if (s1[i] == null)
continue;
boolean found = true;
for (int k = 1; k<input.length; k++) {
Object[] s2 = input[k];
if (s2 == null || s2.length == 0)
return EMPTY_ARRAY;
if (i == 0)
Arrays.sort(s2, cmp);
if (Arrays.binarySearch(s2, s1[i], cmp) < 0) {
found = false;
break;
}
}
if (found) {
lst.add(s1[i]);
}
}
return lst.toArray();
}
else // DMODE_ALL
{
TreeSet<Object> lst = new TreeSet<Object>(cmp); // set, to avoid doubles
for (int i=0; i<input.length; i++) {
if (input[i] == null ||
input[i].length == 0)
continue;
for (int j=0; j<input[i].length; j++)
lst.add(input[i][j]);
}
s1 = lst.toArray();
Arrays.sort(s1, cmp);
return s1;
}
}
}

View file

@ -28,6 +28,8 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.TextProcessor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@ -71,6 +73,7 @@ public class EnvironmentTab extends AbstractCPropertyTab {
private TableViewer tv;
private ArrayList<TabData> data = new ArrayList<TabData>();
private Button b1, b2;
private Label lb1, lb2;
private ICConfigurationDescription cfgd = null;
private StorableEnvironment vars = null;
@ -143,7 +146,7 @@ public class EnvironmentTab extends AbstractCPropertyTab {
public void createControls(Composite parent) {
super.createControls(parent);
usercomp.setLayout(new GridLayout(1, false));
usercomp.setLayout(new GridLayout(2, true));
Label l1 = new Label(usercomp, SWT.LEFT);
l1.setText(UIMessages.getString("EnvironmentTab.0")); //$NON-NLS-1$
l1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@ -181,8 +184,10 @@ public class EnvironmentTab extends AbstractCPropertyTab {
tc = new TableColumn(table, SWT.LEFT);
tc.setText(UIMessages.getString("EnvironmentTab.2")); //$NON-NLS-1$
tc.setWidth(200);
table.setLayoutData(new GridData(GridData.FILL_BOTH));
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
table.setLayoutData(gd);
b1 = new Button(usercomp, SWT.RADIO);
b1.setText(UIMessages.getString("EnvironmentTab.3")); //$NON-NLS-1$
@ -196,6 +201,15 @@ public class EnvironmentTab extends AbstractCPropertyTab {
updateData();
}});
lb1 = new Label(usercomp, SWT.BORDER | SWT.CENTER);
lb1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
lb1.setToolTipText(UIMessages.getString("EnvironmentTab.15")); //$NON-NLS-1$
lb1.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
CDTPrefUtil.spinDMode();
updateData();
}});
b2 = new Button(usercomp, SWT.RADIO);
b2.setText(UIMessages.getString("EnvironmentTab.4")); //$NON-NLS-1$
b2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@ -207,101 +221,36 @@ public class EnvironmentTab extends AbstractCPropertyTab {
vars.setAppendContributedEnvironment(false);
updateData();
}});
lb2 = new Label(usercomp, SWT.BORDER | SWT.CENTER);
lb2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
lb2.setToolTipText(UIMessages.getString("EnvironmentTab.23")); //$NON-NLS-1$
lb2.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
CDTPrefUtil.spinWMode();
updateLbs(null, lb2);
}});
initButtons(new String[] {UIMessages.getString("EnvironmentTab.5"),UIMessages.getString("EnvironmentTab.6"),UIMessages.getString("EnvironmentTab.7"),UIMessages.getString("EnvironmentTab.8"),UIMessages.getString("EnvironmentTab.9")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
}
public void buttonPressed(int i) {
IEnvironmentVariable var = null;
EnvDialog dlg;
int n = table.getSelectionIndex();
int[] idx;
switch (i) {
case 0:
dlg = new EnvDialog(usercomp.getShell(),
var,
UIMessages.getString("EnvironmentTab.10"), //$NON-NLS-1$
true,
page.isMultiCfg(),
cfgd);
if (dlg.open() == Window.OK) {
if (dlg.t1.trim().length() > 0) {
ICConfigurationDescription[] cfgs;
if (dlg.toAll)
cfgs = page.getCfgsEditable();
else
cfgs = new ICConfigurationDescription[] {cfgd};
if (cfgd == null)
vars.createVariable(dlg.t1.trim(), dlg.t2.trim(),
IEnvironmentVariable.ENVVAR_APPEND, SEMI);
else
for (int x=0; x<cfgs.length; x++) {
ce.addVariable(dlg.t1.trim(), dlg.t2.trim(),
IEnvironmentVariable.ENVVAR_APPEND,
SEMI, cfgs[x]);
}
updateData();
}
}
handleEnvAddButtonSelected();
break;
case 1: // select
handleEnvSelectButtonSelected();
updateData();
break;
case 2: // edit
if (n == -1) return;
var = ((TabData)tv.getElementAt(n)).var;
dlg = new EnvDialog(usercomp.getShell(),
var,
UIMessages.getString("EnvironmentTab.11"), //$NON-NLS-1$
false,
page.isMultiCfg(),
cfgd);
if (dlg.open() == Window.OK) {
if (cfgd != null)
ce.addVariable( dlg.t1.trim(), dlg.t2.trim(),
IEnvironmentVariable.ENVVAR_REPLACE,
var.getDelimiter(), cfgd);
else
vars.createVariable(dlg.t1.trim(), dlg.t2.trim(),
IEnvironmentVariable.ENVVAR_REPLACE, var.getDelimiter());
updateData();
}
handleEnvEditButtonSelected(table.getSelectionIndex());
break;
case 3: // remove
if (n == -1) return;
idx = table.getSelectionIndices();
for (int j=0; j<idx.length; j++) {
var = ((TabData)tv.getElementAt(idx[j])).var;
if (cfgd == null)
vars.deleteVariable(var.getName());
else
ce.removeVariable(var.getName(), cfgd);
}
updateData();
handleEnvDelButtonSelected(table.getSelectionIndex());
break;
case 4: // Undefine
if (n == -1) return;
idx = table.getSelectionIndices();
for (int j=0; j<idx.length; j++) {
var = ((TabData)tv.getElementAt(idx[j])).var;
if (cfgd == null)
vars.createVariable(
var.getName(),
null,
IEnvironmentVariable.ENVVAR_REMOVE,
var.getDelimiter());
else
ce.addVariable(
var.getName(),
null,
IEnvironmentVariable.ENVVAR_REMOVE,
var.getDelimiter(), cfgd);
}
updateData();
handleEnvUndefButtonSelected(table.getSelectionIndex());
break;
}
updateButtons();
}
public void updateButtons() {
@ -334,6 +283,7 @@ public class EnvironmentTab extends AbstractCPropertyTab {
b2.setSelection(!vars.appendContributedEnvironment());
_vars = vars.getVariables() ;
}
data.clear();
if (_vars != null) {
for (int i=0; i<_vars.length; i++) {
@ -341,6 +291,8 @@ public class EnvironmentTab extends AbstractCPropertyTab {
}
}
tv.setInput(data);
updateLbs(lb1, lb2);
updateButtons();
}
@ -383,6 +335,91 @@ public class EnvironmentTab extends AbstractCPropertyTab {
}
}
private void handleEnvEditButtonSelected(int n) {
if (n == -1)
return;
IEnvironmentVariable var = ((TabData)tv.getElementAt(n)).var;
EnvDialog dlg = new EnvDialog(usercomp.getShell(),
var,
UIMessages.getString("EnvironmentTab.11"), //$NON-NLS-1$
false,
page.isMultiCfg(),
cfgd);
if (dlg.open() == Window.OK) {
if (cfgd != null)
ce.addVariable( var.getName(), dlg.t2.trim(),
IEnvironmentVariable.ENVVAR_REPLACE,
var.getDelimiter(), cfgd);
else
vars.createVariable(dlg.t1.trim(), dlg.t2.trim(),
IEnvironmentVariable.ENVVAR_REPLACE, var.getDelimiter());
updateData();
}
}
private void handleEnvUndefButtonSelected(int n) {
if (n == -1)
return;
for (int i : table.getSelectionIndices()) {
IEnvironmentVariable var = ((TabData)tv.getElementAt(i)).var;
if (cfgd == null)
vars.createVariable(
var.getName(),
null,
IEnvironmentVariable.ENVVAR_REMOVE,
var.getDelimiter());
else
ce.addVariable(
var.getName(),
null,
IEnvironmentVariable.ENVVAR_REMOVE,
var.getDelimiter(), cfgd);
}
updateData();
}
private void handleEnvDelButtonSelected(int n) {
if (n == -1)
return;
for (int i : table.getSelectionIndices()) {
IEnvironmentVariable var = ((TabData)tv.getElementAt(i)).var;
if (cfgd == null)
vars.deleteVariable(var.getName());
else
ce.removeVariable(var.getName(), cfgd);
}
updateData();
}
private void handleEnvAddButtonSelected() {
IEnvironmentVariable var = null;
EnvDialog dlg = new EnvDialog(usercomp.getShell(),
var,
UIMessages.getString("EnvironmentTab.10"), //$NON-NLS-1$
true,
page.isMultiCfg(),
cfgd);
if (dlg.open() == Window.OK) {
if (dlg.t1.trim().length() > 0) {
ICConfigurationDescription[] cfgs;
if (dlg.toAll)
cfgs = page.getCfgsEditable();
else
cfgs = new ICConfigurationDescription[] {cfgd};
if (cfgd == null)
vars.createVariable(dlg.t1.trim(), dlg.t2.trim(),
IEnvironmentVariable.ENVVAR_APPEND, SEMI);
else
for (int x=0; x<cfgs.length; x++) {
ce.addVariable(dlg.t1.trim(), dlg.t2.trim(),
IEnvironmentVariable.ENVVAR_APPEND,
SEMI, cfgs[x]);
}
updateData();
}
}
}
private void handleEnvSelectButtonSelected() {
// get Environment Variables from the OS
Map v = EnvironmentReader.getEnvVars();
@ -416,6 +453,7 @@ public class EnvironmentTab extends AbstractCPropertyTab {
SEMI, cfgs[y]);
}
}
updateData();
}
}

View file

@ -142,9 +142,14 @@ public class ErrorParsTab extends AbstractCPropertyTab {
public void updateData(ICResourceDescription _cfgd) {
cfgd = _cfgd.getConfiguration();
if (mapParsers == null) return;
String[] ss = (page.isMultiCfg()) ?
((ICMultiConfigDescription)cfgd).getErrorParserIDs() :
cfgd.getBuildSetting().getErrorParserIDs();
String[] ss = null;
if (page.isMultiCfg()) {
String[][] ids = ((ICMultiConfigDescription)cfgd).getErrorParserIDs();
ss = CDTPrefUtil.getStrListForDisplay(ids);
} else {
ss = cfgd.getBuildSetting().getErrorParserIDs();
}
ArrayList<TableData> data = new ArrayList<TableData>(mapParsers.size());
ArrayList<TableData> checked = new ArrayList<TableData>(ss.length);
@ -182,9 +187,13 @@ public class ErrorParsTab extends AbstractCPropertyTab {
protected void performApply(ICResourceDescription src, ICResourceDescription dst) {
ICConfigurationDescription sd = src.getConfiguration();
ICConfigurationDescription dd = dst.getConfiguration();
String[] s = (sd instanceof ICMultiConfigDescription) ?
((ICMultiConfigDescription)sd).getErrorParserIDs() :
sd.getBuildSetting().getErrorParserIDs();
String[] s = null;
if (sd instanceof ICMultiConfigDescription) {
String[][] ss = ((ICMultiConfigDescription)sd).getErrorParserIDs();
s = CDTPrefUtil.getStrListForDisplay(ss);
} else {
s = sd.getBuildSetting().getErrorParserIDs();
}
if (dd instanceof ICMultiConfigDescription)
((ICMultiConfigDescription)sd).setErrorParserIDs(s);
else

View file

@ -1,6 +1,14 @@
/**
*
*/
/*******************************************************************************
* 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - initial API and implementation
* IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
import java.util.Comparator;
@ -10,7 +18,6 @@ import org.eclipse.cdt.core.envvar.IContributedEnvironment;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICMultiConfigDescription;
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
import org.eclipse.cdt.core.settings.model.MultiItemsHolder;
/**
@ -21,10 +28,9 @@ public class MultiCfgContributedEnvironment implements IContributedEnvironment {
private static final IContributedEnvironment ice = CCorePlugin.getDefault().getBuildEnvironmentManager().getContributedEnvironment();
private boolean isMulti = false;
private ICConfigurationDescription[] mono = new ICConfigurationDescription[1];
private ICConfigurationDescription[] cfs;
private static final EnvCmp comparator = new EnvCmp();
private static class EnvCmp implements Comparator {
private static class EnvCmp implements Comparator<Object> {
public int compare(Object a0, Object a1) {
if (a0 == null || a1 == null)
@ -51,17 +57,31 @@ public class MultiCfgContributedEnvironment implements IContributedEnvironment {
public IEnvironmentVariable addVariable(String name, String value,
int op, String delimiter, ICConfigurationDescription des) {
cfs = getCfs(des);
IEnvironmentVariable v = null;
for (int i=0; i<cfs.length; i++)
v = ice.addVariable(name, value, op, delimiter, cfs[i]);
for (ICConfigurationDescription c : getCfs(des))
v = ice.addVariable(name, value, op, delimiter, c);
doReplace(des);
return v;
}
private void doReplace(ICConfigurationDescription des) {
if (isMulti && ! isModifyMode()) {
IEnvironmentVariable[] vars = getVariables(des);
for (int i=0; i<vars.length; i++)
if (! ice.isUserVariable(des, vars[i]))
vars[i] = null;
for (ICConfigurationDescription c : getCfs(des)) {
ice.restoreDefaults(c);
for (IEnvironmentVariable v : vars)
if (v != null)
ice.addVariable(v, c);
}
}
}
public boolean appendEnvironment(ICConfigurationDescription des) {
cfs = getCfs(des);
for (int i=0; i<cfs.length; i++)
if (! ice.appendEnvironment(cfs[i]))
for (ICConfigurationDescription c : getCfs(des))
if (! ice.appendEnvironment(c))
return false;
return true;
}
@ -71,8 +91,8 @@ public class MultiCfgContributedEnvironment implements IContributedEnvironment {
if (!isMulti)
return ice.getVariable(name, des);
// should we show ANY vars, even if they exist not in all cfgs ?
boolean any = (getDispMode(des) == ICMultiItemsHolder.DMODE_ALL);
cfs = getCfs(des);
boolean any = (getDispMode(des) == CDTPrefUtil.DMODE_DISJUNCTION);
ICConfigurationDescription[] cfs = getCfs(des);
IEnvironmentVariable v = ice.getVariable(name, cfs[0]);
// if ((any && v != null) || (! any && v == null))
if (any ^ (v == null))
@ -92,12 +112,13 @@ public class MultiCfgContributedEnvironment implements IContributedEnvironment {
ICConfigurationDescription des) {
if (!isMulti)
return ice.getVariables(des);
cfs = getCfs(des);
ICConfigurationDescription[] cfs = getCfs(des);
IEnvironmentVariable[][] evs = new IEnvironmentVariable[cfs.length][];
for (int i=0; i<cfs.length; i++)
evs[i] = ice.getVariables(cfs[i]);
int i = 0;
for (ICConfigurationDescription c : cfs)
evs[i++] = ice.getVariables(c);
Object[] obs = ((ICMultiItemsHolder)des).getListForDisplay(evs, comparator);
Object[] obs = CDTPrefUtil.getListForDisplay(evs, comparator);
IEnvironmentVariable[] ev = new IEnvironmentVariable[obs.length];
System.arraycopy(obs, 0, ev, 0, obs.length);
return ev;
@ -106,9 +127,8 @@ public class MultiCfgContributedEnvironment implements IContributedEnvironment {
public boolean isUserVariable(ICConfigurationDescription des,
IEnvironmentVariable var) {
cfs = getCfs(des);
for (int i=0; i<cfs.length; i++)
if (! ice.isUserVariable(cfs[i], var))
for (ICConfigurationDescription c : getCfs(des))
if (! ice.isUserVariable(c, var))
return false;
return true; // only if for each cfg
}
@ -116,22 +136,20 @@ public class MultiCfgContributedEnvironment implements IContributedEnvironment {
public IEnvironmentVariable removeVariable(String name,
ICConfigurationDescription des) {
IEnvironmentVariable res = null;
cfs = getCfs(des);
for (int i=0; i<cfs.length; i++)
res = ice.removeVariable(name, cfs[i]);
for (ICConfigurationDescription c : getCfs(des))
res = ice.removeVariable(name, c);
doReplace(des);
return res;
}
public void restoreDefaults(ICConfigurationDescription des) {
cfs = getCfs(des);
for (int i=0; i<cfs.length; i++)
ice.restoreDefaults(cfs[i]);
for (ICConfigurationDescription c : getCfs(des))
ice.restoreDefaults(c);
}
public void setAppendEnvironment(boolean append,ICConfigurationDescription des) {
cfs = getCfs(des);
for (int i=0; i<cfs.length; i++)
ice.setAppendEnvironment(append, cfs[i]);
for (ICConfigurationDescription c : getCfs(des))
ice.setAppendEnvironment(append, c);
}
private ICConfigurationDescription[] getCfs(ICConfigurationDescription des) {
@ -145,8 +163,29 @@ public class MultiCfgContributedEnvironment implements IContributedEnvironment {
private int getDispMode(ICConfigurationDescription des) {
if (isMulti && des instanceof MultiItemsHolder)
return ((MultiItemsHolder)des).getStringListMode() & ICMultiItemsHolder.DMODES;
return CDTPrefUtil.getInt(CDTPrefUtil.KEY_DMODE);
return 0;
}
private boolean isModifyMode() {
int wmode = CDTPrefUtil.getInt(CDTPrefUtil.KEY_WMODE);
return (wmode == CDTPrefUtil.WMODE_MODIFY);
}
public IEnvironmentVariable addVariable(IEnvironmentVariable var,
ICConfigurationDescription des) {
IEnvironmentVariable v = null;
for (ICConfigurationDescription c : getCfs(des))
v = ice.addVariable(var, c);
doReplace(des);
return v;
}
public void addVariables(IEnvironmentVariable[] vars,
ICConfigurationDescription des) {
for (ICConfigurationDescription c : getCfs(des))
ice.addVariables(vars, c);
doReplace(des);
}
}

View file

@ -344,7 +344,6 @@ PropertyMultiCfgTab.10=Add/remove/change affected elements, do not touch others
PropertyMultiCfgTab.11=Replace existing string lists with string list shown to user
PropertyMultiCfgTab.3=String list Display mode
PropertyMultiCfgTab.4=Define how string lists from different configurations\nshould be combined for display, when lists are not equal
PropertyMultiCfgTab.5=Show empty list
PropertyMultiCfgTab.6=Show common elements (conjunction)
PropertyMultiCfgTab.7=Show all elements except doubles (disjunction)
PropertyMultiCfgTab.8=String list Write mode
@ -447,6 +446,10 @@ EnvDialog.3=Add to all configurations
EnvironmentTab.0=Environment variables to set
EnvironmentTab.1=Variable
EnvironmentTab.2=Value
EnvironmentTab.20=MODIFY
EnvironmentTab.21=REPLACE
EnvironmentTab.22=WRITE mode:
EnvironmentTab.23=Current String List WRITE mode. Double-click to change
EnvironmentTab.3=Append variables to native environment
EnvironmentTab.4=Replace native environment with specified one
EnvironmentTab.5=New...
@ -459,6 +462,10 @@ EnvironmentTab.11=Edit variable
EnvironmentTab.12=Variables list
EnvironmentTab.13=Add to all configurations
EnvironmentTab.14=Select variables
EnvironmentTab.15=Current String List DISPLAY mode. Double-click to change
EnvironmentTab.17=CONJUNCTION
EnvironmentTab.18=DISJUNCTION
EnvironmentTab.19=DISPLAY mode:
IncludeTab.0=Include directories
IncludeTab.1=Add directory path
IncludeTab.2=Change directory path

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
@ -202,7 +202,7 @@ public class RefsTab extends AbstractCPropertyTab {
}
protected void performDefaults() {
getResDesc().getConfiguration().setReferenceInfo(new HashMap());
getResDesc().getConfiguration().setReferenceInfo(new HashMap<String, String>());
initData();
}
protected void updateButtons() {} // Do nothing. No buttons to update.

View file

@ -14,7 +14,6 @@ package org.eclipse.cdt.ui.newui;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter;
@ -74,8 +73,9 @@ public class SymbolTab extends AbstractLangsListTab {
int x = table.getSelectionIndex();
if (x == -1) x = 0;
// incs = new LinkedList<ICLanguageSettingEntry>(lang.getSettingEntriesList(getKind()));
incs = getIncs();
ArrayList<ICLanguageSettingEntry> lst = new ArrayList<ICLanguageSettingEntry>();
incs = new LinkedList<ICLanguageSettingEntry>(lang.getSettingEntriesList(getKind()));
if (incs != null) {
Iterator it = incs.iterator();
while (it.hasNext()) {
@ -88,6 +88,7 @@ public class SymbolTab extends AbstractLangsListTab {
if (table.getItemCount() > x) table.select(x);
else if (table.getItemCount() > 0) table.select(0);
}
updateLbs(lb1, lb2);
updateButtons();
}