Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core/model/org')
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/MultiLanguageSetting.java (renamed from core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiLanguageSetting.java)57
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICConfigurationDescription.java6
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICMultiConfigDescription.java4
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICMultiFolderDescription.java17
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICMultiItemsHolder.java66
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/MultiItemsHolder.java124
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigurationDescription.java12
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigurationSpecSettings.java10
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CfgExportSettingContainerFactory.java30
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiConfigDescription.java23
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiFileDescription.java4
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiFolderDescription.java45
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiResourceDescription.java5
13 files changed, 102 insertions, 301 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiLanguageSetting.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/MultiLanguageSetting.java
index 9b5bee5737d..6e35af48689 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiLanguageSetting.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/MultiLanguageSetting.java
@@ -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;
+ }
+
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICConfigurationDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICConfigurationDescription.java
index f12bd614501..a054fbeecf9 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICConfigurationDescription.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICConfigurationDescription.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICMultiConfigDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICMultiConfigDescription.java
index d95e2370c46..b099fa155e6 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICMultiConfigDescription.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICMultiConfigDescription.java
@@ -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);
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICMultiFolderDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICMultiFolderDescription.java
new file mode 100644
index 00000000000..75b56ce456f
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICMultiFolderDescription.java
@@ -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);
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICMultiItemsHolder.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICMultiItemsHolder.java
index 23a6e0f4ab1..6358f6d03c5 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICMultiItemsHolder.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICMultiItemsHolder.java
@@ -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);
-
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/MultiItemsHolder.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/MultiItemsHolder.java
index efa56bf20b8..3afba0e19c4 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/MultiItemsHolder.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/MultiItemsHolder.java
@@ -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);
}
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigurationDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigurationDescription.java
index 8bcb70b19b8..5ecbf936b10 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigurationDescription.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigurationDescription.java
@@ -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);
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigurationSpecSettings.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigurationSpecSettings.java
index 852bfc4e5c0..d8fc2110b2b 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigurationSpecSettings.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigurationSpecSettings.java
@@ -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())
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CfgExportSettingContainerFactory.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CfgExportSettingContainerFactory.java
index fe6d61cac4f..bdcc6a857f7 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CfgExportSettingContainerFactory.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CfgExportSettingContainerFactory.java
@@ -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();
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiConfigDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiConfigDescription.java
index 5550a0ea893..e30bf0e0e56 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiConfigDescription.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiConfigDescription.java
@@ -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);
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiFileDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiFileDescription.java
index 8f045d966b1..d399d8d5cc4 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiFileDescription.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiFileDescription.java
@@ -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)
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiFolderDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiFolderDescription.java
index ec94652c608..96d04ef9f67 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiFolderDescription.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiFolderDescription.java
@@ -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();
+ }
+
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiResourceDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiResourceDescription.java
index cf4aa771743..2279a073df8 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiResourceDescription.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiResourceDescription.java
@@ -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;
}

Back to the top