Permalink
Browse files

[188484] Create 1.5.4 patch for bug 187187

  • Loading branch information...
1 parent 37dda35 commit e4029956444338894b9a5287f63b1e31de7c6cbe deboer committed May 24, 2007
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.server.core; singleton:=true
-Bundle-Version: 1.0.106.qualifier
+Bundle-Version: 1.0.107.qualifier
Bundle-Activator: org.eclipse.wst.server.core.internal.ServerPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -49,14 +49,22 @@ public static IModule getModule(IProject project) {
if (project == null)
throw new IllegalArgumentException();
- IModule[] modules = getModules();
- if (modules != null) {
- int size = modules.length;
+ ModuleFactory[] factories = ServerPlugin.getModuleFactories();
+ if (factories != null) {
+ int size = factories.length;
for (int i = 0; i < size; i++) {
- if (modules[i] != null && project.equals(modules[i].getProject()))
- return modules[i];
+ IModule[] modules = factories[i].getModules();
+ if (modules != null) {
+ int size2 = modules.length;
+ for (int j = 0; j < size2; j++) {
+ if (project.equals(modules[j].getProject()) && isSupportedModule(factories[i].getModuleTypes(), modules[j].getModuleType())) {
+ return modules[j];
+ }
+ }
+ }
}
}
+
return null;
}
@@ -276,7 +284,7 @@ private static boolean matches(String a, String b) {
* @return a possibly empty array of modules
*/
private static IModule[] getModules() {
- List list = new ArrayList();
+ Set set = new HashSet();
ModuleFactory[] factories = ServerPlugin.getModuleFactories();
if (factories != null) {
@@ -286,18 +294,18 @@ private static boolean matches(String a, String b) {
if (modules != null) {
int size2 = modules.length;
for (int j = 0; j < size2; j++) {
- if (!list.contains(modules[j])) {
+ if (!set.contains(modules[j])) {
if (isSupportedModule(factories[i].getModuleTypes(), modules[j].getModuleType()))
- list.add(modules[j]);
+ set.add(modules[j]);
else
Trace.trace(Trace.WARNING, "Invalid module returned from factory, ignored: " + modules[j]);
}
}
}
}
}
- IModule[] modules = new IModule[list.size()];
- list.toArray(modules);
+ IModule[] modules = new IModule[set.size()];
+ set.toArray(modules);
return modules;
}

0 comments on commit e402995

Please sign in to comment.