Source Code Cross Referenced for WorkbenchWindowConfigurer.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » internal » 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.internal 
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.internal;
011:
012:        import java.util.ArrayList;
013:        import java.util.HashMap;
014:        import java.util.Map;
015:
016:        import org.eclipse.core.runtime.IStatus;
017:        import org.eclipse.jface.action.CoolBarManager;
018:        import org.eclipse.jface.action.IAction;
019:        import org.eclipse.jface.action.IContributionItem;
020:        import org.eclipse.jface.action.ICoolBarManager;
021:        import org.eclipse.jface.action.IMenuManager;
022:        import org.eclipse.jface.action.IStatusLineManager;
023:        import org.eclipse.jface.action.IToolBarManager;
024:        import org.eclipse.jface.internal.provisional.action.ICoolBarManager2;
025:        import org.eclipse.jface.internal.provisional.action.IToolBarContributionItem;
026:        import org.eclipse.jface.window.Window;
027:        import org.eclipse.osgi.util.TextProcessor;
028:        import org.eclipse.swt.SWT;
029:        import org.eclipse.swt.dnd.DropTarget;
030:        import org.eclipse.swt.dnd.DropTargetListener;
031:        import org.eclipse.swt.dnd.Transfer;
032:        import org.eclipse.swt.graphics.Point;
033:        import org.eclipse.swt.widgets.Composite;
034:        import org.eclipse.swt.widgets.Control;
035:        import org.eclipse.swt.widgets.Menu;
036:        import org.eclipse.swt.widgets.Shell;
037:        import org.eclipse.ui.IMemento;
038:        import org.eclipse.ui.IWorkbenchPage;
039:        import org.eclipse.ui.IWorkbenchPreferenceConstants;
040:        import org.eclipse.ui.IWorkbenchWindow;
041:        import org.eclipse.ui.application.IActionBarConfigurer;
042:        import org.eclipse.ui.application.IWorkbenchConfigurer;
043:        import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
044:        import org.eclipse.ui.application.WorkbenchAdvisor;
045:        import org.eclipse.ui.internal.StartupThreading.StartupRunnable;
046:        import org.eclipse.ui.internal.presentations.r33.WorkbenchPresentationFactory_33;
047:        import org.eclipse.ui.internal.provisional.application.IActionBarConfigurer2;
048:        import org.eclipse.ui.internal.provisional.presentations.IActionBarPresentationFactory;
049:        import org.eclipse.ui.internal.util.PrefUtil;
050:        import org.eclipse.ui.presentations.AbstractPresentationFactory;
051:
052:        /**
053:         * Internal class providing special access for configuring workbench windows.
054:         * <p>
055:         * Note that these objects are only available to the main application
056:         * (the plug-in that creates and owns the workbench).
057:         * </p>
058:         * <p>
059:         * This class is not intended to be instantiated or subclassed by clients.
060:         * </p>
061:         * 
062:         * @since 3.0
063:         */
064:        public final class WorkbenchWindowConfigurer implements 
065:                IWorkbenchWindowConfigurer {
066:
067:            /**
068:             * The workbench window associated with this configurer.
069:             */
070:            private WorkbenchWindow window;
071:
072:            /**
073:             * The shell style bits to use when the window's shell is being created.
074:             */
075:            private int shellStyle = SWT.SHELL_TRIM
076:                    | Window.getDefaultOrientation();
077:
078:            /**
079:             * The window title to set when the window's shell has been created.
080:             */
081:            private String windowTitle;
082:
083:            /**
084:             * Whether the workbench window should show the fast view bars.
085:             */
086:            private boolean showFastViewBars = false;
087:
088:            /**
089:             * Whether the workbench window should show the perspective bar
090:             */
091:            private boolean showPerspectiveBar = false;
092:
093:            /**
094:             * Whether the workbench window should show the status line.
095:             */
096:            private boolean showStatusLine = true;
097:
098:            /**
099:             * Whether the workbench window should show the main tool bar.
100:             */
101:            private boolean showToolBar = true;
102:
103:            /**
104:             * Whether the workbench window should show the main menu bar.
105:             */
106:            private boolean showMenuBar = true;
107:
108:            /**
109:             * Whether the workbench window should have a progress indicator.
110:             */
111:            private boolean showProgressIndicator = false;
112:
113:            /**
114:             * Table to hold arbitrary key-data settings (key type: <code>String</code>,
115:             * value type: <code>Object</code>).
116:             * @see #setData
117:             */
118:            private Map extraData = new HashMap(1);
119:
120:            /**
121:             * Holds the list drag and drop <code>Transfer</code> for the
122:             * editor area
123:             */
124:            private ArrayList transferTypes = new ArrayList(3);
125:
126:            /**
127:             * The <code>DropTargetListener</code> implementation for handling a
128:             * drop into the editor area.
129:             */
130:            private DropTargetListener dropTargetListener = null;
131:
132:            /**
133:             * Object for configuring this workbench window's action bars. 
134:             * Lazily initialized to an instance unique to this window.
135:             */
136:            private WindowActionBarConfigurer actionBarConfigurer = null;
137:
138:            /**
139:             * The initial size to use for the shell.
140:             */
141:            private Point initialSize = new Point(1024, 768);
142:
143:            /**
144:             * The presentation factory.  Lazily initialized in getPresentationFactory
145:             * if not already assigned in setPresentationFactory.
146:             */
147:            private AbstractPresentationFactory presentationFactory = null;
148:
149:            /**
150:             * Action bar configurer that changes this workbench window.
151:             * This implementation keeps track of of cool bar items
152:             */
153:            class WindowActionBarConfigurer implements  IActionBarConfigurer2 {
154:
155:                private IActionBarConfigurer2 proxy;
156:
157:                /**
158:                 * Sets the proxy to use, or <code>null</code> for none.
159:                 * 
160:                 * @param proxy the proxy
161:                 */
162:                public void setProxy(IActionBarConfigurer2 proxy) {
163:                    this .proxy = proxy;
164:                }
165:
166:                /* (non-Javadoc)
167:                 * @see org.eclipse.ui.application.IActionBarConfigurer#getWindowConfigurer()
168:                 */
169:                public IWorkbenchWindowConfigurer getWindowConfigurer() {
170:                    return window.getWindowConfigurer();
171:                }
172:
173:                /**
174:                 * Returns whether the given id is for a cool item.
175:                 * 
176:                 * @param the item id
177:                 * @return <code>true</code> if it is a cool item,
178:                 * and <code>false</code> otherwise
179:                 */
180:                /* package */boolean containsCoolItem(String id) {
181:                    ICoolBarManager cbManager = getCoolBarManager();
182:                    if (cbManager == null) {
183:                        return false;
184:                    }
185:                    IContributionItem cbItem = cbManager.find(id);
186:                    if (cbItem == null) {
187:                        return false;
188:                    }
189:                    //@ issue: maybe we should check if cbItem is visible?
190:                    return true;
191:                }
192:
193:                /* (non-Javadoc)
194:                 * @see org.eclipse.ui.application.IActionBarConfigurer
195:                 */
196:                public IStatusLineManager getStatusLineManager() {
197:                    if (proxy != null) {
198:                        return proxy.getStatusLineManager();
199:                    }
200:                    return window.getStatusLineManager();
201:                }
202:
203:                /* (non-Javadoc)
204:                 * @see org.eclipse.ui.application.IActionBarConfigurer
205:                 */
206:                public IMenuManager getMenuManager() {
207:                    if (proxy != null) {
208:                        return proxy.getMenuManager();
209:                    }
210:                    return window.getMenuManager();
211:                }
212:
213:                /* (non-Javadoc)
214:                 * @see org.eclipse.ui.internal.AbstractActionBarConfigurer
215:                 */
216:                public ICoolBarManager getCoolBarManager() {
217:                    if (proxy != null) {
218:                        return proxy.getCoolBarManager();
219:                    }
220:                    return window.getCoolBarManager2();
221:                }
222:
223:                /* (non-Javadoc)
224:                 * @see org.eclipse.ui.application.IActionBarConfigurer
225:                 */
226:                public void registerGlobalAction(IAction action) {
227:                    if (proxy != null) {
228:                        proxy.registerGlobalAction(action);
229:                    }
230:                    window.registerGlobalAction(action);
231:                }
232:
233:                private IActionBarPresentationFactory getActionBarPresentationFactory() {
234:                    WorkbenchWindow window = (WorkbenchWindow) getWindowConfigurer()
235:                            .getWindow();
236:                    return window.getActionBarPresentationFactory();
237:                }
238:
239:                /* (non-Javadoc)
240:                 * @see org.eclipse.ui.application.IActionBarConfigurer#createToolBarManager()
241:                 */
242:                public IToolBarManager createToolBarManager() {
243:                    if (proxy != null) {
244:                        return proxy.createToolBarManager();
245:                    }
246:                    return getActionBarPresentationFactory()
247:                            .createToolBarManager();
248:                }
249:
250:                /* (non-Javadoc)
251:                 * @see org.eclipse.ui.application.IActionBarConfigurer#createToolBarContributionItem(org.eclipse.jface.action.IToolBarManager, java.lang.String)
252:                 */
253:                public IToolBarContributionItem createToolBarContributionItem(
254:                        IToolBarManager toolBarManager, String id) {
255:                    if (proxy != null) {
256:                        return proxy.createToolBarContributionItem(
257:                                toolBarManager, id);
258:                    }
259:                    return getActionBarPresentationFactory()
260:                            .createToolBarContributionItem(toolBarManager, id);
261:                }
262:            }
263:
264:            /**
265:             * Creates a new workbench window configurer.
266:             * <p>
267:             * This method is declared package-private. Clients obtain instances
268:             * via {@link WorkbenchAdvisor#getWindowConfigurer 
269:             * WorkbenchAdvisor.getWindowConfigurer}
270:             * </p>
271:             * 
272:             * @param window the workbench window that this object configures
273:             * @see WorkbenchAdvisor#getWindowConfigurer
274:             */
275:            WorkbenchWindowConfigurer(WorkbenchWindow window) {
276:                if (window == null) {
277:                    throw new IllegalArgumentException();
278:                }
279:                this .window = window;
280:                windowTitle = WorkbenchPlugin.getDefault().getProductName();
281:                if (windowTitle == null) {
282:                    windowTitle = ""; //$NON-NLS-1$
283:                }
284:            }
285:
286:            /* (non-javadoc)
287:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer#getWindow
288:             */
289:            public IWorkbenchWindow getWindow() {
290:                return window;
291:            }
292:
293:            /* (non-Javadoc)
294:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer#getWorkbenchConfigurer()
295:             */
296:            public IWorkbenchConfigurer getWorkbenchConfigurer() {
297:                return Workbench.getInstance().getWorkbenchConfigurer();
298:            }
299:
300:            /**
301:             * Returns the title as set by <code>setTitle</code>, without consulting the shell.
302:             * 
303:             * @return the window title as set, or <code>null</code> if not set
304:             */
305:            /* package */String basicGetTitle() {
306:                return windowTitle;
307:            }
308:
309:            /* (non-javadoc)
310:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer#getTitle
311:             */
312:            public String getTitle() {
313:                Shell shell = window.getShell();
314:                if (shell != null) {
315:                    // update the cached title
316:                    windowTitle = shell.getText();
317:                }
318:                return windowTitle;
319:            }
320:
321:            /* (non-javadoc)
322:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer#setTitle
323:             */
324:            public void setTitle(String title) {
325:                if (title == null) {
326:                    throw new IllegalArgumentException();
327:                }
328:                windowTitle = title;
329:                Shell shell = window.getShell();
330:                if (shell != null && !shell.isDisposed()) {
331:                    shell.setText(TextProcessor.process(title,
332:                            WorkbenchWindow.TEXT_DELIMITERS));
333:                }
334:            }
335:
336:            /* (non-javadoc)
337:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer#getShowMenuBar
338:             */
339:            public boolean getShowMenuBar() {
340:                return showMenuBar;
341:            }
342:
343:            /* (non-javadoc)
344:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer#setShowMenuBar
345:             */
346:            public void setShowMenuBar(boolean show) {
347:                showMenuBar = show;
348:                WorkbenchWindow win = (WorkbenchWindow) getWindow();
349:                Shell shell = win.getShell();
350:                if (shell != null) {
351:                    boolean showing = shell.getMenuBar() != null;
352:                    if (show != showing) {
353:                        if (show) {
354:                            shell.setMenuBar(win.getMenuBarManager().getMenu());
355:                        } else {
356:                            shell.setMenuBar(null);
357:                        }
358:                    }
359:                }
360:            }
361:
362:            /* (non-javadoc)
363:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer#getShowToolBar
364:             */
365:            public boolean getShowCoolBar() {
366:                return showToolBar;
367:            }
368:
369:            /* (non-javadoc)
370:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
371:             */
372:            public void setShowCoolBar(boolean show) {
373:                showToolBar = show;
374:                window.setCoolBarVisible(show);
375:                // @issue need to be able to reconfigure after window's controls created
376:            }
377:
378:            /* (non-javadoc)
379:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
380:             */
381:            public boolean getShowFastViewBars() {
382:                return showFastViewBars;
383:            }
384:
385:            /* (non-javadoc)
386:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
387:             */
388:            public void setShowFastViewBars(boolean show) {
389:                showFastViewBars = show;
390:                window.setFastViewBarVisible(show);
391:                // @issue need to be able to reconfigure after window's controls created
392:            }
393:
394:            /* (non-javadoc)
395:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
396:             */
397:            public boolean getShowPerspectiveBar() {
398:                return showPerspectiveBar;
399:            }
400:
401:            /* (non-javadoc)
402:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
403:             */
404:            public void setShowPerspectiveBar(boolean show) {
405:                showPerspectiveBar = show;
406:                window.setPerspectiveBarVisible(show);
407:                // @issue need to be able to reconfigure after window's controls created
408:            }
409:
410:            /* (non-javadoc)
411:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer#getShowStatusLine
412:             */
413:            public boolean getShowStatusLine() {
414:                return showStatusLine;
415:            }
416:
417:            /* (non-javadoc)
418:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer#setShowStatusLine
419:             */
420:            public void setShowStatusLine(boolean show) {
421:                showStatusLine = show;
422:                // @issue need to be able to reconfigure after window's controls created
423:            }
424:
425:            /* (non-Javadoc)
426:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
427:             */
428:            public boolean getShowProgressIndicator() {
429:                return showProgressIndicator;
430:            }
431:
432:            /* (non-Javadoc)
433:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
434:             */
435:            public void setShowProgressIndicator(boolean show) {
436:                showProgressIndicator = show;
437:                // @issue need to be able to reconfigure after window's controls created
438:            }
439:
440:            /* (non-javadoc)
441:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer#getData
442:             */
443:            public Object getData(String key) {
444:                if (key == null) {
445:                    throw new IllegalArgumentException();
446:                }
447:                return extraData.get(key);
448:            }
449:
450:            /* (non-javadoc)
451:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer#setData
452:             */
453:            public void setData(String key, Object data) {
454:                if (key == null) {
455:                    throw new IllegalArgumentException();
456:                }
457:                if (data != null) {
458:                    extraData.put(key, data);
459:                } else {
460:                    extraData.remove(key);
461:                }
462:            }
463:
464:            /* (non-Javadoc)
465:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer#addEditorAreaTransfer
466:             */
467:            public void addEditorAreaTransfer(Transfer tranfer) {
468:                if (tranfer != null && !transferTypes.contains(tranfer)) {
469:                    transferTypes.add(tranfer);
470:                    Transfer[] transfers = new Transfer[transferTypes.size()];
471:                    transferTypes.toArray(transfers);
472:                    IWorkbenchPage[] pages = window.getPages();
473:                    for (int i = 0; i < pages.length; i++) {
474:                        WorkbenchPage page = (WorkbenchPage) pages[i];
475:                        DropTarget dropTarget = ((EditorSashContainer) page
476:                                .getEditorPresentation().getLayoutPart())
477:                                .getDropTarget();
478:                        if (dropTarget != null) {
479:                            dropTarget.setTransfer(transfers);
480:                        }
481:                    }
482:                }
483:            }
484:
485:            /* (non-Javadoc)
486:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
487:             */
488:            public void configureEditorAreaDropListener(
489:                    DropTargetListener dropTargetListener) {
490:                if (dropTargetListener != null) {
491:                    this .dropTargetListener = dropTargetListener;
492:                    IWorkbenchPage[] pages = window.getPages();
493:                    for (int i = 0; i < pages.length; i++) {
494:                        WorkbenchPage page = (WorkbenchPage) pages[i];
495:                        DropTarget dropTarget = ((EditorSashContainer) page
496:                                .getEditorPresentation().getLayoutPart())
497:                                .getDropTarget();
498:                        if (dropTarget != null) {
499:                            dropTarget.addDropListener(this .dropTargetListener);
500:                        }
501:                    }
502:                }
503:            }
504:
505:            /**
506:             * Returns the array of <code>Transfer</code> added by the application
507:             */
508:            /* package */Transfer[] getTransfers() {
509:                Transfer[] transfers = new Transfer[transferTypes.size()];
510:                transferTypes.toArray(transfers);
511:                return transfers;
512:            }
513:
514:            /**
515:             * Returns the drop listener provided by the application.
516:             */
517:            /* package */DropTargetListener getDropTargetListener() {
518:                return dropTargetListener;
519:            }
520:
521:            /* (non-javadoc)
522:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
523:             */
524:            public IActionBarConfigurer getActionBarConfigurer() {
525:                if (actionBarConfigurer == null) {
526:                    // lazily initialize
527:                    actionBarConfigurer = new WindowActionBarConfigurer();
528:                }
529:                return actionBarConfigurer;
530:            }
531:
532:            /**
533:             * Returns whether the given id is for a cool item.
534:             * 
535:             * @param the item id
536:             * @return <code>true</code> if it is a cool item,
537:             * and <code>false</code> otherwise
538:             */
539:            /* package */boolean containsCoolItem(String id) {
540:                // trigger lazy initialization
541:                getActionBarConfigurer();
542:                return actionBarConfigurer.containsCoolItem(id);
543:            }
544:
545:            /* (non-Javadoc)
546:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
547:             */
548:            public int getShellStyle() {
549:                return shellStyle;
550:            }
551:
552:            /* (non-Javadoc)
553:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
554:             */
555:            public void setShellStyle(int shellStyle) {
556:                this .shellStyle = shellStyle;
557:            }
558:
559:            /* (non-Javadoc)
560:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
561:             */
562:            public Point getInitialSize() {
563:                return initialSize;
564:            }
565:
566:            /* (non-Javadoc)
567:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
568:             */
569:            public void setInitialSize(Point size) {
570:                initialSize = size;
571:            }
572:
573:            /* (non-Javadoc)
574:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
575:             */
576:            public AbstractPresentationFactory getPresentationFactory() {
577:                if (presentationFactory == null) {
578:                    presentationFactory = createDefaultPresentationFactory();
579:                }
580:                return presentationFactory;
581:            }
582:
583:            /**
584:             * Creates the default presentation factory by looking up the presentation
585:             * factory extension with the id specified by the presentation factory preference.
586:             * If the preference is null or if no matching extension is found, a
587:             * factory default presentation factory is used.
588:             */
589:            private AbstractPresentationFactory createDefaultPresentationFactory() {
590:                final String factoryId = ((Workbench) window.getWorkbench())
591:                        .getPresentationId();
592:
593:                if (factoryId != null && factoryId.length() > 0) {
594:                    final AbstractPresentationFactory[] factory = new AbstractPresentationFactory[1];
595:                    StartupThreading
596:                            .runWithoutExceptions(new StartupRunnable() {
597:
598:                                public void runWithException() throws Throwable {
599:                                    factory[0] = WorkbenchPlugin.getDefault()
600:                                            .getPresentationFactory(factoryId);
601:                                }
602:                            });
603:
604:                    if (factory[0] != null) {
605:                        return factory[0];
606:                    }
607:                }
608:                // presentation ID must be a bogus value, reset it to the default
609:                PrefUtil.getAPIPreferenceStore().setValue(
610:                        IWorkbenchPreferenceConstants.PRESENTATION_FACTORY_ID,
611:                        IWorkbenchConstants.DEFAULT_PRESENTATION_ID);
612:                return new WorkbenchPresentationFactory_33();
613:            }
614:
615:            /* (non-Javadoc)
616:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
617:             */
618:            public void setPresentationFactory(
619:                    AbstractPresentationFactory factory) {
620:                if (factory == null) {
621:                    throw new IllegalArgumentException();
622:                }
623:                presentationFactory = factory;
624:            }
625:
626:            /**
627:             * Creates the default window contents.
628:             * 
629:             * @param shell the shell
630:             */
631:            public void createDefaultContents(Shell shell) {
632:                window.createDefaultContents(shell);
633:            }
634:
635:            /* (non-Javadoc)
636:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
637:             */
638:            public Menu createMenuBar() {
639:                return window.getMenuManager().createMenuBar(window.getShell());
640:            }
641:
642:            /* (non-Javadoc)
643:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
644:             */
645:            public Control createCoolBarControl(Composite parent) {
646:                ICoolBarManager coolBarManager = window.getCoolBarManager2();
647:                if (coolBarManager != null) {
648:                    if (coolBarManager instanceof  ICoolBarManager2) {
649:                        return ((ICoolBarManager2) coolBarManager)
650:                                .createControl2(parent);
651:                    }
652:                    if (coolBarManager instanceof  CoolBarManager) {
653:                        return ((CoolBarManager) coolBarManager)
654:                                .createControl(parent);
655:                    }
656:                }
657:                return null;
658:            }
659:
660:            /* (non-Javadoc)
661:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
662:             */
663:            public Control createStatusLineControl(Composite parent) {
664:                return window.getStatusLineManager().createControl(parent);
665:            }
666:
667:            /* (non-Javadoc)
668:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
669:             */
670:            public Control createPageComposite(Composite parent) {
671:                return window.createPageComposite(parent);
672:            }
673:
674:            /* (non-Javadoc)
675:             * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer#saveState(org.eclipse.ui.IMemento)
676:             */
677:            public IStatus saveState(IMemento memento) {
678:                return window.saveState(memento);
679:            }
680:
681:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.