Source Code Cross Referenced for WorkbenchConfigurer.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, 2005 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.HashMap;
013:        import java.util.Map;
014:
015:        import org.eclipse.core.runtime.IStatus;
016:        import org.eclipse.jface.resource.ImageDescriptor;
017:        import org.eclipse.jface.window.WindowManager;
018:        import org.eclipse.ui.IMemento;
019:        import org.eclipse.ui.IWorkbench;
020:        import org.eclipse.ui.IWorkbenchWindow;
021:        import org.eclipse.ui.PlatformUI;
022:        import org.eclipse.ui.WorkbenchException;
023:        import org.eclipse.ui.application.IWorkbenchConfigurer;
024:        import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
025:        import org.eclipse.ui.application.WorkbenchAdvisor;
026:
027:        /**
028:         * Internal class providing special access for configuring the workbench.
029:         * <p>
030:         * Note that these objects are only available to the main application
031:         * (the plug-in that creates and owns the workbench).
032:         * </p>
033:         * <p>
034:         * This class is not intended to be instantiated or subclassed by clients.
035:         * </p>
036:         * 
037:         * @since 3.0
038:         */
039:        public final class WorkbenchConfigurer implements  IWorkbenchConfigurer {
040:
041:            /**
042:             * Table to hold arbitrary key-data settings (key type: <code>String</code>,
043:             * value type: <code>Object</code>).
044:             * @see #setData
045:             */
046:            private Map extraData = new HashMap();
047:
048:            /**
049:             * Indicates whether workbench state should be saved on close and 
050:             * restored on subsequent open.
051:             */
052:            private boolean saveAndRestore = false;
053:
054:            /**
055:             * Indicates whether the workbench is being force to close. During
056:             * an emergency close, no interaction with the user should be done.
057:             */
058:            private boolean isEmergencyClosing = false;
059:
060:            /**
061:             * Indicates the behaviour when the last window is closed.
062:             * If <code>true</code>, the workbench will exit (saving the last window's state, 
063:             * if configured to do so).
064:             * If <code>false</code> the window will be closed, leaving the workbench running.
065:             * 
066:             * @since 3.1
067:             */
068:            private boolean exitOnLastWindowClose = true;
069:
070:            /**
071:             * Creates a new workbench configurer.
072:             * <p>
073:             * This method is declared package-private. Clients are passed an instance
074:             * only via {@link WorkbenchAdvisor#initialize WorkbenchAdvisor.initialize}
075:             * </p>
076:             */
077:            /* package */WorkbenchConfigurer() {
078:                super ();
079:            }
080:
081:            /* (non-javadoc)
082:             * @see org.eclipse.ui.application.IWorkbenchConfigurer#getWorkbench
083:             */
084:            public IWorkbench getWorkbench() {
085:                return PlatformUI.getWorkbench();
086:            }
087:
088:            /* (non-javadoc)
089:             * @see org.eclipse.ui.application.IWorkbenchConfigurer#getWorkbenchWindowManager
090:             */
091:            public WindowManager getWorkbenchWindowManager() {
092:                // return the global workbench window manager
093:                return ((Workbench) getWorkbench()).getWindowManager();
094:            }
095:
096:            /* (non-javadoc)
097:             * @see org.eclipse.ui.application.IWorkbenchConfigurer#declareImage
098:             */
099:            public void declareImage(String symbolicName,
100:                    ImageDescriptor descriptor, boolean shared) {
101:                if (symbolicName == null || descriptor == null) {
102:                    throw new IllegalArgumentException();
103:                }
104:                WorkbenchImages.declareImage(symbolicName, descriptor, shared);
105:            }
106:
107:            /* (non-javadoc)
108:             * @see org.eclipse.ui.application.IWorkbenchConfigurer#getWindowConfigurer
109:             */
110:            public IWorkbenchWindowConfigurer getWindowConfigurer(
111:                    IWorkbenchWindow window) {
112:                if (window == null) {
113:                    throw new IllegalArgumentException();
114:                }
115:                return ((WorkbenchWindow) window).getWindowConfigurer();
116:            }
117:
118:            /* (non-Javadoc)
119:             * @see org.eclipse.ui.application.IWorkbenchConfigurer#getSaveAndRestore()
120:             */
121:            public boolean getSaveAndRestore() {
122:                return saveAndRestore;
123:            }
124:
125:            /* (non-Javadoc)
126:             * @see org.eclipse.ui.application.IWorkbenchConfigurer#setSaveAndRestore(boolean)
127:             */
128:            public void setSaveAndRestore(boolean enabled) {
129:                saveAndRestore = enabled;
130:            }
131:
132:            /* (non-Javadoc)
133:             * @see org.eclipse.ui.application.IWorkbenchConfigurer#getData
134:             */
135:            public Object getData(String key) {
136:                if (key == null) {
137:                    throw new IllegalArgumentException();
138:                }
139:                return extraData.get(key);
140:            }
141:
142:            /* (non-Javadoc)
143:             * @see org.eclipse.ui.application.IWorkbenchConfigurer#setData(String, Object)
144:             */
145:            public void setData(String key, Object data) {
146:                if (key == null) {
147:                    throw new IllegalArgumentException();
148:                }
149:                if (data != null) {
150:                    extraData.put(key, data);
151:                } else {
152:                    extraData.remove(key);
153:                }
154:            }
155:
156:            /* (non-Javadoc)
157:             * @see org.eclipse.ui.application.IWorkbenchConfigurer#emergencyClose()
158:             */
159:            public void emergencyClose() {
160:                if (!isEmergencyClosing) {
161:                    isEmergencyClosing = true;
162:                    if (Workbench.getInstance() != null
163:                            && !Workbench.getInstance().isClosing()) {
164:                        Workbench.getInstance().close(
165:                                PlatformUI.RETURN_EMERGENCY_CLOSE, true);
166:                    }
167:                }
168:
169:            }
170:
171:            /* (non-Javadoc)
172:             * @see org.eclipse.ui.application.IWorkbenchConfigurer#emergencyClosing()
173:             */
174:            public boolean emergencyClosing() {
175:                return isEmergencyClosing;
176:            }
177:
178:            /* (non-Javadoc)
179:             * @see org.eclipse.ui.application.IWorkbenchConfigurer#restoreState()
180:             */
181:            public IStatus restoreState() {
182:                return ((Workbench) getWorkbench()).restoreState();
183:            }
184:
185:            /* (non-Javadoc)
186:             * @see org.eclipse.ui.application.IWorkbenchConfigurer#openFirstTimeWindow()
187:             */
188:            public void openFirstTimeWindow() {
189:                ((Workbench) getWorkbench()).openFirstTimeWindow();
190:            }
191:
192:            /* (non-Javadoc)
193:             * @see org.eclipse.ui.application.IWorkbenchConfigurer#restoreWorkbenchWindow(org.eclipse.ui.IMemento)
194:             */
195:            public IWorkbenchWindowConfigurer restoreWorkbenchWindow(
196:                    IMemento memento) throws WorkbenchException {
197:                return getWindowConfigurer(((Workbench) getWorkbench())
198:                        .restoreWorkbenchWindow(memento));
199:            }
200:
201:            /* (non-Javadoc)
202:             * @see org.eclipse.ui.application.IWorkbenchConfigurer#getExitOnLastWindowClose()
203:             */
204:            public boolean getExitOnLastWindowClose() {
205:                return exitOnLastWindowClose;
206:            }
207:
208:            /* (non-Javadoc)
209:             * @see org.eclipse.ui.application.IWorkbenchConfigurer#setExitOnLastWindowClose(boolean)
210:             */
211:            public void setExitOnLastWindowClose(boolean enabled) {
212:                exitOnLastWindowClose = enabled;
213:            }
214:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.