Source Code Cross Referenced for ContributionItemFactory.java in  » IDE-Eclipse » ui-workbench » org » eclipse » 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 » ui workbench » org.eclipse.ui.actions 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2003, 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.ui.actions;
011:
012:        import org.eclipse.jface.action.IContributionItem;
013:        import org.eclipse.ui.IWorkbenchWindow;
014:        import org.eclipse.ui.internal.ChangeToPerspectiveMenu;
015:        import org.eclipse.ui.internal.PinEditorAction;
016:        import org.eclipse.ui.internal.ReopenEditorMenu;
017:        import org.eclipse.ui.internal.ShowInMenu;
018:        import org.eclipse.ui.internal.ShowViewMenu;
019:        import org.eclipse.ui.internal.SwitchToWindowMenu;
020:        import org.eclipse.ui.internal.actions.HelpSearchContributionItem;
021:        import org.eclipse.ui.internal.actions.PinEditorContributionItem;
022:
023:        /**
024:         * Access to standard contribution items provided by the workbench.
025:         * <p>
026:         * Most of the functionality of this class is provided by
027:         * static methods and fields.
028:         * Example usage:
029:         * <pre>
030:         * MenuManager menu = ...;
031:         * IContributionItem reEdit
032:         * 	  = ContributionItemFactory.REOPEN_EDITORS.create(window);
033:         * menu.add(reEdit);
034:         * </pre>
035:         * </p>
036:         * <p>
037:         * Clients may declare subclasses that provide additional application-specific
038:         * contribution item factories.
039:         * </p>
040:         * 
041:         * @since 3.0
042:         */
043:        public abstract class ContributionItemFactory {
044:
045:            /**
046:             * Id of contribution items created by this factory.
047:             */
048:            private final String contributionItemId;
049:
050:            /**
051:             * Creates a new workbench contribution item factory with the given id.
052:             * 
053:             * @param contributionItemId the id of contribution items created by this factory
054:             */
055:            protected ContributionItemFactory(String contributionItemId) {
056:                this .contributionItemId = contributionItemId;
057:            }
058:
059:            /**
060:             * Creates a new standard contribution item for the given workbench window.
061:             * <p>
062:             * A typical contribution item automatically registers listeners against the
063:             * workbench window so that it can keep its enablement state up to date.
064:             * Ordinarily, the window's references to these listeners will be dropped
065:             * automatically when the window closes. However, if the client needs to get
066:             * rid of a contribution item while the window is still open, the client must
067:             * call IContributionItem#dispose to give the item an
068:             * opportunity to deregister its listeners and to perform any other cleanup.
069:             * </p>
070:             * 
071:             * @param window the workbench window
072:             * @return the workbench contribution item
073:             */
074:            public abstract IContributionItem create(IWorkbenchWindow window);
075:
076:            /**
077:             * Returns the id of this contribution item factory.
078:             * 
079:             * @return the id of contribution items created by this factory
080:             */
081:            public String getId() {
082:                return contributionItemId;
083:            }
084:
085:            /**
086:             * Workbench action (id "pinEditor"): Toggle whether the editor is pinned.
087:             * This action maintains its enablement state.
088:             */
089:            public static final ContributionItemFactory PIN_EDITOR = new ContributionItemFactory(
090:                    "pinEditor") { //$NON-NLS-1$
091:                /* (non-javadoc) method declared on ContributionItemFactory */
092:                public IContributionItem create(IWorkbenchWindow window) {
093:                    if (window == null) {
094:                        throw new IllegalArgumentException();
095:                    }
096:                    PinEditorAction action = new PinEditorAction(window);
097:                    action.setId(getId());
098:                    return new PinEditorContributionItem(action, window);
099:                }
100:            };
101:
102:            /**
103:             * Workbench contribution item (id "openWindows"): A list of windows
104:             * currently open in the workbench. Selecting one of the items makes the
105:             * corresponding window the active window.
106:             * This action dynamically maintains the list of windows.
107:             */
108:            public static final ContributionItemFactory OPEN_WINDOWS = new ContributionItemFactory(
109:                    "openWindows") { //$NON-NLS-1$
110:                /* (non-javadoc) method declared on ContributionItemFactory */
111:                public IContributionItem create(IWorkbenchWindow window) {
112:                    if (window == null) {
113:                        throw new IllegalArgumentException();
114:                    }
115:                    return new SwitchToWindowMenu(window, getId(), true);
116:                }
117:            };
118:
119:            /**
120:             * Workbench contribution item (id "viewsShortlist"): A list of views
121:             * available to be opened in the window, arranged as a shortlist of 
122:             * promising views and an "Other" subitem. Selecting
123:             * one of the items opens the corresponding view in the active window.
124:             * This action dynamically maintains the view shortlist.
125:             */
126:            public static final ContributionItemFactory VIEWS_SHORTLIST = new ContributionItemFactory(
127:                    "viewsShortlist") { //$NON-NLS-1$
128:                /* (non-javadoc) method declared on ContributionItemFactory */
129:                public IContributionItem create(IWorkbenchWindow window) {
130:                    if (window == null) {
131:                        throw new IllegalArgumentException();
132:                    }
133:                    return new ShowViewMenu(window, getId());
134:                }
135:            };
136:
137:            /**
138:             * Workbench contribution item (id "viewsShowIn"): A list of views
139:             * available to be opened in the window, arranged as a list of 
140:             * alternate views to show the same item currently selected. Selecting
141:             * one of the items opens the corresponding view in the active window.
142:             * This action dynamically maintains the view list.
143:             */
144:            public static final ContributionItemFactory VIEWS_SHOW_IN = new ContributionItemFactory(
145:                    "viewsShowIn") { //$NON-NLS-1$
146:                /* (non-javadoc) method declared on ContributionItemFactory */
147:                public IContributionItem create(IWorkbenchWindow window) {
148:                    if (window == null) {
149:                        throw new IllegalArgumentException();
150:                    }
151:                    return new ShowInMenu(window, getId());
152:                }
153:            };
154:
155:            /**
156:             * Workbench contribution item (id "reopenEditors"): A list of recent
157:             * editors (with inputs) available to be reopened in the window. Selecting
158:             * one of the items reopens the corresponding editor on its input in the
159:             * active window. This action dynamically maintains the list of editors.
160:             */
161:            public static final ContributionItemFactory REOPEN_EDITORS = new ContributionItemFactory(
162:                    "reopenEditors") { //$NON-NLS-1$
163:                /* (non-javadoc) method declared on ContributionItemFactory */
164:                public IContributionItem create(IWorkbenchWindow window) {
165:                    if (window == null) {
166:                        throw new IllegalArgumentException();
167:                    }
168:                    return new ReopenEditorMenu(window, getId(), true);
169:                }
170:            };
171:
172:            /**
173:             * Workbench contribution item (id "perspectivesShortlist"): A list of
174:             * perspectives available to be opened, arranged as a shortlist of 
175:             * promising perspectives and an "Other" subitem. Selecting
176:             * one of the items makes the corresponding perspective active. Should a 
177:             * new perspective need to be opened, a workbench user preference controls
178:             * whether the prespective is opened in the active window or a new window.
179:             * This action dynamically maintains the perspectives shortlist.
180:             */
181:            public static final ContributionItemFactory PERSPECTIVES_SHORTLIST = new ContributionItemFactory(
182:                    "perspectivesShortlist") { //$NON-NLS-1$
183:                /* (non-javadoc) method declared on ContributionItemFactory */
184:                public IContributionItem create(IWorkbenchWindow window) {
185:                    if (window == null) {
186:                        throw new IllegalArgumentException();
187:                    }
188:                    return new ChangeToPerspectiveMenu(window, getId());
189:                }
190:            };
191:
192:            /**
193:             * Workbench contribution item (id "newWizardShortlist"): A list of
194:             * new item wizards available to be opened, arranged as a shortlist of 
195:             * promising new item wizards and an "Other" subitem. Selecting
196:             * one of the items invokes the corresponding new item wizard. 
197:             * This action dynamically maintains the new item wizard shortlist.
198:             * @since 3.1
199:             */
200:            public static final ContributionItemFactory NEW_WIZARD_SHORTLIST = new ContributionItemFactory(
201:                    "newWizardShortlist") { //$NON-NLS-1$
202:                /* (non-javadoc) method declared on ContributionItemFactory */
203:                public IContributionItem create(IWorkbenchWindow window) {
204:                    if (window == null) {
205:                        throw new IllegalArgumentException();
206:                    }
207:                    return new BaseNewWizardMenu(window, getId());
208:                }
209:            };
210:
211:            /**
212:             * Workbench contribution item (id "helpSearch"): An editable field
213:             * for entering help search queries.
214:             * @since 3.1
215:             */
216:            public static final ContributionItemFactory HELP_SEARCH = new ContributionItemFactory(
217:                    "helpSearch") {//$NON-NLS-1$
218:                public IContributionItem create(IWorkbenchWindow window) {
219:                    if (window == null) {
220:                        throw new IllegalArgumentException();
221:                    }
222:                    return new HelpSearchContributionItem(window, getId());
223:                }
224:            };
225:
226:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.