List of usage examples for org.aspectj.asm AsmManager getHierarchy
public IHierarchy getHierarchy()
From source file:org.eclipse.ajdt.core.model.AJProjectModelFacade.java
License:Open Source License
/** * grabs the structure and relationships for this project * <p> /* w ww . ja v a 2 s .c om*/ * called by the before advice in EnsureInitialized aspect */ synchronized void init() { if (!buildListener.isCurrentlyBuilding(project)) { AjCompiler compiler = AspectJPlugin.getDefault().getCompilerFactory().getCompilerForProject(project); AsmManager existingState = compiler.getModel(); if (existingState != null) { relationshipMap = existingState.getRelationshipMap(); structureModel = existingState.getHierarchy(); if (relationshipMap != null && structureModel != null) { isInitialized = true; } } } else { // can't initialize...building } }
From source file:org.eclipse.ajdt.core.tests.model.AbstractModelTest.java
License:Open Source License
protected void checkHandles(IJavaProject jProject) throws Exception { final AJProjectModelFacade model = AJProjectModelFactory.getInstance().getModelForJavaElement(jProject); final List<String> accumulatedErrors = new ArrayList<String>(); // check all the java handles IPackageFragment[] frags = jProject.getPackageFragments(); for (int i = 0; i < frags.length; i++) { ICompilationUnit[] units = frags[i].getCompilationUnits(); for (int j = 0; j < units.length; j++) { accumulatedErrors.addAll(walk(units[j], model)); }//w ww.ja v a 2 s .c om } // now check all the aj handles AsmManager asm = AspectJPlugin.getDefault().getCompilerFactory() .getCompilerForProject(jProject.getProject()).getModel(); IHierarchy hierarchy = asm.getHierarchy(); hierarchy.getRoot().walk(new HierarchyWalker() { protected void preProcess(IProgramElement node) { try { HandleTestUtils.checkAJHandle(node.getHandleIdentifier(), model); } catch (JavaModelException e) { throw new RuntimeException(e); } } }); if (accumulatedErrors.size() > 0) { StringBuffer sb = new StringBuffer(); sb.append("Found errors in comparing elements:\n"); for (String msg : accumulatedErrors) { sb.append(msg + "\n"); } fail(sb.toString()); } }