[214656] Java 5 for loop
diff --git a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/RuntimeClasspathProviderDelegate.java b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/RuntimeClasspathProviderDelegate.java
index f8f96cd..36ea2c5 100644
--- a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/RuntimeClasspathProviderDelegate.java
+++ b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/RuntimeClasspathProviderDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -214,12 +214,11 @@
File[] files = dir.listFiles();
if (files != null) {
- int size = files.length;
- for (int i = 0; i < size; i++) {
- if (files[i].isDirectory() && depth > 0) {
- addJarFiles(files[i], list, depth - 1);
- } else if (files[i].getAbsolutePath().endsWith(".jar") || files[i].getAbsolutePath().endsWith(".zip")) {
- IPath path = new Path(files[i].getAbsolutePath());
+ for (File file : files) {
+ if (file.isDirectory() && depth > 0) {
+ addJarFiles(file, list, depth - 1);
+ } else if (file.getAbsolutePath().endsWith(".jar") || file.getAbsolutePath().endsWith(".zip")) {
+ IPath path = new Path(file.getAbsolutePath());
list.add(JavaCore.newLibraryEntry(path, null, null));
}
}
@@ -256,15 +255,14 @@
// find the source attachments
sourceAttachments = new ArrayList<SourceAttachmentUpdate>();
- int size = entries.length;
- for (int i = 0; i < size; i++) {
- if (entries[i].getSourceAttachmentPath() != null || entries[i].getExtraAttributes() != null) {
+ for (IClasspathEntry entry : entries) {
+ if (entry.getSourceAttachmentPath() != null || entry.getExtraAttributes() != null) {
SourceAttachmentUpdate sau = new SourceAttachmentUpdate();
sau.runtimeId = runtime.getId();
- sau.entry = entries[i].getPath();
- sau.sourceAttachmentPath = entries[i].getSourceAttachmentPath();
- sau.sourceAttachmentRootPath = entries[i].getSourceAttachmentRootPath();
- sau.attributes = entries[i].getExtraAttributes();
+ sau.entry = entry.getPath();
+ sau.sourceAttachmentPath = entry.getSourceAttachmentPath();
+ sau.sourceAttachmentRootPath = entry.getSourceAttachmentRootPath();
+ sau.attributes = entry.getExtraAttributes();
sourceAttachments.add(sau);
}
}
@@ -286,22 +284,20 @@
IMemento memento = XMLMemento.loadMemento(filename);
IMemento[] children = memento.getChildren("source-attachment");
- int size = children.length;
-
- for (int i = 0; i < size; i++) {
+ for (IMemento child : children) {
try {
SourceAttachmentUpdate sau = new SourceAttachmentUpdate();
- sau.runtimeId = children[i].getString("runtime-id");
- String temp = children[i].getString("entry");
+ sau.runtimeId = child.getString("runtime-id");
+ String temp = child.getString("entry");
if (temp != null)
sau.entry = new Path(temp);
- temp = children[i].getString("source-attachment-path");
+ temp = child.getString("source-attachment-path");
if (temp != null)
sau.sourceAttachmentPath = new Path(temp);
- temp = children[i].getString("source-attachment-root-path");
+ temp = child.getString("source-attachment-root-path");
if (temp != null)
sau.sourceAttachmentRootPath = new Path(temp);
- IMemento[] attrChildren = children[i].getChildren("attribute");
+ IMemento[] attrChildren = child.getChildren("attribute");
if (attrChildren != null) {
int size2 = attrChildren.length;
sau.attributes = new IClasspathAttribute[size2];
@@ -344,9 +340,7 @@
if (sau.sourceAttachmentRootPath != null)
child.putString("source-attachment-root-path", sau.sourceAttachmentRootPath.toPortableString());
if (sau.attributes != null) {
- int size = sau.attributes.length;
- for (int i = 0; i < size; i++) {
- IClasspathAttribute attr = sau.attributes[i];
+ for (IClasspathAttribute attr : sau.attributes) {
IMemento attrChild = child.createChild("attribute");
attrChild.putString("name", attr.getName());
attrChild.putString("value", attr.getValue());
diff --git a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/GenericRuntime.java b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/GenericRuntime.java
index 39a255a..264fcaa 100644
--- a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/GenericRuntime.java
+++ b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/GenericRuntime.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -57,11 +57,10 @@
try {
IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(getVMInstallTypeId());
IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
- int size = vmInstalls.length;
String id = getVMInstallId();
- for (int i = 0; i < size; i++) {
- if (id.equals(vmInstalls[i].getId()))
- return vmInstalls[i];
+ for (IVMInstall vmInst : vmInstalls) {
+ if (id.equals(vmInst.getId()))
+ return vmInst;
}
} catch (Exception e) {
// ignore
diff --git a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/J2EEUtil.java b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/J2EEUtil.java
index bd6a276..2bbf8e9 100644
--- a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/J2EEUtil.java
+++ b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/J2EEUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -53,16 +53,13 @@
List<IModule> list = new ArrayList<IModule>();
IModule[] modules = ServerUtil.getModules(EAR_MODULE);
if (modules != null) {
- int size = modules.length;
- for (int i = 0; i < size; i++) {
- IModule module2 = modules[i];
+ for (IModule module2 : modules) {
IEnterpriseApplication ear = (IEnterpriseApplication) module2.loadAdapter(IEnterpriseApplication.class, monitor);
if (ear != null) {
IModule[] modules2 = ear.getModules();
if (modules2 != null) {
- int size2 = modules2.length;
- for (int j = 0; j < size2; j++) {
- if (module.equals(modules2[j].loadAdapter(IJ2EEModule.class, monitor)))
+ for (IModule m : modules2) {
+ if (module.equals(m.loadAdapter(IJ2EEModule.class, monitor)))
list.add(module2);
}
}
@@ -92,16 +89,13 @@
List<IModule> list = new ArrayList<IModule>();
IModule[] modules = ServerUtil.getModules(EAR_MODULE);
if (modules != null) {
- int size = modules.length;
- for (int i = 0; i < size; i++) {
- IModule module2 = modules[i];
+ for (IModule module2 : modules) {
IEnterpriseApplication ear = (IEnterpriseApplication) module2.loadAdapter(IEnterpriseApplication.class, monitor);
if (ear != null) {
IModule[] modules2 = ear.getModules();
if (modules2 != null) {
- int size2 = modules2.length;
- for (int j = 0; j < size2; j++) {
- if (module.equals(modules2[j]))
+ for (IModule m : modules2) {
+ if (module.equals(m))
list.add(module2);
}
}
@@ -131,16 +125,13 @@
List<IModule> list = new ArrayList<IModule>();
IModule[] modules = ServerUtil.getModules(WEB_MODULE);
if (modules != null) {
- int size = modules.length;
- for (int i = 0; i < size; i++) {
- IModule module2 = modules[i];
+ for (IModule module2 : modules) {
IWebModule web = (IWebModule) module2.loadAdapter(IWebModule.class, monitor);
if (web != null) {
IModule[] modules2 = web.getModules();
if (modules2 != null) {
- int size2 = modules2.length;
- for (int j = 0; j < size2; j++) {
- if (module.equals(modules2[j]))
+ for (IModule m : modules2) {
+ if (module.equals(m))
list.add(module2);
}
}
@@ -158,23 +149,20 @@
IModule[] modules = ServerUtil.getModules(EAR_MODULE);
if (modules != null) {
- int size = modules.length;
- for (int i = 0; i < size; i++) {
- IModule module2 = modules[i];
+ for (IModule module2 : modules) {
IEnterpriseApplication ear = (IEnterpriseApplication) module2.loadAdapter(IEnterpriseApplication.class, monitor);
if (ear != null) {
IModule[] modules2 = ear.getModules();
if (modules2 != null) {
- int size2 = modules2.length;
- for (int j = 0; j < size2; j++) {
- List<IModule> m = earCache.get(modules2[j]);
+ for (IModule mm : modules2) {
+ List<IModule> m = earCache.get(mm);
if (m == null) {
m = new ArrayList<IModule>(2);
- earCache.put(modules2[j], m);
+ earCache.put(mm, m);
}
m.add(module2);
- IJ2EEModule mod = (IJ2EEModule) modules2[j].loadAdapter(IJ2EEModule.class, monitor);
+ IJ2EEModule mod = (IJ2EEModule) mm.loadAdapter(IJ2EEModule.class, monitor);
if (mod != null) {
m = earCache2.get(mod);
if (m == null) {
@@ -191,19 +179,16 @@
modules = ServerUtil.getModules(WEB_MODULE);
if (modules != null) {
- int size = modules.length;
- for (int i = 0; i < size; i++) {
- IModule module2 = modules[i];
+ for (IModule module2 : modules) {
IWebModule web = (IWebModule) module2.loadAdapter(IWebModule.class, monitor);
if (web != null) {
IModule[] modules2 = web.getModules();
if (modules2 != null) {
- int size2 = modules2.length;
- for (int j = 0; j < size2; j++) {
- List<IModule> m = webCache.get(modules2[j]);
+ for (IModule mm : modules2) {
+ List<IModule> m = webCache.get(mm);
if (m == null) {
m = new ArrayList<IModule>(2);
- webCache.put(modules2[j], m);
+ webCache.put(mm, m);
}
m.add(module2);
}
diff --git a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/JavaServerPlugin.java b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/JavaServerPlugin.java
index b603c8e..92e05c7 100644
--- a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/JavaServerPlugin.java
+++ b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/JavaServerPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -132,31 +132,30 @@
public IStatus run(IProgressMonitor monitor) {
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
if (projects != null) {
- int size = projects.length;
- for (int i = 0; i < size; i++) {
- if (projects[i].isAccessible()) {
+ for (IProject project : projects) {
+ if (project.isAccessible()) {
try {
- if (!projects[i].isNatureEnabled(JavaCore.NATURE_ID))
+ if (!project.isNatureEnabled(JavaCore.NATURE_ID))
continue;
- IJavaProject javaProject = JavaCore.create(projects[i]);
+ IJavaProject javaProject = JavaCore.create(project);
boolean found = false;
IClasspathEntry[] ce = javaProject.getRawClasspath();
- for (int j = 0; j < ce.length; j++) {
- if (ce[j].getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
- if (serverContainerPath.isPrefixOf(ce[j].getPath()))
+ for (IClasspathEntry cp : ce) {
+ if (cp.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
+ if (serverContainerPath.isPrefixOf(cp.getPath()))
found = true;
}
}
- Trace.trace(Trace.FINEST, "Classpath change on: " + projects[i] + " " + found);
+ Trace.trace(Trace.FINEST, "Classpath change on: " + project + " " + found);
if (found) {
IRuntime runtime2 = runtime;
if (act == 2)
runtime2 = null;
- RuntimeClasspathContainer container = new RuntimeClasspathContainer(projects[i],
+ RuntimeClasspathContainer container = new RuntimeClasspathContainer(project,
serverContainerPath, rcpw, runtime2, runtime.getId());
JavaCore.setClasspathContainer(serverContainerPath, new IJavaProject[] { javaProject },
new IClasspathContainer[] {container}, null);
@@ -298,14 +297,13 @@
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] cf = registry.getConfigurationElementsFor(JavaServerPlugin.PLUGIN_ID, "runtimeClasspathProviders");
- int size = cf.length;
- List<RuntimeClasspathProviderWrapper> list = new ArrayList<RuntimeClasspathProviderWrapper>(size);
- for (int i = 0; i < size; i++) {
+ List<RuntimeClasspathProviderWrapper> list = new ArrayList<RuntimeClasspathProviderWrapper>(cf.length);
+ for (IConfigurationElement ce : cf) {
try {
- list.add(new RuntimeClasspathProviderWrapper(cf[i]));
- Trace.trace(Trace.CONFIG, " Loaded runtimeClasspathProviders: " + cf[i].getAttribute("id"));
+ list.add(new RuntimeClasspathProviderWrapper(ce));
+ Trace.trace(Trace.CONFIG, " Loaded runtimeClasspathProviders: " + ce.getAttribute("id"));
} catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load runtimeClasspathProviders: " + cf[i].getAttribute("id"), t);
+ Trace.trace(Trace.SEVERE, " Could not load runtimeClasspathProviders: " + ce.getAttribute("id"), t);
}
}
runtimeClasspathProviders = list;
@@ -341,14 +339,13 @@
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] cf = registry.getConfigurationElementsFor(JavaServerPlugin.PLUGIN_ID, "serverProfilers");
- int size = cf.length;
- List<ServerProfiler> list = new ArrayList<ServerProfiler>(size);
- for (int i = 0; i < size; i++) {
+ List<ServerProfiler> list = new ArrayList<ServerProfiler>(cf.length);
+ for (IConfigurationElement ce : cf) {
try {
- list.add(new ServerProfiler(cf[i]));
- Trace.trace(Trace.CONFIG, " Loaded serverProfiler: " + cf[i].getAttribute("id"));
+ list.add(new ServerProfiler(ce));
+ Trace.trace(Trace.CONFIG, " Loaded serverProfiler: " + ce.getAttribute("id"));
} catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load serverProfiler: " + cf[i].getAttribute("id"), t);
+ Trace.trace(Trace.SEVERE, " Could not load serverProfiler: " + ce.getAttribute("id"), t);
}
}
serverProfilers = list;
diff --git a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/RuntimeClasspathContainerInitializer.java b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/RuntimeClasspathContainerInitializer.java
index 6a09011..4d17ce5 100644
--- a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/RuntimeClasspathContainerInitializer.java
+++ b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/RuntimeClasspathContainerInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -98,25 +98,24 @@
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
List<IJavaProject> list = new ArrayList<IJavaProject>();
if (projects != null) {
- int size = projects.length;
- for (int i = 0; i < size; i++) {
- if (projects[i].isAccessible()) {
+ for (IProject project : projects) {
+ if (project.isAccessible()) {
try {
- if (!projects[i].isNatureEnabled(JavaCore.NATURE_ID))
+ if (!project.isNatureEnabled(JavaCore.NATURE_ID))
continue;
- IJavaProject javaProject = JavaCore.create(projects[i]);
+ IJavaProject javaProject = JavaCore.create(project);
boolean found = false;
IClasspathEntry[] ce = javaProject.getRawClasspath();
- for (int j = 0; j < ce.length; j++) {
- if (ce[j].getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
- if (containerPath.isPrefixOf(ce[j].getPath()))
+ for (IClasspathEntry cp : ce) {
+ if (cp.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
+ if (containerPath.isPrefixOf(cp.getPath()))
found = true;
}
}
- Trace.trace(Trace.FINEST, "Classpath change on: " + projects[i] + " " + found);
+ Trace.trace(Trace.FINEST, "Classpath change on: " + project + " " + found);
if (found)
list.add(javaProject);
diff --git a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/RuntimeClasspathProviderWrapper.java b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/RuntimeClasspathProviderWrapper.java
index 6da009a..e7fcd65 100644
--- a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/RuntimeClasspathProviderWrapper.java
+++ b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/RuntimeClasspathProviderWrapper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -110,12 +110,11 @@
if (s == null)
return false;
- int size = s.length;
- for (int i = 0; i < size; i++) {
- if (s[i].endsWith("*")) {
- if (id.length() >= s[i].length() && id.startsWith(s[i].substring(0, s[i].length() - 1)))
+ for (String ss : s) {
+ if (ss.endsWith("*")) {
+ if (id.length() >= ss.length() && id.startsWith(ss.substring(0, ss.length() - 1)))
return true;
- } else if (id.equals(s[i]))
+ } else if (id.equals(ss))
return true;
}
return false;
diff --git a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/RuntimeComponentProviderWrapper.java b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/RuntimeComponentProviderWrapper.java
index 48e0dfb..c6424d0 100644
--- a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/RuntimeComponentProviderWrapper.java
+++ b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/RuntimeComponentProviderWrapper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -84,12 +84,11 @@
if (s == null)
return false;
- int size = s.length;
- for (int i = 0; i < size; i++) {
- if (s[i].endsWith("*")) {
- if (id.length() >= s[i].length() && id.startsWith(s[i].substring(0, s[i].length() - 1)))
+ for (String ss : s) {
+ if (ss.endsWith("*")) {
+ if (id.length() >= ss.length() && id.startsWith(ss.substring(0, ss.length() - 1)))
return true;
- } else if (id.equals(s[i]))
+ } else if (id.equals(ss))
return true;
}
return false;
diff --git a/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewRuntime.java b/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewRuntime.java
index 04c0b24..4f056f8 100644
--- a/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewRuntime.java
+++ b/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewRuntime.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -104,11 +104,10 @@
try {
IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(getVMInstallTypeId());
IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
- int size = vmInstalls.length;
String id = getVMInstallId();
- for (int i = 0; i < size; i++) {
- if (id.equals(vmInstalls[i].getId()))
- return vmInstalls[i];
+ for (IVMInstall vmInstall : vmInstalls) {
+ if (id.equals(vmInstall.getId()))
+ return vmInstall;
}
} catch (Exception e) {
// ignore
diff --git a/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewServer.java b/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewServer.java
index 2da1b7d..a5169ce 100644
--- a/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewServer.java
+++ b/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewServer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -152,9 +152,9 @@
public static IServer findPreviewServer(String id) {
IServer[] servers = ServerCore.getServers();
- for (int i = 0; i < servers.length; i++) {
- if (servers[i].getId().equals(id)) {
- return servers[i];
+ for (IServer server : servers) {
+ if (server.getId().equals(id)) {
+ return server;
}
}
return null;
diff --git a/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewServerBehaviour.java b/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewServerBehaviour.java
index f785e5e..3c4792b 100644
--- a/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewServerBehaviour.java
+++ b/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewServerBehaviour.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -101,23 +101,22 @@
memento.putInteger("port", port);
IModule[] modules = getServer().getModules();
- int size = modules.length;
- for (int i = 0; i < size; i++) {
+ for (IModule module : modules) {
IMemento mod = memento.createChild("module");
- mod.putString("name", modules[i].getName());
- String type = modules[i].getModuleType().getId();
+ mod.putString("name", module.getName());
+ String type = module.getModuleType().getId();
if ("wst.web".equals(type)) {
- IStaticWeb staticWeb = (IStaticWeb) modules[i].loadAdapter(IStaticWeb.class, null);
+ IStaticWeb staticWeb = (IStaticWeb) module.loadAdapter(IStaticWeb.class, null);
if (staticWeb != null)
mod.putString("context", staticWeb.getContextRoot());
mod.putString("type", "static");
} else if ("jst.web".equals(type)) {
- IWebModule webModule = (IWebModule) modules[i].loadAdapter(IWebModule.class, null);
+ IWebModule webModule = (IWebModule) module.loadAdapter(IWebModule.class, null);
if (webModule != null)
mod.putString("context", webModule.getContextRoot());
mod.putString("type", "j2ee");
}
- mod.putString("path", getModulePublishDirectory(modules[i]).toPortableString());
+ mod.putString("path", getModulePublishDirectory(module).toPortableString());
}
try {
memento.saveToFile(getTempDirectory().append("preview.xml").toOSString());
@@ -148,9 +147,8 @@
processListener = new IDebugEventSetListener() {
public void handleDebugEvents(DebugEvent[] events) {
if (events != null) {
- int size = events.length;
- for (int i = 0; i < size; i++) {
- if (newProcess != null && newProcess.equals(events[i].getSource()) && events[i].getKind() == DebugEvent.TERMINATE) {
+ for (DebugEvent event : events) {
+ if (newProcess != null && newProcess.equals(event.getSource()) && event.getKind() == DebugEvent.TERMINATE) {
stop(true);
}
}
@@ -265,7 +263,7 @@
/**
* Return a string representation of this object.
*
- * @return java.lang.String
+ * @return a string
*/
public String toString() {
return "PreviewServer";
diff --git a/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewSourcePathComputerDelegate.java b/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewSourcePathComputerDelegate.java
index d346e90..b6615d0 100644
--- a/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewSourcePathComputerDelegate.java
+++ b/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewSourcePathComputerDelegate.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -45,10 +45,10 @@
if (server != null) {
List<IJavaProject> list = new ArrayList<IJavaProject>();
IModule[] modules = server.getModules();
- for (int i = 0; i < modules.length; i++) {
- IProject project = modules[i].getProject();
+ for (IModule module : modules) {
+ IProject project = module.getProject();
if (project != null) {
- IFolder moduleFolder = project.getFolder(modules[i].getName());
+ IFolder moduleFolder = project.getFolder(module.getName());
if (moduleFolder.exists()) {
sourcefolderList.add(new FolderSourceContainer(moduleFolder, true));
}
@@ -68,8 +68,8 @@
IJavaProject[] projects = new IJavaProject[size];
list.toArray(projects);
- for (int i = 0; i < size; i++)
- classpaths.addAll(Arrays.asList(JavaRuntime.computeUnresolvedRuntimeClasspath(projects[i])));
+ for (IJavaProject project : projects)
+ classpaths.addAll(Arrays.asList(JavaRuntime.computeUnresolvedRuntimeClasspath(project)));
}
IRuntimeClasspathEntry[] entries = new IRuntimeClasspathEntry[classpaths.size()];
diff --git a/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewStartup.java b/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewStartup.java
index 2f9970c..627f528 100644
--- a/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewStartup.java
+++ b/plugins/org.eclipse.jst.server.preview.adapter/src/org/eclipse/jst/server/preview/adapter/internal/core/PreviewStartup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,11 +29,10 @@
IRuntime[] runtimes = ServerCore.getRuntimes();
IRuntime runtime = null;
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- if (runtimes[i].getRuntimeType() != null && PreviewRuntime.ID.equals(runtimes[i].getRuntimeType().getId())) {
- if (ID.equals(runtimes[i].getId()))
- runtime = runtimes[i];
+ for (IRuntime r : runtimes) {
+ if (r.getRuntimeType() != null && PreviewRuntime.ID.equals(r.getRuntimeType().getId())) {
+ if (ID.equals(r.getId()))
+ runtime = r;
}
}
@@ -53,10 +52,9 @@
IServer[] servers = ServerCore.getServers();
boolean found = false;
- size = servers.length;
- for (int i = 0; i < size; i++) {
- if (servers[i].getServerType() != null && PreviewServer.ID.equals(servers[i].getServerType().getId())) {
- if (ID.equals(servers[i].getId()))
+ for (IServer s : servers) {
+ if (s.getServerType() != null && PreviewServer.ID.equals(s.getServerType().getId())) {
+ if (ID.equals(s.getId()))
found = true;
}
}
diff --git a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/GenericRuntimeComposite.java b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/GenericRuntimeComposite.java
index 1ba115b..091b2b1 100644
--- a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/GenericRuntimeComposite.java
+++ b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/GenericRuntimeComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -186,17 +186,14 @@
// get all installed JVMs
installedJREs = new ArrayList<IVMInstall>();
IVMInstallType[] vmInstallTypes = JavaRuntime.getVMInstallTypes();
- int size = vmInstallTypes.length;
- for (int i = 0; i < size; i++) {
- IVMInstall[] vmInstalls = vmInstallTypes[i].getVMInstalls();
- int size2 = vmInstalls.length;
- for (int j = 0; j < size2; j++) {
- installedJREs.add(vmInstalls[j]);
- }
+ for (IVMInstallType vit : vmInstallTypes) {
+ IVMInstall[] vmInstalls = vit.getVMInstalls();
+ for (IVMInstall vmInstall : vmInstalls)
+ installedJREs.add(vmInstall);
}
// get names
- size = installedJREs.size();
+ int size = installedJREs.size();
jreNames = new String[size+1];
jreNames[0] = Messages.runtimeTypeDefaultJRE;
for (int i = 0; i < size; i++) {
diff --git a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ImageResource.java b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ImageResource.java
index 929a3cd..7aeeddb 100644
--- a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ImageResource.java
+++ b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ImageResource.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -41,7 +41,7 @@
private static final String URL_WIZBAN = "wizban/";
- protected static final String IMG_WIZ_RUNTIME_TYPE = "wiz_runtimeType";
+ public static final String IMG_WIZ_RUNTIME_TYPE = "wiz_runtimeType";
public static final String IMG_WIZ_CACTUS_TEST = "wiz_cactus_test";
/**
diff --git a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ServerClasspathContainerPage.java b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ServerClasspathContainerPage.java
index d326287..29e0b93 100644
--- a/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ServerClasspathContainerPage.java
+++ b/plugins/org.eclipse.jst.server.ui/src/org/eclipse/jst/server/ui/internal/ServerClasspathContainerPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -51,14 +51,13 @@
setPageComplete(false);
IRuntime[] runtimes = ServerCore.getRuntimes();
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- if (runtimes[i].getRuntimeType() != null) {
- RuntimeClasspathProviderWrapper rcpw = JavaServerPlugin.findRuntimeClasspathProvider(runtimes[i].getRuntimeType());
+ for (IRuntime runtime : runtimes) {
+ if (runtime.getRuntimeType() != null) {
+ RuntimeClasspathProviderWrapper rcpw = JavaServerPlugin.findRuntimeClasspathProvider(runtime.getRuntimeType());
if (rcpw != null) {
IPath serverContainerPath = new Path(RuntimeClasspathContainer.SERVER_CONTAINER)
- .append(rcpw.getId()).append(runtimes[i].getId());
- runtimeMap.put(runtimes[i], JavaCore.newContainerEntry(serverContainerPath));
+ .append(rcpw.getId()).append(runtime.getId());
+ runtimeMap.put(runtime, JavaCore.newContainerEntry(serverContainerPath));
}
}
}
diff --git a/plugins/org.eclipse.wst.internet.monitor.core/monitorcore/org/eclipse/wst/internet/monitor/core/internal/Monitor.java b/plugins/org.eclipse.wst.internet.monitor.core/monitorcore/org/eclipse/wst/internet/monitor/core/internal/Monitor.java
index aa18131..e4dbc03 100644
--- a/plugins/org.eclipse.wst.internet.monitor.core/monitorcore/org/eclipse/wst/internet/monitor/core/internal/Monitor.java
+++ b/plugins/org.eclipse.wst.internet.monitor.core/monitorcore/org/eclipse/wst/internet/monitor/core/internal/Monitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -224,9 +224,8 @@
int size = requestListeners.size();
IRequestListener[] rl = new IRequestListener[size];
requestListeners.toArray(rl);
-
- for (int i = 0; i < size; i++) {
- IRequestListener listener = rl[i];
+
+ for (IRequestListener listener : rl) {
if (type == ADD)
listener.requestAdded(this, rr);
else if (type == CHANGE)
diff --git a/plugins/org.eclipse.wst.internet.monitor.core/monitorcore/org/eclipse/wst/internet/monitor/core/internal/MonitorManager.java b/plugins/org.eclipse.wst.internet.monitor.core/monitorcore/org/eclipse/wst/internet/monitor/core/internal/MonitorManager.java
index d246801..ba5c55f 100644
--- a/plugins/org.eclipse.wst.internet.monitor.core/monitorcore/org/eclipse/wst/internet/monitor/core/internal/MonitorManager.java
+++ b/plugins/org.eclipse.wst.internet.monitor.core/monitorcore/org/eclipse/wst/internet/monitor/core/internal/MonitorManager.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -188,11 +188,9 @@
* @param type the type of event
*/
protected void fireMonitorEvent(IMonitor monitor, int type) {
- Object[] obj = monitorListeners.toArray();
+ IMonitorListener[] obj = monitorListeners.toArray(new IMonitorListener[monitorListeners.size()]);
- int size = obj.length;
- for (int i = 0; i < size; i++) {
- IMonitorListener listener = (IMonitorListener) obj[i];
+ for (IMonitorListener listener : obj) {
if (type == ADD)
listener.monitorAdded(monitor);
else if (type == CHANGE)
diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorPreferencePage.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorPreferencePage.java
index cb3a9f3..c027481 100644
--- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorPreferencePage.java
+++ b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -282,7 +282,7 @@
/**
* Performs special processing when this page's Defaults button has been pressed.
* <p>
- * This is a framework hook method for sublcasses to do special things when
+ * This is a framework hook method for subclasses to do special things when
* the Defaults button has been pressed.
* Subclasses may override, but should call <code>super.performDefaults</code>.
* </p>
diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorUIPlugin.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorUIPlugin.java
index 1c63c4c..cf7ed83 100644
--- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorUIPlugin.java
+++ b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorUIPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -201,10 +201,8 @@
IMonitor[] monitors = MonitorCore.getMonitors();
if (monitors != null) {
- int size = monitors.length;
- for (int i = 0; i < size; i++) {
- monitors[i].addRequestListener(requestListener);
- }
+ for (IMonitor monitor : monitors)
+ monitor.addRequestListener(requestListener);
}
}
@@ -216,10 +214,8 @@
IMonitor[] monitors = MonitorCore.getMonitors();
if (monitors != null) {
- int size = monitors.length;
- for (int i = 0; i < size; i++) {
- monitors[i].removeRequestListener(requestListener);
- }
+ for (IMonitor monitor : monitors)
+ monitor.removeRequestListener(requestListener);
}
MonitorCore.removeMonitorListener(monitorListener);
diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/custom/MonitorStackLayout.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/custom/MonitorStackLayout.java
index 3ce0785..ff3b111 100644
--- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/custom/MonitorStackLayout.java
+++ b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/custom/MonitorStackLayout.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,9 +31,9 @@
Control children[] = composite.getChildren();
int maxWidth = 0;
int maxHeight = 0;
- for (int i = 0; i < children.length; i++) {
- if (children[i] == topControl) {
- Point size = children[i].computeSize(wHint, hHint, flushCache);
+ for (Control child : children) {
+ if (child == topControl) {
+ Point size = child.computeSize(wHint, hHint, flushCache);
maxWidth = Math.max(size.x, maxWidth);
maxHeight = Math.max(size.y, maxHeight);
}
@@ -54,13 +54,13 @@
protected void layout(Composite composite, boolean flushCache) {
Control children[] = composite.getChildren();
Rectangle rect = composite.getClientArea();
- for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof Label) {
+ for (Control child : children) {
+ if (child instanceof Label) {
Rectangle r = new Rectangle(rect.x+2, rect.y, rect.width-2, rect.height);
- children[i].setBounds(r);
+ child.setBounds(r);
} else
- children[i].setBounds(rect);
- children[i].setVisible(children[i] == topControl);
+ child.setBounds(rect);
+ child.setVisible(child == topControl);
}
}
diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/MonitorTreeContentProvider.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/MonitorTreeContentProvider.java
index 40b610d..b45eb20 100644
--- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/MonitorTreeContentProvider.java
+++ b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/MonitorTreeContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -72,9 +72,7 @@
List<Request> list = new ArrayList<Request>();
Request[] requests = MonitorUIPlugin.getInstance().getRequests();
if (requests != null) {
- int size = requests.length;
- for (int i = 0; i < size; i++) {
- Request req = requests[i];
+ for (Request req : requests) {
if ((req.getLocalPort() == in.intValue())
&& !(req instanceof ResendHTTPRequest))
list.add(req);
@@ -86,10 +84,8 @@
ResendHTTPRequest[] rr = MonitorManager.getInstance().getResendRequests(req);
List<Request> list = new ArrayList<Request>();
if (rr != null) {
- int size = rr.length;
- for (int i = 0; i < size; i++) {
- list.add(rr[i]);
- }
+ for (ResendHTTPRequest r : rr)
+ list.add(r);
}
return list.toArray();
}
@@ -106,9 +102,7 @@
List<Integer> list = new ArrayList<Integer>();
Request[] requests = MonitorUIPlugin.getInstance().getRequests();
if (requests != null) {
- int size = requests.length;
- for (int i = 0; i < size; i++) {
- Request req = requests[i];
+ for (Request req : requests) {
Integer in = new Integer(req.getLocalPort());
if (!list.contains(in))
list.add(in);
diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/MonitorView.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/MonitorView.java
index 23dbafd..19963e6 100644
--- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/MonitorView.java
+++ b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/MonitorView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -479,9 +479,8 @@
IContentFilter[] filters = MonitorPlugin.getInstance().getContentFilters();
IMenuManager menuManager = getViewSite().getActionBars().getMenuManager();
menuManager.add(httpHeaderAction);
- int size = filters.length;
- for (int i = 0; i < size; i++) {
- FilterAction action = new FilterAction(vm, filters[i]);
+ for (IContentFilter cf : filters) {
+ FilterAction action = new FilterAction(vm, cf);
menuManager.add(action);
}
menuManager.add(new Separator());
diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/ViewerManager.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/ViewerManager.java
index 8630b62..0394414 100644
--- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/ViewerManager.java
+++ b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/ViewerManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -123,9 +123,8 @@
IConfigurationElement[] cf = registry.getConfigurationElementsFor(MonitorUIPlugin.PLUGIN_ID, "viewers");
int size = cf.length;
viewers = new ArrayList<Viewer>(size);
- for (int i = 0; i < size; i++) {
- viewers.add(new Viewer(cf[i]));
- }
+ for (IConfigurationElement ce : cf)
+ viewers.add(new Viewer(ce));
}
/* (non-Javadoc)
diff --git a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/HttpRuntimeLocator.java b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/HttpRuntimeLocator.java
index 4bad06a..c325456 100644
--- a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/HttpRuntimeLocator.java
+++ b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/HttpRuntimeLocator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -53,11 +53,11 @@
int size = files.length;
int work = 100 / size;
int workLeft = 100 - (work * size);
- for (int i = 0; i < size; i++) {
+ for (File file : files) {
if (monitor.isCanceled())
return;
- if (files[i] != null && files[i].isDirectory())
- searchDir(listener, files[i], 4, monitor);
+ if (file != null && file.isDirectory())
+ searchDir(listener, file, 4, monitor);
monitor.worked(work);
}
monitor.worked(workLeft);
@@ -83,19 +83,18 @@
}
});
if (files != null) {
- int size = files.length;
- for (int i = 0; i < size; i++) {
+ for (File file : files) {
if (monitor.isCanceled())
return;
- searchDir(listener, files[i], depth - 1, monitor);
+ searchDir(listener, file, depth - 1, monitor);
}
}
}
protected static IRuntimeWorkingCopy getRuntimeFromDir(File dir, IProgressMonitor monitor) {
- for (int i = 0; i < runtimeTypes.length; i++) {
+ for (String rt : runtimeTypes) {
try {
- IRuntimeType runtimeType = ServerCore.findRuntimeType(runtimeTypes[i]);
+ IRuntimeType runtimeType = ServerCore.findRuntimeType(rt);
String absolutePath = dir.getAbsolutePath();
String id = absolutePath.replace(File.separatorChar, '_').replace(':', '-');
IRuntimeWorkingCopy runtime = runtimeType.createRuntime(id, monitor);
@@ -104,7 +103,7 @@
IStatus status = runtime.validate(monitor);
if (status == null || status.getSeverity() != IStatus.ERROR)
return runtime;
-
+
Trace.trace(Trace.FINER, "False runtime found at " + dir.getAbsolutePath()
+ ": " + status.getMessage());
} catch (Exception e) {
diff --git a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/HttpServer.java b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/HttpServer.java
index 373c98c..3a51982 100644
--- a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/HttpServer.java
+++ b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/HttpServer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -218,10 +218,9 @@
public static IServer findHttpServer(String id) {
IServer[] servers = ServerCore.getServers();
- for (int i = 0; i < servers.length; i++) {
- if (servers[i].getId().equals(id)) {
- return servers[i];
- }
+ for (IServer server : servers) {
+ if (server.getId().equals(id))
+ return server;
}
return null;
}
diff --git a/plugins/org.eclipse.wst.server.http.ui/src/org/eclipse/wst/server/http/ui/internal/HttpRuntimeComposite.java b/plugins/org.eclipse.wst.server.http.ui/src/org/eclipse/wst/server/http/ui/internal/HttpRuntimeComposite.java
index 58aa030..3e1c9ec 100644
--- a/plugins/org.eclipse.wst.server.http.ui/src/org/eclipse/wst/server/http/ui/internal/HttpRuntimeComposite.java
+++ b/plugins/org.eclipse.wst.server.http.ui/src/org/eclipse/wst/server/http/ui/internal/HttpRuntimeComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -189,12 +189,10 @@
if (name2.equals(runtimeWC.getName())) {
return true;
}
- IRuntime[] allRuntimes = ServerCore.getRuntimes();
- if (allRuntimes != null) {
- int size = allRuntimes.length;
- for (int i = 0; i < size; i++) {
- IRuntime runtime2 = allRuntimes[i];
+ IRuntime[] runtimes = ServerCore.getRuntimes();
+ if (runtimes != null) {
+ for (IRuntime runtime2 : runtimes) {
if (name2.equals(runtime2.getName()))
return false;
}
diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewServer.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewServer.java
index b4b892c..737b990 100644
--- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewServer.java
+++ b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewServer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -145,10 +145,9 @@
public static IServer findPreviewServer(String id) {
IServer[] servers = ServerCore.getServers();
- for (int i = 0; i < servers.length; i++) {
- if (servers[i].getId().equals(id)) {
- return servers[i];
- }
+ for (IServer server : servers) {
+ if (server.getId().equals(id))
+ return server;
}
return null;
}
diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewServerBehaviour.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewServerBehaviour.java
index e7adbd6..5b1419c 100644
--- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewServerBehaviour.java
+++ b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewServerBehaviour.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -94,17 +94,16 @@
memento.putInteger("port", port);
IModule[] modules = getServer().getModules();
- int size = modules.length;
- for (int i = 0; i < size; i++) {
+ for (IModule module : modules) {
IMemento mod = memento.createChild("module");
- mod.putString("name", modules[i].getName());
- String type = modules[i].getModuleType().getId();
+ mod.putString("name", module.getName());
+ String type = module.getModuleType().getId();
if ("wst.web".equals(type)) {
- IStaticWeb staticWeb = (IStaticWeb) modules[i].loadAdapter(IStaticWeb.class, null);
+ IStaticWeb staticWeb = (IStaticWeb) module.loadAdapter(IStaticWeb.class, null);
mod.putString("context", staticWeb.getContextRoot());
mod.putString("type", "static");
}
- mod.putString("path", getModulePublishDirectory(modules[i]).toPortableString());
+ mod.putString("path", getModulePublishDirectory(module).toPortableString());
}
try {
memento.saveToFile(getTempDirectory().append("preview.xml").toOSString());
@@ -135,9 +134,8 @@
processListener = new IDebugEventSetListener() {
public void handleDebugEvents(DebugEvent[] events) {
if (events != null) {
- int size = events.length;
- for (int i = 0; i < size; i++) {
- if (newProcess != null && newProcess.equals(events[i].getSource()) && events[i].getKind() == DebugEvent.TERMINATE) {
+ for (DebugEvent event : events) {
+ if (newProcess != null && newProcess.equals(event.getSource()) && event.getKind() == DebugEvent.TERMINATE) {
stop(true);
}
}
diff --git a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewStartup.java b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewStartup.java
index 9c5d770..e2792b0 100644
--- a/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewStartup.java
+++ b/plugins/org.eclipse.wst.server.preview.adapter/src/org/eclipse/wst/server/preview/adapter/internal/core/PreviewStartup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,11 +28,10 @@
IRuntime[] runtimes = ServerCore.getRuntimes();
IRuntime runtime = null;
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- if (runtimes[i].getRuntimeType() != null && PreviewRuntime.ID.equals(runtimes[i].getRuntimeType().getId())) {
- if (ID.equals(runtimes[i].getId()))
- runtime = runtimes[i];
+ for (IRuntime r : runtimes) {
+ if (r.getRuntimeType() != null && PreviewRuntime.ID.equals(r.getRuntimeType().getId())) {
+ if (ID.equals(r.getId()))
+ runtime = r;
}
}
@@ -52,10 +51,9 @@
IServer[] servers = ServerCore.getServers();
boolean found = false;
- size = servers.length;
- for (int i = 0; i < size; i++) {
- if (servers[i].getServerType() != null && PreviewServer.ID.equals(servers[i].getServerType().getId())) {
- if (ID.equals(servers[i].getId()))
+ for (IServer s : servers) {
+ if (s.getServerType() != null && PreviewServer.ID.equals(s.getServerType().getId())) {
+ if (ID.equals(s.getId()))
found = true;
}
}
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewStarter.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewStarter.java
index 58d0d6e..ca2144e 100644
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewStarter.java
+++ b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewStarter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,7 +21,7 @@
import org.mortbay.jetty.servlet.WebApplicationContext;
public class PreviewStarter {
- private static final String[] avertedLogs = new String[] {
+ private static final String[] AVERTED_LOGS = new String[] {
"org.mortbay.util.Container", "org.mortbay.http.HttpServer",
"org.mortbay.util.Credential", "org.mortbay.http.SocketListener",
"org.mortbay.http.HttpServer", "org.mortbay.jetty.Server"
@@ -49,14 +49,13 @@
int size = m.length;
if (size > 0) {
System.out.println("Modules:");
- for (int i = 0; i < size; i++) {
- System.out.println(" " + m[i].getName());
- }
+ for (Module mm : m)
+ System.out.println(" " + mm.getName());
System.out.println();
}
- for (int i = 0; i < avertedLogs.length; i++) {
- Logger logger = Logger.getLogger(avertedLogs[i]);
+ for (String log : AVERTED_LOGS) {
+ Logger logger = Logger.getLogger(log);
logger.setFilter(new Filter() {
public boolean isLoggable(LogRecord record) {
//Trace.trace(Trace.FINEST, "Averted Jetty log: " + record.getMessage());
@@ -94,8 +93,7 @@
server.addContext(context2);
server.setRootWebApp("/");
- for (int i = 0; i < size; i++) {
- Module module = m[i];
+ for (Module module : m) {
if (module.isStaticWeb()) {
HttpContext context = new HttpContext();
context.setContextPath(module.getContext());
@@ -141,11 +139,11 @@
protected static boolean deleteDirectory(File directory) {
if (directory.exists() && directory.isDirectory()) {
File[] files = directory.listFiles();
- for (int i = 0; i < files.length; i++) {
- if (files[i].isDirectory()) {
- deleteDirectory(files[i]);
+ for (File file : files) {
+ if (file.isDirectory()) {
+ deleteDirectory(file);
} else {
- files[i].delete();
+ file.delete();
}
}
}
diff --git a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/ServerConfig.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/ServerConfig.java
index f0da938..ea1cc41 100644
--- a/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/ServerConfig.java
+++ b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/ServerConfig.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,11 +38,11 @@
IMemento[] modules2 = memento.getChildren("module");
int size = modules2.length;
List<Module> list = new ArrayList<Module>(size);
- for (int i = 0; i < size; i++) {
- String name = modules2[i].getString("name");
- boolean isStatic = "static".equals(modules2[i].getString("type"));
- String path = modules2[i].getString("path");
- String context = modules2[i].getString("context");
+ for (IMemento mod : modules2) {
+ String name = mod.getString("name");
+ boolean isStatic = "static".equals(mod.getString("type"));
+ String path = mod.getString("path");
+ String context = mod.getString("context");
Module module = new Module(name, isStatic, context, path);
list.add(module);
}