]> source.dussan.org Git - aspectj.git/commitdiff
Added declare error/warning relationships to model.
authormkersten <mkersten>
Sat, 16 Aug 2003 03:14:17 +0000 (03:14 +0000)
committermkersten <mkersten>
Sat, 16 Aug 2003 03:14:17 +0000 (03:14 +0000)
ajde/src/org/aspectj/ajde/ui/StructureView.java
ajde/src/org/aspectj/ajde/ui/StructureViewManager.java
ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java
ajde/src/org/aspectj/ajde/ui/swing/StructureViewTreeListener.java

index 6086e5748a7954f1ea64a7ca25147c33fd74c7cc..7fb9baae6778d4309fe17b1fe98400fa5edd6151 100644 (file)
@@ -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) {
index b2fe1224ff8cb8a38e88821ce0fd167932d3ccac..69113a3310c1737d86a3dfff74f9587b8342ab83 100644 (file)
@@ -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);
index ecf8ed5ae811266db952f83b778a01eeb1e36a57..fe1d31bc02ae95ef510c1313b9d3f04e50b97003 100644 (file)
@@ -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));
                     }
index 749aa570cb7b55020cc4ab35828670f808872be9..67df659eae7aaf054f4a80f8936e9c0fe986f9bf 100644 (file)
@@ -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
                );
                //}
     }