mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
cosmetics: generics
This commit is contained in:
parent
8e6a604b18
commit
5cec38091d
6 changed files with 121 additions and 120 deletions
|
@ -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);
|
||||||
|
|
|
@ -34,7 +34,7 @@ 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;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public final class PathSettingsContainer {
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
@ -114,21 +114,21 @@ public final class PathSettingsContainer {
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,9 +139,9 @@ public final class PathSettingsContainer {
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -177,7 +178,7 @@ public final class PathSettingsContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
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,7 +188,7 @@ 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){
|
||||||
|
@ -231,17 +232,17 @@ public final class PathSettingsContainer {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
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){
|
||||||
|
@ -334,9 +335,9 @@ public final class PathSettingsContainer {
|
||||||
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,17 +428,17 @@ public final class PathSettingsContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
@ -613,12 +614,12 @@ public final class PathSettingsContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
@ -641,8 +642,8 @@ 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;
|
||||||
|
|
|
@ -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(){
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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){
|
||||||
|
|
Loading…
Add table
Reference in a new issue