Source Code Cross Referenced for AccessorDescription.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » internal » ui » refactoring » nls » 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.nls 
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.jdt.internal.ui.refactoring.nls;
011:
012:        import org.eclipse.core.runtime.IPath;
013:
014:        import org.eclipse.jface.dialogs.IDialogSettings;
015:
016:        import org.eclipse.jdt.core.IJavaElement;
017:        import org.eclipse.jdt.core.IPackageFragment;
018:        import org.eclipse.jdt.core.JavaCore;
019:
020:        import org.eclipse.jdt.ui.JavaElementLabels;
021:
022:        /**
023:         *
024:         */
025:        public class AccessorDescription {
026:
027:            private final static String KEY_ACCESSOR_NAME = "accessorName"; //$NON-NLS-1$
028:            private final static String KEY_ACCESSOR_PACK = "accessorPackage"; //$NON-NLS-1$
029:            private final static String KEY_RESOURCE_BUNDLE_NAME = "bundleName"; //$NON-NLS-1$
030:            private final static String KEY_RESOURCE_BUNDLE_PACK = "bundlePackage"; //$NON-NLS-1$
031:
032:            private final IPackageFragment fResourceBundlePackage;
033:            private final String fAccessorClassName;
034:            private final IPackageFragment fAccessorClassPackage;
035:            private final String fResourceBundleName;
036:
037:            /**
038:             * 
039:             */
040:            public AccessorDescription(String accessorClassName,
041:                    IPackageFragment accessorClassPackage,
042:                    String propertyFileName,
043:                    IPackageFragment propertyFilePackage) {
044:                super ();
045:                fAccessorClassName = accessorClassName;
046:                fAccessorClassPackage = accessorClassPackage;
047:                fResourceBundleName = propertyFileName;
048:                fResourceBundlePackage = propertyFilePackage;
049:            }
050:
051:            public String getLabel() {
052:                StringBuffer buf = new StringBuffer();
053:                buf.append(getAccessorClassPackage().getElementName());
054:                if (buf.length() > 0) {
055:                    buf.append('.');
056:                }
057:                buf.append(getAccessorClassName());
058:                buf.append(JavaElementLabels.CONCAT_STRING);
059:                IPath propertyFilePath = getResourceBundlePackage().getPath()
060:                        .append(getResourceBundleName());
061:                buf.append(propertyFilePath.makeRelative().toString());
062:                return buf.toString();
063:            }
064:
065:            public void serialize(IDialogSettings settings) {
066:                settings.put(KEY_ACCESSOR_NAME, getAccessorClassName());
067:                settings.put(KEY_ACCESSOR_PACK, getAccessorClassPackage()
068:                        .getHandleIdentifier());
069:                settings.put(KEY_RESOURCE_BUNDLE_NAME, getResourceBundleName());
070:                settings.put(KEY_RESOURCE_BUNDLE_PACK,
071:                        getResourceBundlePackage().getHandleIdentifier());
072:            }
073:
074:            /**
075:             * @return Returns the accessor class name.
076:             */
077:            public String getAccessorClassName() {
078:                return fAccessorClassName;
079:            }
080:
081:            /**
082:             * @return Returns the accessor class package.
083:             */
084:            public IPackageFragment getAccessorClassPackage() {
085:                return fAccessorClassPackage;
086:            }
087:
088:            /**
089:             * @return Returns the resource bundle name.
090:             */
091:            public String getResourceBundleName() {
092:                return fResourceBundleName;
093:            }
094:
095:            /**
096:             * @return Returns the resource bundle package
097:             */
098:            public IPackageFragment getResourceBundlePackage() {
099:                return fResourceBundlePackage;
100:            }
101:
102:            /* (non-Javadoc)
103:             * @see java.lang.Object#equals(java.lang.Object)
104:             */
105:            public boolean equals(Object obj) {
106:                if (obj != null && obj.getClass().equals(getClass())) {
107:                    AccessorDescription other = (AccessorDescription) obj;
108:                    return other == this 
109:                            || (other.fAccessorClassName
110:                                    .equals(fAccessorClassName)
111:                                    && other.fAccessorClassPackage
112:                                            .equals(fAccessorClassPackage)
113:                                    && other.fResourceBundleName
114:                                            .equals(fResourceBundleName) && other.fResourceBundlePackage
115:                                    .equals(fResourceBundlePackage));
116:                }
117:                return false;
118:            }
119:
120:            /* (non-Javadoc)
121:             * @see java.lang.Object#hashCode()
122:             */
123:            public int hashCode() {
124:                return fAccessorClassName.hashCode()
125:                        + fAccessorClassPackage.hashCode()
126:                        + fResourceBundleName.hashCode()
127:                        + fResourceBundlePackage.hashCode();
128:            }
129:
130:            public static AccessorDescription deserialize(
131:                    IDialogSettings settings) {
132:                String accessorName = settings.get(KEY_ACCESSOR_NAME);
133:                if (accessorName == null) {
134:                    return null;
135:                }
136:
137:                String accessorPackHandle = settings.get(KEY_ACCESSOR_PACK);
138:                if (accessorPackHandle == null) {
139:                    return null;
140:                }
141:                IJavaElement accessorPack = JavaCore.create(accessorPackHandle);
142:                if (!(accessorPack instanceof  IPackageFragment)
143:                        || !accessorPack.exists()) {
144:                    return null;
145:                }
146:
147:                String bundleName = settings.get(KEY_RESOURCE_BUNDLE_NAME);
148:                if (bundleName == null) {
149:                    return null;
150:                }
151:
152:                String bundlePackHandle = settings
153:                        .get(KEY_RESOURCE_BUNDLE_PACK);
154:                if (bundlePackHandle == null) {
155:                    return null;
156:                }
157:                IJavaElement bundlePack = JavaCore.create(bundlePackHandle);
158:                if (!(bundlePack instanceof  IPackageFragment)
159:                        || !bundlePack.exists()) {
160:                    return null;
161:                }
162:
163:                return new AccessorDescription(accessorName,
164:                        (IPackageFragment) accessorPack, bundleName,
165:                        (IPackageFragment) bundlePack);
166:            }
167:        }
ww___w_._jav_a__2__s.__c_o__m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.