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


001:        /*******************************************************************************
002:         * Copyright (c) 2005, 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.handlers;
011:
012:        import java.util.Hashtable;
013:
014:        import org.eclipse.core.runtime.IConfigurationElement;
015:        import org.eclipse.core.runtime.IExecutableExtension;
016:        import org.eclipse.jface.commands.RadioState;
017:
018:        /**
019:         * <p>
020:         * A radio state that can be read from the registry. This stores a piece of
021:         * boolean state information that is grouped with other boolean state to form a
022:         * radio group. In a single radio group, there can be at most one state who
023:         * value is {@link Boolean#TRUE} all the others must be {@link Boolean#FALSE}.
024:         * </p>
025:         * <p>
026:         * When parsing from the registry, this state understands three parameters:
027:         * <code>default</code>, which is the default value for this item;
028:         * <code>persisted</code>, which is whether the state should be persisted
029:         * between sessions; <code>id</code>, which is the identifier of the group to
030:         * which this radio handler belongs. The <code>default</code> parameter
031:         * defaults to <code>false</code>, and the <code>persisted</code> parameter
032:         * defaults to <code>true</code>. If only one parameter is passed (i.e.,
033:         * using the class name followed by a colon), then it is assumed to be the
034:         * <code>id</code> parameter. The <code>id</code> is required for this class
035:         * to function properly.
036:         * </p>
037:         * <p>
038:         * Clients may instantiate this class, but must not extend.
039:         * </p>
040:         * 
041:         * @since 3.2
042:         */
043:        public final class RegistryRadioState extends RadioState implements 
044:                IExecutableExtension {
045:
046:            /**
047:             * Reads the <code>default</code> parameter from the given string. This
048:             * converts the string to a boolean, using <code>true</code> as the
049:             * default.
050:             * 
051:             * @param defaultString
052:             *            The string to parse; may be <code>null</code>.
053:             */
054:            private final void readDefault(final String defaultString) {
055:                if ("true".equalsIgnoreCase(defaultString)) { //$NON-NLS-1$
056:                    setValue(Boolean.TRUE);
057:                }
058:            }
059:
060:            /**
061:             * Reads the <code>persisted</code> parameter from the given string. This
062:             * converts the string to a boolean, using <code>true</code> as the
063:             * default.
064:             * 
065:             * @param persistedString
066:             *            The string to parse; may be <code>null</code>.
067:             */
068:            private final void readPersisted(final String persistedString) {
069:                if ("false".equalsIgnoreCase(persistedString)) { //$NON-NLS-1$
070:                    setShouldPersist(false);
071:                }
072:
073:                setShouldPersist(true);
074:            }
075:
076:            public final void setInitializationData(
077:                    final IConfigurationElement configurationElement,
078:                    final String propertyName, final Object data) {
079:                if (data instanceof  String) {
080:                    // This is the default value.
081:                    setRadioGroupIdentifier((String) data);
082:                    setValue(Boolean.FALSE);
083:                    setShouldPersist(true);
084:
085:                } else if (data instanceof  Hashtable) {
086:                    final Hashtable parameters = (Hashtable) data;
087:
088:                    final Object defaultObject = parameters.get("default"); //$NON-NLS-1$
089:                    if (defaultObject instanceof  String) {
090:                        readDefault((String) defaultObject);
091:                    }
092:
093:                    final Object persistedObject = parameters.get("persisted"); //$NON-NLS-1$
094:                    if (persistedObject instanceof  String) {
095:                        readPersisted((String) persistedObject);
096:                    }
097:
098:                    final Object idObject = parameters.get("id"); //$NON-NLS-1$
099:                    if (idObject instanceof  String) {
100:                        setRadioGroupIdentifier((String) idObject);
101:                    }
102:
103:                } else {
104:                    setShouldPersist(true);
105:
106:                }
107:            }
108:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.