diff options
Diffstat (limited to 'core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model')
5 files changed, 26 insertions, 191 deletions
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); } } |