/* (non-Javadoc) * @see com.hundsun.ares.devtool.common.core.ICommonModule#getResources() */ public IARESResource[] getARESResources() { List<IARESResource> resList = new ArrayList<IARESResource>(); try { for (IARESElement element : getChildren()) { if (element instanceof IARESResource) { resList.add((IARESResource) element); } } } catch (ARESModelException e) { e.printStackTrace(); } return resList.toArray(new IARESResource[resList.size()]); }
/* (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]); }
/* (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]); }
@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; }