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(); }
@Override public List<ReferenceInfo> getReferenceInfos( IARESResource resource, Map<Object, Object> context) { List<ReferenceInfo> infoList = new ArrayList<ReferenceInfo>(); BasicResourceInfo basicInfo = null; try { basicInfo = resource.getInfo(BasicResourceInfo.class); } catch (ARESModelException e) { e.printStackTrace(); } if (basicInfo != null) { ReferenceInfo cnameRefInfo = ReferenceFactory.eINSTANCE.createReferenceInfo(); cnameRefInfo.setResource(resource); cnameRefInfo.setRefName(basicInfo.getChineseName()); cnameRefInfo.setRefType( ResourceTypeMapping.getInstance().getReferenceType(resource.getType())); cnameRefInfo.setRefNamespace(resource.getBundle().getId()); cnameRefInfo.setObjectProvider(ARESResourceObjectProvider.INSTANCE); infoList.add(cnameRefInfo); } return infoList; }