Source Code Cross Referenced for TemplateOption.java in  » IDE-Eclipse » Eclipse-plug-in-development » org » eclipse » pde » ui » templates » 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 » Eclipse plug in development » org.eclipse.pde.ui.templates 
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.pde.ui.templates;
011:
012:        /**
013:         * The base class of all the template options. Options have unique name and a
014:         * value that can be changed. The value of the option is automatically available
015:         * to the template files - can be accessed by substitution (e.g. $value_name$)
016:         * or as part of conditional code generation (e.g. if value_name).
017:         * 
018:         * @since 2.0
019:         */
020:        public abstract class TemplateOption extends TemplateField {
021:            private String name;
022:            private Object value;
023:            private boolean enabled = true;
024:            private boolean required;
025:
026:            /**
027:             * Creates a new option for the provided template section.
028:             * 
029:             * @param section
030:             *            the parent template section
031:             * @param name
032:             *            the unique name of this option
033:             * @param label
034:             *            presentable label of this option
035:             */
036:            public TemplateOption(BaseOptionTemplateSection section,
037:                    String name, String label) {
038:                super (section, label);
039:                this .name = name;
040:            }
041:
042:            /**
043:             * Returns the unique name of this option
044:             * 
045:             * @return option name
046:             */
047:            public String getName() {
048:                return name;
049:            }
050:
051:            /**
052:             * Changes the unique name of this option
053:             * 
054:             * @param name
055:             *            the new option name
056:             */
057:            public void setName(String name) {
058:                this .name = name;
059:            }
060:
061:            /**
062:             * Returns the value of this option.
063:             * 
064:             * @return the current value
065:             */
066:            public Object getValue() {
067:                return value;
068:            }
069:
070:            /**
071:             * Returns whether this option is currently empty. The actual semantics of
072:             * the result depends on the implementing option.
073:             * 
074:             * @return <samp>true </samp> if option is empty, </samp> false otherwise.
075:             */
076:            public boolean isEmpty() {
077:                return false;
078:            }
079:
080:            /**
081:             * Marks this option as required. Required options must be set by the user.
082:             * An option that is empty and is marked required will be flagged as an
083:             * error in the wizard.
084:             * 
085:             * @param required
086:             *            the new value of the property
087:             * @see #isEmpty
088:             */
089:            public void setRequired(boolean required) {
090:                this .required = required;
091:            }
092:
093:            /**
094:             * Returns whether this option is required (cannot be empty)
095:             * 
096:             * @return <samp>true </samp> if this option is required, <samp>false
097:             *         </samp> otherwise.
098:             */
099:            public boolean isRequired() {
100:                return required;
101:            }
102:
103:            /**
104:             * Sets the new value of this option.
105:             * 
106:             * @param value
107:             *            the new value
108:             */
109:            public void setValue(Object value) {
110:                this .value = value;
111:            }
112:
113:            /**
114:             * Returns whether this option is enabled. The actual presentation of
115:             * enabled state depends on the implementing option.
116:             * 
117:             * @return <samp>true </samp> if option is enabled and can be modified.
118:             */
119:            public boolean isEnabled() {
120:                return enabled;
121:            }
122:
123:            /**
124:             * Sets the enabled state of this option. The action presentation of the
125:             * enabled state depends on the implementing option.
126:             * 
127:             * @param enabled
128:             *            the new enabled state
129:             */
130:            public void setEnabled(boolean enabled) {
131:                this .enabled = enabled;
132:            }
133:
134:            /**
135:             * Returns the label of this option that can be presented in the messages to
136:             * the user. The default implementation trims the 'label' property from
137:             * mnemonics and from the trailing column.
138:             */
139:            public String getMessageLabel() {
140:                String label = getLabel();
141:                StringBuffer buf = new StringBuffer();
142:                for (int i = 0; i < label.length(); i++) {
143:                    char c = label.charAt(i);
144:                    if (c == '(' && i < label.length() - 1) {
145:                        char c2 = label.charAt(i + 1);
146:                        if (c2 == '&') {
147:                            // DBCS mnemonic sequence "(&<char>)"
148:                            // It is OK to truncate the label
149:                            // at this point
150:                            break;
151:                        }
152:                    }
153:                    if (c != '&' && c != ':')
154:                        buf.append(c);
155:                }
156:                return buf.toString();
157:            }
158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.