1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

cosmetics: enhanced loops etc

This commit is contained in:
Andrew Gvozdev 2010-01-18 21:44:35 +00:00
parent 0b7f4acca3
commit cddcfe7160

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2008 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
@ -14,7 +14,6 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.settings.model.ICSettingBase; import org.eclipse.cdt.core.settings.model.ICSettingBase;
import org.eclipse.cdt.core.settings.model.ICStorageElement; import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.extension.CResourceData; import org.eclipse.cdt.core.settings.model.extension.CResourceData;
@ -30,9 +29,12 @@ import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.IResourceInfo; import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.core.OptionStringValue; import org.eclipse.cdt.managedbuilder.core.OptionStringValue;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
public abstract class ResourceInfo extends BuildObject implements IResourceInfo { public abstract class ResourceInfo extends BuildObject implements IResourceInfo {
private Configuration config; private Configuration config;
@ -124,7 +126,8 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
} }
path = normalizePath(path); path = normalizePath(path);
} else { } else {
CCorePlugin.log("ResourceInfo.loadFromManifest() : resourcePath is NULL"); Status status = new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "ResourceInfo.loadFromManifest() : resourcePath=NULL", null); //$NON-NLS-1$
ManagedBuilderCorePlugin.log(status);
} }
// exclude // exclude
@ -154,7 +157,8 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
} }
path = normalizePath(path); path = normalizePath(path);
} else { } else {
CCorePlugin.log("ResourceInfo.loadFromProject() : resourcePath is NULL"); Status status = new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "ResourceInfo.loadFromProject() : resourcePath=NULL", null); //$NON-NLS-1$
ManagedBuilderCorePlugin.log(status);
} }
} }
@ -224,7 +228,7 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
private ResourceInfoContainer getRcInfo(){ private ResourceInfoContainer getRcInfo(){
if(rcInfo == null) if(rcInfo == null)
rcInfo = ((Configuration)config).getRcInfoContainer(this); rcInfo = (config).getRcInfoContainer(this);
return rcInfo; return rcInfo;
} }
@ -286,7 +290,7 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
ri.setOption(t, op, ((Boolean)value).booleanValue()); ri.setOption(t, op, ((Boolean)value).booleanValue());
} else if (value instanceof String) { } else if (value instanceof String) {
String s = (String)oldValue; String s = (String)oldValue;
if (s.equals(op.getStringValue()) && ! s.equals((String)value)) if (s.equals(op.getStringValue()) && ! s.equals(value))
ri.setOption(t, op, (String)value); ri.setOption(t, op, (String)value);
} else if (value instanceof String[]) { } else if (value instanceof String[]) {
String[] s = (String[])oldValue; String[] s = (String[])oldValue;
@ -383,8 +387,8 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
return; return;
ITool tools[] = getTools(); ITool tools[] = getTools();
for(int i = 0; i < tools.length; i++){ for (ITool tool : tools) {
((Tool)tools[i]).propertiesChanged(); ((Tool)tool).propertiesChanged();
} }
} }
@ -393,9 +397,8 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
public abstract Set<String> contributeErrorParsers(Set<String> set); public abstract Set<String> contributeErrorParsers(Set<String> set);
protected Set<String> contributeErrorParsers(ITool[] tools, Set<String> set){ protected Set<String> contributeErrorParsers(ITool[] tools, Set<String> set){
for(int i = 0; i < tools.length; i++){ for (ITool tool : tools) {
Tool tool = (Tool)tools[i]; set = ((Tool)tool).contributeErrorParsers(set);
set = tool.contributeErrorParsers(set);
} }
return set; return set;
} }
@ -403,26 +406,24 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
public abstract void resetErrorParsers(); public abstract void resetErrorParsers();
protected void resetErrorParsers(ITool tools[]){ protected void resetErrorParsers(ITool tools[]){
for(int i = 0; i < tools.length; i++){ for (ITool tool : tools) {
Tool tool = (Tool)tools[i]; ((Tool)tool).resetErrorParsers();
tool.resetErrorParsers();
} }
} }
abstract void removeErrorParsers(Set<String> set); abstract void removeErrorParsers(Set<String> set);
protected void removeErrorParsers(ITool tools[], Set<String> set){ protected void removeErrorParsers(ITool tools[], Set<String> set){
for(int i = 0; i < tools.length; i++){ for (ITool tool : tools) {
Tool tool = (Tool)tools[i]; ((Tool)tool).removeErrorParsers(set);
tool.removeErrorParsers(set);
} }
} }
public ITool getToolById(String id) { public ITool getToolById(String id) {
ITool[] tools = getTools(); ITool[] tools = getTools();
for(int i = 0; i < tools.length; i++){ for (ITool tool : tools) {
if(id.equals(tools[i].getId())) if(id.equals(tool.getId()))
return tools[i]; return tool;
} }
return null; return null;
} }
@ -442,7 +443,9 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
public IFolderInfo getParentFolderInfo(){ public IFolderInfo getParentFolderInfo(){
ResourceInfo parentRc = getParentResourceInfo(); ResourceInfo parentRc = getParentResourceInfo();
for(; parentRc != null && !parentRc.isFolderInfo(); parentRc = parentRc.getParentResourceInfo()); for(; parentRc != null && !parentRc.isFolderInfo(); parentRc = parentRc.getParentResourceInfo()) {
// empty body, loop is to find parent only
}
return (IFolderInfo)parentRc; return (IFolderInfo)parentRc;
} }