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


001:        /*******************************************************************************
002:         * Copyright (c) 2003, 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.navigator.extensions;
011:
012:        import java.util.HashMap;
013:        import java.util.Map;
014:
015:        import org.eclipse.core.runtime.IConfigurationElement;
016:        import org.eclipse.ui.internal.navigator.NavigatorPlugin;
017:        import org.eclipse.ui.navigator.MenuInsertionPoint;
018:
019:        /**
020:         * <p>
021:         * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
022:         * part of a work in progress. There is a guarantee neither that this API will
023:         * work nor that it will remain the same. Please do not use this API without
024:         * consulting with the Platform/UI team.
025:         * </p>
026:         * 
027:         * @since 3.2
028:         */
029:        public class NavigatorViewerDescriptorManager {
030:
031:            private static final NavigatorViewerDescriptorManager INSTANCE = new NavigatorViewerDescriptorManager();
032:
033:            private final Map viewerDescriptors = new HashMap();
034:
035:            /**
036:             * @return The intialized singleton instance of the viewer descriptor
037:             *         registry.
038:             */
039:            public static NavigatorViewerDescriptorManager getInstance() {
040:                return INSTANCE;
041:            }
042:
043:            protected NavigatorViewerDescriptorManager() {
044:                new NavigatorViewerDescriptorRegistry().readRegistry();
045:            }
046:
047:            /**
048:             * 
049:             * @param aViewerId
050:             *            The viewer id for the viewer configuration
051:             * @return The viewer descriptor for the given viewer id.
052:             */
053:            public NavigatorViewerDescriptor getNavigatorViewerDescriptor(
054:                    String aViewerId) {
055:
056:                NavigatorViewerDescriptor viewerDescriptor = (NavigatorViewerDescriptor) viewerDescriptors
057:                        .get(aViewerId);
058:                if (viewerDescriptor != null) {
059:                    return viewerDescriptor;
060:                }
061:
062:                synchronized (viewerDescriptors) {
063:                    viewerDescriptor = (NavigatorViewerDescriptor) viewerDescriptors
064:                            .get(aViewerId);
065:                    if (viewerDescriptor == null) {
066:                        viewerDescriptor = new NavigatorViewerDescriptor(
067:                                aViewerId);
068:                        viewerDescriptors.put(viewerDescriptor.getViewerId(),
069:                                viewerDescriptor);
070:                    }
071:                }
072:                return viewerDescriptor;
073:
074:            }
075:
076:            private class NavigatorViewerDescriptorRegistry extends
077:                    RegistryReader implements  IViewerExtPtConstants {
078:
079:                protected NavigatorViewerDescriptorRegistry() {
080:                    super (NavigatorPlugin.PLUGIN_ID, TAG_VIEWER);
081:                }
082:
083:                protected boolean readElement(IConfigurationElement element) {
084:                    if (TAG_VIEWER.equals(element.getName())) {
085:                        String viewerId = element.getAttribute(ATT_VIEWER_ID);
086:                        NavigatorViewerDescriptor descriptor = getNavigatorViewerDescriptor(viewerId);
087:
088:                        String attPopupMenuId = element
089:                                .getAttribute(ATT_POPUP_MENU_ID);
090:                        IConfigurationElement[] tagPopupMenu = element
091:                                .getChildren(TAG_POPUP_MENU);
092:                        if (tagPopupMenu.length == 0 && attPopupMenuId != null) {
093:                            descriptor.setPopupMenuId(attPopupMenuId);
094:                        } else {
095:                            if (attPopupMenuId != null) {
096:                                NavigatorPlugin
097:                                        .logError(
098:                                                0,
099:                                                "A popupMenuId attribute and popupMenu element may NOT be concurrently specified. (see " + element.getNamespaceIdentifier() + ")", null); //$NON-NLS-1$ //$NON-NLS-2$
100:                            } else if (tagPopupMenu.length > 1) {
101:                                NavigatorPlugin
102:                                        .logError(
103:                                                0,
104:                                                "Only one \"popupMenu\" child of \"viewer\" may be specified. (see " + element.getNamespaceIdentifier() + ")", null); //$NON-NLS-1$ //$NON-NLS-2$
105:                            } else if (tagPopupMenu.length == 1) { // valid case
106:
107:                                String popupMenuId = tagPopupMenu[0]
108:                                        .getAttribute(ATT_ID);
109:                                String allowsPlatformContributions = tagPopupMenu[0]
110:                                        .getAttribute(ATT_ALLOWS_PLATFORM_CONTRIBUTIONS);
111:
112:                                if (popupMenuId != null) {
113:                                    descriptor.setPopupMenuId(popupMenuId);
114:                                }
115:
116:                                if (allowsPlatformContributions != null) {
117:                                    descriptor
118:                                            .setAllowsPlatformContributions(Boolean
119:                                                    .valueOf(
120:                                                            allowsPlatformContributions)
121:                                                    .booleanValue());
122:                                }
123:
124:                                IConfigurationElement[] insertionPointElements = tagPopupMenu[0]
125:                                        .getChildren(TAG_INSERTION_POINT);
126:                                MenuInsertionPoint[] insertionPoints = new MenuInsertionPoint[insertionPointElements.length];
127:                                String name;
128:                                String stringAttSeparator;
129:
130:                                boolean isSeparator;
131:                                for (int indx = 0; indx < insertionPointElements.length; indx++) {
132:                                    name = insertionPointElements[indx]
133:                                            .getAttribute(ATT_NAME);
134:                                    stringAttSeparator = insertionPointElements[indx]
135:                                            .getAttribute(ATT_SEPARATOR);
136:                                    isSeparator = stringAttSeparator != null ? Boolean
137:                                            .valueOf(stringAttSeparator)
138:                                            .booleanValue()
139:                                            : false;
140:                                    insertionPoints[indx] = new MenuInsertionPoint(
141:                                            name, isSeparator);
142:                                }
143:                                descriptor
144:                                        .setCustomInsertionPoints(insertionPoints);
145:                            }
146:                        }
147:
148:                        IConfigurationElement[] options = element
149:                                .getChildren(TAG_OPTIONS);
150:                        if (options.length == 1) {
151:                            IConfigurationElement[] properties = options[0]
152:                                    .getChildren(TAG_PROPERTY);
153:                            String name;
154:                            String value;
155:                            for (int i = 0; i < properties.length; i++) {
156:                                name = properties[i].getAttribute(ATT_NAME);
157:                                if (name != null) {
158:                                    value = properties[i]
159:                                            .getAttribute(ATT_VALUE);
160:                                    descriptor.setProperty(name, value);
161:                                }
162:                            }
163:                        } else if (options.length > 1) {
164:                            NavigatorPlugin
165:                                    .logError(
166:                                            0,
167:                                            "Only one \"options\" child of \"viewer\" may be specified. (see " + element.getNamespaceIdentifier() + ")", null); //$NON-NLS-1$ //$NON-NLS-2$
168:
169:                        }
170:                        return true;
171:                    }
172:                    if (TAG_VIEWER_CONTENT_BINDING.equals(element.getName())) {
173:                        String viewerId = element.getAttribute(ATT_VIEWER_ID);
174:                        NavigatorViewerDescriptor descriptor = getNavigatorViewerDescriptor(viewerId);
175:                        descriptor.consumeContentBinding(element);
176:                        return true;
177:                    }
178:                    if (TAG_VIEWER_ACTION_BINDING.equals(element.getName())) {
179:                        String viewerId = element.getAttribute(ATT_VIEWER_ID);
180:                        NavigatorViewerDescriptor descriptor = getNavigatorViewerDescriptor(viewerId);
181:                        descriptor.consumeActionBinding(element);
182:                        return true;
183:                    }
184:                    if (TAG_DRAG_ASSISTANT.equals(element.getName())) {
185:                        String viewerId = element.getAttribute(ATT_VIEWER_ID);
186:                        NavigatorViewerDescriptor descriptor = getNavigatorViewerDescriptor(viewerId);
187:                        descriptor
188:                                .addDragAssistant(new CommonDragAssistantDescriptor(
189:                                        element));
190:                        return true;
191:                    }
192:                    return false;
193:                }
194:            }
195:
196:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.