mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 22:22:11 +02:00
cleanup: loops to enhanced, @Override, spaces
This commit is contained in:
parent
e3b9ef08cd
commit
ef4d88a354
1 changed files with 207 additions and 209 deletions
|
@ -130,13 +130,12 @@ public class InputType extends BuildObject implements IInputType {
|
|||
|
||||
// Load Children
|
||||
IManagedConfigElement[] iElements = element.getChildren();
|
||||
for (int l = 0; l < iElements.length; ++l) {
|
||||
IManagedConfigElement iElement = iElements[l];
|
||||
if (iElement.getName().equals(IInputOrder.INPUT_ORDER_ELEMENT_NAME)) {
|
||||
InputOrder inputOrder = new InputOrder(this, iElement);
|
||||
for (IManagedConfigElement elem : iElements) {
|
||||
if (elem.getName().equals(IInputOrder.INPUT_ORDER_ELEMENT_NAME)) {
|
||||
InputOrder inputOrder = new InputOrder(this, elem);
|
||||
getInputOrderList().add(inputOrder);
|
||||
} else if (iElement.getName().equals(IAdditionalInput.ADDITIONAL_INPUT_ELEMENT_NAME)) {
|
||||
AdditionalInput addlInput = new AdditionalInput(this, iElement);
|
||||
} else if (elem.getName().equals(IAdditionalInput.ADDITIONAL_INPUT_ELEMENT_NAME)) {
|
||||
AdditionalInput addlInput = new AdditionalInput(this, elem);
|
||||
getAdditionalInputList().add(addlInput);
|
||||
}
|
||||
}
|
||||
|
@ -188,8 +187,7 @@ public class InputType extends BuildObject implements IInputType {
|
|||
|
||||
// Load children
|
||||
ICStorageElement configElements[] = element.getChildren();
|
||||
for (int i = 0; i < configElements.length; ++i) {
|
||||
ICStorageElement configElement = configElements[i];
|
||||
for (ICStorageElement configElement : configElements) {
|
||||
if (configElement.getName().equals(IInputOrder.INPUT_ORDER_ELEMENT_NAME)) {
|
||||
InputOrder inputOrder = new InputOrder(this, configElement);
|
||||
getInputOrderList().add(inputOrder);
|
||||
|
@ -225,22 +223,22 @@ public class InputType extends BuildObject implements IInputType {
|
|||
// Copy the remaining attributes
|
||||
|
||||
if (inputType.sourceContentTypeIds != null) {
|
||||
sourceContentTypeIds = (String[])inputType.sourceContentTypeIds.clone();
|
||||
sourceContentTypeIds = inputType.sourceContentTypeIds.clone();
|
||||
}
|
||||
if(inputType.sourceContentTypes != null) {
|
||||
sourceContentTypes = (IContentType[])inputType.sourceContentTypes.clone();
|
||||
sourceContentTypes = inputType.sourceContentTypes.clone();
|
||||
}
|
||||
if (inputType.inputExtensions != null) {
|
||||
inputExtensions = (String[])inputType.inputExtensions.clone();
|
||||
inputExtensions = inputType.inputExtensions.clone();
|
||||
}
|
||||
if (inputType.headerContentTypeIds != null) {
|
||||
headerContentTypeIds = (String[])inputType.headerContentTypeIds.clone();
|
||||
headerContentTypeIds = inputType.headerContentTypeIds.clone();
|
||||
}
|
||||
if (inputType.headerContentTypes != null) {
|
||||
headerContentTypes = (IContentType[])inputType.headerContentTypes.clone();
|
||||
headerContentTypes = inputType.headerContentTypes.clone();
|
||||
}
|
||||
if (inputType.headerExtensions != null) {
|
||||
headerExtensions = (String[])inputType.headerExtensions.clone();
|
||||
headerExtensions = inputType.headerExtensions.clone();
|
||||
}
|
||||
|
||||
if (inputType.dependencyContentTypeId != null) {
|
||||
|
@ -470,8 +468,8 @@ public class InputType extends BuildObject implements IInputType {
|
|||
}
|
||||
|
||||
if(sourceContentTypeIds != null){
|
||||
for(int i = 0; i < sourceContentTypeIds.length; i++){
|
||||
IContentType type = manager.getContentType(sourceContentTypeIds[i]);
|
||||
for (String sourceContentTypeId : sourceContentTypeIds) {
|
||||
IContentType type = manager.getContentType(sourceContentTypeId);
|
||||
if(type != null)
|
||||
list.add(type);
|
||||
}
|
||||
|
@ -515,8 +513,8 @@ public class InputType extends BuildObject implements IInputType {
|
|||
}
|
||||
|
||||
if(headerContentTypeIds != null){
|
||||
for(int i = 0; i < headerContentTypeIds.length; i++){
|
||||
IContentType type = manager.getContentType(headerContentTypeIds[i]);
|
||||
for (String headerContentTypeId : headerContentTypeIds) {
|
||||
IContentType type = manager.getContentType(headerContentTypeId);
|
||||
if(type != null)
|
||||
list.add(type);
|
||||
}
|
||||
|
@ -722,14 +720,14 @@ public class InputType extends BuildObject implements IInputType {
|
|||
Iterator iter = childElements.listIterator();
|
||||
while (iter.hasNext()) {
|
||||
InputOrder io = (InputOrder) iter.next();
|
||||
ICStorageElement ioElement = element.createChild(InputOrder.INPUT_ORDER_ELEMENT_NAME);
|
||||
ICStorageElement ioElement = element.createChild(IInputOrder.INPUT_ORDER_ELEMENT_NAME);
|
||||
io.serialize(ioElement);
|
||||
}
|
||||
childElements = getAdditionalInputList();
|
||||
iter = childElements.listIterator();
|
||||
while (iter.hasNext()) {
|
||||
AdditionalInput ai = (AdditionalInput) iter.next();
|
||||
ICStorageElement aiElement = element.createChild(AdditionalInput.ADDITIONAL_INPUT_ELEMENT_NAME);
|
||||
ICStorageElement aiElement = element.createChild(IAdditionalInput.ADDITIONAL_INPUT_ELEMENT_NAME);
|
||||
ai.serialize(aiElement);
|
||||
}
|
||||
|
||||
|
@ -885,9 +883,9 @@ public class InputType extends BuildObject implements IInputType {
|
|||
kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) {
|
||||
String[] paths = current.getPaths();
|
||||
if (paths != null) {
|
||||
for (int i = 0; i < paths.length; i++) {
|
||||
if (paths[i].length() > 0) {
|
||||
deps.add(Path.fromOSString(paths[i]));
|
||||
for (String path : paths) {
|
||||
if (path.length() > 0) {
|
||||
deps.add(Path.fromOSString(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -909,9 +907,9 @@ public class InputType extends BuildObject implements IInputType {
|
|||
kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) {
|
||||
String[] paths = current.getPaths();
|
||||
if (paths != null) {
|
||||
for (int i = 0; i < paths.length; i++) {
|
||||
if (paths[i].length() > 0) {
|
||||
ins.add(Path.fromOSString(paths[i]));
|
||||
for (String path : paths) {
|
||||
if (path.length() > 0) {
|
||||
ins.add(Path.fromOSString(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -955,6 +953,7 @@ public class InputType extends BuildObject implements IInputType {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IInputType#getName()
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return (name == null && superClass != null) ? superClass.getName() : name;
|
||||
}
|
||||
|
@ -1061,8 +1060,8 @@ public class InputType extends BuildObject implements IInputType {
|
|||
// add "h" to the list if it is not already there.
|
||||
if (type.getId().compareTo("org.eclipse.cdt.core.cxxHeader") == 0) { //$NON-NLS-1$
|
||||
boolean h_found = false;
|
||||
for (int i=0; i<exts.length; i++) {
|
||||
if (exts[i].compareTo("h") == 0) { //$NON-NLS-1$
|
||||
for (String ext : exts) {
|
||||
if (ext.compareTo("h") == 0) { //$NON-NLS-1$
|
||||
h_found = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1087,8 +1086,8 @@ public class InputType extends BuildObject implements IInputType {
|
|||
*/
|
||||
public boolean isDependencyExtension(ITool tool, String ext) {
|
||||
String[] exts = getDependencyExtensions(tool);
|
||||
for (int i=0; i<exts.length; i++) {
|
||||
if (ext.equals(exts[i])) return true;
|
||||
for (String depExt : exts) {
|
||||
if (ext.equals(depExt)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1262,7 +1261,7 @@ public class InputType extends BuildObject implements IInputType {
|
|||
|
||||
return new IContentType[0];
|
||||
}
|
||||
return (IContentType[])sourceContentTypes.clone();
|
||||
return sourceContentTypes.clone();
|
||||
}
|
||||
|
||||
public IContentType[] getHeaderContentTypes() {
|
||||
|
@ -1273,7 +1272,7 @@ public class InputType extends BuildObject implements IInputType {
|
|||
|
||||
return new IContentType[0];
|
||||
}
|
||||
return (IContentType[])headerContentTypes.clone();
|
||||
return headerContentTypes.clone();
|
||||
}
|
||||
|
||||
public String[] getHeaderExtensionsAttribute() {
|
||||
|
@ -1284,7 +1283,7 @@ public class InputType extends BuildObject implements IInputType {
|
|||
|
||||
return new String[0];
|
||||
}
|
||||
return (String[])headerExtensions.clone();
|
||||
return headerExtensions.clone();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1297,7 +1296,7 @@ public class InputType extends BuildObject implements IInputType {
|
|||
|
||||
return new String[0];
|
||||
}
|
||||
return (String[])headerContentTypeIds.clone();
|
||||
return headerContentTypeIds.clone();
|
||||
}
|
||||
|
||||
public String[] getSourceContentTypeIds() {
|
||||
|
@ -1308,7 +1307,7 @@ public class InputType extends BuildObject implements IInputType {
|
|||
|
||||
return new String[0];
|
||||
}
|
||||
return (String[])sourceContentTypeIds.clone();
|
||||
return sourceContentTypeIds.clone();
|
||||
}
|
||||
|
||||
public void setHeaderContentTypeIds(String[] ids) {
|
||||
|
@ -1386,7 +1385,7 @@ public class InputType extends BuildObject implements IInputType {
|
|||
setRebuildState(true);
|
||||
}
|
||||
} else {
|
||||
sourceContentTypes = (IContentType[])types.clone();
|
||||
sourceContentTypes = types.clone();
|
||||
sourceContentTypeIds = new String[types.length];
|
||||
for(int i = 0; i < types.length; i++){
|
||||
sourceContentTypeIds[i] = types[i].getId();
|
||||
|
@ -1409,7 +1408,7 @@ public class InputType extends BuildObject implements IInputType {
|
|||
|
||||
return new String[0];
|
||||
}
|
||||
return (String[])inputExtensions.clone();
|
||||
return inputExtensions.clone();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -1463,10 +1462,8 @@ public class InputType extends BuildObject implements IInputType {
|
|||
// Use content type if specified and registered with Eclipse
|
||||
IContentType types[] = getSourceContentTypes();
|
||||
if (types.length != 0) {
|
||||
IContentType type;
|
||||
List list = new ArrayList();
|
||||
for(int i = 0; i < types.length; i++){
|
||||
type = types[i];
|
||||
for (IContentType type : types) {
|
||||
list.addAll(Arrays.asList(((Tool)tool).getContentTypeFileSpecs(type, project)));
|
||||
}
|
||||
return (String[])list.toArray(new String[list.size()]);
|
||||
|
@ -1478,10 +1475,8 @@ public class InputType extends BuildObject implements IInputType {
|
|||
public String[] getHeaderExtensions(ITool tool) {
|
||||
IContentType types[] = getHeaderContentTypes();
|
||||
if (types.length != 0) {
|
||||
IContentType type;
|
||||
List list = new ArrayList();
|
||||
for(int i = 0; i < types.length; i++){
|
||||
type = types[i];
|
||||
for (IContentType type : types) {
|
||||
list.addAll(Arrays.asList(((Tool)tool).getContentTypeFileSpecs(type)));
|
||||
}
|
||||
return (String[])list.toArray(new String[list.size()]);
|
||||
|
@ -1498,8 +1493,8 @@ public class InputType extends BuildObject implements IInputType {
|
|||
|
||||
public boolean isSourceExtension(ITool tool, String ext, IProject project) {
|
||||
String[] exts = getSourceExtensions(tool, project);
|
||||
for (int i=0; i<exts.length; i++) {
|
||||
if (ext.equals(exts[i])) return true;
|
||||
for (String srcExt : exts) {
|
||||
if (ext.equals(srcExt)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1580,8 +1575,8 @@ public class InputType extends BuildObject implements IInputType {
|
|||
IContentTypeManager manager = Platform.getContentTypeManager();
|
||||
List list = new ArrayList();
|
||||
if (sourceContentTypeIds != null) {
|
||||
for(int i = 0; i < sourceContentTypeIds.length; i++){
|
||||
IContentType type = manager.getContentType(sourceContentTypeIds[i]);
|
||||
for (String sourceContentTypeId : sourceContentTypeIds) {
|
||||
IContentType type = manager.getContentType(sourceContentTypeId);
|
||||
if(type != null)
|
||||
list.add(type);
|
||||
}
|
||||
|
@ -1594,8 +1589,8 @@ public class InputType extends BuildObject implements IInputType {
|
|||
}
|
||||
|
||||
if (headerContentTypeIds != null) {
|
||||
for(int i = 0; i < headerContentTypeIds.length; i++){
|
||||
IContentType type = manager.getContentType(headerContentTypeIds[i]);
|
||||
for (String headerContentTypeId : headerContentTypeIds) {
|
||||
IContentType type = manager.getContentType(headerContentTypeId);
|
||||
if(type != null)
|
||||
list.add(type);
|
||||
}
|
||||
|
@ -1628,6 +1623,7 @@ public class InputType extends BuildObject implements IInputType {
|
|||
/**
|
||||
* @return Returns the managedBuildRevision.
|
||||
*/
|
||||
@Override
|
||||
public String getManagedBuildRevision() {
|
||||
if ( managedBuildRevision == null) {
|
||||
if ( getParent() != null) {
|
||||
|
@ -1640,6 +1636,7 @@ public class InputType extends BuildObject implements IInputType {
|
|||
/**
|
||||
* @return Returns the version.
|
||||
*/
|
||||
@Override
|
||||
public PluginVersionIdentifier getVersion() {
|
||||
if ( version == null) {
|
||||
if ( getParent() != null) {
|
||||
|
@ -1649,6 +1646,7 @@ public class InputType extends BuildObject implements IInputType {
|
|||
return version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVersion(PluginVersionIdentifier version) {
|
||||
// Do nothing
|
||||
}
|
||||
|
@ -1768,8 +1766,8 @@ public class InputType extends BuildObject implements IInputType {
|
|||
langName = getLanguageNameAttribute();
|
||||
if(langName == null){
|
||||
IContentType types[] = getSourceContentTypes();
|
||||
for(int i = 0; i < types.length; i++){
|
||||
String name = types[i].getName();
|
||||
for (IContentType type : types) {
|
||||
String name = type.getName();
|
||||
if(name != null && name.length() != 0){
|
||||
langName = name;
|
||||
break;
|
||||
|
@ -1778,8 +1776,8 @@ public class InputType extends BuildObject implements IInputType {
|
|||
|
||||
if(langName == null){
|
||||
types = getHeaderContentTypes();
|
||||
for(int i = 0; i < types.length; i++){
|
||||
String name = types[i].getName();
|
||||
for (IContentType type : types) {
|
||||
String name = type.getName();
|
||||
if(name != null && name.length() != 0){
|
||||
langName = name;
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue