KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > ajde > ui > swing > BrowserViewManager


1 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  *
3  * This file is part of the IDE support for the AspectJ(tm)
4  * programming language; see http://aspectj.org
5  *
6  * The contents of this file are subject to the Mozilla Public License
7  * Version 1.1 (the "License"); you may not use this file except in
8  * compliance with the License. You may obtain a copy of the License at
9  * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the
14  * License.
15  *
16  * The Original Code is AspectJ.
17  *
18  * The Initial Developer of the Original Code is Xerox Corporation. Portions
19  * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
20  * All Rights Reserved.
21  *
22  * Contributor(s):
23  */

24
25 package org.aspectj.ajde.ui.swing;
26
27 import java.util.*;
28 import javax.swing.*;
29 import java.awt.*;
30 import java.awt.event.*;
31 import org.aspectj.asm.*;
32 import org.aspectj.asm.associations.*;
33 import org.aspectj.asm.views.*;
34 import org.aspectj.ajde.*;
35 import org.aspectj.ajde.internal.*;
36 import org.aspectj.ajde.ui.*;
37
38 /**
39  * Responsible for displaying and controlling the configuration and output of a
40  * master and slave structure view.
41  *
42  * @author Mik Kersten
43  */

44 public class BrowserViewManager {
45
46     private StructureViewPanel browserPanel = null;
47     private boolean globalMode = true;
48     private boolean splitViewMode = false;
49     private IconRegistry icons;
50   
51     private Stack backHistory = new Stack();
52     private Stack forwardHistory = new Stack();
53     private ProgramElementNode currNode = null;
54
55     private final GlobalStructureView DECLARATION_VIEW;
56     private final GlobalStructureView CROSSCUTTING_VIEW;
57     private final GlobalStructureView INHERITANCE_VIEW;
58
59     private final GlobalViewProperties DECLARATION_VIEW_PROPERTIES;
60     private final GlobalViewProperties CROSSCUTTING_VIEW_PROPERTIES;
61     private final GlobalViewProperties INHERITANCE_VIEW_PROPERTIES;
62
63     public BrowserViewManager() {
64         java.util.List JavaDoc views = new ArrayList();
65         views.add(DECLARATION_VIEW);
66         views.add(CROSSCUTTING_VIEW);
67         views.add(INHERITANCE_VIEW);
68         browserPanel = new StructureViewPanel(views);
69     }
70
71     public StructureViewPanel getBrowserPanel() {
72         return browserPanel;
73     }
74
75     public void showSourcesNodes(java.util.List JavaDoc nodes) {
76         for (Iterator it = nodes.iterator(); it.hasNext(); ) {
77             ProgramElementNode currNode = null;
78             StructureNode structureNode = (StructureNode)it.next();
79             if (structureNode instanceof LinkNode) {
80                 currNode = ((LinkNode)structureNode).getProgramElementNode();
81             } else {
82                 currNode = (ProgramElementNode)structureNode;
83             }
84             Ajde.getDefault().getEditorManager().addViewForSourceLine(currNode.getSourceLocation().getSourceFilePath(),
85                 currNode.getSourceLocation().getLineNumber());
86         }
87     }
88
89     public void extractAndInsertSignatures(java.util.List JavaDoc signatures, boolean calls) {
90         PointcutWizard pointcutWizard = new PointcutWizard(signatures);
91         pointcutWizard.setVisible(true);
92         pointcutWizard.setLocation(AjdeUIManager.getDefault().getRootFrame().getX()+100, AjdeUIManager.getDefault().getRootFrame().getY()+100);
93     }
94     
95     {
96         DECLARATION_VIEW_PROPERTIES = new GlobalViewProperties(StructureViewProperties.Hierarchy.DECLARATION);
97         CROSSCUTTING_VIEW_PROPERTIES = new GlobalViewProperties(StructureViewProperties.Hierarchy.CROSSCUTTING);
98         INHERITANCE_VIEW_PROPERTIES = new GlobalViewProperties(StructureViewProperties.Hierarchy.INHERITANCE);
99     
100         CROSSCUTTING_VIEW_PROPERTIES.addRelation(Advice.METHOD_RELATION);
101         CROSSCUTTING_VIEW_PROPERTIES.addRelation(Advice.METHOD_CALL_SITE_RELATION);
102         CROSSCUTTING_VIEW_PROPERTIES.addRelation(Advice.CONSTRUCTOR_RELATION);
103         CROSSCUTTING_VIEW_PROPERTIES.addRelation(Advice.CONSTRUCTOR_CALL_SITE_RELATION);
104         CROSSCUTTING_VIEW_PROPERTIES.addRelation(Advice.HANDLER_RELATION);
105         CROSSCUTTING_VIEW_PROPERTIES.addRelation(Advice.INITIALIZER_RELATION);
106         CROSSCUTTING_VIEW_PROPERTIES.addRelation(Advice.FIELD_ACCESS_RELATION);
107
108         INHERITANCE_VIEW_PROPERTIES.addRelation(Inheritance.IMPLEMENTS_RELATION);
109         INHERITANCE_VIEW_PROPERTIES.addRelation(Inheritance.INHERITS_MEMBERS_RELATION);
110         INHERITANCE_VIEW_PROPERTIES.addRelation(Inheritance.INHERITS_RELATION);
111         
112         DECLARATION_VIEW_PROPERTIES.setRelations(Ajde.getDefault().getStructureViewManager().getAvailableRelations());
113
114         CROSSCUTTING_VIEW = Ajde.getDefault().getStructureViewManager().createGlobalView(CROSSCUTTING_VIEW_PROPERTIES);
115         INHERITANCE_VIEW = Ajde.getDefault().getStructureViewManager().createGlobalView(INHERITANCE_VIEW_PROPERTIES);
116         DECLARATION_VIEW = Ajde.getDefault().getStructureViewManager().createGlobalView(DECLARATION_VIEW_PROPERTIES);
117     }
118 }
119
120
121
Popular Tags