1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

[263133] refactoring for java 1.5 (patch applied)

This commit is contained in:
Alena Laskavaia 2009-02-11 19:26:11 +00:00
parent 91c9f2840c
commit d5b8322626
6 changed files with 109 additions and 101 deletions

View file

@ -31,6 +31,7 @@ public interface IMakeCommonBuildInfo {
/** /**
* @deprecated - use setBuildString(BUILD_LOCATION...) * @deprecated - use setBuildString(BUILD_LOCATION...)
*/ */
@Deprecated
void setBuildLocation(IPath location) throws CoreException; void setBuildLocation(IPath location) throws CoreException;
boolean isStopOnError(); boolean isStopOnError();
@ -44,6 +45,7 @@ public interface IMakeCommonBuildInfo {
/** /**
* @deprecated - use setBuildString(BUILD_COMMAND...) * @deprecated - use setBuildString(BUILD_COMMAND...)
*/ */
@Deprecated
void setBuildCommand(IPath command) throws CoreException; void setBuildCommand(IPath command) throws CoreException;
String getBuildArguments(); String getBuildArguments();
@ -51,15 +53,16 @@ public interface IMakeCommonBuildInfo {
/** /**
* @deprecated - use setBuildString(BUILD_ARGUMENTS...) * @deprecated - use setBuildString(BUILD_ARGUMENTS...)
*/ */
@Deprecated
void setBuildArguments(String args) throws CoreException; void setBuildArguments(String args) throws CoreException;
String[] getErrorParsers(); String[] getErrorParsers();
void setErrorParsers(String[] parsers) throws CoreException; void setErrorParsers(String[] parsers) throws CoreException;
Map getExpandedEnvironment() throws CoreException; Map<String, String> getExpandedEnvironment() throws CoreException;
Map getEnvironment(); Map<String, String> getEnvironment();
void setEnvironment(Map env) throws CoreException; void setEnvironment(Map<String, String> env) throws CoreException;
boolean appendEnvironment(); boolean appendEnvironment();
void setAppendEnvironment(boolean append) throws CoreException; void setAppendEnvironment(boolean append) throws CoreException;

View file

@ -15,6 +15,8 @@ import java.util.EventObject;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
public class MakeTargetEvent extends EventObject { public class MakeTargetEvent extends EventObject {
private static final long serialVersionUID = 1L;
public static final int TARGET_ADD = 1; public static final int TARGET_ADD = 1;
public static final int TARGET_CHANGED = 2; public static final int TARGET_CHANGED = 2;
public static final int TARGET_REMOVED = 3; public static final int TARGET_REMOVED = 3;

View file

@ -42,11 +42,10 @@ public class MakeProject implements ICOwner {
private void updateBinaryParsers(ICDescriptor cDescriptor) throws CoreException { private void updateBinaryParsers(ICDescriptor cDescriptor) throws CoreException {
cDescriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID); cDescriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID);
Preferences makePrefs = MakeCorePlugin.getDefault().getPluginPreferences(); Preferences makePrefs = MakeCorePlugin.getDefault().getPluginPreferences();
String id = makePrefs.getString(CCorePlugin.PREF_BINARY_PARSER); String ids = makePrefs.getString(CCorePlugin.PREF_BINARY_PARSER);
if (id != null && id.length() != 0) { if (ids != null && ids.length() != 0) {
String[] ids = parseStringToArray(id); for (String id : parseStringToArray(ids)) {
for (int i = 0; i < ids.length; i++) { cDescriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, id);
cDescriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, ids[i]);
} }
} }
} }
@ -54,11 +53,10 @@ public class MakeProject implements ICOwner {
private void updateIndexers(ICDescriptor cDescriptor) throws CoreException { private void updateIndexers(ICDescriptor cDescriptor) throws CoreException {
cDescriptor.remove(CCorePlugin.INDEXER_UNIQ_ID); cDescriptor.remove(CCorePlugin.INDEXER_UNIQ_ID);
Preferences corePrefs = CCorePlugin.getDefault().getPluginPreferences(); Preferences corePrefs = CCorePlugin.getDefault().getPluginPreferences();
String id = corePrefs.getString(CCorePlugin.PREF_INDEXER); String ids = corePrefs.getString(CCorePlugin.PREF_INDEXER);
if (id != null && id.length() != 0) { if (ids != null && ids.length() != 0) {
String[] ids = parseStringToArray(id); for (String id : parseStringToArray(ids)) {
for (int i = 0; i < ids.length; i++) { cDescriptor.create(CCorePlugin.INDEXER_UNIQ_ID, id);
cDescriptor.create(CCorePlugin.INDEXER_UNIQ_ID, ids[i]);
} }
} }
} }
@ -66,11 +64,11 @@ public class MakeProject implements ICOwner {
private String[] parseStringToArray(String syms) { private String[] parseStringToArray(String syms) {
if (syms != null && syms.length() > 0) { if (syms != null && syms.length() > 0) {
StringTokenizer tok = new StringTokenizer(syms, ";"); //$NON-NLS-1$ StringTokenizer tok = new StringTokenizer(syms, ";"); //$NON-NLS-1$
ArrayList list = new ArrayList(tok.countTokens()); ArrayList<String> list = new ArrayList<String>(tok.countTokens());
while (tok.hasMoreElements()) { while (tok.hasMoreElements()) {
list.add(tok.nextToken()); list.add(tok.nextToken());
} }
return (String[]) list.toArray(new String[list.size()]); return list.toArray(new String[list.size()]);
} }
return new String[0]; return new String[0];
} }

View file

@ -32,7 +32,9 @@ public class MakeRecon extends OutputStream {
MyList log; MyList log;
StringBuffer currentLine; StringBuffer currentLine;
class MyList extends ArrayList { class MyList extends ArrayList<String> {
private static final long serialVersionUID = 1L;
public void removeInterval (int start, int len) { public void removeInterval (int start, int len) {
removeRange(start, len); removeRange(start, len);
} }
@ -108,6 +110,7 @@ public class MakeRecon extends OutputStream {
/** /**
* @see java.io.OutputStream#close() * @see java.io.OutputStream#close()
*/ */
@Override
public void close() throws IOException { public void close() throws IOException {
if (console != null) { if (console != null) {
console.close(); console.close();
@ -118,6 +121,7 @@ public class MakeRecon extends OutputStream {
/** /**
* @see java.io.OutputStream#flush() * @see java.io.OutputStream#flush()
*/ */
@Override
public void flush() throws IOException { public void flush() throws IOException {
if (console != null) { if (console != null) {
console.flush(); console.flush();
@ -127,6 +131,7 @@ public class MakeRecon extends OutputStream {
/** /**
* @see java.io.OutputStream#write(int) * @see java.io.OutputStream#write(int)
*/ */
@Override
public synchronized void write(int b) throws IOException { public synchronized void write(int b) throws IOException {
currentLine.append((char) b); currentLine.append((char) b);
checkProgress(false); checkProgress(false);
@ -138,6 +143,7 @@ public class MakeRecon extends OutputStream {
/** /**
* @see java.io.OutputStream#write(...) * @see java.io.OutputStream#write(...)
*/ */
@Override
public synchronized void write(byte[] b, int off, int len) throws IOException { public synchronized void write(byte[] b, int off, int len) throws IOException {
if (b == null) { if (b == null) {
throw new NullPointerException(); throw new NullPointerException();
@ -174,7 +180,7 @@ public class MakeRecon extends OutputStream {
private void processLine(String line) { private void processLine(String line) {
int found = -1; int found = -1;
for (int i = 0; i < log.size(); i++) { for (int i = 0; i < log.size(); i++) {
String s = (String)log.get(i); String s = log.get(i);
if (s.startsWith(line)) { if (s.startsWith(line)) {
found = i; found = i;
break; break;
@ -182,7 +188,7 @@ public class MakeRecon extends OutputStream {
} }
if (found != -1) { if (found != -1) {
String show = (String)log.get(found); String show = log.get(found);
if (show.length() > 50) { if (show.length() > 50) {
show = show.substring(0, 50); show = show.substring(0, 50);
} }

View file

@ -12,8 +12,8 @@
package org.eclipse.cdt.make.internal.core; package org.eclipse.cdt.make.internal.core;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.cdt.make.core.IMakeBuilderInfo; import org.eclipse.cdt.make.core.IMakeBuilderInfo;
import org.eclipse.cdt.make.core.IMakeCommonBuildInfo; import org.eclipse.cdt.make.core.IMakeCommonBuildInfo;
@ -44,12 +44,12 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
private boolean isDefaultBuildCmd; private boolean isDefaultBuildCmd;
private boolean isStopOnError; private boolean isStopOnError;
boolean runAllBuidlers = true; boolean runAllBuidlers = true;
private String targetBuilderID; private final String targetBuilderID;
private IContainer container; private IContainer container;
private int appendEnvironment = USE_PROJECT_ENV_SETTING; private int appendEnvironment = USE_PROJECT_ENV_SETTING;
private boolean appendProjectEnvironment = true; private boolean appendProjectEnvironment = true;
private Map buildEnvironment = new HashMap(); private Map<String, String> buildEnvironment = new HashMap<String, String>();
private Map targetAttributes = new HashMap(); private final Map<String, String> targetAttributes = new HashMap<String, String>();
MakeTarget(MakeTargetManager manager, IProject project, String targetBuilderID, String name) throws CoreException { MakeTarget(MakeTargetManager manager, IProject project, String targetBuilderID, String name) throws CoreException {
this.manager = manager; this.manager = manager;
@ -75,7 +75,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
this.name = name; this.name = name;
} }
Map getAttributeMap() { Map<String, String> getAttributeMap() {
return targetAttributes; return targetAttributes;
} }
@ -167,7 +167,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
} }
public String getBuildAttribute(String name, String defaultValue) { public String getBuildAttribute(String name, String defaultValue) {
String value = (String)targetAttributes.get(name); String value = targetAttributes.get(name);
return value != null ? value : defaultValue; return value != null ? value : defaultValue;
} }
@ -193,8 +193,8 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public Map getExpandedEnvironment() throws CoreException { public Map<String, String> getExpandedEnvironment() throws CoreException {
Map env = null; Map<String, String> env = null;
if (appendProjectEnvironment()) { if (appendProjectEnvironment()) {
IMakeBuilderInfo projectInfo; IMakeBuilderInfo projectInfo;
projectInfo = MakeCorePlugin.createBuildInfo(getProject(), manager.getBuilderID(targetBuilderID)); projectInfo = MakeCorePlugin.createBuildInfo(getProject(), manager.getBuilderID(targetBuilderID));
@ -205,18 +205,17 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
} else { } else {
env.putAll(getEnvironment()); env.putAll(getEnvironment());
} }
HashMap envMap = new HashMap(env.entrySet().size());
Iterator iter = env.entrySet().iterator(); HashMap<String, String> envMap = new HashMap<String, String>(env.entrySet().size());
boolean win32 = Platform.getOS().equals(Constants.OS_WIN32); boolean win32 = Platform.getOS().equals(Constants.OS_WIN32);
while (iter.hasNext()) { for (Entry<String, String> entry : env.entrySet()) {
Map.Entry entry = (Map.Entry)iter.next(); String key = entry.getKey();
String key = (String)entry.getKey();
if (win32) { if (win32) {
// Win32 vars are case insensitive. Uppercase everything so // Win32 vars are case insensitive. Uppercase everything so
// that (for example) "pAtH" will correctly replace "PATH" // that (for example) "pAtH" will correctly replace "PATH"
key = key.toUpperCase(); key = key.toUpperCase();
} }
String value = (String)entry.getValue(); String value = entry.getValue();
// translate any string substitution variables // translate any string substitution variables
String translated = value; String translated = value;
translated = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value, false); translated = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value, false);
@ -233,12 +232,12 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
appendProjectEnvironment = append; appendProjectEnvironment = append;
} }
public Map getEnvironment() { public Map<String, String> getEnvironment() {
return buildEnvironment; return buildEnvironment;
} }
public void setEnvironment(Map env) throws CoreException { public void setEnvironment(Map<String, String> env) throws CoreException {
buildEnvironment = new HashMap(env); buildEnvironment = new HashMap<String, String>(env);
manager.updateTarget(this); manager.updateTarget(this);
} }
@ -265,6 +264,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
return container; return container;
} }
@Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == this) if (obj == this)
return true; return true;
@ -275,13 +275,14 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
return false; return false;
} }
@Override
public int hashCode() { public int hashCode() {
return container.hashCode() * 17 + name != null ? name.hashCode(): 0; return container.hashCode() * 17 + name != null ? name.hashCode(): 0;
} }
public void build(IProgressMonitor monitor) throws CoreException { public void build(IProgressMonitor monitor) throws CoreException {
final String builderID = manager.getBuilderID(targetBuilderID); final String builderID = manager.getBuilderID(targetBuilderID);
final HashMap infoMap = new HashMap(); final HashMap<String, String> infoMap = new HashMap<String, String>();
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(infoMap, builderID); IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(infoMap, builderID);
info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make")); //$NON-NLS-1$ info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make")); //$NON-NLS-1$
@ -309,12 +310,12 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
if (runAllBuidlers) { if (runAllBuidlers) {
ICommand[] commands = project.getDescription().getBuildSpec(); ICommand[] commands = project.getDescription().getBuildSpec();
monitor.beginTask("", commands.length); //$NON-NLS-1$ monitor.beginTask("", commands.length); //$NON-NLS-1$
for (int i = 0; i < commands.length; i++) { for (ICommand command : commands) {
if (commands[i].getBuilderName().equals(builderID)) { if (command.getBuilderName().equals(builderID)) {
project.build(IncrementalProjectBuilder.FULL_BUILD, builderID, infoMap, new SubProgressMonitor(monitor, 1)); project.build(IncrementalProjectBuilder.FULL_BUILD, builderID, infoMap, new SubProgressMonitor(monitor, 1));
} else { } else {
project.build(IncrementalProjectBuilder.FULL_BUILD, commands[i].getBuilderName(), project.build(IncrementalProjectBuilder.FULL_BUILD, command.getBuilderName(),
commands[i].getArguments(), new SubProgressMonitor(monitor, 1)); command.getArguments(), new SubProgressMonitor(monitor, 1));
} }
} }
monitor.done(); monitor.done();
@ -330,6 +331,8 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
} }
} }
@SuppressWarnings("unchecked")
@Override
public Object getAdapter(Class adapter) { public Object getAdapter(Class adapter) {
if (adapter.equals(IProject.class)) { if (adapter.equals(IProject.class)) {
return getProject(); return getProject();

View file

@ -12,7 +12,6 @@ package org.eclipse.cdt.make.internal.core;
import java.io.File; import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Vector; import java.util.Vector;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -47,10 +46,10 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
private static String TARGETS_EXT = "targets"; //$NON-NLS-1$ private static String TARGETS_EXT = "targets"; //$NON-NLS-1$
private ListenerList listeners = new ListenerList(); private final ListenerList listeners = new ListenerList();
Map projectMap = new HashMap(); private final Map<IProject, ProjectTargets> projectMap = new HashMap<IProject, ProjectTargets>();
private HashMap builderMap; private HashMap<String, String> builderMap;
protected Vector fProjects = new Vector(); protected Vector<IProject> fProjects = new Vector<IProject>();
public MakeTargetManager() { public MakeTargetManager() {
} }
@ -67,7 +66,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
if (container instanceof IWorkspaceRoot) { if (container instanceof IWorkspaceRoot) {
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeMessages.getString("MakeTargetManager.add_to_workspace_root"), null)); //$NON-NLS-1$ throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeMessages.getString("MakeTargetManager.add_to_workspace_root"), null)); //$NON-NLS-1$
} }
ProjectTargets projectTargets = (ProjectTargets)projectMap.get(target.getProject()); ProjectTargets projectTargets = projectMap.get(target.getProject());
if (projectTargets == null) { if (projectTargets == null) {
projectTargets = readTargets(target.getProject()); projectTargets = readTargets(target.getProject());
} }
@ -83,7 +82,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
} }
public boolean targetExists(IMakeTarget target) { public boolean targetExists(IMakeTarget target) {
ProjectTargets projectTargets = (ProjectTargets)projectMap.get(target.getProject()); ProjectTargets projectTargets = projectMap.get(target.getProject());
if (projectTargets == null) { if (projectTargets == null) {
projectTargets = readTargets(target.getProject()); projectTargets = readTargets(target.getProject());
} }
@ -91,7 +90,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
} }
public void removeTarget(IMakeTarget target) throws CoreException { public void removeTarget(IMakeTarget target) throws CoreException {
ProjectTargets projectTargets = (ProjectTargets)projectMap.get(target.getProject()); ProjectTargets projectTargets = projectMap.get(target.getProject());
if (projectTargets == null) { if (projectTargets == null) {
projectTargets = readTargets(target.getProject()); projectTargets = readTargets(target.getProject());
} }
@ -107,7 +106,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
} }
public void renameTarget(IMakeTarget target, String name) throws CoreException { public void renameTarget(IMakeTarget target, String name) throws CoreException {
ProjectTargets projectTargets = (ProjectTargets)projectMap.get(target.getProject()); ProjectTargets projectTargets = projectMap.get(target.getProject());
if (projectTargets == null) { if (projectTargets == null) {
projectTargets = readTargets(target.getProject()); projectTargets = readTargets(target.getProject());
} }
@ -119,7 +118,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
} }
public IMakeTarget[] getTargets(IContainer container) throws CoreException { public IMakeTarget[] getTargets(IContainer container) throws CoreException {
ProjectTargets projectTargets = (ProjectTargets)projectMap.get(container.getProject()); ProjectTargets projectTargets = projectMap.get(container.getProject());
if (projectTargets == null) { if (projectTargets == null) {
projectTargets = readTargets(container.getProject()); projectTargets = readTargets(container.getProject());
} }
@ -127,7 +126,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
} }
public IMakeTarget findTarget(IContainer container, String name) throws CoreException { public IMakeTarget findTarget(IContainer container, String name) throws CoreException {
ProjectTargets projectTargets = (ProjectTargets)projectMap.get(container.getProject()); ProjectTargets projectTargets = projectMap.get(container.getProject());
if (projectTargets == null) { if (projectTargets == null) {
projectTargets = readTargets(container.getProject()); projectTargets = readTargets(container.getProject());
} }
@ -135,25 +134,23 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
} }
public IProject[] getTargetBuilderProjects() { public IProject[] getTargetBuilderProjects() {
return (IProject[])fProjects.toArray(new IProject[fProjects.size()]); return fProjects.toArray(new IProject[fProjects.size()]);
} }
public String[] getTargetBuilders(IProject project) { public String[] getTargetBuilders(IProject project) {
if (fProjects.contains(project) || hasTargetBuilder(project)) { if (fProjects.contains(project) || hasTargetBuilder(project)) {
try { try {
Vector ids = new Vector(); Vector<String> ids = new Vector<String>();
IProjectDescription description = project.getDescription(); IProjectDescription description = project.getDescription();
ICommand builder[] = description.getBuildSpec(); ICommand commands[] = description.getBuildSpec();
for (int i = 0; i < builder.length; i++) { for (ICommand command : commands) {
Iterator entries = builderMap.entrySet().iterator(); for (Entry<String, String> entry : builderMap.entrySet()) {
while (entries.hasNext()) { if (entry.getValue().equals(command.getBuilderName())) {
Map.Entry entry = (Entry)entries.next();
if (entry.getValue().equals(builder[i].getBuilderName())) {
ids.add(entry.getKey()); ids.add(entry.getKey());
} }
} }
} }
return (String[])ids.toArray(new String[ids.size()]); return ids.toArray(new String[ids.size()]);
} catch (CoreException e) { } catch (CoreException e) {
} }
} }
@ -164,9 +161,9 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
try { try {
if (project.isAccessible()) { if (project.isAccessible()) {
IProjectDescription description = project.getDescription(); IProjectDescription description = project.getDescription();
ICommand builder[] = description.getBuildSpec(); ICommand commands[] = description.getBuildSpec();
for (int j = 0; j < builder.length; j++) { for (ICommand command : commands) {
if (builderMap.containsValue(builder[j].getBuilderName())) { if (builderMap.containsValue(command.getBuilderName())) {
return true; return true;
} }
} }
@ -178,10 +175,10 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
public void startup() { public void startup() {
initializeBuilders(); initializeBuilders();
IProject project[] = ResourcesPlugin.getWorkspace().getRoot().getProjects(); IProject projects[] = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (int i = 0; i < project.length; i++) { for (IProject project : projects) {
if (hasTargetBuilder(project[i])) { if (hasTargetBuilder(project)) {
fProjects.add(project[i]); fProjects.add(project);
} }
} }
ResourcesPlugin.getWorkspace().addResourceChangeListener(this); ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
@ -256,7 +253,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
protected void updateTarget(MakeTarget target) throws CoreException { protected void updateTarget(MakeTarget target) throws CoreException {
if (target.getContainer() != null ) { // target has not been added to manager. if (target.getContainer() != null ) { // target has not been added to manager.
ProjectTargets projectTargets = (ProjectTargets)projectMap.get(target.getProject()); ProjectTargets projectTargets = projectMap.get(target.getProject());
if (projectTargets == null || !projectTargets.contains(target)) { if (projectTargets == null || !projectTargets.contains(target)) {
return; // target has not been added to manager. return; // target has not been added to manager.
} }
@ -287,15 +284,15 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
} }
protected void initializeBuilders() { protected void initializeBuilders() {
builderMap = new HashMap(); builderMap = new HashMap<String, String>();
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(MakeCorePlugin.PLUGIN_ID, MakeTargetManager.TARGET_BUILD_EXT); IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(MakeCorePlugin.PLUGIN_ID, MakeTargetManager.TARGET_BUILD_EXT);
IExtension[] ext = point.getExtensions(); IExtension[] extensions = point.getExtensions();
for (int i = 0; i < ext.length; i++) { for (IExtension extension : extensions) {
IConfigurationElement[] element = ext[i].getConfigurationElements(); IConfigurationElement[] cfgElements = extension.getConfigurationElements();
for (int j = 0; j < element.length; j++) { for (IConfigurationElement cfgElement : cfgElements) {
if (element[j].getName().equals("builder")) { //$NON-NLS-1$ if (cfgElement.getName().equals("builder")) { //$NON-NLS-1$
String builderID = element[j].getAttribute("builderID"); //$NON-NLS-1$ String builderID = cfgElement.getAttribute("builderID"); //$NON-NLS-1$
String targetID = element[j].getAttribute("id"); //$NON-NLS-1$ String targetID = cfgElement.getAttribute("id"); //$NON-NLS-1$
builderMap.put(targetID, builderID); builderMap.put(targetID, builderID);
} }
} }
@ -303,9 +300,8 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
} }
protected void notifyListeners(MakeTargetEvent event) { protected void notifyListeners(MakeTargetEvent event) {
Object[] list = listeners.getListeners(); for (Object listener : listeners.getListeners()) {
for (int i = 0; i < list.length; i++) { ((IMakeTargetListener)listener).targetChanged(event);
((IMakeTargetListener)list[i]).targetChanged(event);
} }
} }
@ -318,6 +314,6 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
} }
public String getBuilderID(String targetBuilderID) { public String getBuilderID(String targetBuilderID) {
return (String)builderMap.get(targetBuilderID); return builderMap.get(targetBuilderID);
} }
} }