Exemplo n.º 1
0
 private String tranCH2En(String[] urls, IARESProject project) throws Exception {
   StringBuffer sb = new StringBuffer();
   IARESModuleRoot root = project.getModuleRoot(getModuleRootByCHName(urls[0], project));
   if (root != null) {
     for (int i = 1; i < urls.length; i++) {
       for (IARESModule module : root.getModules()) {
         IARESResource property = module.getARESResource(IARESModule.MODULE_PROPERTY_FILE);
         if (property != null && property.exists()) {
           try {
             ModuleProperty info = property.getInfo(ModuleProperty.class);
             if (info != null) {
               Object obj = info.getValue(ICommonModel.CNAME);
               if (obj != null) {
                 if (StringUtils.equals(urls[i], obj.toString())) {
                   sb.append("/");
                   sb.append(module.getShortName());
                   break;
                 }
               }
             }
           } catch (Exception e) {
             e.printStackTrace();
           }
         }
       }
     }
     for (String enname : urls) {
       root.getModule(enname);
     }
   }
   return sb.toString();
 }
Exemplo n.º 2
0
  /* (non-Javadoc)
   * @see com.hundsun.ares.devtool.common.core.ICommonModule#getSubModules()
   */
  public IARESModule[] getSubModules() throws ARESModelException {
    // default module
    if (isDefaultModule()) {
      return new IARESModule[0];
    }

    IARESModuleRoot root = getRoot();
    IARESModule[] all = root.getModules();
    List<IARESModule> modules = new ArrayList<IARESModule>();
    for (IARESModule module : all) {
      if (module.getElementName().startsWith(getElementName() + ".")) modules.add(module);
    }
    return modules.toArray(new IARESModule[0]);
  }
Exemplo n.º 3
0
  /* (non-Javadoc)
   * @see com.hundsun.ares.studio.core.IARESModule#getARESResources(java.lang.String[], boolean)
   */
  public IARESResource[] getARESResources(String[] types, boolean recursion) {
    List<IARESResource> result = new ArrayList<IARESResource>();
    for (IARESResource element : getARESResources()) {
      if (isInArray(element.getType(), types)) result.add(element);
    }

    if (recursion) {
      try {
        for (IARESModule module : getSubModules()) {
          result.addAll(Arrays.asList(module.getARESResources(types)));
        }
      } catch (ARESModelException e) {
        e.printStackTrace();
      }
    }
    return result.toArray(new IARESResource[0]);
  }
Exemplo n.º 4
0
  /* (non-Javadoc)
   * @see com.hundsun.ares.studio.core.IARESModule#getARESResources(boolean)
   */
  public IARESResource[] getARESResources(boolean recursion) {
    List<IARESResource> resList = new ArrayList<IARESResource>();
    try {
      for (IARESElement element : getChildren()) {
        if (element instanceof IARESResource) {
          resList.add((IARESResource) element);
        }
      }

      if (recursion) {
        for (IARESModule subModule : getSubModules()) {
          resList.addAll(Arrays.asList(subModule.getARESResources()));
        }
      }
    } catch (ARESModelException e) {
      e.printStackTrace();
    }
    return resList.toArray(new IARESResource[0]);
  }