Source Code Cross Referenced for PropertyPagesRegistryReader.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » internal » registry » 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.registry 
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.ui.internal.registry;
011:
012:        import java.util.ArrayList;
013:        import java.util.Collection;
014:        import java.util.Iterator;
015:        import java.util.List;
016:
017:        import org.eclipse.core.runtime.IConfigurationElement;
018:        import org.eclipse.core.runtime.IExtensionRegistry;
019:        import org.eclipse.ui.PlatformUI;
020:        import org.eclipse.ui.internal.dialogs.PropertyPageContributorManager;
021:        import org.eclipse.ui.internal.dialogs.RegistryPageContributor;
022:
023:        /**
024:         * This class loads property pages from the registry.
025:         */
026:        public class PropertyPagesRegistryReader extends
027:                CategorizedPageRegistryReader {
028:
029:            /**
030:             * Value "<code>nameFilter</code>".
031:             */
032:            public static final String ATT_NAME_FILTER = "nameFilter";//$NON-NLS-1$
033:
034:            /**
035:             * Value "<code>name</code>".
036:             */
037:            public static final String ATT_FILTER_NAME = "name";//$NON-NLS-1$
038:
039:            /**
040:             * Value "<code>value</code>".
041:             */
042:            public static final String ATT_FILTER_VALUE = "value";//$NON-NLS-1$
043:
044:            private static final String TAG_PAGE = "page";//$NON-NLS-1$
045:
046:            /**
047:             * Value "<code>filter</code>".
048:             */
049:            public static final String TAG_FILTER = "filter";//$NON-NLS-1$
050:
051:            /**
052:             * Value "<code>keywordReference</code>".
053:             */
054:            public static final String TAG_KEYWORD_REFERENCE = "keywordReference";//$NON-NLS-1$
055:
056:            /**
057:             * Value "<code>objectClass</code>".
058:             */
059:            public static final String ATT_OBJECTCLASS = "objectClass";//$NON-NLS-1$
060:
061:            /**
062:             * Value "<code>adaptable</code>".
063:             */
064:            public static final String ATT_ADAPTABLE = "adaptable";//$NON-NLS-1$
065:
066:            private static final String CHILD_ENABLED_WHEN = "enabledWhen"; //$NON-NLS-1$;
067:
068:            private Collection pages = new ArrayList();
069:
070:            private PropertyPageContributorManager manager;
071:
072:            class PropertyCategoryNode extends CategoryNode {
073:
074:                RegistryPageContributor page;
075:
076:                /**
077:                 * Create a new category node on the given reader for the property page.
078:                 * 
079:                 * @param reader
080:                 * @param propertyPage
081:                 */
082:                PropertyCategoryNode(CategorizedPageRegistryReader reader,
083:                        RegistryPageContributor propertyPage) {
084:                    super (reader);
085:                    page = propertyPage;
086:                }
087:
088:                /*
089:                 * (non-Javadoc)
090:                 * 
091:                 * @see org.eclipse.ui.internal.registry.CategorizedPageRegistryReader.CategoryNode#getLabelText()
092:                 */
093:                String getLabelText() {
094:                    return page.getPageName();
095:                }
096:
097:                /*
098:                 * (non-Javadoc)
099:                 * 
100:                 * @see org.eclipse.ui.internal.registry.CategorizedPageRegistryReader.CategoryNode#getLabelText(java.lang.Object)
101:                 */
102:                String getLabelText(Object element) {
103:                    return ((RegistryPageContributor) element).getPageName();
104:                }
105:
106:                /*
107:                 * (non-Javadoc)
108:                 * 
109:                 * @see org.eclipse.ui.internal.registry.CategorizedPageRegistryReader.CategoryNode#getNode()
110:                 */
111:                Object getNode() {
112:                    return page;
113:                }
114:            }
115:
116:            /**
117:             * The constructor.
118:             * 
119:             * @param manager
120:             *            the manager
121:             */
122:            public PropertyPagesRegistryReader(
123:                    PropertyPageContributorManager manager) {
124:                this .manager = manager;
125:            }
126:
127:            /**
128:             * Reads static property page specification.
129:             */
130:            private void processPageElement(IConfigurationElement element) {
131:                String pageId = element
132:                        .getAttribute(IWorkbenchRegistryConstants.ATT_ID);
133:
134:                if (pageId == null) {
135:                    logMissingAttribute(element,
136:                            IWorkbenchRegistryConstants.ATT_ID);
137:                    return;
138:                }
139:
140:                RegistryPageContributor contributor = new RegistryPageContributor(
141:                        pageId, element);
142:
143:                String pageClassName = getClassValue(element,
144:                        IWorkbenchRegistryConstants.ATT_CLASS);
145:                if (pageClassName == null) {
146:                    logMissingAttribute(element,
147:                            IWorkbenchRegistryConstants.ATT_CLASS);
148:                    return;
149:                }
150:                if (element.getAttribute(ATT_OBJECTCLASS) == null) {
151:                    pages.add(contributor);
152:                    manager.registerContributor(contributor, Object.class
153:                            .getName());
154:                } else {
155:                    List objectClassNames = new ArrayList();
156:                    objectClassNames.add(element.getAttribute(ATT_OBJECTCLASS));
157:                    registerContributors(contributor, objectClassNames);
158:                }
159:            }
160:
161:            /**
162:             * Register the contributor for all of the relevant classes.
163:             * 
164:             * @param contributor
165:             * @param objectClassNames
166:             */
167:            private void registerContributors(
168:                    RegistryPageContributor contributor, List objectClassNames) {
169:
170:                pages.add(contributor);
171:                for (Iterator iter = objectClassNames.iterator(); iter
172:                        .hasNext();) {
173:                    manager.registerContributor(contributor, (String) iter
174:                            .next());
175:                }
176:
177:            }
178:
179:            /**
180:             * Reads the next contribution element.
181:             * 
182:             * public for dynamic UI
183:             */
184:            public boolean readElement(IConfigurationElement element) {
185:                if (element.getName().equals(TAG_PAGE)) {
186:                    processPageElement(element);
187:                    readElementChildren(element);
188:                    return true;
189:                }
190:                if (element.getName().equals(TAG_FILTER)) {
191:                    return true;
192:                }
193:
194:                if (element.getName().equals(CHILD_ENABLED_WHEN)) {
195:                    return true;
196:                }
197:
198:                if (element.getName().equals(TAG_KEYWORD_REFERENCE)) {
199:                    return true;
200:                }
201:
202:                return false;
203:            }
204:
205:            /**
206:             * Reads all occurances of propertyPages extension in the registry.
207:             * 
208:             * @param registry
209:             *            the registry
210:             */
211:            public void registerPropertyPages(IExtensionRegistry registry) {
212:                readRegistry(registry, PlatformUI.PLUGIN_ID,
213:                        IWorkbenchRegistryConstants.PL_PROPERTY_PAGES);
214:                processNodes();
215:            }
216:
217:            /*
218:             * (non-Javadoc)
219:             * 
220:             * @see org.eclipse.ui.internal.registry.CategorizedPageRegistryReader#add(java.lang.Object,
221:             *      java.lang.Object)
222:             */
223:            void add(Object parent, Object node) {
224:                ((RegistryPageContributor) parent)
225:                        .addSubPage((RegistryPageContributor) node);
226:
227:            }
228:
229:            /*
230:             * (non-Javadoc)
231:             * 
232:             * @see org.eclipse.ui.internal.registry.CategorizedPageRegistryReader#createCategoryNode(org.eclipse.ui.internal.registry.CategorizedPageRegistryReader,
233:             *      java.lang.Object)
234:             */
235:            CategoryNode createCategoryNode(
236:                    CategorizedPageRegistryReader reader, Object object) {
237:                return new PropertyCategoryNode(reader,
238:                        (RegistryPageContributor) object);
239:            }
240:
241:            /*
242:             * (non-Javadoc)
243:             * 
244:             * @see org.eclipse.ui.internal.registry.CategorizedPageRegistryReader#findNode(java.lang.Object,
245:             *      java.lang.String)
246:             */
247:            Object findNode(Object parent, String currentToken) {
248:                return ((RegistryPageContributor) parent)
249:                        .getChild(currentToken);
250:            }
251:
252:            /*
253:             * (non-Javadoc)
254:             * 
255:             * @see org.eclipse.ui.internal.registry.CategorizedPageRegistryReader#findNode(java.lang.String)
256:             */
257:            Object findNode(String id) {
258:                Iterator iterator = pages.iterator();
259:                while (iterator.hasNext()) {
260:                    RegistryPageContributor next = (RegistryPageContributor) iterator
261:                            .next();
262:                    if (next.getPageId().equals(id))
263:                        return next;
264:                }
265:                return null;
266:            }
267:
268:            /*
269:             * (non-Javadoc)
270:             * 
271:             * @see org.eclipse.ui.internal.registry.CategorizedPageRegistryReader#getCategory(java.lang.Object)
272:             */
273:            String getCategory(Object node) {
274:                return ((RegistryPageContributor) node).getCategory();
275:            }
276:
277:            /*
278:             * (non-Javadoc)
279:             * 
280:             * @see org.eclipse.ui.internal.registry.CategorizedPageRegistryReader#getFavoriteNodeId()
281:             */
282:            String getFavoriteNodeId() {
283:                return null;// properties do not support favorites
284:            }
285:
286:            /*
287:             * (non-Javadoc)
288:             * 
289:             * @see org.eclipse.ui.internal.registry.CategorizedPageRegistryReader#getNodes()
290:             */
291:            Collection getNodes() {
292:                return pages;
293:            }
294:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.