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


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 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.ide.dialogs;
011:
012:        import org.eclipse.core.resources.IResource;
013:        import org.eclipse.core.resources.ResourcesPlugin;
014:        import org.eclipse.core.runtime.Preferences;
015:        import org.eclipse.jface.dialogs.MessageDialog;
016:        import org.eclipse.jface.preference.PreferencePage;
017:        import org.eclipse.swt.SWT;
018:        import org.eclipse.swt.events.SelectionAdapter;
019:        import org.eclipse.swt.events.SelectionEvent;
020:        import org.eclipse.swt.graphics.Font;
021:        import org.eclipse.swt.layout.GridData;
022:        import org.eclipse.swt.layout.GridLayout;
023:        import org.eclipse.swt.widgets.Button;
024:        import org.eclipse.swt.widgets.Composite;
025:        import org.eclipse.swt.widgets.Control;
026:        import org.eclipse.swt.widgets.Label;
027:        import org.eclipse.ui.IWorkbench;
028:        import org.eclipse.ui.IWorkbenchPreferencePage;
029:        import org.eclipse.ui.PlatformUI;
030:        import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
031:        import org.eclipse.ui.internal.ide.IIDEHelpContextIds;
032:
033:        /**
034:         * Preference page for linked resources. 
035:         * This preference page allows enabling and disabling the workbench linked 
036:         * resource support.
037:         * It also shows all path variables currently defined in the workspace's path 
038:         * variable manager. The user may add, edit and remove path variables. 
039:         *  
040:         * @see org.eclipse.ui.internal.ide.dialogs.PathVariableDialog
041:         */
042:        public class LinkedResourcesPreferencePage extends PreferencePage
043:                implements  IWorkbenchPreferencePage {
044:            private Label topLabel;
045:
046:            private PathVariablesGroup pathVariablesGroup;
047:
048:            /**
049:             * Constructs a preference page of path variables.
050:             * Omits "Restore Defaults"/"Apply Changes" buttons.
051:             */
052:            public LinkedResourcesPreferencePage() {
053:                pathVariablesGroup = new PathVariablesGroup(true,
054:                        IResource.FILE | IResource.FOLDER);
055:
056:                this .noDefaultAndApplyButton();
057:            }
058:
059:            /**
060:             * Resets this page's internal state and creates its UI contents.
061:             * 
062:             * @see PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
063:             */
064:            protected Control createContents(Composite parent) {
065:                Font font = parent.getFont();
066:
067:                PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
068:                        IIDEHelpContextIds.LINKED_RESOURCE_PREFERENCE_PAGE);
069:                // define container & its gridding
070:                Composite pageComponent = new Composite(parent, SWT.NULL);
071:                GridLayout layout = new GridLayout();
072:                layout.marginWidth = 0;
073:                layout.marginHeight = 0;
074:                pageComponent.setLayout(layout);
075:                GridData data = new GridData();
076:                data.verticalAlignment = GridData.FILL;
077:                data.horizontalAlignment = GridData.FILL;
078:                pageComponent.setLayoutData(data);
079:                pageComponent.setFont(font);
080:
081:                final Button enableLinkedResourcesButton = new Button(
082:                        pageComponent, SWT.CHECK);
083:                enableLinkedResourcesButton
084:                        .setText(IDEWorkbenchMessages.LinkedResourcesPreference_enableLinkedResources);
085:                enableLinkedResourcesButton.setFont(font);
086:                enableLinkedResourcesButton
087:                        .addSelectionListener(new SelectionAdapter() {
088:                            public void widgetSelected(SelectionEvent e) {
089:                                boolean enabled = enableLinkedResourcesButton
090:                                        .getSelection();
091:                                Preferences preferences = ResourcesPlugin
092:                                        .getPlugin().getPluginPreferences();
093:                                preferences.setValue(
094:                                        ResourcesPlugin.PREF_DISABLE_LINKING,
095:                                        !enabled);
096:
097:                                updateWidgetState(enabled);
098:                                if (enabled) {
099:                                    MessageDialog
100:                                            .openWarning(
101:                                                    getShell(),
102:                                                    IDEWorkbenchMessages.LinkedResourcesPreference_linkedResourcesWarningTitle,
103:                                                    IDEWorkbenchMessages.LinkedResourcesPreference_linkedResourcesWarningMessage);
104:                                }
105:                            }
106:                        });
107:
108:                createSpace(pageComponent);
109:
110:                topLabel = new Label(pageComponent, SWT.NONE);
111:                topLabel
112:                        .setText(IDEWorkbenchMessages.LinkedResourcesPreference_explanation);
113:                data = new GridData();
114:                data.verticalAlignment = GridData.FILL;
115:                data.horizontalAlignment = GridData.FILL;
116:                topLabel.setLayoutData(data);
117:                topLabel.setFont(font);
118:
119:                pathVariablesGroup.createContents(pageComponent);
120:
121:                Preferences preferences = ResourcesPlugin.getPlugin()
122:                        .getPluginPreferences();
123:                boolean enableLinking = !preferences
124:                        .getBoolean(ResourcesPlugin.PREF_DISABLE_LINKING);
125:                enableLinkedResourcesButton.setSelection(enableLinking);
126:                updateWidgetState(enableLinking);
127:                return pageComponent;
128:            }
129:
130:            /**
131:             * Creates a tab of one horizontal spans.
132:             *
133:             * @param parent  the parent in which the tab should be created
134:             */
135:            protected static void createSpace(Composite parent) {
136:                Label vfiller = new Label(parent, SWT.LEFT);
137:                GridData gridData = new GridData();
138:                gridData = new GridData();
139:                gridData.horizontalAlignment = GridData.BEGINNING;
140:                gridData.grabExcessHorizontalSpace = false;
141:                gridData.verticalAlignment = GridData.CENTER;
142:                gridData.grabExcessVerticalSpace = false;
143:                vfiller.setLayoutData(gridData);
144:            }
145:
146:            /**
147:             * Disposes the path variables group.
148:             * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
149:             */
150:            public void dispose() {
151:                pathVariablesGroup.dispose();
152:                super .dispose();
153:            }
154:
155:            /**
156:             * Empty implementation. This page does not use the workbench.
157:             * 
158:             * @see IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
159:             */
160:            public void init(IWorkbench workbench) {
161:            }
162:
163:            /**
164:             * Commits the temporary state to the path variable manager in response to user
165:             * confirmation.
166:             * 
167:             * @see PreferencePage#performOk()
168:             * @see PathVariablesGroup#performOk()
169:             */
170:            public boolean performOk() {
171:                return pathVariablesGroup.performOk();
172:            }
173:
174:            /**
175:             * Set the widget enabled state
176:             * 
177:             * @param enableLinking the new widget enabled state
178:             */
179:            protected void updateWidgetState(boolean enableLinking) {
180:                topLabel.setEnabled(enableLinking);
181:                pathVariablesGroup.setEnabled(enableLinking);
182:            }
183:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.