summaryrefslogtreecommitdiffstats
path: root/ajde/src
diff options
context:
space:
mode:
authormkersten <mkersten>2003-08-08 11:02:53 +0000
committermkersten <mkersten>2003-08-08 11:02:53 +0000
commitf1deb9c11024ecebab2e0aa17a260821375c25bd (patch)
tree9c3434439dddfb2e90a40187c8255ff80a2b147f /ajde/src
parent3e5974557278e81a9891edd4269eca39a8d42f43 (diff)
downloadaspectj-f1deb9c11024ecebab2e0aa17a260821375c25bd.tar.gz
aspectj-f1deb9c11024ecebab2e0aa17a260821375c25bd.zip
Reimplemented ASM API as described in bug "41254: revise asm and create interfaces". Containment hierarchy is done and tests added. Relationships are not done yet. All clients except AJDT ported. More UI porting in Swing clients required.
Diffstat (limited to 'ajde/src')
-rw-r--r--ajde/src/org/aspectj/ajde/internal/LstBuildConfigManager.java18
-rw-r--r--ajde/src/org/aspectj/ajde/ui/AbstractIconRegistry.java70
-rw-r--r--ajde/src/org/aspectj/ajde/ui/BuildConfigModel.java13
-rw-r--r--ajde/src/org/aspectj/ajde/ui/BuildConfigNode.java136
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java87
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java24
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureView.java8
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureViewManager.java79
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureViewNode.java4
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java48
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureViewProperties.java26
-rw-r--r--ajde/src/org/aspectj/ajde/ui/internal/NavigationHistoryModel.java14
-rw-r--r--ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java348
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/AjdeUIManager.java28
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/BrowserStructureViewToolPanel.java57
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/BrowserView.java4
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java26
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/BrowserViewTreeListener.java69
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java4
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java30
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/PointcutWizard.java4
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java8
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/StructureTreeManager.java56
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/StructureViewPanel.java28
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNode.java34
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeFactory.java16
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java82
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/TreeViewBuildConfigEditor.java12
28 files changed, 693 insertions, 640 deletions
diff --git a/ajde/src/org/aspectj/ajde/internal/LstBuildConfigManager.java b/ajde/src/org/aspectj/ajde/internal/LstBuildConfigManager.java
index f6e23cf61..779a8350e 100644
--- a/ajde/src/org/aspectj/ajde/internal/LstBuildConfigManager.java
+++ b/ajde/src/org/aspectj/ajde/internal/LstBuildConfigManager.java
@@ -14,20 +14,12 @@
package org.aspectj.ajde.internal;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FilenameFilter;
+import java.io.*;
import java.util.*;
-import org.aspectj.ajde.Ajde;
-import org.aspectj.ajde.BuildConfigListener;
-import org.aspectj.ajde.BuildConfigManager;
-import org.aspectj.ajde.ui.BuildConfigModel;
-import org.aspectj.ajde.ui.BuildConfigNode;
-import org.aspectj.asm.StructureNode;
-import org.aspectj.bridge.IMessage;
-import org.aspectj.bridge.Message;
-import org.aspectj.bridge.SourceLocation;
+import org.aspectj.ajde.*;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.bridge.*;
import org.aspectj.util.ConfigParser;
/**
@@ -247,7 +239,7 @@ public class LstBuildConfigManager implements BuildConfigManager {
}
for (Iterator it = nodesToRemove.iterator(); it.hasNext(); ) {
- StructureNode currNode = (StructureNode)it.next();
+ BuildConfigNode currNode = (BuildConfigNode)it.next();
node.removeChild(currNode);
}
return node.getChildren().size() > 0;
diff --git a/ajde/src/org/aspectj/ajde/ui/AbstractIconRegistry.java b/ajde/src/org/aspectj/ajde/ui/AbstractIconRegistry.java
index 1b281d1ed..6e4a32b41 100644
--- a/ajde/src/org/aspectj/ajde/ui/AbstractIconRegistry.java
+++ b/ajde/src/org/aspectj/ajde/ui/AbstractIconRegistry.java
@@ -14,11 +14,7 @@
package org.aspectj.ajde.ui;
-import org.aspectj.asm.AdviceAssociation;
-import org.aspectj.asm.InheritanceAssociation;
-import org.aspectj.asm.IntroductionAssociation;
-import org.aspectj.asm.ProgramElementNode;
-import org.aspectj.asm.Relation;
+import org.aspectj.asm.*;
/**
* Uses the factory pattern.
@@ -62,12 +58,12 @@ public abstract class AbstractIconRegistry {
protected final AbstractIcon RELATION_REFERENCE_FORWARD = createIcon(STRUCTURE_PATH + "referenceForward.gif");
protected final AbstractIcon RELATION_REFERENCE_BACK = createIcon(STRUCTURE_PATH + "referenceBack.gif");
- public AbstractIcon getRelationIcon(Relation relation) {
- if (relation.getAssociationName().equals(AdviceAssociation.NAME)) {
+ public AbstractIcon getRelationIcon(IRelationship.Kind relationship) {
+ if (relationship == IRelationship.Kind.ADVICE) {
return RELATION_ADVICE_FORWARD;
- } else if (relation.getAssociationName().equals(IntroductionAssociation.NAME)) {
+ } else if (relationship == IRelationship.Kind.DECLARE) {
return RELATION_ADVICE_FORWARD;
- } else if (relation.getAssociationName().equals(InheritanceAssociation.NAME)) {
+ } else if (relationship == IRelationship.Kind.INHERITANCE) {
return RELATION_INHERITANCE_FORWARD;
} else {
return RELATION_REFERENCE_FORWARD;
@@ -77,8 +73,8 @@ public abstract class AbstractIconRegistry {
/**
* @return null if the kind could not be resolved
*/
- protected AbstractIcon getStructureIcon(ProgramElementNode.Kind kind, ProgramElementNode.Accessibility accessibility) {
- return getStructureIcon(kind, ProgramElementNode.Accessibility.PUBLIC);
+ protected AbstractIcon getStructureIcon(IProgramElement.Kind kind, IProgramElement.Accessibility accessibility) {
+ return getStructureIcon(kind, IProgramElement.Accessibility.PUBLIC);
}
/**
@@ -86,56 +82,56 @@ public abstract class AbstractIconRegistry {
*
* @return null if the kind could not be resolved
*/
- public AbstractIcon getStructureIcon(ProgramElementNode.Kind kind) {
- if (kind == ProgramElementNode.Kind.PROJECT) {
+ public AbstractIcon getStructureIcon(IProgramElement.Kind kind) {
+ if (kind == IProgramElement.Kind.PROJECT) {
return PROJECT;
- } else if (kind == ProgramElementNode.Kind.PACKAGE) {
+ } else if (kind == IProgramElement.Kind.PACKAGE) {
return PACKAGE;
- } else if (kind == ProgramElementNode.Kind.FILE) {
+ } else if (kind == IProgramElement.Kind.FILE) {
return FILE;
- } else if (kind == ProgramElementNode.Kind.FILE_JAVA) {
+ } else if (kind == IProgramElement.Kind.FILE_JAVA) {
return FILE_JAVA;
- } else if (kind == ProgramElementNode.Kind.FILE_ASPECTJ) {
+ } else if (kind == IProgramElement.Kind.FILE_ASPECTJ) {
return FILE_ASPECTJ;
- } else if (kind == ProgramElementNode.Kind.FILE_LST) {
+ } else if (kind == IProgramElement.Kind.FILE_LST) {
return FILE_LST;
- } else if (kind == ProgramElementNode.Kind.CLASS) {
+ } else if (kind == IProgramElement.Kind.CLASS) {
return CLASS;
- } else if (kind == ProgramElementNode.Kind.INTERFACE) {
+ } else if (kind == IProgramElement.Kind.INTERFACE) {
return INTERFACE;
- } else if (kind == ProgramElementNode.Kind.ASPECT) {
+ } else if (kind == IProgramElement.Kind.ASPECT) {
return ASPECT;
- } else if (kind == ProgramElementNode.Kind.INITIALIZER) {
+ } else if (kind == IProgramElement.Kind.INITIALIZER) {
return INITIALIZER;
- } else if (kind == ProgramElementNode.Kind.INTER_TYPE_CONSTRUCTOR) {
+ } else if (kind == IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR) {
return INTRODUCTION;
- } else if (kind == ProgramElementNode.Kind.INTER_TYPE_FIELD) {
+ } else if (kind == IProgramElement.Kind.INTER_TYPE_FIELD) {
return INTRODUCTION;
- } else if (kind == ProgramElementNode.Kind.INTER_TYPE_METHOD) {
+ } else if (kind == IProgramElement.Kind.INTER_TYPE_METHOD) {
return INTRODUCTION;
- } else if (kind == ProgramElementNode.Kind.CONSTRUCTOR) {
+ } else if (kind == IProgramElement.Kind.CONSTRUCTOR) {
return CONSTRUCTOR;
- } else if (kind == ProgramElementNode.Kind.METHOD) {
+ } else if (kind == IProgramElement.Kind.METHOD) {
return METHOD;
- } else if (kind == ProgramElementNode.Kind.FIELD) {
+ } else if (kind == IProgramElement.Kind.FIELD) {
return FIELD;
- } else if (kind == ProgramElementNode.Kind.POINTCUT) {
+ } else if (kind == IProgramElement.Kind.POINTCUT) {
return POINTCUT;
- } else if (kind == ProgramElementNode.Kind.ADVICE) {
+ } else if (kind == IProgramElement.Kind.ADVICE) {
return ADVICE;
- } else if (kind == ProgramElementNode.Kind.DECLARE_PARENTS) {
+ } else if (kind == IProgramElement.Kind.DECLARE_PARENTS) {
return DECLARE_PARENTS;
- } else if (kind == ProgramElementNode.Kind.DECLARE_WARNING) {
+ } else if (kind == IProgramElement.Kind.DECLARE_WARNING) {
return DECLARE_WARNING;
- } else if (kind == ProgramElementNode.Kind.DECLARE_ERROR) {
+ } else if (kind == IProgramElement.Kind.DECLARE_ERROR) {
return DECLARE_ERROR;
- } else if (kind == ProgramElementNode.Kind.DECLARE_SOFT) {
+ } else if (kind == IProgramElement.Kind.DECLARE_SOFT) {
return DECLARE_SOFT;
- } else if (kind == ProgramElementNode.Kind.DECLARE_PRECEDENCE) {
+ } else if (kind == IProgramElement.Kind.DECLARE_PRECEDENCE) {
return DECLARE_SOFT;
- } else if (kind == ProgramElementNode.Kind.CODE) {
+ } else if (kind == IProgramElement.Kind.CODE) {
return CODE;
- } else if (kind == ProgramElementNode.Kind.ERROR) {
+ } else if (kind == IProgramElement.Kind.ERROR) {
return ERROR;
} else {
System.err.println("AJDE Message: unresolved icon kind " + kind);
diff --git a/ajde/src/org/aspectj/ajde/ui/BuildConfigModel.java b/ajde/src/org/aspectj/ajde/ui/BuildConfigModel.java
index 1687e69ee..fdd00fb76 100644
--- a/ajde/src/org/aspectj/ajde/ui/BuildConfigModel.java
+++ b/ajde/src/org/aspectj/ajde/ui/BuildConfigModel.java
@@ -24,7 +24,9 @@ import org.aspectj.asm.StructureModel;
/**
* @author Mik Kersten
*/
-public class BuildConfigModel extends StructureModel {
+public class BuildConfigModel {
+
+ private BuildConfigNode root = null;
private String sourceFile;
@@ -94,6 +96,15 @@ public class BuildConfigModel extends StructureModel {
public void setSourceFile(String sourceFile) {
this.sourceFile = sourceFile;
}
+
+ public BuildConfigNode getRoot() {
+ return root;
+ }
+
+ public void setRoot(BuildConfigNode node) {
+ root = node;
+ }
+
}
diff --git a/ajde/src/org/aspectj/ajde/ui/BuildConfigNode.java b/ajde/src/org/aspectj/ajde/ui/BuildConfigNode.java
index 5c28c7e43..eff97262b 100644
--- a/ajde/src/org/aspectj/ajde/ui/BuildConfigNode.java
+++ b/ajde/src/org/aspectj/ajde/ui/BuildConfigNode.java
@@ -14,31 +14,141 @@
package org.aspectj.ajde.ui;
-import java.io.ObjectStreamException;
-import java.io.Serializable;
-import java.util.List;
+import java.io.*;
+import java.util.*;
-import org.aspectj.asm.StructureNode;
+import org.aspectj.bridge.*;
/**
* @author Mik Kersten
+ *
+ * TODO: clean-up after merging of org.aspectj.asm.StructureNode
*/
-public class BuildConfigNode extends StructureNode {
+public class BuildConfigNode {
+
+
+
+ protected BuildConfigNode parent = null;
+ protected String name = "";
+ protected Kind kind;
+ // children.listIterator() should support remove() operation
+ protected List children = new ArrayList();
+ protected IMessage message = null;
+ protected ISourceLocation sourceLocation = null;
+
+ /**
+ * Used during serialization.
+ */
+ public BuildConfigNode() { }
+
+// public BuildConfigNode(String name, String kind, String resourcePath, List children) {
+// this(name, kind, children);
+// this.resourcePath = resourcePath;
+// }
- private String resourcePath;
- private Kind kind;
- private boolean isActive = true;
-
public BuildConfigNode(String name, Kind kind, String resourcePath) {
- super(name, kind.toString());
+ this(name, kind);
this.kind = kind;
this.resourcePath = resourcePath;
}
- public BuildConfigNode(String name, String kind, String resourcePath, List children) {
- super(name, kind, children);
- this.resourcePath = resourcePath;
+// public BuildConfigNode(String name, Kind kind, List children) {
+// this.name = name;
+// this.kind = kind;
+// if (children != null) {
+// this.children = children;
+// }
+// setParents();
+// }
+
+ public BuildConfigNode(String name, Kind kind) {
+ this.name = name;
+ this.kind = kind;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ public List getChildren() {
+ return children;
+ }
+
+ public void addChild(BuildConfigNode child) {
+ if (children == null) {
+ children = new ArrayList();
+ }
+ children.add(child);
+ child.setParent(this);
+ }
+
+ public void addChild(int position, BuildConfigNode child) {
+ if (children == null) {
+ children = new ArrayList();
+ }
+ children.add(position, child);
+ child.setParent(this);
+ }
+
+ public boolean removeChild(BuildConfigNode child) {
+ child.setParent(null);
+ return children.remove(child);
+ }
+
+ /**
+ * Comparison is string-name based only.
+ */
+ public int compareTo(Object o) throws ClassCastException {
+ if (this == o) {
+ return 0;
+ } else {
+ BuildConfigNode sn = (BuildConfigNode)o;
+ return this.getName().compareTo(sn.getName());
+ }
+ }
+
+ public String getName() {
+ return name;
}
+
+ public ISourceLocation getSourceLocation() {
+ return sourceLocation;
+ }
+
+ public void setSourceLocation(ISourceLocation sourceLocation) {
+ this.sourceLocation = sourceLocation;
+ }
+
+ public IMessage getMessage() {
+ return message;
+ }
+
+ public void setMessage(IMessage message) {
+ this.message = message;
+ }
+
+ public BuildConfigNode getParent() {
+ return parent;
+ }
+
+ public void setParent(BuildConfigNode parent) {
+ this.parent = parent;
+ }
+
+ private void setParents() {
+ if (children == null) return;
+ for (Iterator it = children.iterator(); it.hasNext(); ) {
+ ((BuildConfigNode)it.next()).setParent(this);
+ }
+ }
+
+ public void setName(String string) {
+ name = string;
+ }
+
+
+ private String resourcePath;
+ private boolean isActive = true;
public String getResourcePath() {
return resourcePath;
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java b/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java
index 81d33f75c..1b4a1a9d1 100644
--- a/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java
+++ b/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java
@@ -14,25 +14,10 @@
package org.aspectj.ajde.ui;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
+import java.util.*;
import org.aspectj.ajde.Ajde;
-import org.aspectj.asm.LinkNode;
-import org.aspectj.asm.ProgramElementNode;
-import org.aspectj.asm.RelationNode;
-import org.aspectj.asm.StructureModel;
-import org.aspectj.asm.StructureModelManager;
-import org.aspectj.asm.StructureNode;
+import org.aspectj.asm.*;
/**
* Prototype functionality for package view clients.
@@ -63,15 +48,15 @@ public class StructureModelUtil {
Object key = it.next();
List annotations = (List) annotationsMap.get(key);
for (Iterator it2 = annotations.iterator(); it2.hasNext();) {
- ProgramElementNode node = (ProgramElementNode) it2.next();
+ IProgramElement node = (IProgramElement) it2.next();
List relations = node.getRelations();
for (Iterator it3 = relations.iterator(); it3.hasNext();) {
- RelationNode relationNode = (RelationNode) it3.next();
+ IRelationship relationNode = (IRelationship) it3.next();
if (relationNode.getKind().equals("Advice")) {
- List children = relationNode.getChildren();
+ List children = relationNode.getTargets();
List aspects = new Vector();
@@ -80,19 +65,19 @@ public class StructureModelUtil {
) {
Object object = it4.next();
- if (object instanceof LinkNode) {
- ProgramElementNode pNode =
- ((LinkNode) object).getProgramElementNode();
-
- if (pNode.getProgramElementKind()
- == ProgramElementNode.Kind.ADVICE) {
-
- StructureNode theAspect = pNode.getParent();
-
- aspects.add(theAspect);
-
- }
- }
+// 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);
@@ -111,11 +96,11 @@ public class StructureModelUtil {
*
* @return the set of aspects with advice that affects the specified package
*/
- public static Set getAspectsAffectingPackage(ProgramElementNode packageNode) {
+ public static Set getAspectsAffectingPackage(IProgramElement packageNode) {
List files = StructureModelUtil.getFilesInPackage(packageNode);
Set aspects = new HashSet();
for (Iterator it = files.iterator(); it.hasNext();) {
- ProgramElementNode fileNode = (ProgramElementNode) it.next();
+ IProgramElement fileNode = (IProgramElement) it.next();
Map adviceMap =
getLinesToAspectMap(
fileNode.getSourceLocation().getSourceFile().getAbsolutePath());
@@ -135,20 +120,20 @@ public class StructureModelUtil {
return null;
} else {
return getPackagesHelper(
- (ProgramElementNode) model.getRoot(),
- ProgramElementNode.Kind.PACKAGE,
+ (IProgramElement) model.getRoot(),
+ IProgramElement.Kind.PACKAGE,
null,
packages);
}
}
private static List getPackagesHelper(
- ProgramElementNode node,
- ProgramElementNode.Kind kind,
+ IProgramElement node,
+ IProgramElement.Kind kind,
String prename,
List matches) {
- if (kind == null || node.getProgramElementKind().equals(kind)) {
+ if (kind == null || node.getKind().equals(kind)) {
if (prename == null) {
prename = new String(node.toString());
} else {
@@ -162,10 +147,10 @@ public class StructureModelUtil {
}
for (Iterator it = node.getChildren().iterator(); it.hasNext();) {
- StructureNode nextNode = (StructureNode) it.next();
- if (nextNode instanceof ProgramElementNode) {
+ IProgramElement nextNode = (IProgramElement) it.next();
+ if (nextNode instanceof IProgramElement) {
getPackagesHelper(
- (ProgramElementNode) nextNode,
+ (IProgramElement) nextNode,
kind,
prename,
matches);
@@ -202,8 +187,8 @@ public class StructureModelUtil {
private class SortingComparator implements Comparator {
public int compare(Object o1, Object o2) {
- ProgramElementNode p1 = (ProgramElementNode) o1;
- ProgramElementNode p2 = (ProgramElementNode) o2;
+ IProgramElement p1 = (IProgramElement) o1;
+ IProgramElement p2 = (IProgramElement) o2;
String name1 = p1.getName();
String name2 = p2.getName();
@@ -217,8 +202,8 @@ public class StructureModelUtil {
Object[] array1 = (Object[]) o1;
Object[] array2 = (Object[]) o2;
- ProgramElementNode p1 = (ProgramElementNode) array1[1];
- ProgramElementNode p2 = (ProgramElementNode) array2[1];
+ IProgramElement p1 = (IProgramElement) array1[1];
+ IProgramElement p2 = (IProgramElement) array2[1];
String name1 = p1.getName();
String name2 = p2.getName();
@@ -230,7 +215,7 @@ public class StructureModelUtil {
/**
* @return all of the AspectJ and Java source files in a package
*/
- public static List getFilesInPackage(ProgramElementNode packageNode) {
+ public static List getFilesInPackage(IProgramElement packageNode) {
List packageContents;
if (packageNode == null) {
return null;
@@ -239,9 +224,9 @@ public class StructureModelUtil {
}
List files = new ArrayList();
for (Iterator it = packageContents.iterator(); it.hasNext(); ) {
- ProgramElementNode packageItem = (ProgramElementNode)it.next();
- if (packageItem.getProgramElementKind() == ProgramElementNode.Kind.FILE_JAVA
- || packageItem.getProgramElementKind() == ProgramElementNode.Kind.FILE_ASPECTJ) {
+ IProgramElement packageItem = (IProgramElement)it.next();
+ if (packageItem.getKind() == IProgramElement.Kind.FILE_JAVA
+ || packageItem.getKind() == IProgramElement.Kind.FILE_ASPECTJ) {
files.add(packageItem);
}
}
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java b/ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java
index e997091b4..6afc5b91e 100644
--- a/ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java
+++ b/ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java
@@ -14,14 +14,10 @@
package org.aspectj.ajde.ui;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
import org.aspectj.ajde.Ajde;
-import org.aspectj.asm.ProgramElementNode;
-import org.aspectj.asm.StructureModel;
-import org.aspectj.asm.StructureNode;
+import org.aspectj.asm.*;
/**
* @author Mik Kersten
@@ -35,35 +31,35 @@ public class StructureSearchManager {
*/
public List findMatches(
String pattern,
- ProgramElementNode.Kind kind) {
+ IProgramElement.Kind kind) {
List matches = new ArrayList();
StructureModel model = Ajde.getDefault().getStructureModelManager().getStructureModel();
if (model.equals(StructureModel.NO_STRUCTURE)) {
return null;
} else {
- return findMatchesHelper((ProgramElementNode)model.getRoot(), pattern, kind, matches);
+ return findMatchesHelper((IProgramElement)model.getRoot(), pattern, kind, matches);
}
}
private List findMatchesHelper(
- ProgramElementNode node,
+ IProgramElement node,
String pattern,
- ProgramElementNode.Kind kind,
+ IProgramElement.Kind kind,
List matches) {
if (node != null && node.getName().indexOf(pattern) != -1) {
- if (kind == null || node.getProgramElementKind().equals(kind)) {
+ if (kind == null || node.getKind().equals(kind)) {
matches.add(node);
}
}
for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
- StructureNode nextNode = (StructureNode)it.next();
- if (nextNode instanceof ProgramElementNode) {
+ IProgramElement nextNode = (IProgramElement)it.next();
+ if (nextNode instanceof IProgramElement) {
findMatchesHelper(
- (ProgramElementNode)nextNode,
+ (IProgramElement)nextNode,
pattern,
kind,
matches);
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureView.java b/ajde/src/org/aspectj/ajde/ui/StructureView.java
index 52d592479..3ff063d0c 100644
--- a/ajde/src/org/aspectj/ajde/ui/StructureView.java
+++ b/ajde/src/org/aspectj/ajde/ui/StructureView.java
@@ -16,7 +16,7 @@ package org.aspectj.ajde.ui;
import java.util.Iterator;
-import org.aspectj.asm.ProgramElementNode;
+import org.aspectj.asm.IProgramElement;
/**
* @author Mik Kersten
@@ -57,7 +57,7 @@ public abstract class StructureView {
*/
public StructureViewNode getActiveNode() {
if (activeNode != null
- && activeNode.getStructureNode() instanceof ProgramElementNode) {
+ && activeNode.getStructureNode() instanceof IProgramElement) {
return activeNode;
} else {
return null;
@@ -69,11 +69,11 @@ public abstract class StructureView {
*
* @return the first match
*/
- public StructureViewNode findCorrespondingViewNode(ProgramElementNode node) {
+ public StructureViewNode findCorrespondingViewNode(IProgramElement node) {
return findCorrespondingViewNodeHelper(rootNode, node);
}
- private StructureViewNode findCorrespondingViewNodeHelper(StructureViewNode node, ProgramElementNode pNode) {
+ private StructureViewNode findCorrespondingViewNodeHelper(StructureViewNode node, IProgramElement pNode) {
if (node != null
&& node.getStructureNode() != null
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java b/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java
index ad2be9c79..880ddd5ae 100644
--- a/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java
+++ b/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java
@@ -14,23 +14,11 @@
package org.aspectj.ajde.ui;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
import org.aspectj.ajde.Ajde;
-import org.aspectj.ajde.ui.internal.NavigationHistoryModel;
-import org.aspectj.ajde.ui.internal.TreeStructureViewBuilder;
-import org.aspectj.asm.AdviceAssociation;
-import org.aspectj.asm.InheritanceAssociation;
-import org.aspectj.asm.IntroductionAssociation;
-import org.aspectj.asm.LinkNode;
-import org.aspectj.asm.ProgramElementNode;
-import org.aspectj.asm.ReferenceAssociation;
-import org.aspectj.asm.StructureModel;
-import org.aspectj.asm.StructureModelListener;
-import org.aspectj.asm.StructureModelManager;
-import org.aspectj.asm.StructureNode;
+import org.aspectj.ajde.ui.internal.*;
+import org.aspectj.asm.*;
/**
* @author Mik Kersten
@@ -47,7 +35,7 @@ public class StructureViewManager {
private static final StructureViewProperties DEFAULT_VIEW_PROPERTIES;
private static final List AVAILABLE_RELATIONS;
- public final StructureModelListener VIEW_LISTENER = new StructureModelListener() {
+ public final IStructureModelListener VIEW_LISTENER = new IStructureModelListener() {
public void modelUpdated(StructureModel model) {
Ajde.getDefault().logEvent("updating structure views: " + structureViews);
//
@@ -71,7 +59,7 @@ public class StructureViewManager {
}
public void fireNavigateBackAction(StructureView view) {
- ProgramElementNode backNode = historyModel.navigateBack();
+ IProgramElement backNode = historyModel.navigateBack();
if (backNode == null) {
Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("No node to navigate back to in history");
@@ -81,7 +69,7 @@ public class StructureViewManager {
}
public void fireNavigateForwardAction(StructureView view) {
- ProgramElementNode forwardNode = historyModel.navigateForward();
+ IProgramElement forwardNode = historyModel.navigateForward();
if (forwardNode == null) {
Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("No node to navigate forward to in history");
@@ -96,26 +84,27 @@ public class StructureViewManager {
* @param newFilePath the canonicalized path to the new file
*/
public void fireNavigationAction(String newFilePath, int lineNumber) {
- StructureNode currNode = Ajde.getDefault().getStructureModelManager().getStructureModel().findNodeForSourceLine(
+ IProgramElement currNode = Ajde.getDefault().getStructureModelManager().getStructureModel().findNodeForSourceLine(
newFilePath,
lineNumber);
- if (currNode instanceof ProgramElementNode) {
- navigationAction((ProgramElementNode)currNode, true);
+ if (currNode instanceof IProgramElement) {
+ navigationAction((IProgramElement)currNode, true);
}
}
/**
* History is recorded for {@link LinkNode} navigations.
*/
- public void fireNavigationAction(StructureNode structureNode) {
- ProgramElementNode node = null;
+ public void fireNavigationAction(IProgramElement IProgramElement) {
+ IProgramElement node = null;
boolean recordHistory = false;
- if (structureNode instanceof LinkNode) {
- node = ((LinkNode)structureNode).getProgramElementNode();
- recordHistory = true;
- } else if (structureNode instanceof ProgramElementNode) {
- node = (ProgramElementNode)structureNode;
+// if (IProgramElement instanceof LinkNode) {
+// node = ((LinkNode)IProgramElement).getProgramElementNode();
+// recordHistory = true;
+// } else
+ if (IProgramElement instanceof IProgramElement) {
+ node = (IProgramElement)IProgramElement;
}
if (node != null) navigationAction(node, recordHistory);
}
@@ -125,7 +114,7 @@ public class StructureViewManager {
* and as such is below the granularity visible in the view the parent is highlighted,
* along with the corresponding sourceline.
*/
- private void navigationAction(ProgramElementNode node, boolean recordHistory) {
+ private void navigationAction(IProgramElement node, boolean recordHistory) {
if (node == null
|| node == StructureModel.NO_STRUCTURE) {
Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("Source not available for node: " + node.getName());
@@ -145,8 +134,8 @@ public class StructureViewManager {
for (Iterator it = structureViews.iterator(); it.hasNext(); ) {
StructureView view = (StructureView)it.next();
if (!(view instanceof GlobalStructureView) || !recordHistory || defaultFileView == null) {
- if (node.getProgramElementKind().equals(ProgramElementNode.Kind.CODE)) {
- ProgramElementNode parentNode = (ProgramElementNode)node.getParent();
+ if (node.getKind().equals(IProgramElement.Kind.CODE)) {
+ IProgramElement parentNode = (IProgramElement)node.getParent();
if (parentNode != null) {
StructureViewNode currNode = view.findCorrespondingViewNode(parentNode);
int lineOffset = node.getSourceLocation().getLine() - parentNode.getSourceLocation().getLine();
@@ -160,11 +149,11 @@ public class StructureViewManager {
}
}
- private ProgramElementNode getProgramElementNode(StructureViewNode node) {
- if (node.getStructureNode() instanceof ProgramElementNode) {
- return (ProgramElementNode)node.getStructureNode();
- } else if (node.getStructureNode() instanceof LinkNode) {
- return ((LinkNode)node.getStructureNode()).getProgramElementNode();
+ private IProgramElement getProgramElementNode(StructureViewNode node) {
+ if (node.getStructureNode() instanceof IProgramElement) {
+ return (IProgramElement)node.getStructureNode();
+// } else if (node.getStructureNode() instanceof LinkNode) {
+// return ((LinkNode)node.getStructureNode()).getProgramElementNode();
} else {
return null;
}
@@ -228,20 +217,10 @@ public class StructureViewManager {
static {
AVAILABLE_RELATIONS = new ArrayList();
- AVAILABLE_RELATIONS.add(AdviceAssociation.METHOD_CALL_SITE_RELATION);
- AVAILABLE_RELATIONS.add(AdviceAssociation.METHOD_RELATION);
- AVAILABLE_RELATIONS.add(AdviceAssociation.CONSTRUCTOR_CALL_SITE_RELATION);
- AVAILABLE_RELATIONS.add(AdviceAssociation.CONSTRUCTOR_RELATION);
- AVAILABLE_RELATIONS.add(AdviceAssociation.FIELD_ACCESS_RELATION);
- AVAILABLE_RELATIONS.add(AdviceAssociation.INITIALIZER_RELATION);
- AVAILABLE_RELATIONS.add(AdviceAssociation.HANDLER_RELATION);
- AVAILABLE_RELATIONS.add(AdviceAssociation.INTRODUCTION_RELATION);
- AVAILABLE_RELATIONS.add(IntroductionAssociation.INTRODUCES_RELATION);
- AVAILABLE_RELATIONS.add(InheritanceAssociation.IMPLEMENTS_RELATION);
- AVAILABLE_RELATIONS.add(InheritanceAssociation.INHERITS_RELATION);
- AVAILABLE_RELATIONS.add(InheritanceAssociation.INHERITS_MEMBERS_RELATION);
- AVAILABLE_RELATIONS.add(ReferenceAssociation.USES_POINTCUT_RELATION);
- AVAILABLE_RELATIONS.add(ReferenceAssociation.IMPORTS_RELATION);
+ AVAILABLE_RELATIONS.add(IRelationship.Kind.ADVICE);
+ AVAILABLE_RELATIONS.add(IRelationship.Kind.INHERITANCE);
+ AVAILABLE_RELATIONS.add(IRelationship.Kind.DECLARE);
+ 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/StructureViewNode.java b/ajde/src/org/aspectj/ajde/ui/StructureViewNode.java
index fc2700813..f225a6a05 100644
--- a/ajde/src/org/aspectj/ajde/ui/StructureViewNode.java
+++ b/ajde/src/org/aspectj/ajde/ui/StructureViewNode.java
@@ -16,14 +16,14 @@ package org.aspectj.ajde.ui;
import java.util.List;
-import org.aspectj.asm.StructureNode;
+import org.aspectj.asm.IProgramElement;
/**
* @author Mik Kersten
*/
public interface StructureViewNode {
- public StructureNode getStructureNode();
+ public IProgramElement getStructureNode();
public AbstractIcon getIcon();
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java b/ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java
index 102d58b95..19f64a315 100644
--- a/ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java
+++ b/ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java
@@ -16,10 +16,7 @@ package org.aspectj.ajde.ui;
import java.util.List;
-import org.aspectj.asm.LinkNode;
-import org.aspectj.asm.ProgramElementNode;
-import org.aspectj.asm.RelationNode;
-import org.aspectj.asm.StructureNode;
+import org.aspectj.asm.*;
/**
* @author Mik Kersten
@@ -32,31 +29,40 @@ public abstract class StructureViewNodeFactory {
this.iconRegistry = iconRegistry;
}
- public StructureViewNode createNode(StructureNode node) {
+ public StructureViewNode createNode(IProgramElement node) {
return createNode(node, null);
}
- public StructureViewNode createNode(StructureNode node, List children) {
+ public StructureViewNode createNode(IProgramElement node, List children) {
AbstractIcon icon;
- if (node instanceof ProgramElementNode) {
- ProgramElementNode pNode = (ProgramElementNode)node;
- icon = iconRegistry.getStructureIcon(pNode.getProgramElementKind(), pNode.getAccessibility());
- } else if (node instanceof RelationNode) {
- RelationNode relationNode = (RelationNode)node;
- icon = iconRegistry.getRelationIcon(relationNode.getRelation());
- } else if (node instanceof LinkNode) {
- LinkNode linkNode = (LinkNode)node;
- icon = iconRegistry.getStructureIcon(
- linkNode.getProgramElementNode().getProgramElementKind(),
- linkNode.getProgramElementNode().getAccessibility());
- } else {
- icon = new AbstractIcon(null);
- }
+// if (node instanceof IProgramElement) {
+// IProgramElement pNode = (IProgramElement)node;
+ icon = iconRegistry.getStructureIcon(node.getKind(), node.getAccessibility());
+// } else if (node instanceof IRelationship) {
+// IRelationship relationNode = (IRelationship)node;
+// icon = iconRegistry.getRelationIcon(relationNode.getKind());
+//// } else if (node instanceof LinkNode) {
+//// LinkNode linkNode = (LinkNode)node;
+//// icon = iconRegistry.getStructureIcon(
+//// linkNode.getProgramElementNode().getProgramElementKind(),
+//// linkNode.getProgramElementNode().getAccessibility());
+// } else {
+// icon = new AbstractIcon(null);
+// }
+// node.setChildren(children);
return createConcreteNode(node, icon, children);
}
+
+ public StructureViewNode createNode(IRelationship relationship) {
+ AbstractIcon icon;
+ icon = iconRegistry.getRelationIcon(relationship.getKind());
+ return createConcreteNode(relationship, icon);
+ }
+ protected abstract StructureViewNode createConcreteNode(IRelationship relationship, AbstractIcon icon);
+
/**
* Implementors must override this method in order to create new nodes.
*/
- protected abstract StructureViewNode createConcreteNode(StructureNode node, AbstractIcon icon, List children);
+ protected abstract StructureViewNode createConcreteNode(IProgramElement node, AbstractIcon icon, List children);
}
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureViewProperties.java b/ajde/src/org/aspectj/ajde/ui/StructureViewProperties.java
index 230108d62..519d928a7 100644
--- a/ajde/src/org/aspectj/ajde/ui/StructureViewProperties.java
+++ b/ajde/src/org/aspectj/ajde/ui/StructureViewProperties.java
@@ -15,11 +15,9 @@
package org.aspectj.ajde.ui;
import java.io.ObjectStreamException;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
-import org.aspectj.asm.ProgramElementNode;
-import org.aspectj.asm.Relation;
+import org.aspectj.asm.*;
/**
* Nested properties use the typesafe enum pattern.
@@ -54,12 +52,12 @@ public class StructureViewProperties {
this.relations = relations;
}
- public void addRelation(Relation relation) {
- relations.add(relation);
+ public void addRelation(IRelationship.Kind kind) {
+ relations.add(kind);
}
- public void removeRelation(Relation relation) {
- relations.remove(relation);
+ public void removeRelation(IRelationship.Kind kind) {
+ relations.remove(kind);
}
public void setFilteredMemberAccessibility(List memberVisibility) {
@@ -70,11 +68,11 @@ public class StructureViewProperties {
return filteredMemberAccessibility;
}
- public void addFilteredMemberAccessibility(ProgramElementNode.Accessibility accessibility) {
+ public void addFilteredMemberAccessibility(IProgramElement.Accessibility accessibility) {
this.filteredMemberAccessibility.add(accessibility);
}
- public void removeFilteredMemberAccessibility(ProgramElementNode.Accessibility accessibility) {
+ public void removeFilteredMemberAccessibility(IProgramElement.Accessibility accessibility) {
this.filteredMemberAccessibility.remove(accessibility);
}
@@ -86,11 +84,11 @@ public class StructureViewProperties {
this.filteredMemberModifiers = memberModifiers;
}
- public void addFilteredMemberModifiers(ProgramElementNode.Modifiers modifiers) {
+ public void addFilteredMemberModifiers(IProgramElement.Modifiers modifiers) {
this.filteredMemberModifiers.add(modifiers);
}
- public void removeFilteredMemberModifiers(ProgramElementNode.Modifiers modifiers) {
+ public void removeFilteredMemberModifiers(IProgramElement.Modifiers modifiers) {
this.filteredMemberModifiers.remove(modifiers);
}
@@ -110,11 +108,11 @@ public class StructureViewProperties {
this.filteredMemberKinds = memberKinds;
}
- public void addFilteredMemberKind(ProgramElementNode.Kind kind) {
+ public void addFilteredMemberKind(IProgramElement.Kind kind) {
this.filteredMemberKinds.add(kind);
}
- public void removeFilteredMemberKind(ProgramElementNode.Kind kind) {
+ public void removeFilteredMemberKind(IProgramElement.Kind kind) {
this.filteredMemberKinds.remove(kind);
}
diff --git a/ajde/src/org/aspectj/ajde/ui/internal/NavigationHistoryModel.java b/ajde/src/org/aspectj/ajde/ui/internal/NavigationHistoryModel.java
index d15167926..2f1425a94 100644
--- a/ajde/src/org/aspectj/ajde/ui/internal/NavigationHistoryModel.java
+++ b/ajde/src/org/aspectj/ajde/ui/internal/NavigationHistoryModel.java
@@ -16,41 +16,41 @@ package org.aspectj.ajde.ui.internal;
import java.util.Stack;
-import org.aspectj.asm.ProgramElementNode;
+import org.aspectj.asm.IProgramElement;
/**
* @author Mik Kersten
*/
public class NavigationHistoryModel {
- private ProgramElementNode currNode = null;
+ private IProgramElement currNode = null;
private Stack backHistory = new Stack();
private Stack forwardHistory = new Stack();
/**
* @return null if the history is empty
*/
- public ProgramElementNode navigateBack() {
+ public IProgramElement navigateBack() {
if (backHistory.isEmpty() || currNode == null) return null;
forwardHistory.push(currNode);
- currNode = (ProgramElementNode)backHistory.pop();
+ currNode = (IProgramElement)backHistory.pop();
return currNode;
}
/**
* @return null if the history is empty
*/
- public ProgramElementNode navigateForward() {
+ public IProgramElement navigateForward() {
if (forwardHistory.isEmpty() || currNode == null) return null;
backHistory.push(currNode);
- currNode = (ProgramElementNode)forwardHistory.pop();
+ currNode = (IProgramElement)forwardHistory.pop();
return currNode;
}
- public void navigateToNode(ProgramElementNode toNode) {
+ public void navigateToNode(IProgramElement toNode) {
if (currNode != null) backHistory.push(currNode);
currNode = toNode;
}
diff --git a/ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java b/ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java
index 32daa8a34..4473dc1e9 100644
--- a/ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java
+++ b/ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java
@@ -14,24 +14,11 @@
package org.aspectj.ajde.ui.internal;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
-import org.aspectj.ajde.ui.FileStructureView;
-import org.aspectj.ajde.ui.GlobalStructureView;
-import org.aspectj.ajde.ui.StructureView;
-import org.aspectj.ajde.ui.StructureViewNode;
-import org.aspectj.ajde.ui.StructureViewNodeFactory;
-import org.aspectj.ajde.ui.StructureViewProperties;
-import org.aspectj.asm.LinkNode;
-import org.aspectj.asm.ProgramElementNode;
-import org.aspectj.asm.Relation;
-import org.aspectj.asm.RelationNode;
-import org.aspectj.asm.StructureModel;
-import org.aspectj.asm.StructureNode;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.*;
+import org.aspectj.asm.internal.ProgramElement;
/**
* @author Mik Kersten
@@ -49,7 +36,7 @@ public class TreeStructureViewBuilder {
*/
public void buildView(StructureView view, StructureModel model) {
StructureViewProperties properties = view.getViewProperties();
- StructureNode modelRoot = null;
+ IProgramElement modelRoot = null;
boolean noStructure = false;
if (isFileView(view)) {
FileStructureView fileView = (FileStructureView)view;
@@ -62,7 +49,7 @@ public class TreeStructureViewBuilder {
} else {
modelRoot = model.getRoot();
}
-
+
StructureViewNode viewRoot = null;
if (!isFileView(view)) {
StructureViewProperties.Hierarchy hierarchy
@@ -90,53 +77,50 @@ public class TreeStructureViewBuilder {
private void addPackageNode(StructureView view, StructureViewNode viewRoot) {
if (isFileView(view)) {
- ProgramElementNode fileNode = (ProgramElementNode)viewRoot.getStructureNode();
-
- StructureNode parentNode = fileNode.getParent();
- if (parentNode instanceof ProgramElementNode
- && ((ProgramElementNode)parentNode).getProgramElementKind().equals(ProgramElementNode.Kind.PACKAGE)) {
- String name = ((ProgramElementNode)parentNode).getName();
- ProgramElementNode packageNode = new ProgramElementNode(name, ProgramElementNode.Kind.PACKAGE, null);
- packageNode.setSourceLocation(fileNode.getSourceLocation());
- StructureViewNode packageViewNode = createViewNode(
- packageNode,
- view.getViewProperties()
- );
- viewRoot.getChildren().add(0, packageViewNode);
- };
+// IProgramElement fileNode = viewRoot.getStructureNode();
+// IProgramElement parentNode = fileNode.getParent();
+//
+// if (parentNode.getKind() == IProgramElement.Kind.PACKAGE) {
+// String name = parentNode.getName();
+// IProgramElement packageNode = new ProgramElement(name, IProgramElement.Kind.PACKAGE, null);
+// packageNode.setSourceLocation(fileNode.getSourceLocation());
+// StructureViewNode packageViewNode = createViewNode(
+// packageNode,
+// view.getViewProperties()
+// );
+// viewRoot.getChildren().add(0, packageViewNode);
+// };
}
}
- private StructureViewNode createViewNode(StructureNode node, StructureViewProperties properties) {
+ private StructureViewNode createViewNode(IProgramElement node, StructureViewProperties properties) {
if (node == null) return null;
List children = new ArrayList();
- if (node instanceof ProgramElementNode) {
- ProgramElementNode pNode = (ProgramElementNode)node;
- if (pNode.getRelations() != null) {
- for (Iterator it = pNode.getRelations().iterator(); it.hasNext(); ) {
- StructureNode structureNode = (StructureNode)it.next();
- if (acceptNode(structureNode, properties)) {
- children.add(createViewNode(structureNode, properties));
- }
- }
- }
- if (pNode.isRunnable() && pNode.getParent() != null) {
- ProgramElementNode parent = (ProgramElementNode)pNode.getParent();
- if (parent.getProgramElementKind().equals(ProgramElementNode.Kind.CLASS)
- || parent.getProgramElementKind().equals(ProgramElementNode.Kind.ASPECT)) {
- parent.setRunnable(true);
- pNode.setRunnable(false);
- }
- }
- }
- if (node.getChildren() != null) {
- for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
- StructureNode structureNode = (StructureNode)it.next();
- if (acceptNode(structureNode, properties)) {
- children.add(createViewNode(structureNode, properties));
+// 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.isRunnable() && node.getParent() != null) {
+ IProgramElement parent = node.getParent();
+ if (parent.getKind().equals(IProgramElement.Kind.CLASS)
+ || parent.getKind().equals(IProgramElement.Kind.ASPECT)) {
+ parent.setRunnable(true);
+ node.setRunnable(false);
+ }
+ }
+// if (node.getChildren() != null) {
+// for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+// IProgramElement IProgramElement = (IProgramElement)it.next();
+// if (acceptNode(IProgramElement, properties)) {
+// children.add(createViewNode(IProgramElement, properties));
+// }
+// }
+// }
StructureViewNode viewNode = nodeFactory.createNode(node, children);//new TreeViewNode(root, null, children);
return viewNode;
}
@@ -149,43 +133,43 @@ public class TreeStructureViewBuilder {
&& !(view instanceof GlobalStructureView);
}
- private boolean acceptGranularity(ProgramElementNode.Kind kind, StructureViewProperties.Granularity granularity) {
+ private boolean acceptGranularity(IProgramElement.Kind kind, StructureViewProperties.Granularity granularity) {
if (granularity == StructureViewProperties.Granularity.DECLARED_ELEMENTS) {
return true;
} else if (granularity == StructureViewProperties.Granularity.MEMBER &&
- (kind != ProgramElementNode.Kind.CODE)) {
+ (kind != IProgramElement.Kind.CODE)) {
return true;
} else if (granularity == StructureViewProperties.Granularity.TYPE
- && (kind == ProgramElementNode.Kind.PROJECT
- || kind == ProgramElementNode.Kind.PACKAGE
+ && (kind == IProgramElement.Kind.PROJECT
+ || kind == IProgramElement.Kind.PACKAGE
|| kind.isSourceFileKind()
|| kind.isTypeKind())) {
return true;
} else if (granularity == StructureViewProperties.Granularity.FILE
- && (kind == ProgramElementNode.Kind.PROJECT
- || kind == ProgramElementNode.Kind.PACKAGE
+ && (kind == IProgramElement.Kind.PROJECT
+ || kind == IProgramElement.Kind.PACKAGE
|| kind.isSourceFileKind())) {
return true;
} else if (granularity == StructureViewProperties.Granularity.PACKAGE
- && (kind == ProgramElementNode.Kind.PROJECT
- || kind == ProgramElementNode.Kind.PACKAGE)) {
+ && (kind == IProgramElement.Kind.PROJECT
+ || kind == IProgramElement.Kind.PACKAGE)) {
return true;
} else {
return false;
}
}
- private boolean acceptNode(StructureNode node, StructureViewProperties properties) {
- if (node instanceof ProgramElementNode) {
- ProgramElementNode pNode = (ProgramElementNode)node;
- if (!acceptGranularity(pNode.getProgramElementKind(), properties.getGranularity())) {
+ private boolean acceptNode(IProgramElement node, StructureViewProperties properties) {
+ if (node instanceof IProgramElement) {
+ IProgramElement pNode = (IProgramElement)node;
+ if (!acceptGranularity(pNode.getKind(), properties.getGranularity())) {
return false;
} else if (pNode.isMemberKind()) {
if (properties.getFilteredMemberAccessibility().contains(pNode.getAccessibility())) {
return false;
}
- if (properties.getFilteredMemberKinds().contains(pNode.getProgramElementKind())) {
+ if (properties.getFilteredMemberKinds().contains(pNode.getKind())) {
return false;
}
for (Iterator it = pNode.getModifiers().iterator(); it.hasNext(); ) {
@@ -194,8 +178,8 @@ public class TreeStructureViewBuilder {
}
}
}
- } else if (node instanceof RelationNode) {
- Relation relation = ((RelationNode)node).getRelation();
+ } else if (node instanceof IRelationship) {
+ IRelationship relation = (IRelationship)node;
return properties.getRelations().contains(relation);
} else {
return true;
@@ -213,7 +197,7 @@ public class TreeStructureViewBuilder {
}
private StructureViewNode buildCustomTree(GlobalStructureView view, StructureModel model) {
- StructureNode rootNode = model.getRoot();
+ IProgramElement rootNode = model.getRoot();
StructureViewNode treeNode = nodeFactory.createNode(rootNode);
List rootNodes = new ArrayList();
@@ -221,10 +205,10 @@ public class TreeStructureViewBuilder {
for (Iterator it = rootNodes.iterator(); it.hasNext(); ) {
if (view.getGlobalViewProperties().getHierarchy().equals(StructureViewProperties.Hierarchy.CROSSCUTTING)) {
- treeNode.add(getCrosscuttingChildren((StructureNode)it.next()));
+ treeNode.add(getCrosscuttingChildren((IProgramElement)it.next()));
} else if (view.getGlobalViewProperties().getHierarchy().equals(StructureViewProperties.Hierarchy.INHERITANCE)) {
treeNode.add(getInheritanceChildren(
- (StructureNode)it.next(),
+ (IProgramElement)it.next(),
view.getViewProperties().getRelations())
);
}
@@ -232,123 +216,125 @@ public class TreeStructureViewBuilder {
return treeNode;
}
- private void getRoots(StructureNode rootNode, List roots, StructureViewProperties.Hierarchy hierarchy) {
- if (rootNode != null && rootNode.getChildren() != null) {
- for (Iterator it = rootNode.getChildren().iterator(); it.hasNext(); ) {
- StructureNode node = (StructureNode)it.next();
- if (node instanceof ProgramElementNode) {
- if (acceptNodeAsRoot((ProgramElementNode)node, hierarchy)) {
- ProgramElementNode pNode = (ProgramElementNode)node;
- List relations = pNode.getRelations();
- String delimiter = "";
- if (hierarchy.equals(StructureViewProperties.Hierarchy.CROSSCUTTING)) {
- delimiter = "uses pointcut";
- } else if (hierarchy.equals(StructureViewProperties.Hierarchy.INHERITANCE)) {
- delimiter = "inherits";
- }
- if (relations != null && relations.toString().indexOf(delimiter) == -1) {
- boolean found = false;
- for (Iterator it2 = roots.iterator(); it2.hasNext(); ) {
- if (((ProgramElementNode)it2.next()).equals(pNode)) found = true;
- }
- if (!found) roots.add(pNode);
- }
- }
- }
- getRoots(node, roots, hierarchy);
- }
- }
+ private void getRoots(IProgramElement rootNode, List roots, StructureViewProperties.Hierarchy hierarchy) {
+// if (rootNode != null && rootNode.getChildren() != null) {
+// for (Iterator it = rootNode.getChildren().iterator(); it.hasNext(); ) {
+// IProgramElement node = (IProgramElement)it.next();
+// if (node instanceof IProgramElement) {
+// if (acceptNodeAsRoot((IProgramElement)node, hierarchy)) {
+// IProgramElement pNode = (IProgramElement)node;
+// List relations = pNode.getRelations();
+// String delimiter = "";
+// if (hierarchy.equals(StructureViewProperties.Hierarchy.CROSSCUTTING)) {
+// delimiter = "uses pointcut";
+// } else if (hierarchy.equals(StructureViewProperties.Hierarchy.INHERITANCE)) {
+// delimiter = "inherits";
+// }
+// if (relations != null && relations.toString().indexOf(delimiter) == -1) {
+// boolean found = false;
+// for (Iterator it2 = roots.iterator(); it2.hasNext(); ) {
+// if (((IProgramElement)it2.next()).equals(pNode)) found = true;
+// }
+// if (!found) roots.add(pNode);
+// }
+// }
+// }
+// getRoots(node, roots, hierarchy);
+// }
+// }
}
- public boolean acceptNodeAsRoot(ProgramElementNode node, StructureViewProperties.Hierarchy hierarchy) {
+ public boolean acceptNodeAsRoot(IProgramElement node, StructureViewProperties.Hierarchy hierarchy) {
if (hierarchy.equals(StructureViewProperties.Hierarchy.CROSSCUTTING)) {
- return node.getProgramElementKind().equals(ProgramElementNode.Kind.ADVICE)
- || node.getProgramElementKind().equals(ProgramElementNode.Kind.POINTCUT);
+ return node.getKind().equals(IProgramElement.Kind.ADVICE)
+ || node.getKind().equals(IProgramElement.Kind.POINTCUT);
} else if (hierarchy.equals(StructureViewProperties.Hierarchy.INHERITANCE)) {
- return node.getProgramElementKind().equals(ProgramElementNode.Kind.CLASS);
+ return node.getKind().equals(IProgramElement.Kind.CLASS);
} else {
return false;
}
}
- private StructureViewNode getInheritanceChildren(StructureNode node, List associations) {
+ private StructureViewNode getInheritanceChildren(IProgramElement node, List associations) {
StructureViewNode treeNode = nodeFactory.createNode(node);
//StructureViewNode treeNode = new StructureViewNodeAdapter(node);
- List relations = ((ProgramElementNode)node).getRelations();
- if (relations != null) {
- for (Iterator it = relations.iterator(); it.hasNext(); ) {
- RelationNode relation = (RelationNode)it.next();
- if (relation.getName().equals("is inherited by")) {
- for (Iterator it2 = relation.getChildren().iterator(); it2.hasNext(); ) {
- ProgramElementNode pNode = ((LinkNode)it2.next()).getProgramElementNode();
- StructureViewNode newNode = getInheritanceChildren(pNode, associations);
- StructureViewNode typeChildren = buildTree(newNode.getStructureNode(), associations);
- for (int i = 0; i < typeChildren.getChildren().size(); i++) {
- newNode.add((StructureViewNode)typeChildren.getChildren().get(i));
- }
- treeNode.add(newNode);
- }
- }
- }
- }
- return treeNode;
+ List relations = ((IProgramElement)node).getRelations();
+ throw new RuntimeException("unimplemented");
+// if (relations != null) {
+// for (Iterator it = relations.iterator(); it.hasNext(); ) {
+// IRelationship relation = (IRelationship)it.next();
+// if (relation.getName().equals("is inherited by")) {
+// for (Iterator it2 = relation.getTargets().iterator(); it2.hasNext(); ) {
+//// IProgramElement pNode = ((LinkNode)it2.next()).getProgramElementNode();
+//// StructureViewNode newNode = getInheritanceChildren(pNode, associations);
+// StructureViewNode typeChildren = buildTree(newNode.getStructureNode(), associations);
+// for (int i = 0; i < typeChildren.getChildren().size(); i++) {
+// newNode.add((StructureViewNode)typeChildren.getChildren().get(i));
+// }
+// treeNode.add(newNode);
+// }
+// }
+// }
+// }
+// return treeNode;
}
- private StructureViewNode getCrosscuttingChildren(StructureNode node) {
+ private StructureViewNode getCrosscuttingChildren(IProgramElement node) {
//StructureViewNodeAdapter treeNode = new StructureViewNodeAdapter(node);
StructureViewNode treeNode = nodeFactory.createNode(node);
- List relations = ((ProgramElementNode)node).getRelations();
- if (relations != null) {
- for (Iterator it = relations.iterator(); it.hasNext(); ) {
- RelationNode relation = (RelationNode)it.next();
- if (relation.getName().equals("pointcut used by")) {
- for (Iterator it2 = relation.getChildren().iterator(); it2.hasNext(); ) {
- ProgramElementNode pNode = ((LinkNode)it2.next()).getProgramElementNode();
- StructureViewNode newNode = getCrosscuttingChildren(pNode);
- for (Iterator it3 = pNode.getRelations().iterator(); it3.hasNext(); ) {
- RelationNode relationNode = (RelationNode)it3.next();
- if (relationNode.getName().indexOf("pointcut") == -1) {
- newNode.add(getRelations(relationNode));
- }
- }
- treeNode.add(newNode);
- }
- } else if (relations.toString().indexOf("uses pointcut") == -1) {
- for (Iterator it4 = relations.iterator(); it4.hasNext(); ) {
- RelationNode relationNode = (RelationNode)it4.next();
- if (relationNode.getName().indexOf("pointcut") == -1) {
- treeNode.add(getRelations(relationNode));
- }
- }
- }
- }
- }
- return treeNode;
+ List relations = ((IProgramElement)node).getRelations();
+ throw new RuntimeException("unimplemented");
+// if (relations != null) {
+// for (Iterator it = relations.iterator(); it.hasNext(); ) {
+// IRelationship relation = (IRelationship)it.next();
+// if (relation.getName().equals("pointcut used by")) {
+// for (Iterator it2 = relation.getTargets().iterator(); it2.hasNext(); ) {
+// IProgramElement pNode = ((LinkNode)it2.next()).getProgramElementNode();
+// StructureViewNode newNode = getCrosscuttingChildren(pNode);
+// for (Iterator it3 = pNode.getRelations().iterator(); it3.hasNext(); ) {
+// IRelationship relationNode = (IRelation)it3.next();
+// if (relationNode.getName().indexOf("pointcut") == -1) {
+// newNode.add(getRelations(relationNode));
+// }
+// }
+// treeNode.add(newNode);
+// }
+// } else if (relations.toString().indexOf("uses pointcut") == -1) {
+// for (Iterator it4 = relations.iterator(); it4.hasNext(); ) {
+// IRelation relationNode = (IRelationship)it4.next();
+// if (relationNode.getName().indexOf("pointcut") == -1) {
+// treeNode.add(getRelations(relationNode));
+// }
+// }
+// }
+// }
+// }
+// return treeNode;
}
- private StructureViewNode buildTree(StructureNode node, List associations) {
+ private StructureViewNode buildTree(IProgramElement node, List associations) {
//StructureViewNode treeNode = new StructureViewNodeAdapter(node);
StructureViewNode treeNode = nodeFactory.createNode(node);
- if (node instanceof ProgramElementNode) {
- List relations = ((ProgramElementNode)node).getRelations();
- if (relations != null) {
- for (Iterator it = relations.iterator(); it.hasNext(); ) {
- RelationNode relationNode = (RelationNode)it.next();
- if (associations.contains(relationNode.getRelation().toString())) {
- treeNode.add(buildTree(relationNode, associations));
- }
- }
- }
- }
+// if (node instanceof IProgramElement) {
+// List relations = ((IProgramElement)node).getRelations();
+// if (relations != null) {
+// for (Iterator it = relations.iterator(); it.hasNext(); ) {
+// IRelationship relationNode = (IRelationship)it.next();
+// if (associations.contains(relationNode.toString())) {
+// treeNode.add(buildTree(relationNode, associations));
+// }
+// }
+// }
+// }
if (node != null) {
List children = null;
children = node.getChildren();
if (children != null) {
List childList = new ArrayList();
for (Iterator itt = children.iterator(); itt.hasNext(); ) {
- StructureNode child = (StructureNode)itt.next();
- if (child instanceof ProgramElementNode) {
- ProgramElementNode progNode = (ProgramElementNode)child;
+ IProgramElement child = (IProgramElement)itt.next();
+ if (child instanceof IProgramElement) {
+ IProgramElement progNode = (IProgramElement)child;
if (!progNode.isCode()) {
childList.add(buildTree(child, associations));
}
@@ -366,12 +352,12 @@ public class TreeStructureViewBuilder {
return treeNode;
}
- private StructureViewNode getRelations(RelationNode node) {
+ private StructureViewNode getRelations(IRelationship node) {
//StructureViewNode treeNode = new StructureViewNode(node);
StructureViewNode treeNode = nodeFactory.createNode(node);
- for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ for (Iterator it = node.getTargets().iterator(); it.hasNext(); ) {
treeNode.add(
- nodeFactory.createNode((StructureNode)it.next())
+ nodeFactory.createNode((IProgramElement)it.next())
);
}
return treeNode;
@@ -392,11 +378,11 @@ public class TreeStructureViewBuilder {
private static final Comparator ALPHABETICAL_COMPARATOR = new Comparator() {
public int compare(Object o1, Object o2) {
- StructureNode sv1 = ((StructureViewNode)o1).getStructureNode();
- StructureNode sv2 = ((StructureViewNode)o2).getStructureNode();
- if (sv1 instanceof ProgramElementNode && sv2 instanceof ProgramElementNode) {
- ProgramElementNode p1 = (ProgramElementNode)sv1;
- ProgramElementNode p2 = (ProgramElementNode)sv2;
+ IProgramElement sv1 = ((StructureViewNode)o1).getStructureNode();
+ IProgramElement sv2 = ((StructureViewNode)o2).getStructureNode();
+ if (sv1 instanceof IProgramElement && sv2 instanceof IProgramElement) {
+ IProgramElement p1 = (IProgramElement)sv1;
+ IProgramElement p2 = (IProgramElement)sv2;
return p1.getName().compareTo(p2.getName());
} else {
return 0;
@@ -406,11 +392,11 @@ public class TreeStructureViewBuilder {
private static final Comparator DECLARATIONAL_COMPARATOR = new Comparator() {
public int compare(Object o1, Object o2) {
- StructureNode sv1 = ((StructureViewNode)o1).getStructureNode();
- StructureNode sv2 = ((StructureViewNode)o2).getStructureNode();
- if (sv1 instanceof ProgramElementNode && sv2 instanceof ProgramElementNode) {
- ProgramElementNode p1 = (ProgramElementNode)sv1;
- ProgramElementNode p2 = (ProgramElementNode)sv2;
+ IProgramElement sv1 = ((StructureViewNode)o1).getStructureNode();
+ IProgramElement sv2 = ((StructureViewNode)o2).getStructureNode();
+ if (sv1 instanceof IProgramElement && sv2 instanceof IProgramElement) {
+ IProgramElement p1 = (IProgramElement)sv1;
+ IProgramElement p2 = (IProgramElement)sv2;
if (p1.getSourceLocation() == null) {
return 0;
} else if (p1.getSourceLocation().getLine() < p2.getSourceLocation().getLine()) {
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/AjdeUIManager.java b/ajde/src/org/aspectj/ajde/ui/swing/AjdeUIManager.java
index c2dbd074c..bd1f9d76b 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/AjdeUIManager.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/AjdeUIManager.java
@@ -47,6 +47,28 @@ public class AjdeUIManager {
private Frame rootFrame = null;
private StructureViewPanel fileStructurePanel = null;
+ public void init(
+ EditorAdapter editorAdapter,
+ TaskListManager taskListManager,
+ ProjectPropertiesAdapter projectProperties,
+ UserPreferencesAdapter userPreferencesAdapter,
+ IdeUIAdapter ideUIAdapter,
+ IconRegistry iconRegistry,
+ Frame rootFrame,
+ boolean useFileView) {
+
+ init(editorAdapter,
+ taskListManager,
+ projectProperties,
+ userPreferencesAdapter,
+ ideUIAdapter,
+ iconRegistry,
+ rootFrame,
+ new DefaultBuildProgressMonitor(rootFrame),
+ new AjdeErrorHandler(),
+ useFileView);
+ }
+
/**
* Order of initialization is critical here.
*/
@@ -58,10 +80,10 @@ public class AjdeUIManager {
IdeUIAdapter ideUIAdapter,
IconRegistry iconRegistry,
Frame rootFrame,
+ BuildProgressMonitor progressMonitor,
+ ErrorHandler errorHandler,
boolean useFileView) {
try {
- BuildProgressMonitor compileProgress = new DefaultBuildProgressMonitor(rootFrame);
- ErrorHandler errorHandler = new AjdeErrorHandler();
this.iconRegistry = iconRegistry;
//ConfigurationManager configManager = new LstConfigurationManager();
this.ideUIAdapter = ideUIAdapter;
@@ -72,7 +94,7 @@ public class AjdeUIManager {
Ajde.init(
editorAdapter,
taskListManager,
- compileProgress,
+ progressMonitor,
projectProperties,
buildOptionsAdapter,
new SwingTreeViewNodeFactory(iconRegistry),
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BrowserStructureViewToolPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/BrowserStructureViewToolPanel.java
index 3b69fd7a6..0ab69ae09 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/BrowserStructureViewToolPanel.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/BrowserStructureViewToolPanel.java
@@ -14,29 +14,16 @@
package org.aspectj.ajde.ui.swing;
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
+import java.awt.*;
+import java.awt.event.*;
import java.util.Iterator;
-import javax.swing.ButtonGroup;
-import javax.swing.Icon;
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JRadioButtonMenuItem;
-import javax.swing.JSeparator;
+import javax.swing.*;
import javax.swing.border.Border;
import org.aspectj.ajde.Ajde;
-import org.aspectj.ajde.ui.GlobalStructureView;
-import org.aspectj.ajde.ui.StructureView;
-import org.aspectj.ajde.ui.StructureViewProperties;
-import org.aspectj.asm.ProgramElementNode;
-import org.aspectj.asm.Relation;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.*;
public class BrowserStructureViewToolPanel extends JPanel {
@@ -112,7 +99,7 @@ public class BrowserStructureViewToolPanel extends JPanel {
private JPopupMenu createFilterMenu() {
JPopupMenu filterMenu = new JPopupMenu();
- ProgramElementNode.Accessibility[] accessibility = ProgramElementNode.Accessibility.ALL;
+ IProgramElement.Accessibility[] accessibility = IProgramElement.Accessibility.ALL;
for (int i = 0; i < accessibility.length; i++) {
CheckBoxSelectionMenuButton menuItem = new CheckBoxSelectionMenuButton(accessibility[i]);
menuItem.setIcon(AjdeUIManager.getDefault().getIconRegistry().getAccessibilitySwingIcon(accessibility[i]));
@@ -120,7 +107,7 @@ public class BrowserStructureViewToolPanel extends JPanel {
}
filterMenu.add(new JSeparator());
- ProgramElementNode.Kind[] kinds = ProgramElementNode.Kind.ALL;
+ IProgramElement.Kind[] kinds = IProgramElement.Kind.ALL;
for (int i = 0; i < kinds.length; i++) {
if (kinds[i].isMemberKind()) {
CheckBoxSelectionMenuButton menuItem = new CheckBoxSelectionMenuButton(kinds[i]);
@@ -130,7 +117,7 @@ public class BrowserStructureViewToolPanel extends JPanel {
}
filterMenu.add(new JSeparator());
- ProgramElementNode.Modifiers[] modifiers = ProgramElementNode.Modifiers.ALL;
+ IProgramElement.Modifiers[] modifiers = IProgramElement.Modifiers.ALL;
for (int i = 0; i < modifiers.length; i++) {
CheckBoxSelectionMenuButton menuItem = new CheckBoxSelectionMenuButton(modifiers[i]);
filterMenu.add(menuItem);
@@ -143,7 +130,7 @@ public class BrowserStructureViewToolPanel extends JPanel {
java.util.List relations = Ajde.getDefault().getStructureViewManager().getAvailableRelations();
for (Iterator it = relations.iterator(); it.hasNext(); ) {
- Relation relation = (Relation)it.next();
+ IRelationship.Kind relation = (IRelationship.Kind)it.next();
CheckBoxSelectionMenuButton menuItem = new CheckBoxSelectionMenuButton(relation);
menuItem.setIcon((Icon)AjdeUIManager.getDefault().getIconRegistry().getRelationIcon(relation).getIconResource());
relationsMenu.add(menuItem);
@@ -198,17 +185,17 @@ public class BrowserStructureViewToolPanel extends JPanel {
//super.setSelected(true);
}
- public CheckBoxSelectionMenuButton(ProgramElementNode.Accessibility accessibility) {
+ public CheckBoxSelectionMenuButton(IProgramElement.Accessibility accessibility) {
this(accessibility.toString());
this.addActionListener(new CheckBoxSelectionMenuActionListener(accessibility));
}
- public CheckBoxSelectionMenuButton(ProgramElementNode.Kind kind) {
+ public CheckBoxSelectionMenuButton(IProgramElement.Kind kind) {
this(kind.toString());
this.addActionListener(new CheckBoxSelectionMenuActionListener(kind));
}
- public CheckBoxSelectionMenuButton(ProgramElementNode.Modifiers modifiers) {
+ public CheckBoxSelectionMenuButton(IProgramElement.Modifiers modifiers) {
this(modifiers.toString());
this.addActionListener(new CheckBoxSelectionMenuActionListener(modifiers));
}
@@ -218,7 +205,7 @@ public class BrowserStructureViewToolPanel extends JPanel {
this.addActionListener(new CheckBoxSelectionMenuActionListener(sorting));
}
- public CheckBoxSelectionMenuButton(Relation relation) {
+ public CheckBoxSelectionMenuButton(IRelationship.Kind relation) {
this(relation.toString());
this.addActionListener(new CheckBoxSelectionMenuActionListener(relation));
}
@@ -228,21 +215,21 @@ public class BrowserStructureViewToolPanel extends JPanel {
* Ewwwwww!
*/
private class CheckBoxSelectionMenuActionListener implements ActionListener {
- private ProgramElementNode.Accessibility accessibility = null;
- private ProgramElementNode.Kind kind = null;
- private ProgramElementNode.Modifiers modifiers = null;
+ private IProgramElement.Accessibility accessibility = null;
+ private IProgramElement.Kind kind = null;
+ private IProgramElement.Modifiers modifiers = null;
private StructureViewProperties.Sorting sorting = null;
- private Relation relation = null;
+ private IRelationship.Kind relation = null;
- public CheckBoxSelectionMenuActionListener(ProgramElementNode.Accessibility accessibility) {
+ public CheckBoxSelectionMenuActionListener(IProgramElement.Accessibility accessibility) {
this.accessibility = accessibility;
}
- public CheckBoxSelectionMenuActionListener(ProgramElementNode.Kind kind) {
+ public CheckBoxSelectionMenuActionListener(IProgramElement.Kind kind) {
this.kind = kind;
}
- public CheckBoxSelectionMenuActionListener(ProgramElementNode.Modifiers modifiers) {
+ public CheckBoxSelectionMenuActionListener(IProgramElement.Modifiers modifiers) {
this.modifiers = modifiers;
}
@@ -250,8 +237,8 @@ public class BrowserStructureViewToolPanel extends JPanel {
this.sorting = sorting;
}
- public CheckBoxSelectionMenuActionListener(Relation relation) {
- this.relation = relation;
+ public CheckBoxSelectionMenuActionListener(IRelationship.Kind relationKind) {
+ this.relation = relationKind;
}
public void actionPerformed(ActionEvent e) {
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BrowserView.java b/ajde/src/org/aspectj/ajde/ui/swing/BrowserView.java
index aa1ed12d3..acabee500 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/BrowserView.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/BrowserView.java
@@ -37,7 +37,7 @@ import javax.swing.ListCellRenderer;
import javax.swing.border.Border;
import org.aspectj.ajde.Ajde;
-import org.aspectj.asm.ProgramElementNode;
+import org.aspectj.asm.IProgramElement;
/**
* @author Mik Kersten
@@ -215,7 +215,7 @@ class BrowserView extends JPanel {
joinpointProbe_button_actionPerformed(e);
}
});
- joinpointProbe_button.setIcon(icons.getStructureSwingIcon(ProgramElementNode.Kind.POINTCUT));
+ joinpointProbe_button.setIcon(icons.getStructureSwingIcon(IProgramElement.Kind.POINTCUT));
joinpointProbe_button.setToolTipText("Create joinpoint probe");
joinpointProbe_button.setPreferredSize(new Dimension(20, 20));
joinpointProbe_button.setMinimumSize(new Dimension(20, 20));
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java
index 2e21a3631..7763573d2 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java
@@ -35,7 +35,7 @@ public class BrowserViewManager {
private Stack backHistory = new Stack();
private Stack forwardHistory = new Stack();
- private ProgramElementNode currNode = null;
+ private IProgramElement currNode = null;
private final GlobalStructureView DECLARATION_VIEW;
private final GlobalStructureView CROSSCUTTING_VIEW;
@@ -68,17 +68,19 @@ public class BrowserViewManager {
CROSSCUTTING_VIEW_PROPERTIES = new GlobalViewProperties(StructureViewProperties.Hierarchy.CROSSCUTTING);
INHERITANCE_VIEW_PROPERTIES = new GlobalViewProperties(StructureViewProperties.Hierarchy.INHERITANCE);
- CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.METHOD_RELATION);
- CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.METHOD_CALL_SITE_RELATION);
- CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.CONSTRUCTOR_RELATION);
- CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.CONSTRUCTOR_CALL_SITE_RELATION);
- CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.HANDLER_RELATION);
- CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.INITIALIZER_RELATION);
- CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.FIELD_ACCESS_RELATION);
-
- INHERITANCE_VIEW_PROPERTIES.addRelation(InheritanceAssociation.IMPLEMENTS_RELATION);
- INHERITANCE_VIEW_PROPERTIES.addRelation(InheritanceAssociation.INHERITS_MEMBERS_RELATION);
- INHERITANCE_VIEW_PROPERTIES.addRelation(InheritanceAssociation.INHERITS_RELATION);
+// CROSSCUTTING_VIEW_PROPERTIES.addRelation(IRelationship.Kind.ADVICE);
+// CROSSCUTTING_VIEW_PROPERTIES.addRelation(IRelationship.Kind.ADVICE);
+// CROSSCUTTING_VIEW_PROPERTIES.addRelation(IRelationship.Kind.ADVICE);
+// CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.METHOD_CALL_SITE_RELATION);
+// CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.CONSTRUCTOR_RELATION);
+// CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.CONSTRUCTOR_CALL_SITE_RELATION);
+// CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.HANDLER_RELATION);
+// CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.INITIALIZER_RELATION);
+// CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.FIELD_ACCESS_RELATION);
+//
+// INHERITANCE_VIEW_PROPERTIES.addRelation(InheritanceAssociation.IMPLEMENTS_RELATION);
+// INHERITANCE_VIEW_PROPERTIES.addRelation(InheritanceAssociation.INHERITS_MEMBERS_RELATION);
+// INHERITANCE_VIEW_PROPERTIES.addRelation(InheritanceAssociation.INHERITS_RELATION);
DECLARATION_VIEW_PROPERTIES.setRelations(Ajde.getDefault().getStructureViewManager().getAvailableRelations());
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewTreeListener.java b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewTreeListener.java
index 814d48e04..9dfd6bb50 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewTreeListener.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewTreeListener.java
@@ -14,23 +14,14 @@
package org.aspectj.ajde.ui.swing;
-import java.awt.event.ActionEvent;
-import java.awt.event.InputEvent;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JMenuItem;
-import javax.swing.JPopupMenu;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
+import java.awt.event.*;
+import java.util.*;
+
+import javax.swing.*;
+import javax.swing.event.*;
import javax.swing.tree.TreePath;
-import org.aspectj.asm.LinkNode;
-import org.aspectj.asm.ProgramElementNode;
-import org.aspectj.asm.StructureNode;
+import org.aspectj.asm.IProgramElement;
/**
* @author Mik Kersten
@@ -61,20 +52,21 @@ class BrowserViewTreeListener implements TreeSelectionListener, MouseListener {
public void singleClickNavigation(MouseEvent e) {
SwingTreeViewNode treeNode = (SwingTreeViewNode)tree.getLastSelectedPathComponent();
if (treeNode != null && !e.isControlDown() && !e.isShiftDown() && e.getModifiers() != 4) {
- StructureNode currNode = (StructureNode)treeNode.getUserObject();
- if (currNode instanceof ProgramElementNode && !e.isControlDown()
+ IProgramElement currNode = (IProgramElement)treeNode.getUserObject();
+ if (currNode instanceof IProgramElement && !e.isControlDown()
&& !e.isShiftDown() && e.getModifiers() != 4) {
//AjdeUIManager.getDefault().getViewManager().showNodeInMasterView((ProgramElementNode)currNode);
//if (AjdeUIManager.getDefault().getViewManager().isSplitViewMode()) {
// AjdeUIManager.getDefault().getViewManager().showNodeInSlaveView((ProgramElementNode)currNode);
//}
- } else if (currNode instanceof LinkNode) {
+ }
+// else if (currNode instanceof LinkNode) {
//if (!AjdeUIManager.getDefault().getViewManager().isSplitViewMode()) {
// AjdeUIManager.getDefault().getViewManager().showNodeInMasterView((LinkNode)currNode);
//} else {
// AjdeUIManager.getDefault().getViewManager().showNodeInSlaveView(((LinkNode)currNode).getProgramElementNode());
//}
- }
+// }
}
}
@@ -82,18 +74,19 @@ class BrowserViewTreeListener implements TreeSelectionListener, MouseListener {
int clickCount = e.getClickCount();
SwingTreeViewNode treeNode = (SwingTreeViewNode)tree.getLastSelectedPathComponent();
if (treeNode != null) {
- StructureNode currNode = (StructureNode)treeNode.getUserObject();
- if (currNode instanceof ProgramElementNode && !e.isControlDown() && !e.isShiftDown()
+ IProgramElement currNode = (IProgramElement)treeNode.getUserObject();
+ if (currNode instanceof IProgramElement && !e.isControlDown() && !e.isShiftDown()
&& e.getModifiers() != 4) {
//AjdeUIManager.getDefault().getViewManager().showNodeInMasterView(((LinkNode)currNode).getProgramElementNode());
//AjdeUIManager.getDefault().getViewManager().showNodeInSlaveView(((LinkNode)currNode).getProgramElementNode());
- } else if (currNode instanceof LinkNode) {
- if (clickCount == 1) {
- //AjdeUIManager.getDefault().getViewManager().showLink((LinkNode)currNode);
- } else if (clickCount == 2) {
- //navigationAction((ProgramElementNode)((LinkNode)currNode).getProgramElementNode(), true, true);
- }
- }
+ }
+// else if (currNode instanceof LinkNode) {
+// if (clickCount == 1) {
+// //AjdeUIManager.getDefault().getViewManager().showLink((LinkNode)currNode);
+// } else if (clickCount == 2) {
+// //navigationAction((ProgramElementNode)((LinkNode)currNode).getProgramElementNode(), true, true);
+// }
+// }
}
}
@@ -107,14 +100,14 @@ class BrowserViewTreeListener implements TreeSelectionListener, MouseListener {
TreePath[] selectionPaths = tree.getSelectionPaths();
final List signatures = new ArrayList();
for (int i = 0; i < selectionPaths.length; i++) {
- StructureNode currNode = (StructureNode)((SwingTreeViewNode)selectionPaths[i].getLastPathComponent()).getUserObject();
- if (currNode instanceof LinkNode || currNode instanceof ProgramElementNode) {
- signatures.add(currNode);
- }
+ IProgramElement currNode = (IProgramElement)((SwingTreeViewNode)selectionPaths[i].getLastPathComponent()).getUserObject();
+// if (currNode instanceof LinkNode || currNode instanceof IProgramElement) {
+// signatures.add(currNode);
+// }
}
JPopupMenu popup = new JPopupMenu();
- JMenuItem showSourcesItem = new JMenuItem("Display sources", AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.CODE));
+ JMenuItem showSourcesItem = new JMenuItem("Display sources", AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.CODE));
showSourcesItem.setFont(new java.awt.Font("Dialog", 0, 11));
showSourcesItem.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
@@ -123,11 +116,11 @@ class BrowserViewTreeListener implements TreeSelectionListener, MouseListener {
// public void showSourcesNodes(java.util.List nodes) {
// for (Iterator it = nodes.iterator(); it.hasNext(); ) {
// ProgramElementNode currNode = null;
-// StructureNode structureNode = (StructureNode)it.next();
-// if (structureNode instanceof LinkNode) {
-// currNode = ((LinkNode)structureNode).getProgramElementNode();
+// IProgramElement IProgramElement = (IProgramElement)it.next();
+// if (IProgramElement instanceof LinkNode) {
+// currNode = ((LinkNode)IProgramElement).getProgramElementNode();
// } else {
-// currNode = (ProgramElementNode)structureNode;
+// currNode = (ProgramElementNode)IProgramElement;
// }
// ISourceLocation sourceLoc = currNode.getSourceLocation();
// if (null != sourceLoc) {
@@ -143,7 +136,7 @@ class BrowserViewTreeListener implements TreeSelectionListener, MouseListener {
popup.add(showSourcesItem);
popup.addSeparator();
- JMenuItem generatePCD = new JMenuItem("Pointcut Wizard (alpha)...", AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.POINTCUT));
+ JMenuItem generatePCD = new JMenuItem("Pointcut Wizard (alpha)...", AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.POINTCUT));
generatePCD.setFont(new java.awt.Font("Dialog", 0, 11));
generatePCD.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java b/ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java
index 6ad79052a..ebb9319ef 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java
@@ -24,7 +24,7 @@ import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import org.aspectj.ajde.Ajde;
-import org.aspectj.asm.ProgramElementNode;
+import org.aspectj.asm.IProgramElement;
public class BuildConfigPopupMenu extends JPopupMenu {
@@ -47,7 +47,7 @@ public class BuildConfigPopupMenu extends JPopupMenu {
action.actionPerformed(e);
}
});
- buildItem.setIcon((Icon)AjdeUIManager.getDefault().getIconRegistry().getStructureIcon(ProgramElementNode.Kind.FILE_LST).getIconResource());
+ buildItem.setIcon((Icon)AjdeUIManager.getDefault().getIconRegistry().getStructureIcon(IProgramElement.Kind.FILE_LST).getIconResource());
this.add(buildItem);
}
}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java b/ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java
index 875ba9ed1..decccab65 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java
@@ -14,13 +14,11 @@
package org.aspectj.ajde.ui.swing;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
+import javax.swing.*;
-import org.aspectj.ajde.ui.AbstractIcon;
-import org.aspectj.ajde.ui.AbstractIconRegistry;
-import org.aspectj.asm.ProgramElementNode;
-import org.aspectj.asm.Relation;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.*;
+import org.aspectj.asm.IProgramElement;
/**
* Default icons. Override behavior for custom icons.
@@ -110,32 +108,32 @@ public class IconRegistry extends AbstractIconRegistry {
public Icon getMergeStructureViewIcon() { return MERGE_STRUCTURE_VIEW; }
public Icon getStructureViewIcon() { return STRUCTURE_VIEW; }
- public Icon getAssociationSwingIcon(Relation relation) {
+ public Icon getAssociationSwingIcon(IRelationship.Kind relation) {
return convertToSwingIcon(getRelationIcon(relation));
}
- protected AbstractIcon getStructureIcon(ProgramElementNode.Kind kind, ProgramElementNode.Accessibility accessibility) {
+ protected AbstractIcon getStructureIcon(IProgramElement.Kind kind, IProgramElement.Accessibility accessibility) {
return getStructureIcon(kind);
}
- public Icon getStructureSwingIcon(ProgramElementNode.Kind kind, ProgramElementNode.Accessibility accessibility) {
+ public Icon getStructureSwingIcon(IProgramElement.Kind kind, IProgramElement.Accessibility accessibility) {
return convertToSwingIcon(getStructureIcon(kind, accessibility));
}
- public Icon getStructureSwingIcon(ProgramElementNode.Kind kind) {
+ public Icon getStructureSwingIcon(IProgramElement.Kind kind) {
return convertToSwingIcon(getStructureIcon(kind));
}
- public Icon getAccessibilitySwingIcon(ProgramElementNode.Accessibility accessibility) {
- if (accessibility == ProgramElementNode.Accessibility.PUBLIC) {
+ public Icon getAccessibilitySwingIcon(IProgramElement.Accessibility accessibility) {
+ if (accessibility == IProgramElement.Accessibility.PUBLIC) {
return ACCESSIBILITY_PUBLIC;
- } else if (accessibility == ProgramElementNode.Accessibility.PACKAGE) {
+ } else if (accessibility == IProgramElement.Accessibility.PACKAGE) {
return ACCESSIBILITY_PACKAGE;
- } else if (accessibility == ProgramElementNode.Accessibility.PROTECTED) {
+ } else if (accessibility == IProgramElement.Accessibility.PROTECTED) {
return ACCESSIBILITY_PROTECTED;
- } else if (accessibility == ProgramElementNode.Accessibility.PRIVATE) {
+ } else if (accessibility == IProgramElement.Accessibility.PRIVATE) {
return ACCESSIBILITY_PRIVATE;
- } else if (accessibility == ProgramElementNode.Accessibility.PRIVILEGED) {
+ } else if (accessibility == IProgramElement.Accessibility.PRIVILEGED) {
return ACCESSIBILITY_PRIVILEGED;
} else {
return null;
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/PointcutWizard.java b/ajde/src/org/aspectj/ajde/ui/swing/PointcutWizard.java
index 045f361a3..bfd469a6d 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/PointcutWizard.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/PointcutWizard.java
@@ -21,7 +21,7 @@ import java.util.*;
import javax.swing.*;
import org.aspectj.ajde.ui.*;
-import org.aspectj.asm.InheritanceAssociation;
+import org.aspectj.asm.IRelationship;
/**
* @author Mik Kersten
@@ -69,7 +69,7 @@ class PointcutWizard extends JFrame {
private Map getViewProperties() {
Map views = new HashMap();
GlobalViewProperties INHERITANCE_VIEW = new GlobalViewProperties(StructureViewProperties.Hierarchy.INHERITANCE);
- INHERITANCE_VIEW.addRelation(InheritanceAssociation.INHERITS_RELATION);
+ 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 4ec5e8ff0..afdf6ba52 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java
@@ -32,9 +32,9 @@ import javax.swing.border.Border;
import org.aspectj.ajde.Ajde;
import org.aspectj.ajde.ui.StructureView;
import org.aspectj.ajde.ui.StructureViewProperties;
-import org.aspectj.asm.ProgramElementNode;
+import org.aspectj.asm.IProgramElement;
import org.aspectj.asm.StructureModel;
-import org.aspectj.asm.StructureModelListener;
+import org.aspectj.asm.IStructureModelListener;
public class SimpleStructureViewToolPanel extends JPanel {
@@ -60,7 +60,7 @@ public class SimpleStructureViewToolPanel extends JPanel {
BorderLayout borderLayout3 = new BorderLayout();
BorderLayout borderLayout4 = new BorderLayout();
- public final StructureModelListener MODEL_LISTENER = new StructureModelListener() {
+ public final IStructureModelListener MODEL_LISTENER = new IStructureModelListener() {
public void modelUpdated(StructureModel model) {
String path = Ajde.getDefault().getConfigurationManager().getActiveConfigFile();
String fileName = "<no active config>";
@@ -218,7 +218,7 @@ public class SimpleStructureViewToolPanel extends JPanel {
hideNonAJ_button.setBorder(AjdeWidgetStyles.LOWERED_BEVEL_BORDER);
hideNonAJEnabled = true;
currentView.getViewProperties().setFilteredMemberKinds(
- ProgramElementNode.Kind.getNonAJMemberKinds()
+ IProgramElement.Kind.getNonAJMemberKinds()
);
}
Ajde.getDefault().getStructureViewManager().refreshView(currentView);
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/StructureTreeManager.java b/ajde/src/org/aspectj/ajde/ui/swing/StructureTreeManager.java
index 1ab612a80..29871bf8d 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/StructureTreeManager.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/StructureTreeManager.java
@@ -19,21 +19,11 @@ import java.util.ArrayList;
import javax.swing.SwingUtilities;
import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreeNode;
-import javax.swing.tree.TreePath;
+import javax.swing.tree.*;
import org.aspectj.ajde.Ajde;
-import org.aspectj.ajde.ui.AbstractIcon;
-import org.aspectj.ajde.ui.GlobalStructureView;
-import org.aspectj.ajde.ui.StructureView;
-import org.aspectj.ajde.ui.StructureViewProperties;
-import org.aspectj.asm.ProgramElementNode;
-import org.aspectj.asm.RelationNode;
-import org.aspectj.asm.StructureModel;
-import org.aspectj.asm.StructureNode;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.*;
/**
* @author Mik Kersten
@@ -64,24 +54,24 @@ class StructureTreeManager {
structureTree.addMouseListener((MouseListener)treeListener);
}
- public void highlightNode(ProgramElementNode node) {
+ public void highlightNode(IProgramElement node) {
highlightNode((SwingTreeViewNode)structureTree.getModel().getRoot(), node);
}
- public StructureNode getSelectedStructureNode() {
- return (StructureNode)((SwingTreeViewNode)structureTree.getLastSelectedPathComponent()).getUserObject();
+ public IProgramElement getSelectedIProgramElement() {
+ return (IProgramElement)((SwingTreeViewNode)structureTree.getLastSelectedPathComponent()).getUserObject();
}
public void scrollToHighlightedNode() {
structureTree.scrollPathToVisible(structureTree.getSelectionPath());
}
- private void highlightNode(SwingTreeViewNode parent, ProgramElementNode node) {
+ private void highlightNode(SwingTreeViewNode parent, IProgramElement node) {
for (int i = 0; i < parent.getChildCount(); i++) {
SwingTreeViewNode currNode = (SwingTreeViewNode)parent.getChildAt(i);
- StructureNode sNode = (StructureNode)currNode.getUserObject();
- if (sNode instanceof ProgramElementNode &&
- ((ProgramElementNode)sNode).equals(node)) {
+ IProgramElement sNode = (IProgramElement)currNode.getUserObject();
+ if (sNode instanceof IProgramElement &&
+ ((IProgramElement)sNode).equals(node)) {
TreePath path = new TreePath(currNode.getPath());
structureTree.setSelectionPath(path);
int currRow = structureTree.getRowForPath(path);
@@ -146,11 +136,11 @@ class StructureTreeManager {
for (int i = 0; i < structureTree.getRowCount(); i++) {
TreePath path = structureTree.getPathForRow(i);
SwingTreeViewNode node = (SwingTreeViewNode)path.getLastPathComponent();
- if (node.getUserObject() instanceof ProgramElementNode) {
- ProgramElementNode pNode = (ProgramElementNode)node.getUserObject();
- ProgramElementNode.Kind kind = pNode.getProgramElementKind();
- if (kind == ProgramElementNode.Kind.PROJECT
- || kind == ProgramElementNode.Kind.PACKAGE) {
+ if (node.getUserObject() instanceof IProgramElement) {
+ IProgramElement pNode = (IProgramElement)node.getUserObject();
+ IProgramElement.Kind kind = pNode.getKind();
+ if (kind == IProgramElement.Kind.PROJECT
+ || kind == IProgramElement.Kind.PACKAGE) {
structureTree.expandPath(path);
} else {
structureTree.collapsePath(path);
@@ -166,7 +156,7 @@ class StructureTreeManager {
for (int i = 0; i < structureTree.getRowCount(); i++) {
TreePath path = structureTree.getPathForRow(i);
SwingTreeViewNode node = (SwingTreeViewNode)path.getLastPathComponent();
- if (path.getPath().length-1 > depth || node.getUserObject() instanceof RelationNode) {
+ if (path.getPath().length-1 > depth || node.getUserObject() instanceof IRelationship) {
structureTree.collapsePath(path);
} else {
structureTree.expandPath(path);
@@ -371,7 +361,7 @@ class StructureTreeManager {
// }
// public ProgramElementNode getRootProgramElementNode() {
-// StructureNode node = (StructureNode)((SwingTreeViewNode)structureTree.getModel().getRoot()).getUserObject();
+// IProgramElement node = (IProgramElement)((SwingTreeViewNode)structureTree.getModel().getRoot()).getUserObject();
// if (node instanceof ProgramElementNode) {
// return (ProgramElementNode)node;
// } else {
@@ -383,7 +373,7 @@ class StructureTreeManager {
// * @todo HACK: this is a workaround and can break
// */
// private static ProgramElementNode mapResult = null;
-// private ProgramElementNode getNodeForLink(LinkNode node, StructureNode rootNode) {
+// private ProgramElementNode getNodeForLink(LinkNode node, IProgramElement rootNode) {
// ProgramElementNode result = null;
// if (rootNode instanceof ProgramElementNode &&
// ((ProgramElementNode)rootNode).getName().equals(node.getProgramElementNode().getName())) {
@@ -391,7 +381,7 @@ class StructureTreeManager {
// } else {
// ProgramElementNode linkedNode = node.getProgramElementNode();
// for (Iterator it = rootNode.getChildren().iterator(); it.hasNext(); ) {
-// StructureNode child = (StructureNode)it.next();
+// IProgramElement child = (IProgramElement)it.next();
// getNodeForLink(node, child);
// }
// }
@@ -400,14 +390,14 @@ class StructureTreeManager {
// private void sortNodes(List nodes) {
// if (sortNodes) {
-// Collections.sort(nodes, structureNodeComparator);
+// Collections.sort(nodes, IProgramElementComparator);
// }
// }
-// private class StructureNodeComparator implements Comparator {
+// private class IProgramElementComparator implements Comparator {
// public int compare(Object o1, Object o2) {
-// StructureNode t1 = (StructureNode) ((SwingTreeViewNode) o1).getUserObject();
-// StructureNode t2 = (StructureNode) ((SwingTreeViewNode) o2).getUserObject();
+// IProgramElement t1 = (IProgramElement) ((SwingTreeViewNode) o1).getUserObject();
+// IProgramElement t2 = (IProgramElement) ((SwingTreeViewNode) o2).getUserObject();
// if (t1 instanceof ProgramElementNode && t2 instanceof ProgramElementNode) {
// ProgramElementNode p1 = (ProgramElementNode) t1;
// ProgramElementNode p2 = (ProgramElementNode) t2;
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/StructureViewPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/StructureViewPanel.java
index 89ece89e3..ed93d0706 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/StructureViewPanel.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/StructureViewPanel.java
@@ -14,23 +14,15 @@
package org.aspectj.ajde.ui.swing;
-import java.awt.BorderLayout;
-import java.awt.Color;
+import java.awt.*;
import java.util.Iterator;
-import javax.swing.BorderFactory;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.border.BevelBorder;
-import javax.swing.border.Border;
+import javax.swing.*;
+import javax.swing.border.*;
import org.aspectj.ajde.Ajde;
-import org.aspectj.ajde.ui.FileStructureView;
-import org.aspectj.ajde.ui.StructureView;
-import org.aspectj.ajde.ui.StructureViewNode;
-import org.aspectj.ajde.ui.StructureViewRenderer;
-import org.aspectj.asm.ProgramElementNode;
-import org.aspectj.asm.StructureNode;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.IProgramElement;
/**
* Represents the configuration of a structure view of the system, rendered
@@ -98,8 +90,8 @@ public class StructureViewPanel extends JPanel implements StructureViewRenderer
public void setActiveNode(StructureViewNode node, int lineOffset) {
if (node == null) return;
- if (!(node.getStructureNode() instanceof ProgramElementNode)) return;
- ProgramElementNode pNode = (ProgramElementNode)node.getStructureNode();
+ if (!(node.getStructureNode() instanceof IProgramElement)) return;
+ IProgramElement pNode = (IProgramElement)node.getStructureNode();
treeManager.highlightNode(pNode);
if (pNode.getSourceLocation() != null) {
Ajde.getDefault().getEditorAdapter().showSourceLine(
@@ -112,9 +104,9 @@ public class StructureViewPanel extends JPanel implements StructureViewRenderer
public void highlightActiveNode() {
if (currentView.getActiveNode() == null) return;
- StructureNode node = currentView.getActiveNode().getStructureNode();
- if (node instanceof ProgramElementNode) {
- treeManager.highlightNode((ProgramElementNode)node);
+ IProgramElement node = currentView.getActiveNode().getStructureNode();
+ if (node instanceof IProgramElement) {
+ treeManager.highlightNode((IProgramElement)node);
}
}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNode.java b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNode.java
index 75810c575..e1ca0bd75 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNode.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNode.java
@@ -14,27 +14,24 @@
package org.aspectj.ajde.ui.swing;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
import javax.swing.tree.DefaultMutableTreeNode;
-import org.aspectj.ajde.ui.AbstractIcon;
-import org.aspectj.ajde.ui.StructureViewNode;
-import org.aspectj.asm.StructureNode;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.*;
/**
* @author Mik Kersten
*/
public class SwingTreeViewNode extends DefaultMutableTreeNode implements StructureViewNode {
- private StructureNode structureNode;
+ private IProgramElement programElement;
private AbstractIcon icon;
- public SwingTreeViewNode(StructureNode structureNode, AbstractIcon icon, List children) {
- super(structureNode, true);
- this.structureNode = structureNode;
+ public SwingTreeViewNode(IProgramElement programElement, AbstractIcon icon, List children) {
+ super(programElement, true);
+ this.programElement = programElement;
this.icon = icon;
if (children != null) {
@@ -43,9 +40,22 @@ public class SwingTreeViewNode extends DefaultMutableTreeNode implements Structu
}
}
}
+
+ public SwingTreeViewNode(IRelationship relationship, AbstractIcon icon) {
+// super(IProgramElement, true);
+ throw new RuntimeException("unimplemented");
+// this.IProgramElement = IProgramElement;
+// this.icon = icon;
+//
+// if (children != null) {
+// for (Iterator it = children.iterator(); it.hasNext(); ) {
+// super.add((SwingTreeViewNode)it.next());
+// }
+// }
+ }
- public StructureNode getStructureNode() {
- return structureNode;
+ public IProgramElement getStructureNode() {
+ return programElement;
}
public AbstractIcon getIcon() {
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeFactory.java b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeFactory.java
index 440e2341f..9c45432d2 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeFactory.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeFactory.java
@@ -16,10 +16,9 @@ package org.aspectj.ajde.ui.swing;
import java.util.List;
-import org.aspectj.ajde.ui.AbstractIcon;
-import org.aspectj.ajde.ui.StructureViewNode;
-import org.aspectj.ajde.ui.StructureViewNodeFactory;
-import org.aspectj.asm.StructureNode;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.*;
+import org.aspectj.asm.IProgramElement;
/**
* @author Mik Kersten
@@ -30,7 +29,14 @@ public class SwingTreeViewNodeFactory extends StructureViewNodeFactory {
super(iconRegistry);
}
- protected StructureViewNode createConcreteNode(StructureNode node, AbstractIcon icon, List children) {
+ protected StructureViewNode createConcreteNode(IProgramElement node, AbstractIcon icon, List children) {
return new SwingTreeViewNode(node, icon, children);
}
+
+ protected StructureViewNode createConcreteNode(
+ IRelationship relationship,
+ AbstractIcon icon) {
+ return new SwingTreeViewNode(relationship, icon);
+ }
+
}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java
index a2ba8a601..019c96361 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java
@@ -14,20 +14,13 @@
package org.aspectj.ajde.ui.swing;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Font;
+import java.awt.*;
-import javax.swing.Icon;
-import javax.swing.JTree;
+import javax.swing.*;
import javax.swing.tree.DefaultTreeCellRenderer;
-import org.aspectj.asm.LinkNode;
-import org.aspectj.asm.ProgramElementNode;
-import org.aspectj.asm.RelationNode;
-import org.aspectj.asm.StructureNode;
-import org.aspectj.bridge.IMessage;
-import org.aspectj.bridge.ISourceLocation;
+import org.aspectj.asm.*;
+import org.aspectj.bridge.*;
/**
* @author Mik Kersten
@@ -43,19 +36,19 @@ class SwingTreeViewNodeRenderer extends DefaultTreeCellRenderer {
boolean hasFocus) {
if (treeNode == null) return null;
SwingTreeViewNode viewNode = (SwingTreeViewNode)treeNode;
- StructureNode node = viewNode.getStructureNode();
+ IProgramElement node = viewNode.getStructureNode();
- if (node instanceof LinkNode) {
- ISourceLocation sourceLoc = ((LinkNode)node).getProgramElementNode().getSourceLocation();
- if ((null != sourceLoc)
- && (null != sourceLoc.getSourceFile().getAbsolutePath())) {
- setTextNonSelectionColor(AjdeWidgetStyles.LINK_NODE_COLOR);
- } else {
- setTextNonSelectionColor(AjdeWidgetStyles.LINK_NODE_NO_SOURCE_COLOR);
- }
- } else {
+// if (node instanceof LinkNode) {
+// ISourceLocation sourceLoc = ((LinkNode)node).getProgramElementNode().getSourceLocation();
+// if ((null != sourceLoc)
+// && (null != sourceLoc.getSourceFile().getAbsolutePath())) {
+// setTextNonSelectionColor(AjdeWidgetStyles.LINK_NODE_COLOR);
+// } else {
+// setTextNonSelectionColor(AjdeWidgetStyles.LINK_NODE_NO_SOURCE_COLOR);
+// }
+// } else {
setTextNonSelectionColor(new Color(0, 0, 0));
- }
+// }
super.getTreeCellRendererComponent(tree, treeNode, sel, expanded, leaf, row, hasFocus);
this.setFont(StructureTree.DEFAULT_FONT);
@@ -66,29 +59,30 @@ class SwingTreeViewNodeRenderer extends DefaultTreeCellRenderer {
setIcon(null);
}
- if (node instanceof ProgramElementNode) {
- ProgramElementNode pNode = (ProgramElementNode)node;
- if (pNode.isRunnable()) {
- //setIcon(AjdeUIManager.getDefault().getIconRegistry().getExecuteIcon());
- }
- if (pNode.isImplementor()) {
- //this.setText("<implementor>");
- }
- if (pNode.isOverrider()) {
- //this.setText("<overrider>");
- }
- } else if (node instanceof RelationNode) {
- this.setFont(new Font(this.getFont().getName(), Font.ITALIC, this.getFont().getSize()));
- }
+ if (node instanceof IProgramElement) {
+ IProgramElement pNode = (IProgramElement)node;
+// if (pNode.isRunnable()) {
+// //setIcon(AjdeUIManager.getDefault().getIconRegistry().getExecuteIcon());
+// }
+// if (pNode.isImplementor()) {
+// //this.setText("<implementor>");
+// }
+// if (pNode.isOverrider()) {
+// //this.setText("<overrider>");
+// }
+
+ if (node.getMessage() != null) {
+ if (node.getMessage().getKind().equals(IMessage.WARNING)) {
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getWarningIcon());
+ } else if (node.getMessage().getKind().equals(IMessage.ERROR)) {
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getErrorIcon());
+ } else {
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getInfoIcon());
+ }
+ }
- if (node.getMessage() != null) {
- if (node.getMessage().getKind().equals(IMessage.WARNING)) {
- setIcon(AjdeUIManager.getDefault().getIconRegistry().getWarningIcon());
- } else if (node.getMessage().getKind().equals(IMessage.ERROR)) {
- setIcon(AjdeUIManager.getDefault().getIconRegistry().getErrorIcon());
- } else {
- setIcon(AjdeUIManager.getDefault().getIconRegistry().getInfoIcon());
- }
+ } else if (node instanceof IRelationship) {
+ this.setFont(new Font(this.getFont().getName(), Font.ITALIC, this.getFont().getSize()));
}
return this;
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/TreeViewBuildConfigEditor.java b/ajde/src/org/aspectj/ajde/ui/swing/TreeViewBuildConfigEditor.java
index 0b0eb19db..13b65d4b0 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/TreeViewBuildConfigEditor.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/TreeViewBuildConfigEditor.java
@@ -46,7 +46,7 @@ import org.aspectj.ajde.ui.BuildConfigEditor;
import org.aspectj.ajde.ui.BuildConfigModel;
import org.aspectj.ajde.ui.BuildConfigNode;
import org.aspectj.ajde.ui.InvalidResourceException;
-import org.aspectj.asm.ProgramElementNode;
+import org.aspectj.asm.IProgramElement;
/**
* UI for editing build configuration (".lst") files via a graphical tree-based
* representation.
@@ -246,15 +246,15 @@ public class TreeViewBuildConfigEditor extends JPanel implements BuildConfigEdit
//}
BuildConfigNode.Kind kind = ctn.getModelNode().getBuildConfigNodeKind();
if (kind.equals(BuildConfigNode.Kind.FILE_ASPECTJ)) {
- setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.FILE_ASPECTJ));
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.FILE_ASPECTJ));
} else if (kind.equals(BuildConfigNode.Kind.FILE_JAVA)) {
- setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.FILE_JAVA));
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.FILE_JAVA));
} else if (kind.equals(BuildConfigNode.Kind.FILE_LST)) {
- setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.FILE_LST));
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.FILE_LST));
} else if (kind.equals(BuildConfigNode.Kind.DIRECTORY)) {
- setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.PACKAGE));
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.PACKAGE));
} else {
- setIcon((Icon)AjdeUIManager.getDefault().getIconRegistry().getStructureIcon(ProgramElementNode.Kind.ERROR).getIconResource());
+ setIcon((Icon)AjdeUIManager.getDefault().getIconRegistry().getStructureIcon(IProgramElement.Kind.ERROR).getIconResource());
p.remove(cbox);
}