Java Code Examples for org.eclipse.wst.server.core.IServer#getChildModules()

The following examples show how to use org.eclipse.wst.server.core.IServer#getChildModules() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GwtFacetUtils.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Get the modules added in the server.
 * 
 * @return
 */
public static IModule[] getModules(IServer server) {
  // Multi-module project
  IModule[] modules = server.getChildModules(server.getModules(), new NullProgressMonitor());
  if (modules == null || modules.length == 0) { // does it have multi-modules?
    // So it doesn't have multi-modules, lets use the root as the module.
    modules = server.getModules();
  }

  // Just in case
  if (modules == null || modules.length == 0) {
    GwtWtpPlugin.logMessage(
        "Could not find GWT Faceted project from the Server runtime. Add a GWT Facet to the server modules.");
    return null;
  }

  return modules;
}
 
Example 2
Source File: ModuleUtils.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
/** Recursively walk the children from {@code modulePath}. */
private static void addChildModules(IServer server, IModule[] modulePath, Set<IModule> modules) {
  IModule[] newModulePath = Arrays.copyOf(modulePath, modulePath.length + 1);
  for (IModule child : server.getChildModules(modulePath, null)) {
    if (modules.add(child)) {
      newModulePath[newModulePath.length - 1] = child;
      addChildModules(server, newModulePath, modules);
    }
  }
}
 
Example 3
Source File: GwtWtpPlugin.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Return all the modules on the server, including child modules.
 */
private List<IModule[]> getAllModules(IServer server) {
  List<IModule[]> modules = new ArrayList<>();
  // todo: add grandchildren
  for (IModule root : server.getModules()) {
    modules.add(new IModule[] {root});
    for (IModule child : server.getChildModules(new IModule[] {root}, null)) {
      modules.add(new IModule[] {root, child});
    }
  }
  return modules;
}