1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-28 11:25:35 +02:00

cosmetics: generics

This commit is contained in:
Andrew Gvozdev 2010-01-23 06:13:39 +00:00
parent 8e6a604b18
commit 5cec38091d
6 changed files with 121 additions and 120 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others. * Copyright (c) 2007, 2010 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -19,7 +19,7 @@ import org.eclipse.cdt.core.settings.model.util.KindBasedStore;
public final class CExternalSetting implements ICExternalSetting { public final class CExternalSetting implements ICExternalSetting {
// private EntryStore fEntryStore = new EntryStore(); // private EntryStore fEntryStore = new EntryStore();
private KindBasedStore fStore = new KindBasedStore(false); private KindBasedStore<CEntriesSet> fStore = new KindBasedStore<CEntriesSet>(false);
private String[] fContentTypeIds; private String[] fContentTypeIds;
private String[] fLanguageIds; private String[] fLanguageIds;
private String[] fExtensions; private String[] fExtensions;
@ -77,7 +77,7 @@ public final class CExternalSetting implements ICExternalSetting {
// } // }
private CEntriesSet getEntriesSet(int kind, boolean create) { private CEntriesSet getEntriesSet(int kind, boolean create) {
CEntriesSet set = (CEntriesSet)fStore.get(kind); CEntriesSet set = fStore.get(kind);
if (set == null && create) { if (set == null && create) {
set = new CEntriesSet(); set = new CEntriesSet();
fStore.put(kind, set); fStore.put(kind, set);

View file

@ -25,7 +25,7 @@ public final class PathSettingsContainer {
private static final String ROOY_PATH_NAME = Path.ROOT.toString(); private static final String ROOY_PATH_NAME = Path.ROOT.toString();
// private static final boolean DEBUG = true; // private static final boolean DEBUG = true;
// private static final int INIT_CHILDREN_MAP_CAPACITY = 2; // private static final int INIT_CHILDREN_MAP_CAPACITY = 2;
// private Map fChildrenMap; // private Map fChildrenMap;
// private Map fPatternMap; // private Map fPatternMap;
private PatternNameMap fPatternChildrenMap; private PatternNameMap fPatternChildrenMap;
@ -34,17 +34,17 @@ public final class PathSettingsContainer {
private String fName; private String fName;
private PathSettingsContainer fRootContainer; private PathSettingsContainer fRootContainer;
private PathSettingsContainer fDirectParentContainer; private PathSettingsContainer fDirectParentContainer;
private List fListeners; private List<IPathSettingsContainerListener> fListeners;
private boolean fIsPatternMode; private boolean fIsPatternMode;
private static final int ADDED = 1; private static final int ADDED = 1;
private static final int REMOVED = 2; private static final int REMOVED = 2;
private static final int VALUE_CHANGED = 3; private static final int VALUE_CHANGED = 3;
private static final int PATH_CHANGED = 4; private static final int PATH_CHANGED = 4;
private static class PatternSearchInfo { private static class PatternSearchInfo {
Set fStoreSet; Set<PathSettingsContainer> fStoreSet;
int fNumDoubleStarEls; int fNumDoubleStarEls;
} }
@ -59,7 +59,7 @@ public final class PathSettingsContainer {
private PathSettingsContainer(boolean pattternMode){ private PathSettingsContainer(boolean pattternMode){
this(null, null, ROOY_PATH_NAME, pattternMode); this(null, null, ROOY_PATH_NAME, pattternMode);
} }
private PathSettingsContainer(PathSettingsContainer root, PathSettingsContainer parent, String name, boolean patternMode){ private PathSettingsContainer(PathSettingsContainer root, PathSettingsContainer parent, String name, boolean patternMode){
fRootContainer = root; fRootContainer = root;
fDirectParentContainer = parent; fDirectParentContainer = parent;
@ -72,13 +72,13 @@ public final class PathSettingsContainer {
fValue = INEXISTENT_VALUE; fValue = INEXISTENT_VALUE;
} }
} }
private PatternNameMap getPatternChildrenMap(boolean create){ private PatternNameMap getPatternChildrenMap(boolean create){
if(fPatternChildrenMap == null && create) if(fPatternChildrenMap == null && create)
fPatternChildrenMap = new PatternNameMap(); fPatternChildrenMap = new PatternNameMap();
return fPatternChildrenMap; return fPatternChildrenMap;
} }
private PathSettingsContainer getExacChild(String name, boolean create){ private PathSettingsContainer getExacChild(String name, boolean create){
PatternNameMap pMap = getPatternChildrenMap(create); PatternNameMap pMap = getPatternChildrenMap(create);
if(pMap != null){ if(pMap != null){
@ -104,7 +104,7 @@ public final class PathSettingsContainer {
return null; return null;
} }
private List getChildren(String name){ private List<PathSettingsContainer> getChildren(String name){
PatternNameMap pMap = getPatternChildrenMap(false); PatternNameMap pMap = getPatternChildrenMap(false);
if(pMap != null){ if(pMap != null){
return pMap.getValues(name); return pMap.getValues(name);
@ -112,39 +112,39 @@ public final class PathSettingsContainer {
return null; return null;
} }
private void notifyChange(PathSettingsContainer container, int type, Object oldValue, boolean childrenAffected){ private void notifyChange(PathSettingsContainer container, int type, Object oldValue, boolean childrenAffected){
List list = getListenersList(false); List<IPathSettingsContainerListener> list = getListenersList(false);
if(list != null && list.size() > 0){ if(list != null && list.size() > 0){
for(Iterator iter = list.iterator(); iter.hasNext();){ for (IPathSettingsContainerListener listener : list) {
switch(type){ switch(type){
case ADDED: case ADDED:
((IPathSettingsContainerListener)iter.next()).containerAdded(container); listener.containerAdded(container);
break; break;
case REMOVED: case REMOVED:
((IPathSettingsContainerListener)iter.next()).aboutToRemove(container); listener.aboutToRemove(container);
break; break;
case VALUE_CHANGED: case VALUE_CHANGED:
((IPathSettingsContainerListener)iter.next()).containerValueChanged(container, oldValue); listener.containerValueChanged(container, oldValue);
break; break;
case PATH_CHANGED: case PATH_CHANGED:
((IPathSettingsContainerListener)iter.next()).containerPathChanged(container, (IPath)oldValue, childrenAffected); listener.containerPathChanged(container, (IPath)oldValue, childrenAffected);
break; break;
} }
} }
} }
PathSettingsContainer parent = getParentContainer(); PathSettingsContainer parent = getParentContainer();
if(parent != null) if(parent != null)
parent.notifyChange(container, type, oldValue, childrenAffected); parent.notifyChange(container, type, oldValue, childrenAffected);
} }
private List getListenersList(boolean create){ private List<IPathSettingsContainerListener> getListenersList(boolean create){
if(fListeners == null && create) if(fListeners == null && create)
fListeners = new ArrayList(); fListeners = new ArrayList<IPathSettingsContainerListener>();
return fListeners; return fListeners;
} }
public boolean hasChildren(){ public boolean hasChildren(){
PatternNameMap pMap = getPatternChildrenMap(false); PatternNameMap pMap = getPatternChildrenMap(false);
return pMap != null && pMap.size() != 0; return pMap != null && pMap.size() != 0;
@ -163,7 +163,8 @@ public final class PathSettingsContainer {
} else if(!exactPath){ } else if(!exactPath){
for(; for(;
container.internalGetValue() == INEXISTENT_VALUE; container.internalGetValue() == INEXISTENT_VALUE;
container = container.getDirectParentContainer()); container = container.getDirectParentContainer()) {
}
} else if(container.internalGetValue() == INEXISTENT_VALUE){ } else if(container.internalGetValue() == INEXISTENT_VALUE){
container = null; container = null;
} }
@ -171,13 +172,13 @@ public final class PathSettingsContainer {
} }
return container; return container;
} }
static IPath toNormalizedContainerPath(IPath path){ static IPath toNormalizedContainerPath(IPath path){
return Path.ROOT.append(path); return Path.ROOT.append(path);
} }
public PathSettingsContainer[] getChildren(final boolean includeThis){ public PathSettingsContainer[] getChildren(final boolean includeThis){
final List list = new ArrayList(); final List<PathSettingsContainer> list = new ArrayList<PathSettingsContainer>();
accept(new IPathSettingsContainerVisitor(){ accept(new IPathSettingsContainerVisitor(){
public boolean visit(PathSettingsContainer container) { public boolean visit(PathSettingsContainer container) {
@ -187,9 +188,9 @@ public final class PathSettingsContainer {
} }
}); });
return (PathSettingsContainer[])list.toArray(new PathSettingsContainer[list.size()]); return list.toArray(new PathSettingsContainer[list.size()]);
} }
public PathSettingsContainer[] getChildrenForPath(IPath path, boolean includePath){ public PathSettingsContainer[] getChildrenForPath(IPath path, boolean includePath){
PathSettingsContainer cr = findContainer(path, false, true, fIsPatternMode, -1, null); PathSettingsContainer cr = findContainer(path, false, true, fIsPatternMode, -1, null);
if(cr != null) if(cr != null)
@ -203,22 +204,22 @@ public final class PathSettingsContainer {
return cr.getDirectChildren(); return cr.getDirectChildren();
return new PathSettingsContainer[0]; return new PathSettingsContainer[0];
} }
/* public PathSettingsContainer[] getDirectChildrenForPath(IPath path, boolean searchPatterns){ /* public PathSettingsContainer[] getDirectChildrenForPath(IPath path, boolean searchPatterns){
if(!searchPatterns) if(!searchPatterns)
return getDirectChildrenForPath(path); return getDirectChildrenForPath(path);
if(!isRoot() && !PatternNameMap.isPatternName(fName)){ if(!isRoot() && !PatternNameMap.isPatternName(fName)){
return getDirectParentContainer().getDirectChildrenForPath( return getDirectParentContainer().getDirectChildrenForPath(
new Path(fName).append(path), true); new Path(fName).append(path), true);
} }
return searchPatternsDirectChildrenForPath(path); return searchPatternsDirectChildrenForPath(path);
} }
private PathSettingsContainer[] searchPatternsDirectChildrenForPath(IPath path){ private PathSettingsContainer[] searchPatternsDirectChildrenForPath(IPath path){
Set set = new HashSet(); Set set = new HashSet();
findContainer(path, false, false, path.segmentCount(), set); findContainer(path, false, false, path.segmentCount(), set);
if(DEBUG){ if(DEBUG){
for(Iterator iter = set.iterator(); iter.hasNext();){ for(Iterator iter = set.iterator(); iter.hasNext();){
PathSettingsContainer child = (PathSettingsContainer)iter.next(); PathSettingsContainer child = (PathSettingsContainer)iter.next();
@ -226,22 +227,22 @@ public final class PathSettingsContainer {
throw new IllegalStateException(); throw new IllegalStateException();
} }
} }
return (PathSettingsContainer[])set.toArray(new PathSettingsContainer[set.size()]); return (PathSettingsContainer[])set.toArray(new PathSettingsContainer[set.size()]);
} }
*/ */
public PathSettingsContainer[] getDirectChildren(){ public PathSettingsContainer[] getDirectChildren(){
List list = doGetDirectChildren(null); List<PathSettingsContainer> list = doGetDirectChildren(null);
if(list == null || list.size() == 0) if(list == null || list.size() == 0)
return new PathSettingsContainer[0]; return new PathSettingsContainer[0];
return (PathSettingsContainer[])list.toArray(new PathSettingsContainer[list.size()]); return list.toArray(new PathSettingsContainer[list.size()]);
} }
private List doGetDirectChildren(List list){ private List<PathSettingsContainer> doGetDirectChildren(List<PathSettingsContainer> list){
PatternNameMap pMap = getPatternChildrenMap(false); PatternNameMap pMap = getPatternChildrenMap(false);
if(pMap != null){ if(pMap != null){
if(list == null) if(list == null)
list = new ArrayList(); list = new ArrayList<PathSettingsContainer>();
for(Iterator iter = pMap.values().iterator(); iter.hasNext(); ){ for(Iterator iter = pMap.values().iterator(); iter.hasNext(); ){
PathSettingsContainer cr = (PathSettingsContainer)iter.next(); PathSettingsContainer cr = (PathSettingsContainer)iter.next();
if(cr.fValue == INEXISTENT_VALUE){ if(cr.fValue == INEXISTENT_VALUE){
@ -253,7 +254,7 @@ public final class PathSettingsContainer {
} }
return list; return list;
} }
public Object[] getValues(final boolean includeThis){ public Object[] getValues(final boolean includeThis){
final List list = new ArrayList(); final List list = new ArrayList();
accept(new IPathSettingsContainerVisitor(){ accept(new IPathSettingsContainerVisitor(){
@ -273,13 +274,13 @@ public final class PathSettingsContainer {
return fDirectParentContainer.getValidContainer(); return fDirectParentContainer.getValidContainer();
return null; return null;
} }
private PathSettingsContainer getValidContainer(){ private PathSettingsContainer getValidContainer(){
if(internalGetValue() == INEXISTENT_VALUE) if(internalGetValue() == INEXISTENT_VALUE)
return getDirectParentContainer().getValidContainer(); return getDirectParentContainer().getValidContainer();
return this; return this;
} }
public Object removeChildContainer(IPath path){ public Object removeChildContainer(IPath path){
PathSettingsContainer container = getChildContainer(path, false, true); PathSettingsContainer container = getChildContainer(path, false, true);
Object value = null; Object value = null;
@ -289,7 +290,7 @@ public final class PathSettingsContainer {
} }
return value; return value;
} }
public void remove(){ public void remove(){
if(!isValid()) if(!isValid())
return; return;
@ -307,12 +308,12 @@ public final class PathSettingsContainer {
fRootContainer = null; fRootContainer = null;
} }
} }
private void checkRemove(){ private void checkRemove(){
if(fValue == INEXISTENT_VALUE && !hasChildren()) if(fValue == INEXISTENT_VALUE && !hasChildren())
remove(); remove();
} }
private void disconnectChild(PathSettingsContainer child){ private void disconnectChild(PathSettingsContainer child){
getPatternChildrenMap(true).remove(child.getName()); getPatternChildrenMap(true).remove(child.getName());
} }
@ -324,26 +325,26 @@ public final class PathSettingsContainer {
public boolean isValid(){ public boolean isValid(){
return fValue != INEXISTENT_VALUE && fRootContainer != null; return fValue != INEXISTENT_VALUE && fRootContainer != null;
} }
public void removeChildren(){ public void removeChildren(){
PatternNameMap pMap = getPatternChildrenMap(false); PatternNameMap pMap = getPatternChildrenMap(false);
if(pMap == null || pMap.size() == 0) if(pMap == null || pMap.size() == 0)
return; return;
Collection c = pMap.values(); Collection c = pMap.values();
PathSettingsContainer childContainers[] = (PathSettingsContainer[])c.toArray(new PathSettingsContainer[c.size()]); PathSettingsContainer childContainers[] = (PathSettingsContainer[])c.toArray(new PathSettingsContainer[c.size()]);
for(int i = 0; i < childContainers.length; i++){ for (PathSettingsContainer childContainer : childContainers) {
childContainers[i].removeChildren(); childContainer.removeChildren();
childContainers[i].remove(); childContainer.remove();
} }
} }
private void deleteChild(PathSettingsContainer child){ private void deleteChild(PathSettingsContainer child){
getPatternChildrenMap(false).remove(child.getName()); getPatternChildrenMap(false).remove(child.getName());
} }
private String getName(){ private String getName(){
return fName; return fName;
} }
@ -368,7 +369,7 @@ public final class PathSettingsContainer {
// if(list != null){ // if(list != null){
// int size = list.size(); // int size = list.size();
// PathSettingsContainer child, childFound; // PathSettingsContainer child, childFound;
// //
// for(int i = 0; i < size; i++){ // for(int i = 0; i < size; i++){
// child = (PathSettingsContainer)list.get(i); // child = (PathSettingsContainer)list.get(i);
// if(directChildren && child.fValue != INEXISTENT_VALUE){ // if(directChildren && child.fValue != INEXISTENT_VALUE){
@ -378,8 +379,8 @@ public final class PathSettingsContainer {
// } // }
// //
// if(childFound.fValue != INEXISTENT_VALUE){ // if(childFound.fValue != INEXISTENT_VALUE){
// if(container == null // if(container == null
// || container.getValue() == INEXISTENT_VALUE // || container.getValue() == INEXISTENT_VALUE
// || container.getPath().segmentCount() < childFound.getPath().segmentCount()){ // || container.getPath().segmentCount() < childFound.getPath().segmentCount()){
// container = childFound; // container = childFound;
// } // }
@ -393,7 +394,7 @@ public final class PathSettingsContainer {
// if(dsChild != null && !storeSet.contains(dsChild)){ // if(dsChild != null && !storeSet.contains(dsChild)){
// container = dsChild.findContainer(path, false, false, directChildren, storeSet); // container = dsChild.findContainer(path, false, false, directChildren, storeSet);
// } // }
// //
// if(container == null){ // if(container == null){
// if(isDoubleStarName()){ // if(isDoubleStarName()){
// if(path.segmentCount() != 0){ // if(path.segmentCount() != 0){
@ -410,7 +411,7 @@ public final class PathSettingsContainer {
} }
return container; return container;
} }
static boolean pathsEqual(IPath p1, IPath p2) { static boolean pathsEqual(IPath p1, IPath p2) {
if (p1 == p2) if (p1 == p2)
return true; return true;
@ -422,22 +423,22 @@ public final class PathSettingsContainer {
while (--i >= 0) while (--i >= 0)
if (!p1.segment(i).equals(p2.segment(i))) if (!p1.segment(i).equals(p2.segment(i)))
return false; return false;
return true; return true;
} }
private PathSettingsContainer processPatterns(IPath path, int matchDepth, int depth, PatternSearchInfo psi){ private PathSettingsContainer processPatterns(IPath path, int matchDepth, int depth, PatternSearchInfo psi){
Set storeSet = psi.fStoreSet; Set<PathSettingsContainer> storeSet = psi.fStoreSet;
PathSettingsContainer container = null; PathSettingsContainer container = null;
String name = path.segment(0); String name = path.segment(0);
List list = getChildren(name); List<PathSettingsContainer> list = getChildren(name);
PathSettingsContainer child, childFound; PathSettingsContainer child, childFound;
boolean exactPathFound = false; boolean exactPathFound = false;
if(list != null){ if(list != null){
int size = list.size(); int size = list.size();
for(int i = 0; i < size; i++){ for(int i = 0; i < size; i++){
child = (PathSettingsContainer)list.get(i); child = list.get(i);
if(matchDepth == 0 && child.fValue != INEXISTENT_VALUE){ if(matchDepth == 0 && child.fValue != INEXISTENT_VALUE){
childFound = child; childFound = child;
} else { } else {
@ -445,14 +446,14 @@ public final class PathSettingsContainer {
} }
if(childFound != null && childFound.fValue != INEXISTENT_VALUE){ if(childFound != null && childFound.fValue != INEXISTENT_VALUE){
if(!exactPathFound if(!exactPathFound
&& path.segmentCount() == 1 && path.segmentCount() == 1
&& child != childFound && child != childFound
&& name.equals(childFound.fName)){ && name.equals(childFound.fName)){
container = childFound; container = childFound;
exactPathFound = true; exactPathFound = true;
} else if(container == null } else if(container == null
|| container.getValue() == INEXISTENT_VALUE || container.getValue() == INEXISTENT_VALUE
|| container.getPath().segmentCount() < childFound.getPath().segmentCount()){ || container.getPath().segmentCount() < childFound.getPath().segmentCount()){
container = childFound; container = childFound;
} }
@ -472,11 +473,11 @@ public final class PathSettingsContainer {
} else { } else {
childFound = child.findContainer(path, false, false, true, matchDepth, psi); childFound = child.findContainer(path, false, false, true, matchDepth, psi);
} }
if(childFound != null && childFound.fValue != INEXISTENT_VALUE){ if(childFound != null && childFound.fValue != INEXISTENT_VALUE){
psi.fNumDoubleStarEls++; psi.fNumDoubleStarEls++;
if(container == null if(container == null
|| container.getValue() == INEXISTENT_VALUE || container.getValue() == INEXISTENT_VALUE
|| container.getPath().segmentCount() < childFound.getPath().segmentCount() + depth - psi.fNumDoubleStarEls){ || container.getPath().segmentCount() < childFound.getPath().segmentCount() + depth - psi.fNumDoubleStarEls){
container = childFound; container = childFound;
} }
@ -484,7 +485,7 @@ public final class PathSettingsContainer {
storeSet.add(container); storeSet.add(container);
} }
} }
if(container == null){ if(container == null){
if(isDoubleStarName()){ if(isDoubleStarName()){
if(path.segmentCount() > 1){ if(path.segmentCount() > 1){
@ -504,19 +505,19 @@ public final class PathSettingsContainer {
} }
return container; return container;
} }
private int stepDepth(int depth){ private int stepDepth(int depth){
return depth == 0 ? depth : depth-1; return depth == 0 ? depth : depth-1;
} }
public void accept(IPathSettingsContainerVisitor visitor){ public void accept(IPathSettingsContainerVisitor visitor){
doAccept(visitor); doAccept(visitor);
} }
private boolean doAccept(IPathSettingsContainerVisitor visitor){ private boolean doAccept(IPathSettingsContainerVisitor visitor){
if(fValue != INEXISTENT_VALUE && !visitor.visit(this)) if(fValue != INEXISTENT_VALUE && !visitor.visit(this))
return false; return false;
PatternNameMap pMap = getPatternChildrenMap(false); PatternNameMap pMap = getPatternChildrenMap(false);
if(pMap != null){ if(pMap != null){
for(Iterator iter = pMap.values().iterator(); iter.hasNext();){ for(Iterator iter = pMap.values().iterator(); iter.hasNext();){
@ -527,8 +528,8 @@ public final class PathSettingsContainer {
} }
return true; return true;
} }
public IPath getPath(){ public IPath getPath(){
if(fPath == null){ if(fPath == null){
if(fDirectParentContainer != null) if(fDirectParentContainer != null)
@ -538,15 +539,15 @@ public final class PathSettingsContainer {
} }
return fPath; return fPath;
} }
public void setPath(IPath path, boolean moveChildren){ public void setPath(IPath path, boolean moveChildren){
if(path == null || isRoot() || path.equals(getPath()) || path.segmentCount() == 0) if(path == null || isRoot() || path.equals(getPath()) || path.segmentCount() == 0)
return; return;
IPath oldPath = getPath(); IPath oldPath = getPath();
fDirectParentContainer.disconnectChild(this); fDirectParentContainer.disconnectChild(this);
if(!moveChildren){ if(!moveChildren){
if(hasChildren()){ if(hasChildren()){
PathSettingsContainer cr = new PathSettingsContainer(fRootContainer, fDirectParentContainer, fName, fIsPatternMode); PathSettingsContainer cr = new PathSettingsContainer(fRootContainer, fDirectParentContainer, fName, fIsPatternMode);
@ -558,9 +559,9 @@ public final class PathSettingsContainer {
} }
} }
} else { } else {
} }
PathSettingsContainer newParent = fRootContainer.findContainer(path.removeLastSegments(1), true, true, false, -1, null); PathSettingsContainer newParent = fRootContainer.findContainer(path.removeLastSegments(1), true, true, false, -1, null);
PathSettingsContainer oldParent = fDirectParentContainer; PathSettingsContainer oldParent = fDirectParentContainer;
fName = path.segment(path.segmentCount()-1); fName = path.segment(path.segmentCount()-1);
@ -568,19 +569,19 @@ public final class PathSettingsContainer {
setParent(newParent); setParent(newParent);
newParent.connectChild(this); newParent.connectChild(this);
oldParent.checkRemove(); oldParent.checkRemove();
notifyChange(this, PATH_CHANGED, oldPath, moveChildren); notifyChange(this, PATH_CHANGED, oldPath, moveChildren);
} }
private Object internalGetValue(){ private Object internalGetValue(){
return fValue; return fValue;
} }
public boolean isRoot(){ public boolean isRoot(){
return fRootContainer == this; return fRootContainer == this;
} }
private Object internalSetValue(Object value){ private Object internalSetValue(Object value){
Object oldValue = fValue; Object oldValue = fValue;
fValue = value; fValue = value;
@ -591,38 +592,38 @@ public final class PathSettingsContainer {
} }
return oldValue; return oldValue;
} }
public Object setValue(Object value){ public Object setValue(Object value){
if(fValue == INEXISTENT_VALUE) if(fValue == INEXISTENT_VALUE)
throw new IllegalStateException(); throw new IllegalStateException();
return internalSetValue(value); return internalSetValue(value);
} }
public Object getValue(){ public Object getValue(){
if(fValue == INEXISTENT_VALUE) if(fValue == INEXISTENT_VALUE)
throw new IllegalStateException(); throw new IllegalStateException();
return fValue; return fValue;
} }
public PathSettingsContainer getRootContainer(){ public PathSettingsContainer getRootContainer(){
return fRootContainer; return fRootContainer;
} }
private PathSettingsContainer getDirectParentContainer(){ private PathSettingsContainer getDirectParentContainer(){
return fDirectParentContainer; return fDirectParentContainer;
} }
public void addContainerListener(IPathSettingsContainerListener listenet){ public void addContainerListener(IPathSettingsContainerListener listenet){
List list = getListenersList(true); List<IPathSettingsContainerListener> list = getListenersList(true);
list.add(listenet); list.add(listenet);
} }
public void removeContainerListener(IPathSettingsContainerListener listenet){ public void removeContainerListener(IPathSettingsContainerListener listenet){
List list = getListenersList(false); List<IPathSettingsContainerListener> list = getListenersList(false);
if(list != null) if(list != null)
list.remove(listenet); list.remove(listenet);
} }
private void setParent(PathSettingsContainer parent){ private void setParent(PathSettingsContainer parent){
fDirectParentContainer = parent; fDirectParentContainer = parent;
} }
@ -631,7 +632,7 @@ public final class PathSettingsContainer {
public String toString() { public String toString() {
return contributeToString(new StringBuffer(), 0).toString(); return contributeToString(new StringBuffer(), 0).toString();
} }
private StringBuffer contributeToString(StringBuffer buf, int depth){ private StringBuffer contributeToString(StringBuffer buf, int depth){
for (int i= 0; i < depth; i++) { for (int i= 0; i < depth; i++) {
buf.append('\t'); buf.append('\t');
@ -641,13 +642,13 @@ public final class PathSettingsContainer {
PathSettingsContainer[] directChildren = getDirectChildren(); PathSettingsContainer[] directChildren = getDirectChildren();
if(directChildren.length != 0){ if(directChildren.length != 0){
int nextDepth = depth + 1; int nextDepth = depth + 1;
for(int i = 0; i < directChildren.length; i++){ for (PathSettingsContainer child : directChildren) {
directChildren[i].contributeToString(buf, nextDepth); child.contributeToString(buf, nextDepth);
} }
} }
return buf; return buf;
} }
static boolean hasSpecChars(IPath path){ static boolean hasSpecChars(IPath path){
int count = path.segmentCount(); int count = path.segmentCount();
for(int i = 0; i < count; i++){ for(int i = 0; i < count; i++){

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others. * Copyright (c) 2010 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -59,14 +59,14 @@ public class CConfigurationDataProviderDescriptor {
StringTokenizer t = new StringTokenizer(value, DELIMITER); StringTokenizer t = new StringTokenizer(value, DELIMITER);
int num = t.countTokens(); int num = t.countTokens();
List list = new ArrayList(num); List<String> list = new ArrayList<String>(num);
for(int i = 0; i < num; i++){ for(int i = 0; i < num; i++){
String v = t.nextToken().trim(); String v = t.nextToken().trim();
if(v.length() != 0) if(v.length() != 0)
list.add(v); list.add(v);
} }
return (String[])list.toArray(new String[list.size()]); return list.toArray(new String[list.size()]);
} }
@ -108,11 +108,11 @@ public class CConfigurationDataProviderDescriptor {
} }
public String[] getNatureIds(){ public String[] getNatureIds(){
return (String[])fNatureIds.clone(); return fNatureIds.clone();
} }
public String[] getConflictingNatureIds(){ public String[] getConflictingNatureIds(){
return (String[])fConflictingNatureIds.clone(); return fConflictingNatureIds.clone();
} }
/* public String[] getBuilderIds(){ /* public String[] getBuilderIds(){

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others. * Copyright (c) 2007, 2010 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -378,7 +378,7 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
@Override @Override
public ICSourceEntry[] getSourceEntries() { public ICSourceEntry[] getSourceEntries() {
initSourceEntries(); initSourceEntries();
return (ICSourceEntry[])fProjSourceEntries.clone(); return fProjSourceEntries.clone();
} }
private void initSourceEntries(){ private void initSourceEntries(){
@ -397,11 +397,11 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
throw ExceptionFactory.createIsReadOnlyException(); throw ExceptionFactory.createIsReadOnlyException();
} }
public Map getReferenceInfo() { public Map<String, String> getReferenceInfo() {
return getSpecSettings().getReferenceInfo(); return getSpecSettings().getReferenceInfo();
} }
public void setReferenceInfo(Map refs) { public void setReferenceInfo(Map<String, String> refs) {
throw ExceptionFactory.createIsReadOnlyException(); throw ExceptionFactory.createIsReadOnlyException();
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others. * Copyright (c) 2007, 2010 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -15,7 +15,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
class CExternalSettingChangeEvent { class CExternalSettingChangeEvent {
private List fChangeInfoList = new ArrayList(); private List<CExternalSettingsContainerChangeInfo> fChangeInfoList = new ArrayList<CExternalSettingsContainerChangeInfo>();
CExternalSettingChangeEvent(CExternalSettingsContainerChangeInfo[] infos){ CExternalSettingChangeEvent(CExternalSettingsContainerChangeInfo[] infos){
fChangeInfoList.addAll(Arrays.asList(infos)); fChangeInfoList.addAll(Arrays.asList(infos));
@ -26,7 +26,7 @@ class CExternalSettingChangeEvent {
// } // }
public CExternalSettingsContainerChangeInfo[] getChangeInfos(){ public CExternalSettingsContainerChangeInfo[] getChangeInfos(){
return (CExternalSettingsContainerChangeInfo[])fChangeInfoList.toArray( return fChangeInfoList.toArray(
new CExternalSettingsContainerChangeInfo[fChangeInfoList.size()]); new CExternalSettingsContainerChangeInfo[fChangeInfoList.size()]);
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others. * Copyright (c) 2007, 2010 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -43,7 +43,7 @@ public class ResourceDescriptionHolder {
} }
public void setCurrentPath(IPath path){ public void setCurrentPath(IPath path){
//TODO: do we need to move choldren here? //TODO: do we need to move children here?
fPathSettingContainer.setPath(path, true); fPathSettingContainer.setPath(path, true);
} }
@ -53,7 +53,7 @@ public class ResourceDescriptionHolder {
} }
public ICResourceDescription[] getResourceDescriptions(final int kind){ public ICResourceDescription[] getResourceDescriptions(final int kind){
final List list = new ArrayList(); final List<ICResourceDescription> list = new ArrayList<ICResourceDescription>();
fPathSettingContainer.accept(new IPathSettingsContainerVisitor(){ fPathSettingContainer.accept(new IPathSettingsContainerVisitor(){
public boolean visit(PathSettingsContainer container) { public boolean visit(PathSettingsContainer container) {
@ -68,15 +68,15 @@ public class ResourceDescriptionHolder {
}); });
if(kind == ICSettingBase.SETTING_FILE) if(kind == ICSettingBase.SETTING_FILE)
return (ICFileDescription[])list.toArray(new ICFileDescription[list.size()]); return list.toArray(new ICFileDescription[list.size()]);
else if(kind == ICSettingBase.SETTING_FOLDER) else if(kind == ICSettingBase.SETTING_FOLDER)
return (ICFolderDescription[])list.toArray(new ICFolderDescription[list.size()]); return list.toArray(new ICFolderDescription[list.size()]);
return (ICResourceDescription[])list.toArray(new ICResourceDescription[list.size()]); return list.toArray(new ICResourceDescription[list.size()]);
} }
public ICResourceDescription[] getResourceDescriptions(){ public ICResourceDescription[] getResourceDescriptions(){
final List list = new ArrayList(); final List<Object> list = new ArrayList<Object>();
fPathSettingContainer.accept(new IPathSettingsContainerVisitor(){ fPathSettingContainer.accept(new IPathSettingsContainerVisitor(){
public boolean visit(PathSettingsContainer container) { public boolean visit(PathSettingsContainer container) {
@ -85,7 +85,7 @@ public class ResourceDescriptionHolder {
} }
}); });
return (ICResourceDescription[])list.toArray(new ICResourceDescription[list.size()]); return list.toArray(new ICResourceDescription[list.size()]);
} }
public void removeResurceDescription(IPath path){ public void removeResurceDescription(IPath path){