Source Code Cross Referenced for PreferenceTransferElement.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » internal » preferences » 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.internal.preferences 
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.internal.preferences;
011:
012:        import java.util.Map;
013:
014:        import org.eclipse.core.runtime.CoreException;
015:        import org.eclipse.core.runtime.IConfigurationElement;
016:        import org.eclipse.core.runtime.preferences.IPreferenceFilter;
017:        import org.eclipse.jface.resource.ImageDescriptor;
018:        import org.eclipse.ui.IPluginContribution;
019:        import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
020:        import org.eclipse.ui.internal.registry.PreferenceTransferRegistryReader;
021:        import org.eclipse.ui.internal.registry.RegistryReader;
022:        import org.eclipse.ui.model.WorkbenchAdapter;
023:        import org.eclipse.ui.plugin.AbstractUIPlugin;
024:
025:        /**
026:         * Instances represent registered preference transfers.
027:         * 
028:         * @since 3.1
029:         */
030:        public class PreferenceTransferElement extends WorkbenchAdapter
031:                implements  IPluginContribution {
032:            private String id;
033:
034:            private ImageDescriptor imageDescriptor;
035:
036:            private IConfigurationElement configurationElement;
037:
038:            private IPreferenceFilter filter;
039:
040:            /**
041:             * Create a new instance of this class
042:             * 
043:             * @param configurationElement
044:             *              
045:             */
046:            public PreferenceTransferElement(
047:                    IConfigurationElement configurationElement) {
048:                this .configurationElement = configurationElement;
049:                id = configurationElement
050:                        .getAttribute(IWorkbenchRegistryConstants.ATT_ID);
051:            }
052:
053:            /**
054:             * @return IConfigurationElement
055:             */
056:            public IConfigurationElement getConfigurationElement() {
057:                return configurationElement;
058:            }
059:
060:            /**
061:             * Answer the preference filter of this element
062:             * If the class attribute is specified it will be used, if not then look to the 
063:             * 
064:             * @return java.lang.String
065:             * @throws CoreException 
066:             */
067:            public IPreferenceFilter getFilter() throws CoreException {
068:                //TODO: can the CoreException be removed?
069:                if (filter == null) {
070:                    IConfigurationElement[] mappings = PreferenceTransferRegistryReader
071:                            .getMappings(configurationElement);
072:                    PreferenceFilter prefFilter = new PreferenceFilter();
073:                    prefFilter.scopes = new String[mappings.length];
074:                    prefFilter.maps = new Map[mappings.length];
075:                    for (int i = 0; i < mappings.length; i++) {
076:                        prefFilter.scopes[i] = PreferenceTransferRegistryReader
077:                                .getScope(mappings[i]);
078:                        prefFilter.maps[i] = PreferenceTransferRegistryReader
079:                                .getEntry(mappings[i]);
080:                    }
081:                    filter = prefFilter;
082:                }
083:                return filter;
084:            }
085:
086:            /**
087:             * Answer the description parameter of this element
088:             * 
089:             * @return java.lang.String
090:             */
091:            public String getDescription() {
092:                return RegistryReader.getDescription(configurationElement);
093:            }
094:
095:            /**
096:             * Answer the id as specified in the extension.
097:             * 
098:             * @return java.lang.String
099:             */
100:            public String getID() {
101:                return id;
102:            }
103:
104:            /**
105:             * Answer the icon of this element.
106:             * 
107:             * @return an image descriptor
108:             */
109:            public ImageDescriptor getImageDescriptor() {
110:                if (imageDescriptor == null) {
111:                    String iconName = configurationElement
112:                            .getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
113:                    if (iconName == null) {
114:                        return null;
115:                    }
116:                    imageDescriptor = AbstractUIPlugin
117:                            .imageDescriptorFromPlugin(configurationElement
118:                                    .getNamespace(), iconName);
119:                }
120:                return imageDescriptor;
121:            }
122:
123:            /**
124:             * Returns the name of this preference transfer element.
125:             * @return the name of the element
126:             */
127:            public String getName() {
128:                return configurationElement
129:                        .getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
130:            }
131:
132:            /* (non-Javadoc)
133:             * @see org.eclipse.ui.IPluginContribution#getLocalId()
134:             */
135:            public String getLocalId() {
136:                return getID();
137:            }
138:
139:            /* (non-Javadoc)
140:             * @see org.eclipse.ui.IPluginContribution#getPluginId()
141:             */
142:            public String getPluginId() {
143:                return (configurationElement != null) ? configurationElement
144:                        .getNamespace() : null;
145:            }
146:
147:            class PreferenceFilter implements  IPreferenceFilter {
148:
149:                protected String[] scopes;
150:                protected Map[] maps;
151:
152:                public String[] getScopes() {
153:                    return scopes;
154:                }
155:
156:                public Map getMapping(String scope) {
157:                    for (int i = 0; i < scopes.length; i++) {
158:                        String item = scopes[i];
159:                        if (item.equals(scope)) {
160:                            return maps[i];
161:                        }
162:                    }
163:                    return null;
164:                }
165:
166:            }
167:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.