Source Code Cross Referenced for LightweightActionDescriptor.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » internal » decorators » 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.decorators 
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.decorators;
011:
012:        import org.eclipse.core.runtime.IAdaptable;
013:        import org.eclipse.core.runtime.IConfigurationElement;
014:        import org.eclipse.core.runtime.IExtension;
015:        import org.eclipse.jface.resource.ImageDescriptor;
016:        import org.eclipse.ui.internal.dialogs.DialogUtil;
017:        import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
018:        import org.eclipse.ui.model.IWorkbenchAdapter;
019:        import org.eclipse.ui.plugin.AbstractUIPlugin;
020:
021:        /**
022:         * Represent the description of an action within
023:         * an action set. It does not create an action.
024:         *
025:         * [Issue: This class overlaps with ActionDescriptor
026:         *		and should be reviewed to determine if code
027:         *		reuse if possible.]
028:         */
029:        public class LightweightActionDescriptor implements  IAdaptable,
030:                IWorkbenchAdapter {
031:            private static final Object[] NO_CHILDREN = new Object[0];
032:
033:            private String id;
034:
035:            private String label;
036:
037:            private String description;
038:
039:            private ImageDescriptor image;
040:
041:            /**
042:             * Create a new instance of <code>LightweightActionDescriptor</code>.
043:             * 
044:             * @param actionElement the configuration element
045:             */
046:            public LightweightActionDescriptor(
047:                    IConfigurationElement actionElement) {
048:                super ();
049:
050:                this .id = actionElement
051:                        .getAttribute(IWorkbenchRegistryConstants.ATT_ID);
052:                this .label = actionElement
053:                        .getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
054:                this .description = actionElement
055:                        .getAttribute(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
056:
057:                String iconName = actionElement
058:                        .getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
059:                if (iconName != null) {
060:                    IExtension extension = actionElement
061:                            .getDeclaringExtension();
062:                    this .image = AbstractUIPlugin.imageDescriptorFromPlugin(
063:                            extension.getNamespace(), iconName);
064:                }
065:            }
066:
067:            /**
068:             * Returns an object which is an instance of the given class
069:             * associated with this object. Returns <code>null</code> if
070:             * no such object can be found.
071:             */
072:            public Object getAdapter(Class adapter) {
073:                if (adapter == IWorkbenchAdapter.class) {
074:                    return this ;
075:                }
076:                return null;
077:            }
078:
079:            /**
080:             * Returns the action's description.
081:             * 
082:             * @return the description
083:             */
084:            public String getDescription() {
085:                return description;
086:            }
087:
088:            /**
089:             * Returns the action's id.
090:             * 
091:             * @return the id
092:             */
093:            public String getId() {
094:                return id;
095:            }
096:
097:            /**
098:             * Returns the action's image descriptor.
099:             * 
100:             * @return the image descriptor
101:             */
102:            public ImageDescriptor getImageDescriptor() {
103:                return image;
104:            }
105:
106:            /* (non-Javadoc)
107:             * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
108:             */
109:            public ImageDescriptor getImageDescriptor(Object o) {
110:                if (o == this ) {
111:                    return getImageDescriptor();
112:                }
113:                return null;
114:            }
115:
116:            /**
117:             * Returns the action's label.
118:             * 
119:             * @return the label
120:             */
121:            public String getLabel() {
122:                return label;
123:            }
124:
125:            /* (non-Javadoc)
126:             * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
127:             */
128:            public String getLabel(Object o) {
129:                if (o == this ) {
130:                    String text = getLabel();
131:                    int end = text.lastIndexOf('@');
132:                    if (end >= 0) {
133:                        text = text.substring(0, end);
134:                    }
135:                    return DialogUtil.removeAccel(text);
136:                }
137:                return o == null ? "" : o.toString();//$NON-NLS-1$
138:            }
139:
140:            /* (non-Javadoc)
141:             * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
142:             */
143:            public Object[] getChildren(Object o) {
144:                return NO_CHILDREN;
145:            }
146:
147:            /* (non-Javadoc)
148:             * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
149:             */
150:            public Object getParent(Object o) {
151:                return null;
152:            }
153:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.