Source Code Cross Referenced for JavaSearchActionGroup.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » ui » actions » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Eclipse » jdt » org.eclipse.jdt.ui.actions 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2006 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.jdt.ui.actions;
011:
012:        import org.eclipse.core.runtime.Assert;
013:
014:        import org.eclipse.jface.action.GroupMarker;
015:        import org.eclipse.jface.action.IMenuManager;
016:        import org.eclipse.jface.action.MenuManager;
017:        import org.eclipse.jface.action.Separator;
018:
019:        import org.eclipse.ui.IActionBars;
020:        import org.eclipse.ui.IViewPart;
021:        import org.eclipse.ui.IWorkbenchSite;
022:        import org.eclipse.ui.actions.ActionContext;
023:        import org.eclipse.ui.actions.ActionGroup;
024:        import org.eclipse.ui.part.Page;
025:        import org.eclipse.ui.texteditor.ITextEditorActionConstants;
026:
027:        import org.eclipse.jdt.ui.PreferenceConstants;
028:
029:        import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
030:        import org.eclipse.jdt.internal.ui.search.SearchMessages;
031:
032:        /**
033:         * Action group that adds the Java search actions to a context menu and
034:         * the global menu bar.
035:         * 
036:         * <p>
037:         * This class may be instantiated; it is not intended to be subclassed.
038:         * </p>
039:         * 
040:         * @since 2.0
041:         */
042:        public class JavaSearchActionGroup extends ActionGroup {
043:
044:            private JavaEditor fEditor;
045:
046:            private ReferencesSearchGroup fReferencesGroup;
047:            private ReadReferencesSearchGroup fReadAccessGroup;
048:            private WriteReferencesSearchGroup fWriteAccessGroup;
049:            private DeclarationsSearchGroup fDeclarationsGroup;
050:            private ImplementorsSearchGroup fImplementorsGroup;
051:            private OccurrencesSearchGroup fOccurrencesGroup;
052:
053:            /**
054:             * Creates a new <code>JavaSearchActionGroup</code>. The group 
055:             * requires that the selection provided by the part's selection provider 
056:             * is of type <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
057:             * 
058:             * @param part the view part that owns this action group
059:             */
060:            public JavaSearchActionGroup(IViewPart part) {
061:                this (part.getViewSite());
062:            }
063:
064:            /**
065:             * Creates a new <code>JavaSearchActionGroup</code>. The group 
066:             * requires that the selection provided by the page's selection provider 
067:             * is of type <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
068:             * 
069:             * @param page the page that owns this action group
070:             */
071:            public JavaSearchActionGroup(Page page) {
072:                this (page.getSite());
073:            }
074:
075:            /**
076:             * Note: This constructor is for internal use only. Clients should not call this constructor.
077:             * @param editor the Java editor
078:             */
079:            public JavaSearchActionGroup(JavaEditor editor) {
080:                Assert.isNotNull(editor);
081:                fEditor = editor;
082:
083:                fReferencesGroup = new ReferencesSearchGroup(fEditor);
084:                fReadAccessGroup = new ReadReferencesSearchGroup(fEditor);
085:                fWriteAccessGroup = new WriteReferencesSearchGroup(fEditor);
086:                fDeclarationsGroup = new DeclarationsSearchGroup(fEditor);
087:                fImplementorsGroup = new ImplementorsSearchGroup(fEditor);
088:                fOccurrencesGroup = new OccurrencesSearchGroup(fEditor);
089:            }
090:
091:            private JavaSearchActionGroup(IWorkbenchSite site) {
092:                fReferencesGroup = new ReferencesSearchGroup(site);
093:                fReadAccessGroup = new ReadReferencesSearchGroup(site);
094:                fWriteAccessGroup = new WriteReferencesSearchGroup(site);
095:                fDeclarationsGroup = new DeclarationsSearchGroup(site);
096:                fImplementorsGroup = new ImplementorsSearchGroup(site);
097:                fOccurrencesGroup = new OccurrencesSearchGroup(site);
098:            }
099:
100:            /* 
101:             * Method declared on ActionGroup.
102:             */
103:            public void setContext(ActionContext context) {
104:                fReferencesGroup.setContext(context);
105:                fDeclarationsGroup.setContext(context);
106:                fImplementorsGroup.setContext(context);
107:                fReadAccessGroup.setContext(context);
108:                fWriteAccessGroup.setContext(context);
109:                fOccurrencesGroup.setContext(context);
110:            }
111:
112:            /* 
113:             * Method declared on ActionGroup.
114:             */
115:            public void fillActionBars(IActionBars actionBar) {
116:                super .fillActionBars(actionBar);
117:                fReferencesGroup.fillActionBars(actionBar);
118:                fDeclarationsGroup.fillActionBars(actionBar);
119:                fImplementorsGroup.fillActionBars(actionBar);
120:                fReadAccessGroup.fillActionBars(actionBar);
121:                fWriteAccessGroup.fillActionBars(actionBar);
122:                fOccurrencesGroup.fillActionBars(actionBar);
123:            }
124:
125:            /* 
126:             * Method declared on ActionGroup.
127:             */
128:            public void fillContextMenu(IMenuManager menu) {
129:                super .fillContextMenu(menu);
130:
131:                if (PreferenceConstants.getPreferenceStore().getBoolean(
132:                        PreferenceConstants.SEARCH_USE_REDUCED_MENU)) {
133:                    fReferencesGroup.fillContextMenu(menu);
134:                    fDeclarationsGroup.fillContextMenu(menu);
135:
136:                    if (fEditor == null) {
137:                        fImplementorsGroup.fillContextMenu(menu);
138:                        fReadAccessGroup.fillContextMenu(menu);
139:                        fWriteAccessGroup.fillContextMenu(menu);
140:                    }
141:                } else {
142:                    IMenuManager target = menu;
143:                    IMenuManager searchSubMenu = null;
144:                    if (fEditor != null) {
145:                        String groupName = SearchMessages.group_search;
146:                        searchSubMenu = new MenuManager(groupName,
147:                                ITextEditorActionConstants.GROUP_FIND);
148:                        searchSubMenu.add(new GroupMarker(
149:                                ITextEditorActionConstants.GROUP_FIND));
150:                        target = searchSubMenu;
151:                    }
152:
153:                    fReferencesGroup.fillContextMenu(target);
154:                    fDeclarationsGroup.fillContextMenu(target);
155:                    fImplementorsGroup.fillContextMenu(target);
156:                    fReadAccessGroup.fillContextMenu(target);
157:                    fWriteAccessGroup.fillContextMenu(target);
158:
159:                    if (searchSubMenu != null) {
160:                        fOccurrencesGroup.fillContextMenu(target);
161:                        searchSubMenu.add(new Separator());
162:                    }
163:
164:                    // no other way to find out if we have added items.
165:                    if (searchSubMenu != null
166:                            && searchSubMenu.getItems().length > 2) {
167:                        menu.appendToGroup(
168:                                ITextEditorActionConstants.GROUP_FIND,
169:                                searchSubMenu);
170:                    }
171:                }
172:            }
173:
174:            /* 
175:             * Method declared on ActionGroup.
176:             */
177:            public void dispose() {
178:                fReferencesGroup.dispose();
179:                fDeclarationsGroup.dispose();
180:                fImplementorsGroup.dispose();
181:                fReadAccessGroup.dispose();
182:                fWriteAccessGroup.dispose();
183:                fOccurrencesGroup.dispose();
184:
185:                super.dispose();
186:            }
187:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.