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


001:        /*******************************************************************************
002:         * Copyright (c) 2003, 2007 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.ide;
011:
012:        import org.eclipse.core.resources.IProject;
013:        import org.eclipse.core.resources.IncrementalProjectBuilder;
014:        import org.eclipse.ui.IWorkbenchWindow;
015:        import org.eclipse.ui.actions.ActionFactory;
016:        import org.eclipse.ui.actions.GlobalBuildAction;
017:        import org.eclipse.ui.actions.NewWizardDropDownAction;
018:        import org.eclipse.ui.actions.NewWizardMenu;
019:        import org.eclipse.ui.actions.QuickStartAction;
020:        import org.eclipse.ui.actions.RetargetAction;
021:        import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
022:        import org.eclipse.ui.internal.ide.TipsAndTricksAction;
023:        import org.eclipse.ui.internal.ide.actions.BuildCleanAction;
024:        import org.eclipse.ui.internal.ide.actions.OpenWorkspaceAction;
025:        import org.eclipse.ui.internal.ide.actions.ProjectPropertyDialogAction;
026:        import org.eclipse.ui.internal.ide.actions.RetargetActionWithDefault;
027:        import org.eclipse.ui.internal.ide.actions.ToggleAutoBuildAction;
028:
029:        /**
030:         * Access to standard actions provided by the IDE workbench (including
031:         * those of the generic workbench).
032:         * <p>
033:         * The functionality of this class is provided by static fields.
034:         * Example usage:
035:         * <pre>
036:         * MenuManager menu = ...;
037:         * ActionFactory.IWorkbenchAction closeProjectAction
038:         * 	  = IDEActionFactory.CLOSE_PROJECT.create(window);
039:         * menu.add(closeProjectAction);
040:         * </pre>
041:         * </p>
042:         * 
043:         * @since 3.0
044:         */
045:        public final class IDEActionFactory {
046:
047:            /**
048:             * Prevents instantiation.
049:             */
050:            private IDEActionFactory() {
051:                // do nothing
052:            }
053:
054:            /**
055:             * IDE-specific workbench action: Add task.
056:             * This action is a {@link RetargetAction} with 
057:             * id "addTask". This action maintains its enablement state.
058:             */
059:            public static final ActionFactory ADD_TASK = new ActionFactory(
060:                    "addTask") { //$NON-NLS-1$
061:                /* (non-javadoc) method declared on ActionFactory */
062:                public IWorkbenchAction create(IWorkbenchWindow window) {
063:                    if (window == null) {
064:                        throw new IllegalArgumentException();
065:                    }
066:                    RetargetAction action = new RetargetAction(getId(),
067:                            IDEWorkbenchMessages.Workbench_addTask);
068:                    action
069:                            .setToolTipText(IDEWorkbenchMessages.Workbench_addTaskToolTip);
070:                    window.getPartService().addPartListener(action);
071:                    action.setActionDefinitionId("org.eclipse.ui.edit.addTask"); //$NON-NLS-1$
072:                    return action;
073:                }
074:            };
075:
076:            /**
077:             * IDE-specific workbench action: Add bookmark.
078:             * This action is a {@link RetargetAction} with 
079:             * id "bookmark". This action maintains its enablement state.
080:             */
081:            public static final ActionFactory BOOKMARK = new ActionFactory(
082:                    "bookmark") { //$NON-NLS-1$
083:                /* (non-javadoc) method declared on ActionFactory */
084:                public IWorkbenchAction create(IWorkbenchWindow window) {
085:                    if (window == null) {
086:                        throw new IllegalArgumentException();
087:                    }
088:                    RetargetAction action = new RetargetAction(getId(),
089:                            IDEWorkbenchMessages.Workbench_addBookmark);
090:                    action
091:                            .setToolTipText(IDEWorkbenchMessages.Workbench_addBookmarkToolTip);
092:                    window.getPartService().addPartListener(action);
093:                    action
094:                            .setActionDefinitionId("org.eclipse.ui.edit.addBookmark"); //$NON-NLS-1$
095:                    return action;
096:                }
097:            };
098:
099:            /**
100:             * IDE-specific workbench action: Incremental build.
101:             * This action maintains its enablement state.
102:             */
103:            public static final ActionFactory BUILD = new ActionFactory("build") { //$NON-NLS-1$
104:                /* (non-javadoc) method declared on ActionFactory */
105:                public IWorkbenchAction create(IWorkbenchWindow window) {
106:                    if (window == null) {
107:                        throw new IllegalArgumentException();
108:                    }
109:                    return new GlobalBuildAction(window,
110:                            IncrementalProjectBuilder.INCREMENTAL_BUILD);
111:                }
112:            };
113:
114:            /**
115:             * IDE-specific workbench action: Build clean
116:             * This action maintains its enablement state.
117:             * @since 3.0
118:             */
119:            public static final ActionFactory BUILD_CLEAN = new ActionFactory(
120:                    "buildClean") { //$NON-NLS-1$
121:                /* (non-javadoc) method declared on ActionFactory */
122:                public IWorkbenchAction create(IWorkbenchWindow window) {
123:                    if (window == null) {
124:                        throw new IllegalArgumentException();
125:                    }
126:                    IWorkbenchAction action = new BuildCleanAction(window);
127:                    action.setId(getId());
128:                    return action;
129:                }
130:            };
131:
132:            /**
133:             * IDE-specific workbench action: Build automatically
134:             * This action maintains its enablement state.
135:             * @since 3.0
136:             */
137:            public static final ActionFactory BUILD_AUTOMATICALLY = new ActionFactory(
138:                    "buildAutomatically") { //$NON-NLS-1$
139:                /* (non-javadoc) method declared on ActionFactory */
140:                public IWorkbenchAction create(IWorkbenchWindow window) {
141:                    if (window == null) {
142:                        throw new IllegalArgumentException();
143:                    }
144:                    IWorkbenchAction action = new ToggleAutoBuildAction(window);
145:                    action.setId(getId());
146:                    action
147:                            .setActionDefinitionId("org.eclipse.ui.project.buildAutomatically"); //$NON-NLS-1$
148:                    return action;
149:                }
150:            };
151:
152:            /**
153:             * IDE-specific workbench action: Incremental build.
154:             * This action is a {@link RetargetAction} with 
155:             * id "buildProject". This action maintains its enablement state.
156:             */
157:            public static final ActionFactory BUILD_PROJECT = new ActionFactory(
158:                    "buildProject") { //$NON-NLS-1$
159:                /* (non-javadoc) method declared on ActionFactory */
160:                public IWorkbenchAction create(IWorkbenchWindow window) {
161:                    if (window == null) {
162:                        throw new IllegalArgumentException();
163:                    }
164:                    RetargetAction action = new RetargetActionWithDefault(
165:                            getId(),
166:                            IDEWorkbenchMessages.Workbench_buildProject);
167:                    action
168:                            .setToolTipText(IDEWorkbenchMessages.Workbench_buildProjectToolTip);
169:                    window.getPartService().addPartListener(action);
170:                    action
171:                            .setActionDefinitionId("org.eclipse.ui.project.buildProject"); //$NON-NLS-1$
172:                    return action;
173:                }
174:            };
175:
176:            /**
177:             * IDE-specific workbench action: Close project.
178:             * This action is a {@link RetargetAction} with 
179:             * id "closeProject". This action maintains its enablement state.
180:             */
181:            public static final ActionFactory CLOSE_PROJECT = new ActionFactory(
182:                    "closeProject") { //$NON-NLS-1$
183:                /* (non-javadoc) method declared on ActionFactory */
184:                public IWorkbenchAction create(IWorkbenchWindow window) {
185:                    if (window == null) {
186:                        throw new IllegalArgumentException();
187:                    }
188:                    RetargetAction action = new RetargetAction(getId(),
189:                            IDEWorkbenchMessages.CloseResourceAction_text);
190:                    action
191:                            .setToolTipText(IDEWorkbenchMessages.CloseResourceAction_text);
192:                    window.getPartService().addPartListener(action);
193:                    action
194:                            .setActionDefinitionId("org.eclipse.ui.project.closeProject"); //$NON-NLS-1$
195:                    return action;
196:                }
197:            };
198:
199:            /**
200:             * IDE-specific workbench action: Close unrelated projects.
201:             * <p>
202:             * This action closes all projects that are unrelated to the selected projects. A
203:             * project is unrelated if it is not directly or transitively referenced by one 
204:             * of the selected projects, and does not directly or transitively reference
205:             * one of the selected projects.
206:             * </p>
207:             * This action is a {@link RetargetAction} with 
208:             * id "closeUnrelatedProjects". This action maintains its enablement state.
209:             * @see IProject#getReferencedProjects()
210:             * @see IProject#getReferencingProjects()
211:             * @see IProject#close(org.eclipse.core.runtime.IProgressMonitor)
212:             * @since 3.2
213:             */
214:            public static final ActionFactory CLOSE_UNRELATED_PROJECTS = new ActionFactory(
215:                    "closeUnrelatedProjects") { //$NON-NLS-1$
216:                /* (non-javadoc) method declared on ActionFactory */
217:                public IWorkbenchAction create(IWorkbenchWindow window) {
218:                    if (window == null) {
219:                        throw new IllegalArgumentException();
220:                    }
221:                    RetargetAction action = new RetargetAction(
222:                            getId(),
223:                            IDEWorkbenchMessages.CloseUnrelatedProjectsAction_text);
224:                    action
225:                            .setToolTipText(IDEWorkbenchMessages.CloseUnrelatedProjectsAction_toolTip);
226:                    window.getPartService().addPartListener(action);
227:                    action
228:                            .setActionDefinitionId("org.eclipse.ui.project.closeUnrelatedProjects"); //$NON-NLS-1$
229:                    return action;
230:                }
231:            };
232:
233:            /**
234:             * IDE-specific workbench action: Opens the "new" wizard drop down, including
235:             * resource-specific items for Project... and Example...
236:             * This action maintains its enablement state.
237:             */
238:            public static final ActionFactory NEW_WIZARD_DROP_DOWN = new ActionFactory(
239:                    "newWizardDropDown") { //$NON-NLS-1$
240:                /* (non-javadoc) method declared on ActionFactory */
241:                public IWorkbenchAction create(IWorkbenchWindow window) {
242:                    if (window == null) {
243:                        throw new IllegalArgumentException();
244:                    }
245:                    // @issue we are creating a NEW action just to pass to NewWizardDropDownAction
246:                    IWorkbenchAction innerAction = ActionFactory.NEW
247:                            .create(window);
248:                    NewWizardMenu newWizardMenu = new NewWizardMenu(window);
249:                    IWorkbenchAction action = new NewWizardDropDownAction(
250:                            window, innerAction, newWizardMenu);
251:                    action.setId(getId());
252:                    return action;
253:                }
254:            };
255:
256:            /**
257:             * IDE-specific workbench action: Open project.
258:             * This action is a {@link RetargetAction} with 
259:             * id "openProject". This action maintains its enablement state.
260:             */
261:            public static final ActionFactory OPEN_PROJECT = new ActionFactory(
262:                    "openProject") { //$NON-NLS-1$
263:                /* (non-javadoc) method declared on ActionFactory */
264:                public IWorkbenchAction create(IWorkbenchWindow window) {
265:                    if (window == null) {
266:                        throw new IllegalArgumentException();
267:                    }
268:                    RetargetAction action = new RetargetAction(getId(),
269:                            IDEWorkbenchMessages.OpenResourceAction_text);
270:                    action
271:                            .setToolTipText(IDEWorkbenchMessages.OpenResourceAction_toolTip);
272:                    window.getPartService().addPartListener(action);
273:                    action
274:                            .setActionDefinitionId("org.eclipse.ui.project.openProject"); //$NON-NLS-1$
275:                    return action;
276:                }
277:            };
278:
279:            /**
280:             * IDE-specific workbench action: Open workspace.
281:             * This action maintains its enablement state.
282:             */
283:            public static final ActionFactory OPEN_WORKSPACE = new ActionFactory(
284:                    "openWorkspace") { //$NON-NLS-1$
285:                /* (non-javadoc) method declared on ActionFactory */
286:                public IWorkbenchAction create(IWorkbenchWindow window) {
287:                    if (window == null) {
288:                        throw new IllegalArgumentException();
289:                    }
290:                    IWorkbenchAction action = new OpenWorkspaceAction(window);
291:                    action.setId(getId());
292:                    return action;
293:                }
294:            };
295:
296:            /**
297:             * IDE-specific workbench action: Open project properties.
298:             * This action maintains its enablement state.
299:             */
300:            public static final ActionFactory OPEN_PROJECT_PROPERTIES = new ActionFactory(
301:                    "projectProperties") { //$NON-NLS-1$
302:                /* (non-javadoc) method declared on ActionFactory */
303:                public IWorkbenchAction create(IWorkbenchWindow window) {
304:                    if (window == null) {
305:                        throw new IllegalArgumentException();
306:                    }
307:                    IWorkbenchAction action = new ProjectPropertyDialogAction(
308:                            window);
309:                    action.setId(getId());
310:                    return action;
311:                }
312:            };
313:
314:            /**
315:             * IDE-specific workbench action: Quick start.
316:             * This action maintains its enablement state.
317:             * 
318:             * @deprecated the IDE now uses the new intro mechanism
319:             */
320:            public static final ActionFactory QUICK_START = new ActionFactory(
321:                    "quickStart") { //$NON-NLS-1$
322:                /* (non-javadoc) method declared on ActionFactory */
323:                public IWorkbenchAction create(IWorkbenchWindow window) {
324:                    if (window == null) {
325:                        throw new IllegalArgumentException();
326:                    }
327:                    IWorkbenchAction action = new QuickStartAction(window);
328:                    action.setId(getId());
329:                    return action;
330:                }
331:            };
332:
333:            /**
334:             * IDE-specific workbench action: Full build.
335:             * This action maintains its enablement state.
336:             * 
337:             * @deprecated as of 3.0, this action no longer appears in the UI (was deprecated in 3.1)
338:             */
339:            public static final ActionFactory REBUILD_ALL = new ActionFactory(
340:                    "rebuildAll") { //$NON-NLS-1$
341:                /* (non-javadoc) method declared on ActionFactory */
342:                public IWorkbenchAction create(IWorkbenchWindow window) {
343:                    if (window == null) {
344:                        throw new IllegalArgumentException();
345:                    }
346:                    IWorkbenchAction action = new GlobalBuildAction(window,
347:                            IncrementalProjectBuilder.FULL_BUILD);
348:                    action.setId(getId());
349:                    return action;
350:                }
351:            };
352:
353:            /**
354:             * IDE-specific workbench action: Rebuild project.
355:             * This action is a {@link RetargetAction} with 
356:             * id "rebuildProject". This action maintains its enablement state.
357:             * 
358:             * @deprecated as of 3.0, this action no longer appears in the UI (was deprecated in 3.1)
359:             */
360:            public static final ActionFactory REBUILD_PROJECT = new ActionFactory(
361:                    "rebuildProject") { //$NON-NLS-1$
362:                /* (non-javadoc) method declared on ActionFactory */
363:                public IWorkbenchAction create(IWorkbenchWindow window) {
364:                    if (window == null) {
365:                        throw new IllegalArgumentException();
366:                    }
367:                    RetargetAction action = new RetargetAction(getId(),
368:                            IDEWorkbenchMessages.Workbench_rebuildProject);
369:                    action
370:                            .setToolTipText(IDEWorkbenchMessages.Workbench_rebuildProjectToolTip);
371:                    window.getPartService().addPartListener(action);
372:                    action
373:                            .setActionDefinitionId("org.eclipse.ui.project.rebuildProject"); //$NON-NLS-1$
374:                    return action;
375:                }
376:            };
377:
378:            /**
379:             * IDE-specific workbench action: Tips and tricks.
380:             * This action maintains its enablement state.
381:             */
382:            public static final ActionFactory TIPS_AND_TRICKS = new ActionFactory(
383:                    "tipsAndTricks") { //$NON-NLS-1$
384:                /* (non-javadoc) method declared on ActionFactory */
385:                public IWorkbenchAction create(IWorkbenchWindow window) {
386:                    if (window == null) {
387:                        throw new IllegalArgumentException();
388:                    }
389:                    IWorkbenchAction action = new TipsAndTricksAction(window);
390:                    action.setId(getId());
391:                    return action;
392:                }
393:            };
394:
395:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.