import org.aspectj.ajde.ui.StructureSearchManager;
import org.aspectj.ajde.ui.StructureViewManager;
import org.aspectj.ajde.ui.StructureViewNodeFactory;
-import org.aspectj.asm.StructureModelManager;
+import org.aspectj.asm.AsmManager;
import org.aspectj.bridge.Version;
import org.aspectj.util.LangUtil;
import org.aspectj.util.Reflection;
* use should be avoided. Used <CODE>getStructureViewManager()</CODE>
* instead.
*/
- public StructureModelManager getStructureModelManager() {
- return StructureModelManager.getDefault();
+ public AsmManager getStructureModelManager() {
+ return AsmManager.getDefault();
}
public void logEvent(String message) {
public void compileFinished(String buildConfig, int buildTime, boolean succeeded, boolean warnings) {
String configFilePath = projectProperties.getDefaultBuildConfigFile();
if (!succeeded) {
- StructureModelManager.getDefault().fireModelUpdated();
+ AsmManager.getDefault().fireModelUpdated();
}
}
package org.aspectj.ajde.ui;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.aspectj.asm.StructureModel;
+import java.io.IOException;
+import java.util.*;
/**
+ * TODO: we have schitzophrenia between BuildConfigNode(s) and IProgramElement(s), fix.
+ *
* @author Mik Kersten
*/
public class BuildConfigModel {
public void setRoot(BuildConfigNode node) {
root = node;
}
+
+ public BuildConfigNode findNodeForSourceLine(String sourceFilePath, int lineNumber) {
+ BuildConfigNode node = findNodeForSourceLineHelper(root, sourceFilePath, lineNumber);
+ return node;
+ }
+
+ private BuildConfigNode findNodeForSourceLineHelper(BuildConfigNode node, String sourceFilePath, int lineNumber) {
+ if (matches(node, sourceFilePath, lineNumber)
+ && !hasMoreSpecificChild(node, sourceFilePath, lineNumber)) {
+ return node;
+ }
+
+ if (node != null && node.getChildren() != null) {
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ BuildConfigNode foundNode = findNodeForSourceLineHelper(
+ (BuildConfigNode)it.next(),
+ sourceFilePath,
+ lineNumber);
+ if (foundNode != null) return foundNode;
+ }
+ }
+ return null;
+ }
+
+ private boolean matches(BuildConfigNode node, String sourceFilePath, int lineNumber) {
+ try {
+ return node != null
+ && node.getSourceLocation() != null
+ && node.getSourceLocation().getSourceFile().getCanonicalPath().equals(sourceFilePath)
+ && ((node.getSourceLocation().getLine() <= lineNumber
+ && node.getSourceLocation().getEndLine() >= lineNumber)
+ ||
+ (lineNumber <= 1
+ && node instanceof BuildConfigNode)
+ );
+ } catch (IOException ioe) {
+ return false;
+ }
+ }
+
+ private boolean hasMoreSpecificChild(BuildConfigNode node, String sourceFilePath, int lineNumber) {
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ BuildConfigNode child = (BuildConfigNode)it.next();
+ if (matches(child, sourceFilePath, lineNumber)) return true;
+ }
+ return false;
+ }
}
public static Map getLinesToAspectMap(String sourceFilePath) {
Map annotationsMap =
- StructureModelManager.getDefault().getInlineAnnotations(
+ AsmManager.getDefault().getInlineAnnotations(
sourceFilePath,
true,
true);
Map aspectMap = new HashMap();
Set keys = annotationsMap.keySet();
- for (Iterator it = keys.iterator(); it.hasNext();) {
- Object key = it.next();
- List annotations = (List) annotationsMap.get(key);
- for (Iterator it2 = annotations.iterator(); it2.hasNext();) {
- IProgramElement node = (IProgramElement) it2.next();
+// for (Iterator it = keys.iterator(); it.hasNext();) {
+// Object key = it.next();
+// List annotations = (List) annotationsMap.get(key);
+// for (Iterator it2 = annotations.iterator(); it2.hasNext();) {
+// IProgramElement node = (IProgramElement) it2.next();
- List relations = node.getRelations();
-
- for (Iterator it3 = relations.iterator(); it3.hasNext();) {
- IRelationship relationNode = (IRelationship) it3.next();
+// List relations = node.getRelations();
+//
+// for (Iterator it3 = relations.iterator(); it3.hasNext();) {
+// IRelationship relationNode = (IRelationship) it3.next();
// if (relationNode.getKind().equals("Advice")) {
// List children = relationNode.getTargets();
// aspectMap.put(key, aspects);
// }
// }
-
- }
- }
- }
+//
+// }
+// }
+// }
return aspectMap;
}
public StructureViewManager(StructureViewNodeFactory nodeFactory) {
treeViewBuilder = new TreeStructureViewBuilder(nodeFactory);
- StructureModelManager.getDefault().addListener(VIEW_LISTENER);
+ AsmManager.getDefault().addListener(VIEW_LISTENER);
}
public void fireNavigateBackAction(StructureView view) {
if (defaultFileView.getSourceFile() != null
&& !defaultFileView.getSourceFile().equals(newFilePath)) {
defaultFileView.setSourceFile(newFilePath);
- treeViewBuilder.buildView(defaultFileView, StructureModelManager.getDefault().getModel());
+ treeViewBuilder.buildView(defaultFileView, AsmManager.getDefault().getModel());
}
}
if (properties == null) properties = DEFAULT_VIEW_PROPERTIES;
FileStructureView view = new FileStructureView(properties);
view.setSourceFile(sourceFilePath);
- treeViewBuilder.buildView(view, StructureModelManager.getDefault().getModel());
+ treeViewBuilder.buildView(view, AsmManager.getDefault().getModel());
structureViews.add(view);
return view;
}
AbstractIcon icon = iconRegistry.getStructureIcon(node.getKind(), node.getAccessibility());
IStructureViewNode svNode = createDeclaration(node, icon, children);
- IRelationship rel = StructureModelManager.getDefault().getMapper().get(node);
+ IRelationship rel = AsmManager.getDefault().getMapper().get(node);
if (rel != null && rel.getTargets().size() > 0) {
IStructureViewNode relNode = createRelationship(
rel,
for (Iterator it = rel.getTargets().iterator(); it.hasNext(); ) {
IProgramElement link = (IProgramElement)it.next();
IStructureViewNode linkNode = createLink(
- link,
- iconRegistry.getIcon(link.getKind())
+ link,
+ iconRegistry.getStructureIcon(link.getKind(), link.getAccessibility())
);
relNode.add(linkNode);
if (node == null) return null;
List children = new ArrayList();
// IProgramElement pNode = node;
- if (node.getRelations() != null) {
- for (Iterator it = node.getRelations().iterator(); it.hasNext(); ) {
- IProgramElement IProgramElement = (IProgramElement)it.next();
- if (acceptNode(IProgramElement, properties)) {
- children.add(createViewNode(IProgramElement, properties));
- }
- }
- }
+// if (node.getRelations() != null) {
+// for (Iterator it = node.getRelations().iterator(); it.hasNext(); ) {
+// IProgramElement IProgramElement = (IProgramElement)it.next();
+// if (acceptNode(IProgramElement, properties)) {
+// children.add(createViewNode(IProgramElement, properties));
+// }
+// }
+// }
if (node.isRunnable() && node.getParent() != null) {
IProgramElement parent = node.getParent();
if (parent.getKind().equals(IProgramElement.Kind.CLASS)
IProgramElement pNode = (IProgramElement)node;
if (!acceptGranularity(pNode.getKind(), properties.getGranularity())) {
return false;
- } else if (pNode.isMemberKind()) {
+ } else if (pNode.getKind().isMemberKind()) {
if (properties.getFilteredMemberAccessibility().contains(pNode.getAccessibility())) {
return false;
}
private IStructureViewNode getInheritanceChildren(IProgramElement node, List associations) {
IStructureViewNode treeNode = nodeFactory.createNode(node);
//StructureViewNode treeNode = new StructureViewNodeAdapter(node);
- List relations = ((IProgramElement)node).getRelations();
+// List relations = ((IProgramElement)node).getRelations();
throw new RuntimeException("unimplemented");
// if (relations != null) {
// for (Iterator it = relations.iterator(); it.hasNext(); ) {
private IStructureViewNode getCrosscuttingChildren(IProgramElement node) {
//StructureViewNodeAdapter treeNode = new StructureViewNodeAdapter(node);
- IStructureViewNode treeNode = nodeFactory.createNode(node);
- List relations = ((IProgramElement)node).getRelations();
+// IStructureViewNode treeNode = nodeFactory.createNode(node);
+// List relations = ((IProgramElement)node).getRelations();
throw new RuntimeException("unimplemented");
// if (relations != null) {
// for (Iterator it = relations.iterator(); it.hasNext(); ) {
IProgramElement child = (IProgramElement)itt.next();
if (child instanceof IProgramElement) {
IProgramElement progNode = (IProgramElement)child;
- if (!progNode.isCode()) {
+ if (progNode.getKind() != IProgramElement.Kind.CODE) {
childList.add(buildTree(child, associations));
}
} else {
return convertToSwingIcon(getIcon(relation));
}
- protected AbstractIcon getStructureIcon(IProgramElement.Kind kind, IProgramElement.Accessibility accessibility) {
+ public AbstractIcon getStructureIcon(IProgramElement.Kind kind, IProgramElement.Accessibility accessibility) {
return getIcon(kind);
}
public int getX() { return x; }
public void setX(int x) { this.x = x; }
-
+
public int changeX(int x) {
this.x = x;
return x;
}
aspect InterTypeDecCoverage {
+ public int Point.xxx = 0;
+ public int Point.check(int i, Line l) { return 1 + i; }
+}
+
+aspect DeclareCoverage {
pointcut illegalNewFigElt(): call(Point.new(..)) && !withincode(* *.doIt(..));
declare parents: Point && Line implements java.util.Observable;
declare soft: SizeException : call(* Point.getX());
declare precedence: AdviceCoverage, InterTypeDecCoverage, *;
-
- public int Point.xxx = 0;
- public int Point.check(int i, Line l) { return 1 + i; }
// public Line.new(String s) { }
}
IProgramElement node = (IProgramElement)model.getRoot();
assertNotNull(node);
- IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, "InterTypeDecCoverage");
+ IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, "DeclareCoverage");
assertNotNull(aspect);
String decErrMessage = "declare error: \"Illegal construct..\"";
IProgramElement node = (IProgramElement)model.getRoot();
assertNotNull(node);
- IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, "InterTypeDecCoverage");
+ IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, "InterTypeDecCoverage");
assertNotNull(aspect);
String fieldMsg = "Point.xxx";
IProgramElement node = (IProgramElement)model.getRoot();
assertNotNull(node);
- IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, "AdviceNamingCoverage");
+ IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, "AdviceNamingCoverage");
assertNotNull(aspect);
String ptct = "named()";
IProgramElement node = (IProgramElement)model.getRoot();
assertNotNull(node);
- IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, "AbstractAspect");
+ IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, "AbstractAspect");
assertNotNull(aspect);
String abst = "abPtct()";
IProgramElement node = (IProgramElement)model.getRoot();
assertNotNull(node);
- IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, "AdviceNamingCoverage");
+ IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, "AdviceNamingCoverage");
assertNotNull(aspect);
String anon = "before(): <anonymous pointcut>";
protected void setUp() throws Exception {
super.setUp("examples");
assertTrue("build success", doSynchronousBuild(CONFIG_FILE_PATH));
- model = StructureModelManager.getDefault().getModel();
+ model = AsmManager.getDefault().getModel();
}
protected void tearDown() throws Exception {
import java.util.List;
import org.aspectj.asm.*;
+import org.aspectj.asm.internal.ProgramElement;
// TODO: check for return types
public class AsmRelationshipsTest extends AjdeTestCase {
- private StructureModelManager manager = null;
+ private AsmManager manager = null;
private static final String CONFIG_FILE_PATH = "../examples/coverage/coverage.lst";
public AsmRelationshipsTest(String name) {
super(name);
}
- public void testAdvice() {
- IProgramElement node = (IProgramElement)manager.getModel().getRoot();
- assertNotNull(node);
-
+// public void testInterTypeDeclarations() {
+// checkMapping("InterTypeDecCoverage", "Point", "Point.xxx:", "xxx");
+// }
+
+ public void testAdvice() {
checkMapping("AdvisesRelationshipCoverage", "Point", "before(): methodExecutionP..", "setX(int)");
checkUniDirectionalMapping("AdvisesRelationshipCoverage", "Point", "before(): getP..", "field-get(int Point.x)");
checkUniDirectionalMapping("AdvisesRelationshipCoverage", "Point", "before(): setP..", "field-set(int Point.xxx)");
}
private void checkUniDirectionalMapping(String fromType, String toType, String from, String to) {
- IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, fromType);
+ IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, fromType);
assertNotNull(aspect);
String beforeExec = from;
IProgramElement beforeExecNode = manager.getModel().findNode(aspect, IProgramElement.Kind.ADVICE, beforeExec);
}
private void checkMapping(String fromType, String toType, String from, String to) {
- IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, fromType);
+ IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, fromType);
assertNotNull(aspect);
String beforeExec = from;
IProgramElement beforeExecNode = manager.getModel().findNode(aspect, IProgramElement.Kind.ADVICE, beforeExec);
IRelationship rel = manager.getMapper().get(beforeExecNode);
assertEquals(((IProgramElement)rel.getTargets().get(0)).getName(), to);
- IProgramElement clazz = StructureModelManager.getDefault().getModel().findNodeForType(null, toType);
+ IProgramElement clazz = AsmManager.getDefault().getModel().findNodeForType(null, toType);
assertNotNull(clazz);
String set = to;
IProgramElement setNode = manager.getModel().findNode(clazz, IProgramElement.Kind.METHOD, set);
protected void setUp() throws Exception {
super.setUp("examples");
assertTrue("build success", doSynchronousBuild(CONFIG_FILE_PATH));
- manager = StructureModelManager.getDefault();
+ manager = AsmManager.getDefault();
}
protected void tearDown() throws Exception {
null,
null,
null);
-
- //Ajde.getDefault().enableLogging( System.out );
} catch (Throwable t) {
String s = "Unable to initialize AJDE "
+ LangUtil.renderException(t);
public class NullIdeErrorHandler implements ErrorHandler {
public void handleWarning(String message) {
- System.out.println("NullIde warning: " + message);
+ System.out.println("NullIde> warning: " + message);
}
public void handleError(String message) {
- System.out.println("NullIde error: " + message);
+ System.out.println("NullIde> error: " + message);
}
public void handleError(String message, Throwable t) {
- System.out.println("NullIde error: " + message);
+ System.out.println("NullIde> error: " + message);
t.printStackTrace(System.out);
}
}
public class NullIdeProgressMonitor implements BuildProgressMonitor {
public void start(String configFile) {
-// System.out.println("> compiling: " + configFile);
+
}
public void setProgressText(String text) {
}
/* Guard against null source locations e.g. JAR file messages */
if (null != message.getSourceLocation()) {
- System.out.println("> added sourceline task: " + message + ", file: " + message.getSourceLocation().getSourceFile().getAbsolutePath()
+ System.out.println("NullIde> task: " + message.getMessage() + ", file: " + message.getSourceLocation().getSourceFile().getAbsolutePath()
+ ": " + message.getSourceLocation().getLine());
}
else {
- System.out.println("> added sourceline task: " + message);
+ System.out.println("NullIde> task: " + message);
}
}
public class NullIdeUIAdapter implements IdeUIAdapter {
public void displayStatusInformation(String message) {
- System.out.println("NullIde> " + message);
+ System.out.println("NullIde>" + message);
}
public void resetGUI() {
/* Ensure we didn't copy any JAR manifests */
if (fileName.toLowerCase().startsWith("meta-inf")) {
byte[] outManifest = FileUtil.readAsByteArray(outjar);
-// System.err.println("? compareJars() fileName='" + fileName + "', manifest='" + new String(outManifest) + "'");
assertFalse("Manifest has been copied",Arrays.equals(inManifest,outManifest));
}
/* Ensure we didn't copy any JAR manifests */
if (fileName.toLowerCase().startsWith("meta-inf")) {
byte[] outManifest = FileUtil.readAsByteArray(toResources[i]);
-// System.err.println("? compareJars() fileName='" + fileName + "', manifest='" + new String(outManifest) + "'");
assertFalse("Manifest has been copied",Arrays.equals(inManifest,outManifest));
}
boolean b = resources.remove(fileName);
/* JAR manifests shouldn't be copied */
if (fileName.toLowerCase().startsWith("meta-inf")) {
manifest = FileUtil.readAsByteArray(injar);
-// System.err.println("? compareJars() fileName='" + fileName + "', manifest='" + new String(manifest) + "'");
}
else {
resources.add(fileName);
public boolean verifyAgainstSavedModel(String lstFile) {
File modelFile = new File(genStructureModelExternFilePath(lstFile));
StructureModel model = getModelForFile(lstFile);
- System.out.println(">> model: " + model.getRoot());
if (modelFile.exists()) {
Ajde.getDefault().getStructureModelManager().readStructureModel(lstFile);
StructureModel savedModel = Ajde.getDefault().getStructureModelManager().getModel();
- //System.err.println( savedModel.getRoot().getClass() + ", " + savedModel.getRoot());
-
// AMC This test will not pass as written until IProgramElement defines
// equals. The equals loic is commented out in the IProgramElement
// class - adding it back in could have unforeseen system-wide
// ProgramElementNode pNode = (ProgramElementNode)node;
// ProgramElementNode foundNode = null;
// final List list = pNode.getRelations();
-// //System.err.println(">>>> " + pNode + ", " + list);
// assertNotNull("pNode.getRelations()", list);
// for (Iterator it = list.iterator(); it.hasNext(); ) {
// RelationNode relation = (RelationNode)it.next();
public void testPointcutName() throws IOException {
File testFile = openFile("figures-coverage/figures/Main.java");
- //System.err.println("PointcutName, testFile: " + testFile.getCanonicalPath() + " exists: " + testFile.exists());
IProgramElement node = Ajde.getDefault().getStructureModelManager().getModel().findRootNodeForSourceFile(
testFile.getCanonicalPath());
- //System.err.println(" node: " + node);
assertTrue("find result", node != null) ;
IProgramElement pNode = (IProgramElement)((IProgramElement)node).getChildren().get(1);
IProgramElement pointcut = (IProgramElement)pNode.getChildren().get(0);
public void testFileNodeFind() throws IOException {
File testFile = openFile("figures-coverage/figures/Main.java");
- //System.err.println("NodeFind, testFile: " + testFile.getCanonicalPath() + " exists: " + testFile.exists());
IProgramElement node = Ajde.getDefault().getStructureModelManager().getModel().findNodeForSourceLine(
testFile.getCanonicalPath(), 1);
- //System.err.println(" node: " + node);
assertTrue("find result", node != null) ;
assertEquals("find result has children", 2, node.getChildren().size()) ;
IProgramElement pNode = (IProgramElement)node;
public void testVersionMatch() {
String ajdeVersion = Ajde.getDefault().getVersion();
String compilerVersion = Version.text;
- System.out.println("> ajde version: " + ajdeVersion + " <-> compiler version: " + compilerVersion);
assertTrue("version check", ajdeVersion.equals(compilerVersion));
}
Iterator it = list.iterator();
while (st.hasMoreElements()) {
String s1 = (String)st.nextElement();
- System.out.print("comparing: " + s1 + " <-> ");
String s2 = (String)it.next();
- System.out.println(s2);
if (!s1.equals(s2)) return false;
}
if (it.hasNext()) {
List packages = StructureModelUtil.getPackagesInModel();
assertTrue("packages list not null", packages != null);
assertTrue("packages list not empty", !packages.isEmpty());
- // System.err.println("> packages: " + packages);
IProgramElement packageNode = (IProgramElement)((Object[])packages.get(0))[0];
assertTrue("package node not null", packageNode != null);
- // System.err.println("> package node: " + packageNode);
List files = StructureModelUtil.getFilesInPackage(packageNode);
assertTrue("fle list not null", files != null);
- // System.err.println("> file list: " + files);
// TODO: re-enable
// Map lineAdviceMap = StructureModelUtil.getLinesToAspectMap(
// ((IProgramElement)files.get(0)).getSourceLocation().getSourceFile().getAbsolutePath()
// );
//
-// assertTrue("line->advice map not null", lineAdviceMap != null);
-// // System.err.println("> line->advice map: " + lineAdviceMap);
+// assertTrue("line->advice map not null", lineAdviceMap != null);
//
// Set aspects = StructureModelUtil.getAspectsAffectingPackage(packageNode);
-// assertTrue("aspect list not null", aspects != null);
-// // System.err.println("> aspects affecting package: " + aspects);
+// assertTrue("aspect list not null", aspects != null);
}
"Point",
null
);
- System.err.println(matches);
assertTrue("non existent node", true);
}
"Point",
IProgramElement.Kind.CONSTRUCTOR
);
- System.err.println(matches);
assertTrue("non existent node", true);
}
renderer.setHasBeenNotified(false);
String modelPath = genStructureModelExternFilePath(CONFIG_FILE_PATH);
openFile(modelPath).delete();
- //System.err.println("> path: " + modelPath);
Ajde.getDefault().getStructureModelManager().readStructureModel(CONFIG_FILE_PATH);
assertTrue("notified", renderer.getHasBeenNotified());
- //System.err.println(">>>>>> " + currentView.getRootNode().getIProgramElement());
// AMC should this be currentView, or should we recreate the root... do the latter
//IProgramElement n = currentView.getRootNode().getIProgramElement();
IProgramElement n = Ajde.getDefault().getStructureModelManager().getModel().getRoot();
}
// public void testViewListenerRegistrations() {
-// System.err.println("> starting...");
// Ajde.getDefault().getBuildManager().build("C:/Dev/aspectj/tests/ajde/examples/coverage-figures/src/AllFiles.lst");
// while(!testerBuildListener.getBuildFinished()) {
// try {
// } catch (InterruptedException ie) { }
// }
// List renderers = Ajde.getDefault().getStructureViewManager().getDefaultFileStructureView().getRenderers();
-// System.err.println("> renderers (1): " + renderers);
//
// testerBuildListener.reset();
// Ajde.getDefault().getBuildManager().build("C:/Dev/aspectj/tests/ajde/examples/coverage-figures/src/AllFiles.lst");
// Thread.sleep(300);
// } catch (InterruptedException ie) { }
// }
-// System.err.println("> renderers (2): " + renderers);
// assertTrue("checking renderers", true);
// }
}
if (batch) {
// System.err.println("XXXX batch: " + buildConfig.getFiles());
if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode()) {
- bcelWorld.setModel(StructureModelManager.getDefault().getModel());
+ bcelWorld.setModel(AsmManager.getDefault().getModel());
// in incremental build, only get updated model?
}
performCompilation(buildConfig.getFiles());
// but always returns true
// XXX weaved not in Mik's incremental
if (buildConfig.isGenerateModelMode()) {
- StructureModelManager.getDefault().fireModelUpdated();
+ AsmManager.getDefault().fireModelUpdated();
}
return !handler.hasErrors();
} finally {
private void setupModel() {
String rootLabel = "<root>";
- StructureModel model = StructureModelManager.getDefault().getModel();
+ StructureModel model = AsmManager.getDefault().getModel();
IProgramElement.Kind kind = IProgramElement.Kind.FILE_JAVA;
if (buildConfig.getConfigFile() != null) {
rootLabel = buildConfig.getConfigFile().getName();
}
model.setRoot(new ProgramElement(rootLabel, kind, new ArrayList()));
- HashMap modelFileMap = new HashMap();
model.setFileMap(new HashMap());
setStructureModel(model);
}
}
public void externalizeModel() {
- if (!StructureModelManager.getDefault().getModel().isValid()) return;
+ if (!AsmManager.getDefault().getModel().isValid()) return;
try {
//Set fileSet = StructureModelManager.INSTANCE.getStructureModel().getFileMap().entrySet();
- Set fileSet = StructureModelManager.getDefault().getModel().getFileMapEntrySet();
+ Set fileSet = AsmManager.getDefault().getModel().getFileMapEntrySet();
for (Iterator it = fileSet.iterator(); it.hasNext(); ) {
IProgramElement peNode = (IProgramElement)((Map.Entry)it.next()).getValue();
dumpStructureToFile(peNode);
} else {
print("nil");
}
- if (node.getSignature() != null) {
+ if (node.getName() != null) {
print("\"" + node.getDeclaringType() + "\" "); //5
} else {
print("nil");
print("nil");
} else {
print("(");
- if (node instanceof IProgramElement) {
- java.util.List relations = ((IProgramElement)node).getRelations();
- if (relations != null) {
- for (Iterator it = relations.iterator(); it.hasNext(); ) {
- IRelationship relNode = (IRelationship)it.next();
- if (relNode.getKind() == IRelationship.Kind.ADVICE ||
- relNode.getKind() == IRelationship.Kind.DECLARE) {
- printDecls(relNode); // 6
- }
- }
- }
- }
+// if (node instanceof IProgramElement) {
+// java.util.List relations = ((IProgramElement)node).getRelations();
+// if (relations != null) {
+// for (Iterator it = relations.iterator(); it.hasNext(); ) {
+// IRelationship relNode = (IRelationship)it.next();
+// if (relNode.getKind() == IRelationship.Kind.ADVICE ||
+// relNode.getKind() == IRelationship.Kind.DECLARE) {
+// printDecls(relNode); // 6
+// }
+// }
+// }
+// }
print(") ");
print("(");
print(") ");
import junit.framework.TestCase;
import org.aspectj.ajdt.ajc.BuildArgParser;
-import org.aspectj.asm.StructureModelManager;
+import org.aspectj.asm.AsmManager;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.MessageHandler;
import org.aspectj.bridge.MessageWriter;
}, messageWriter);
String err = parser.getOtherMessages(true);
assertTrue(err, null == err);
- manager.setStructureModel(StructureModelManager.getDefault().getModel());
+ manager.setStructureModel(AsmManager.getDefault().getModel());
MessageHandler handler = new MessageHandler();
manager.batchBuild(buildConfig, handler);
assertCompileMessagesValid(handler);
// TODO: might want to show these in the future
return;
}
- IRelationshipMapper mapper = StructureModelManager.getDefault().getMapper();
+ IRelationshipMapper mapper = AsmManager.getDefault().getMapper();
IProgramElement targetNode = getNode(model, shadow);
IProgramElement adviceNode = getNode(model, a);