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


001:        /*******************************************************************************
002:         * Copyright (c) 2004, 2006 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.activities;
011:
012:        import java.util.Hashtable;
013:        import java.util.Properties;
014:
015:        import org.eclipse.core.runtime.IConfigurationElement;
016:        import org.eclipse.core.runtime.IExecutableExtension;
017:        import org.eclipse.jface.dialogs.Dialog;
018:        import org.eclipse.jface.dialogs.IDialogConstants;
019:        import org.eclipse.jface.preference.PreferencePage;
020:        import org.eclipse.swt.SWT;
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.ui.IWorkbench;
027:        import org.eclipse.ui.IWorkbenchPreferencePage;
028:        import org.eclipse.ui.internal.IPreferenceConstants;
029:        import org.eclipse.ui.internal.WorkbenchPlugin;
030:        import org.eclipse.ui.internal.activities.ws.ActivityEnabler;
031:        import org.eclipse.ui.internal.activities.ws.ActivityMessages;
032:
033:        /**
034:         * Preference page that allows configuration of the activity set. This page may
035:         * be used by product developers to provide basic ability to tweak the enabled
036:         * activity set. You may provide the certain strings to this class via method #2
037:         * of {@link org.eclipse.core.runtime.IExecutableExtension}.
038:         * 
039:         * @see #ACTIVITY_NAME
040:         * @see #ACTIVITY_PROMPT_BUTTON
041:         * @see #ACTIVITY_PROMPT_BUTTON_TOOLTIP
042:         * @since 3.1
043:         */
044:        public final class ActivitiesPreferencePage extends PreferencePage
045:                implements  IWorkbenchPreferencePage, IExecutableExtension {
046:
047:            /**
048:             * The name to use for the activities.  Ie: "Capabilities".
049:             */
050:            public static final String ACTIVITY_NAME = "activityName"; //$NON-NLS-1$
051:
052:            /**
053:             * The label to be used for the prompt button. Ie: "&Prompt when enabling capabilities".
054:             */
055:            public static final String ACTIVITY_PROMPT_BUTTON = "activityPromptButton"; //$NON-NLS-1$
056:
057:            /**
058:             * The tooltip to be used for the prompt button. Ie: "Prompt when a feature is first used that requires enablement of capabilities".
059:             */
060:            public static final String ACTIVITY_PROMPT_BUTTON_TOOLTIP = "activityPromptButtonTooltip"; //$NON-NLS-1$
061:
062:            private Button activityPromptButton;
063:
064:            private IWorkbench workbench;
065:
066:            private ActivityEnabler enabler;
067:
068:            private Properties strings = new Properties();
069:
070:            private IMutableActivityManager workingCopy;
071:
072:            /**
073:             * Create the prompt for activity enablement.
074:             * 
075:             * @param composite the parent
076:             */
077:            protected void createActivityPromptPref(Composite composite) {
078:                activityPromptButton = new Button(composite, SWT.CHECK);
079:                activityPromptButton.setText(strings.getProperty(
080:                        ACTIVITY_PROMPT_BUTTON,
081:                        ActivityMessages.activityPromptButton));
082:                activityPromptButton.setToolTipText(strings.getProperty(
083:                        ACTIVITY_PROMPT_BUTTON_TOOLTIP,
084:                        ActivityMessages.activityPromptToolTip));
085:
086:                setActivityButtonState();
087:            }
088:
089:            /**
090:             * Sets the state of the activity prompt button from preferences.
091:             */
092:            private void setActivityButtonState() {
093:                activityPromptButton
094:                        .setSelection(getPreferenceStore()
095:                                .getBoolean(
096:                                        IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT));
097:            }
098:
099:            /* (non-Javadoc)
100:             * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
101:             */
102:            protected Control createContents(Composite parent) {
103:                initializeDialogUnits(parent);
104:
105:                Composite composite = new Composite(parent, SWT.NONE);
106:                GridLayout layout = new GridLayout();
107:                layout.marginHeight = 0;
108:                layout.marginWidth = 0;
109:                layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
110:                layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
111:                composite.setLayout(layout);
112:
113:                createActivityPromptPref(composite);
114:                GridData data = new GridData(GridData.FILL_HORIZONTAL);
115:                activityPromptButton.setLayoutData(data);
116:
117:                data = new GridData(GridData.FILL_BOTH);
118:                workingCopy = workbench.getActivitySupport()
119:                        .createWorkingCopy();
120:                enabler = new ActivityEnabler(workingCopy, strings);
121:                enabler.createControl(composite).setLayoutData(data);
122:
123:                Dialog.applyDialogFont(composite);
124:
125:                return composite;
126:            }
127:
128:            /* (non-Javadoc)
129:             * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
130:             */
131:            public void init(IWorkbench aWorkbench) {
132:                this .workbench = aWorkbench;
133:                setPreferenceStore(WorkbenchPlugin.getDefault()
134:                        .getPreferenceStore());
135:            }
136:
137:            /* (non-Javadoc)
138:             * @see org.eclipse.jface.preference.IPreferencePage#performOk()
139:             */
140:            public boolean performOk() {
141:                enabler.updateActivityStates();
142:                workbench.getActivitySupport().setEnabledActivityIds(
143:                        workingCopy.getEnabledActivityIds());
144:
145:                getPreferenceStore().setValue(
146:                        IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT,
147:                        activityPromptButton.getSelection());
148:
149:                return true;
150:            }
151:
152:            /* (non-Javadoc)
153:             * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
154:             */
155:            protected void performDefaults() {
156:                enabler.restoreDefaults();
157:                activityPromptButton
158:                        .setSelection(getPreferenceStore()
159:                                .getDefaultBoolean(
160:                                        IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT));
161:                super .performDefaults();
162:            }
163:
164:            /* (non-Javadoc)
165:             * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
166:             */
167:            public void setInitializationData(IConfigurationElement config,
168:                    String propertyName, Object data) {
169:                if (data instanceof  Hashtable) {
170:                    strings.putAll((Hashtable) data);
171:                }
172:            }
173:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.