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


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 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.jdt.internal.ui.refactoring;
011:
012:        import org.eclipse.swt.SWT;
013:        import org.eclipse.swt.events.SelectionAdapter;
014:        import org.eclipse.swt.events.SelectionEvent;
015:        import org.eclipse.swt.widgets.Button;
016:        import org.eclipse.swt.widgets.Composite;
017:
018:        import org.eclipse.ltk.core.refactoring.Refactoring;
019:
020:        import org.eclipse.jdt.internal.corext.refactoring.tagging.IDelegateUpdating;
021:
022:        import org.eclipse.jdt.internal.ui.JavaPlugin;
023:
024:        /**
025:         * This is a helper class to keep a consistent design between refactorings
026:         * capable of creating delegates.
027:         * 
028:         * @since 3.2
029:         * 
030:         */
031:        public class DelegateUIHelper {
032:
033:            public static Button generateDeprecateDelegateCheckbox(
034:                    Composite parent, Refactoring refactoring) {
035:                final IDelegateUpdating updating = (IDelegateUpdating) refactoring
036:                        .getAdapter(IDelegateUpdating.class);
037:                if (updating == null || !updating.canEnableDelegateUpdating())
038:                    return null;
039:                final Button button = createCheckbox(parent,
040:                        getDeprecateDelegateCheckBoxTitle(),
041:                        loadDeprecateDelegateSetting(updating));
042:                updating.setDeprecateDelegates(button.getSelection());
043:                button.addSelectionListener(new SelectionAdapter() {
044:
045:                    public void widgetSelected(SelectionEvent e) {
046:                        updating.setDeprecateDelegates(button.getSelection());
047:                    }
048:                });
049:                return button;
050:            }
051:
052:            public static Button generateLeaveDelegateCheckbox(
053:                    Composite parent, Refactoring refactoring, boolean plural) {
054:                final IDelegateUpdating updating = (IDelegateUpdating) refactoring
055:                        .getAdapter(IDelegateUpdating.class);
056:                if (updating == null || !updating.canEnableDelegateUpdating())
057:                    return null;
058:                final Button button = createCheckbox(parent, updating
059:                        .getDelegateUpdatingTitle(plural),
060:                        loadLeaveDelegateSetting(updating));
061:                updating.setDelegateUpdating(button.getSelection());
062:                button.addSelectionListener(new SelectionAdapter() {
063:
064:                    public void widgetSelected(SelectionEvent e) {
065:                        updating.setDelegateUpdating(button.getSelection());
066:                    }
067:                });
068:                return button;
069:            }
070:
071:            public static void saveLeaveDelegateSetting(Button button) {
072:                saveBooleanSetting(DELEGATE_UPDATING, button);
073:            }
074:
075:            public static void saveDeprecateDelegateSetting(Button button) {
076:                saveBooleanSetting(DELEGATE_DEPRECATION, button);
077:            }
078:
079:            public static boolean loadLeaveDelegateSetting(
080:                    IDelegateUpdating refactoring) {
081:                return getBooleanSetting(DELEGATE_UPDATING, refactoring
082:                        .getDelegateUpdating());
083:            }
084:
085:            public static boolean loadDeprecateDelegateSetting(
086:                    IDelegateUpdating refactoring) {
087:                return getBooleanSetting(DELEGATE_DEPRECATION, refactoring
088:                        .getDeprecateDelegates());
089:            }
090:
091:            public static String getDeprecateDelegateCheckBoxTitle() {
092:                return RefactoringMessages.DelegateCreator_deprecate_delegates;
093:            }
094:
095:            // ************** Helper methods *******************
096:
097:            /**
098:             * Dialog settings key (value is of type boolean).
099:             */
100:            public static final String DELEGATE_UPDATING = "delegateUpdating"; //$NON-NLS-1$
101:
102:            /**
103:             * Dialog settings key (value is of type boolean).
104:             */
105:            public static final String DELEGATE_DEPRECATION = "delegateDeprecation"; //$NON-NLS-1$
106:
107:            private DelegateUIHelper() {
108:                // no instances
109:            }
110:
111:            private static Button createCheckbox(Composite parent,
112:                    String title, boolean value) {
113:                Button checkBox = new Button(parent, SWT.CHECK);
114:                checkBox.setText(title);
115:                checkBox.setSelection(value);
116:                return checkBox;
117:            }
118:
119:            private static boolean getBooleanSetting(String key,
120:                    boolean defaultValue) {
121:                String update = JavaPlugin.getDefault().getDialogSettings()
122:                        .get(key);
123:                if (update != null)
124:                    return Boolean.valueOf(update).booleanValue();
125:                else
126:                    return defaultValue;
127:            }
128:
129:            private static void saveBooleanSetting(String key, Button button) {
130:                if (button != null && !button.isDisposed()
131:                        && button.getEnabled())
132:                    JavaPlugin.getDefault().getDialogSettings().put(key,
133:                            button.getSelection());
134:            }
135:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.