Source Code Cross Referenced for UDIGWorkbenchWindowAdvisor.java in  » GIS » udig-1.1 » net » refractions » udig » internal » ui » 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 » GIS » udig 1.1 » net.refractions.udig.internal.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* uDig - User Friendly Desktop Internet GIS client
002:         * http://udig.refractions.net
003:         * (C) 2004, Refractions Research Inc.
004:         *
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation;
008:         * version 2.1 of the License.
009:         *
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:         * Lesser General Public License for more details.
014:         */
015:        package net.refractions.udig.internal.ui;
016:
017:        import net.refractions.udig.core.internal.CorePlugin;
018:        import net.refractions.udig.ui.UDIGDragDropUtilities;
019:        import net.refractions.udig.ui.WorkbenchConfiguration;
020:        import net.refractions.udig.ui.preferences.PreferenceConstants;
021:
022:        import org.eclipse.core.runtime.Platform;
023:        import org.eclipse.jface.preference.IPreferenceStore;
024:        import org.eclipse.ui.PlatformUI;
025:        import org.eclipse.ui.application.ActionBarAdvisor;
026:        import org.eclipse.ui.application.IActionBarConfigurer;
027:        import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
028:        import org.eclipse.ui.application.WorkbenchWindowAdvisor;
029:        import org.osgi.service.prefs.Preferences;
030:
031:        /**
032:         * Public base class for configuring a workbench window.
033:         * <p>
034:         * The workbench window advisor object is created in response to a workbench
035:         * window being created (one per window), and is used to configure the window.
036:         * </p>
037:         * <p>
038:         * An application should declare a subclass of
039:         * <code>WorkbenchWindowAdvisor</code> and override methods to configure
040:         * workbench windows to suit the needs of the particular application.
041:         * </p>
042:         * <p>
043:         * The following advisor methods are called at strategic points in the workbench
044:         * window's lifecycle (as with the workbench advisor, all occur within the
045:         * dynamic scope of the call to
046:         * {@link PlatformUI#createAndRunWorkbench PlatformUI.createAndRunWorkbench}):
047:         * <ul>
048:         * <li><code>preWindowOpen</code> - called as the window is being opened; use
049:         * to configure aspects of the window other than actions bars</li>
050:         * <li><code>postWindowRestore</code> - called after the window has been
051:         * recreated from a previously saved state; use to adjust the restored window</li>
052:         * <li><code>postWindowCreate</code> - called after the window has been
053:         * created, either from an initial state or from a restored state; used to
054:         * adjust the window</li>
055:         * <li><code>openIntro</code> - called immediately before the window is
056:         * opened in order to create the introduction component, if any.</li>
057:         * <li><code>postWindowOpen</code> - called after the window has been opened;
058:         * use to hook window listeners, etc.</li>
059:         * <li><code>preWindowShellClose</code> - called when the window's shell is
060:         * closed by the user; use to pre-screen window closings</li>
061:         * </ul>
062:         * </p>
063:         * 
064:         * @author cole.markham
065:         * @since 1.0.0
066:         */
067:        public class UDIGWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
068:
069:            /**
070:             * Constructor
071:             * 
072:             * @param configurer
073:             */
074:            public UDIGWorkbenchWindowAdvisor(
075:                    IWorkbenchWindowConfigurer configurer) {
076:                super (configurer);
077:            }
078:
079:            @Override
080:            public void preWindowOpen() {
081:                super .preWindowOpen();
082:                IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
083:                WorkbenchConfiguration configuration = lookupConfiguration();
084:                configuration.configureWorkbench(configurer);
085:
086:                UDIGDragDropUtilities.registerUDigDND(configurer);
087:            }
088:
089:            private WorkbenchConfiguration lookupConfiguration() {
090:
091:                Class interfaceClass = WorkbenchConfiguration.class;
092:                String prefConstant = PreferenceConstants.P_WORKBENCH_CONFIGURATION;
093:                String xpid = WorkbenchConfiguration.XPID;
094:                String idField = WorkbenchConfiguration.ATTR_ID;
095:                String classField = WorkbenchConfiguration.ATTR_CLASS;
096:
097:                WorkbenchConfiguration config = (WorkbenchConfiguration) UiPlugin
098:                        .lookupConfigurationObject(interfaceClass, UiPlugin
099:                                .getDefault().getPreferenceStore(),
100:                                UiPlugin.ID, prefConstant, xpid, idField,
101:                                classField);
102:
103:                if (config == null) {
104:                    return new UDIGWorkbenchConfiguration();
105:
106:                }
107:                return config;
108:            }
109:
110:            @Override
111:            public ActionBarAdvisor createActionBarAdvisor(
112:                    IActionBarConfigurer configurer) {
113:                return new UDIGActionBarAdvisor(configurer);
114:            }
115:
116:            @Override
117:            public void postWindowOpen() {
118:                super .postWindowOpen();
119:                try {
120:                    Preferences userPreferences = UiPlugin.getUserPreferences();
121:                    if (!userPreferences
122:                            .nodeExists("net.refractions.udig.ui.firstRun")) { //$NON-NLS-1$
123:                        firstRun();
124:                    } else {
125:                        showTip();
126:                    }
127:                } catch (Exception e) {
128:                    UiPlugin.log("", e); //$NON-NLS-1$
129:                }
130:            }
131:
132:            private void showTip() {
133:
134:                try {
135:                    IPreferenceStore store = UiPlugin.getDefault()
136:                            .getPreferenceStore();
137:                    if (store.getBoolean(PreferenceConstants.P_SHOW_TIPS)
138:                            && TipDialog.hasTips()
139:                            && !CorePlugin.isDeveloping()) {
140:                        TipDialog dialog = new TipDialog(this 
141:                                .getWindowConfigurer().getWindow().getShell());
142:                        dialog.setBlockOnOpen(false);
143:                        dialog.open();
144:                    }
145:                } catch (Exception e) {
146:                    UiPlugin.log("", e); //$NON-NLS-1$
147:                }
148:            }
149:
150:            private void firstRun() throws Exception {
151:                //		getWindowConfigurer().getWindow().getShell().setMaximized(true);
152:                Preferences userPreferences = UiPlugin.getUserPreferences();
153:                userPreferences
154:                        .node("net.refractions.udig.ui.firstRun").putBoolean("net.refractions.udig.ui.isFirstRun", false); //$NON-NLS-1$ //$NON-NLS-2$
155:
156:                if (Platform.getOS().equals(Platform.OS_LINUX)) {
157:                    LinuxAdvancedDialog dialog = new LinuxAdvancedDialog(
158:                            getWindowConfigurer().getWindow().getShell());
159:                    dialog.open();
160:                }
161:            }
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.