diff options
author | mkersten <mkersten> | 2003-08-08 14:59:46 +0000 |
---|---|---|
committer | mkersten <mkersten> | 2003-08-08 14:59:46 +0000 |
commit | f7944d2c68e8561e12498c006729c6c341b657f7 (patch) | |
tree | 205af60b87fa308248a3d01694a9685a53260fe8 /ajde | |
parent | 555d9cd8fec8a2c0bc3daac63123a9bea941a912 (diff) | |
download | aspectj-f7944d2c68e8561e12498c006729c6c341b657f7.tar.gz aspectj-f7944d2c68e8561e12498c006729c6c341b657f7.zip |
First pass at new relationship API support.
Diffstat (limited to 'ajde')
7 files changed, 54 insertions, 43 deletions
diff --git a/ajde/src/org/aspectj/ajde/ui/AbstractIconRegistry.java b/ajde/src/org/aspectj/ajde/ui/AbstractIconRegistry.java index 6e4a32b41..edf519bc9 100644 --- a/ajde/src/org/aspectj/ajde/ui/AbstractIconRegistry.java +++ b/ajde/src/org/aspectj/ajde/ui/AbstractIconRegistry.java @@ -63,8 +63,8 @@ public abstract class AbstractIconRegistry { return RELATION_ADVICE_FORWARD; } else if (relationship == IRelationship.Kind.DECLARE) { return RELATION_ADVICE_FORWARD; - } else if (relationship == IRelationship.Kind.INHERITANCE) { - return RELATION_INHERITANCE_FORWARD; +// } else if (relationship == IRelationship.Kind.INHERITANCE) { +// return RELATION_INHERITANCE_FORWARD; } else { return RELATION_REFERENCE_FORWARD; } diff --git a/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java b/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java index 1b4a1a9d1..540449669 100644 --- a/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java +++ b/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java @@ -55,34 +55,34 @@ public class StructureModelUtil { for (Iterator it3 = relations.iterator(); it3.hasNext();) { IRelationship relationNode = (IRelationship) it3.next(); - if (relationNode.getKind().equals("Advice")) { - List children = relationNode.getTargets(); - - List aspects = new Vector(); - - for (Iterator it4 = children.iterator(); - it4.hasNext(); - ) { - Object object = it4.next(); - -// if (object instanceof LinkNode) { -// IProgramElement pNode = -// ((LinkNode) object).getProgramElementNode(); -// -// if (pNode.getProgramElementKind() -// == IProgramElement.Kind.ADVICE) { +// if (relationNode.getKind().equals("Advice")) { +// List children = relationNode.getTargets(); // -// IProgramElement theAspect = pNode.getParent(); +// List aspects = new Vector(); // -// aspects.add(theAspect); +// for (Iterator it4 = children.iterator(); +// it4.hasNext(); +// ) { +// Object object = it4.next(); // -// } -// } - } - if (!aspects.isEmpty()) { - aspectMap.put(key, aspects); - } - } +//// if (object instanceof LinkNode) { +//// IProgramElement pNode = +//// ((LinkNode) object).getProgramElementNode(); +//// +//// if (pNode.getProgramElementKind() +//// == IProgramElement.Kind.ADVICE) { +//// +//// IProgramElement theAspect = pNode.getParent(); +//// +//// aspects.add(theAspect); +//// +//// } +//// } +// } +// if (!aspects.isEmpty()) { +// aspectMap.put(key, aspects); +// } +// } } } diff --git a/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java b/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java index 880ddd5ae..5507db525 100644 --- a/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java +++ b/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java @@ -36,7 +36,7 @@ public class StructureViewManager { private static final List AVAILABLE_RELATIONS; public final IStructureModelListener VIEW_LISTENER = new IStructureModelListener() { - public void modelUpdated(StructureModel model) { + public void containmentHierarchyUpdated(StructureModel model) { Ajde.getDefault().logEvent("updating structure views: " + structureViews); // // if (defaultFileView != null) { @@ -218,9 +218,9 @@ public class StructureViewManager { static { AVAILABLE_RELATIONS = new ArrayList(); AVAILABLE_RELATIONS.add(IRelationship.Kind.ADVICE); - AVAILABLE_RELATIONS.add(IRelationship.Kind.INHERITANCE); - AVAILABLE_RELATIONS.add(IRelationship.Kind.DECLARE); - AVAILABLE_RELATIONS.add(IRelationship.Kind.REFERENCE); + AVAILABLE_RELATIONS.add(IRelationship.Kind.DECLARE); +// AVAILABLE_RELATIONS.add(IRelationship.Kind.INHERITANCE); +// AVAILABLE_RELATIONS.add(IRelationship.Kind.REFERENCE); DEFAULT_VIEW_PROPERTIES = new StructureViewProperties(); DEFAULT_VIEW_PROPERTIES.setRelations(AVAILABLE_RELATIONS); diff --git a/ajde/src/org/aspectj/ajde/ui/swing/PointcutWizard.java b/ajde/src/org/aspectj/ajde/ui/swing/PointcutWizard.java index bfd469a6d..33bcfc18e 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/PointcutWizard.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/PointcutWizard.java @@ -69,8 +69,8 @@ class PointcutWizard extends JFrame { private Map getViewProperties() { Map views = new HashMap(); GlobalViewProperties INHERITANCE_VIEW = new GlobalViewProperties(StructureViewProperties.Hierarchy.INHERITANCE); - INHERITANCE_VIEW.addRelation(IRelationship.Kind.INHERITANCE); - views.put(INHERITANCE_VIEW.toString(), INHERITANCE_VIEW); +// INHERITANCE_VIEW.addRelation(IRelationship.Kind.INHERITANCE); +// views.put(INHERITANCE_VIEW.toString(), INHERITANCE_VIEW); return views; } diff --git a/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java index afdf6ba52..dc9b5cd76 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java @@ -61,7 +61,7 @@ public class SimpleStructureViewToolPanel extends JPanel { BorderLayout borderLayout4 = new BorderLayout(); public final IStructureModelListener MODEL_LISTENER = new IStructureModelListener() { - public void modelUpdated(StructureModel model) { + public void containmentHierarchyUpdated(StructureModel model) { String path = Ajde.getDefault().getConfigurationManager().getActiveConfigFile(); String fileName = "<no active config>"; if (path != null) fileName = new File(path).getName(); diff --git a/ajde/testdata/examples/coverage/ModelCoverage.java b/ajde/testdata/examples/coverage/ModelCoverage.java index 2ba60fbf0..8066ca751 100644 --- a/ajde/testdata/examples/coverage/ModelCoverage.java +++ b/ajde/testdata/examples/coverage/ModelCoverage.java @@ -2,7 +2,6 @@ import java.io.*; class Point { - int x; static int sx; @@ -36,7 +35,10 @@ class SubPoint extends Point { } class Line { } -aspect AdvisesRelationCoverage { +aspect AdvisesRelationshipCoverage { + pointcut executionP(): execution(void Point.setX(int)); + before(): executionP() { } + before(): execution(*..*.new(..)) { } before(): get(int *.*) { } before(): set(int *.*) { } diff --git a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java index 6dd2a8ea7..dce7331e4 100644 --- a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java +++ b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java @@ -28,11 +28,23 @@ public class AsmRelationshipsTest extends AjdeTestCase { super(name); } - public void testPointcuts() { + public void testExecution() { IProgramElement node = (IProgramElement)model.getRoot(); assertNotNull(node); - - System.err.println("> root: " + node); + + IProgramElement aspect = StructureModelManager.getDefault().getStructureModel().findNodeForClass(null, "AdvisesRelationshipCoverage"); + assertNotNull(aspect); + + String beforeExec = "before(): executionP.."; + IProgramElement beforeExecNode = model.findNode(aspect, IProgramElement.Kind.ADVICE, beforeExec); + assertNotNull(beforeExecNode); + + + +// System.err.println("> root: " + node); + + +// assertEquals(ptctNode.getName(), ptct); // // IProgramElement aspect = StructureModelManager.getDefault().getStructureModel().findNodeForClass(null, "AdviceNamingCoverage"); @@ -40,10 +52,7 @@ public class AsmRelationshipsTest extends AjdeTestCase { // fail(); -// String ptct = "named()"; -// IProgramElement ptctNode = model.findNode(aspect, IProgramElement.Kind.POINTCUT, ptct); -// assertNotNull(ptctNode); -// assertEquals(ptctNode.getName(), ptct); + // // String params = "namedWithArgs(int, int)"; // IProgramElement paramsNode = model.findNode(aspect, IProgramElement.Kind.POINTCUT, params); |