Author: rob.stryker(a)jboss.com
Date: 2010-01-14 21:31:36 -0500 (Thu, 14 Jan 2010)
New Revision: 19760
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/util/ServerModelUtilities.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ModuleUtil.java
Log:
Moving an API lower
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ModuleUtil.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ModuleUtil.java 2010-01-14
22:24:32 UTC (rev 19759)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ModuleUtil.java 2010-01-15
02:31:36 UTC (rev 19760)
@@ -11,53 +11,26 @@
package org.jboss.ide.eclipse.as.core.util;
import java.util.ArrayList;
-import java.util.Arrays;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jst.server.core.IEnterpriseApplication;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.as.wtp.core.modules.IJBTModule;
+import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
+@Deprecated
+/**
+ * Please use org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities
+ */
public class ModuleUtil {
+ @Deprecated
public static ArrayList<IModule[]> getShallowChildren(IServer server, IModule[]
root) {
- ArrayList<IModule[]> list = new ArrayList<IModule[]>();
- IModule[] children = server.getChildModules(root, new NullProgressMonitor());
- // children is { aWar, bWar, cWar } projects
- int length = children == null ? 0 : children.length;
- for( int i = 0; i < length; i++ ) {
- ArrayList<IModule> inner = new ArrayList<IModule>();
- inner.addAll(Arrays.asList(root));
- inner.add(children[i]);
- IModule[] innerMods = inner.toArray(new IModule[inner.size()]);
- list.add(innerMods);
- }
- return list;
+ return ServerModelUtilities.getShallowChildren(server, root);
}
-
+ @Deprecated
public static ArrayList<IModule[]> getDeepChildren(IServer server, IModule[] mod)
{
- ArrayList<IModule[]> deep = getShallowChildren(server, mod);
- IModule[] toBeSearched;
- for( int i = 0; i < deep.size(); i++ ) {
- toBeSearched = deep.get(i);
- deep.addAll(getShallowChildren(server, toBeSearched));
- }
- return deep;
+ return ServerModelUtilities.getDeepChildren(server, mod);
}
-
+ @Deprecated
public static IModule[] getChildModules(IModule[] module) {
- int last = module.length-1;
- if (module[last] != null && module[last].getModuleType() != null) {
- IEnterpriseApplication enterpriseApplication = (IEnterpriseApplication) module[last]
- .loadAdapter(IEnterpriseApplication.class, null);
- if( enterpriseApplication != null )
- return enterpriseApplication.getModules() == null ? new IModule[]{} :
enterpriseApplication.getModules();
-
- IJBTModule jbtMod = (IJBTModule)module[last].loadAdapter(IJBTModule.class, null);
- if( jbtMod != null )
- return jbtMod.getModules();
- }
- return new IModule[0];
+ return ServerModelUtilities.getChildModules(module);
}
-
}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/util/ServerModelUtilities.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/util/ServerModelUtilities.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/util/ServerModelUtilities.java 2010-01-15
02:31:36 UTC (rev 19760)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.wtp.core.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jst.server.core.IEnterpriseApplication;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.wtp.core.modules.IJBTModule;
+
+public class ServerModelUtilities {
+
+ public static ArrayList<IModule[]> getShallowChildren(IServer server, IModule[]
root) {
+ ArrayList<IModule[]> list = new ArrayList<IModule[]>();
+ IModule[] children = server.getChildModules(root, new NullProgressMonitor());
+ // children is { aWar, bWar, cWar } projects
+ int length = children == null ? 0 : children.length;
+ for( int i = 0; i < length; i++ ) {
+ ArrayList<IModule> inner = new ArrayList<IModule>();
+ inner.addAll(Arrays.asList(root));
+ inner.add(children[i]);
+ IModule[] innerMods = inner.toArray(new IModule[inner.size()]);
+ list.add(innerMods);
+ }
+ return list;
+ }
+
+ public static ArrayList<IModule[]> getDeepChildren(IServer server, IModule[] mod)
{
+ ArrayList<IModule[]> deep = getShallowChildren(server, mod);
+ IModule[] toBeSearched;
+ for( int i = 0; i < deep.size(); i++ ) {
+ toBeSearched = deep.get(i);
+ deep.addAll(getShallowChildren(server, toBeSearched));
+ }
+ return deep;
+ }
+
+ public static IModule[] getChildModules(IModule[] module) {
+ int last = module.length-1;
+ if (module[last] != null && module[last].getModuleType() != null) {
+ IEnterpriseApplication enterpriseApplication = (IEnterpriseApplication) module[last]
+ .loadAdapter(IEnterpriseApplication.class, null);
+ if( enterpriseApplication != null )
+ return enterpriseApplication.getModules() == null ? new IModule[]{} :
enterpriseApplication.getModules();
+
+ IJBTModule jbtMod = (IJBTModule)module[last].loadAdapter(IJBTModule.class, null);
+ if( jbtMod != null )
+ return jbtMod.getModules();
+ }
+ return new IModule[0];
+ }
+}