From 466cb82c3ba6cf23e28bb8b8e8da0e54a90486b2 Mon Sep 17 00:00:00 2001 From: mkersten Date: Sat, 16 Aug 2003 03:14:17 +0000 Subject: [PATCH] Added declare error/warning relationships to model. --- .../org/aspectj/ajde/ui/StructureView.java | 9 ++--- .../aspectj/ajde/ui/StructureViewManager.java | 35 ++----------------- .../ui/internal/TreeStructureViewBuilder.java | 4 +-- .../ui/swing/StructureViewTreeListener.java | 4 ++- 4 files changed, 13 insertions(+), 39 deletions(-) diff --git a/ajde/src/org/aspectj/ajde/ui/StructureView.java b/ajde/src/org/aspectj/ajde/ui/StructureView.java index 6086e5748..7fb9baae6 100644 --- a/ajde/src/org/aspectj/ajde/ui/StructureView.java +++ b/ajde/src/org/aspectj/ajde/ui/StructureView.java @@ -73,12 +73,13 @@ public abstract class StructureView { return findCorrespondingViewNodeHelper(rootNode, node); } - private IStructureViewNode findCorrespondingViewNodeHelper(IStructureViewNode node, IProgramElement pNode) { - + private IStructureViewNode findCorrespondingViewNodeHelper(IStructureViewNode node, IProgramElement pNode) { if (node != null && node.getStructureNode() != null - && node.getStructureNode().equals(pNode)) { - return node; + && node.getStructureNode().equals(pNode) + && node.getKind() == IStructureViewNode.Kind.DECLARATION) { + + return node; } if (node != null && node.getChildren() != null) { diff --git a/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java b/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java index b2fe1224f..69113a331 100644 --- a/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java +++ b/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java @@ -39,10 +39,6 @@ public class StructureViewManager { public final IHierarchyListener VIEW_LISTENER = new IHierarchyListener() { public void elementsUpdated(IHierarchy model) { Ajde.getDefault().logEvent("updating structure views: " + structureViews); -// -// if (defaultFileView != null) { -// defaultFileView.setSourceFile(Ajde.getDefault().getEditorManager().getCurrFile()); -// } for (Iterator it = structureViews.iterator(); it.hasNext(); ) { treeViewBuilder.buildView((StructureView)it.next(), (AspectJElementHierarchy)model); @@ -97,17 +93,8 @@ public class StructureViewManager { /** * History is recorded for {@link LinkNode} navigations. */ - public void fireNavigationAction(IProgramElement IProgramElement) { - IProgramElement node = null; - boolean recordHistory = false; -// if (IProgramElement instanceof LinkNode) { -// node = ((LinkNode)IProgramElement).getProgramElementNode(); -// recordHistory = true; -// } else - if (IProgramElement instanceof IProgramElement) { - node = (IProgramElement)IProgramElement; - } - if (node != null) navigationAction(node, recordHistory); + public void fireNavigationAction(IProgramElement pe, boolean isLink) { + navigationAction(pe, isLink); } /** @@ -116,11 +103,7 @@ public class StructureViewManager { * along with the corresponding sourceline. */ private void navigationAction(IProgramElement node, boolean recordHistory) { - if (node == null - || node == IHierarchy.NO_STRUCTURE) { - Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("Source not available for node: " + node.getName()); - return; - } + if (node == null) return; Ajde.getDefault().logEvent("navigating to node: " + node + ", recordHistory: " + recordHistory); if (recordHistory) historyModel.navigateToNode(node); if (defaultFileView != null && node.getSourceLocation() != null) { @@ -150,16 +133,6 @@ public class StructureViewManager { } } - private IProgramElement getProgramElementNode(IStructureViewNode node) { - if (node.getStructureNode() instanceof IProgramElement) { - return (IProgramElement)node.getStructureNode(); -// } else if (node.getStructureNode() instanceof LinkNode) { -// return ((LinkNode)node.getStructureNode()).getProgramElementNode(); - } else { - return null; - } - } - public void refreshView(StructureView view) { IStructureViewNode activeNode = view.getActiveNode(); treeViewBuilder.buildView(view, Ajde.getDefault().getStructureModelManager().getHierarchy()); @@ -220,8 +193,6 @@ public class StructureViewManager { AVAILABLE_RELATIONS = new ArrayList(); AVAILABLE_RELATIONS.add(IRelationship.Kind.ADVICE); AVAILABLE_RELATIONS.add(IRelationship.Kind.DECLARE); -// AVAILABLE_RELATIONS.add(IRelationship.Kind.INHERITANCE); -// AVAILABLE_RELATIONS.add(IRelationship.Kind.REFERENCE); DEFAULT_VIEW_PROPERTIES = new StructureViewProperties(); DEFAULT_VIEW_PROPERTIES.setRelations(AVAILABLE_RELATIONS); diff --git a/ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java b/ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java index ecf8ed5ae..fe1d31bc0 100644 --- a/ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java +++ b/ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java @@ -337,9 +337,9 @@ public class TreeStructureViewBuilder { IProgramElement child = (IProgramElement)itt.next(); if (child instanceof IProgramElement) { IProgramElement progNode = (IProgramElement)child; - if (progNode.getKind() != IProgramElement.Kind.CODE) { +// if (progNode.getKind() != IProgramElement.Kind.CODE) { childList.add(buildTree(child, associations)); - } +// } } else { childList.add(buildTree(child, associations)); } diff --git a/ajde/src/org/aspectj/ajde/ui/swing/StructureViewTreeListener.java b/ajde/src/org/aspectj/ajde/ui/swing/StructureViewTreeListener.java index 749aa570c..67df659ea 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/StructureViewTreeListener.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/StructureViewTreeListener.java @@ -21,6 +21,7 @@ import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import org.aspectj.ajde.Ajde; +import org.aspectj.ajde.ui.IStructureViewNode; /** * @author Mik Kersten @@ -54,7 +55,8 @@ class StructureViewTreeListener implements TreeSelectionListener, MouseListener //if (e.getClickCount() == 2) { Ajde.getDefault().getStructureViewManager().fireNavigationAction( - treeNode.getStructureNode() + treeNode.getStructureNode(), + treeNode.getKind() == IStructureViewNode.Kind.LINK ); //} } -- 2.39.5