Source Code Cross Referenced for AdaptableList.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » model » 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.model 
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.model;
011:
012:        import java.lang.reflect.Array;
013:        import java.util.ArrayList;
014:        import java.util.Collection;
015:        import java.util.List;
016:
017:        import org.eclipse.core.runtime.Assert;
018:        import org.eclipse.core.runtime.IAdaptable;
019:
020:        /**
021:         * A modifiable list of <code>IAdaptable</code> objects.
022:         * The list is adaptable to <code>IWorkbenchAdapter</code>, and can be used to
023:         * display an arbitrary set of adaptable objects in a viewer.
024:         * <p>
025:         * This class is not intended to be subclassed.
026:         * </p>
027:         * 
028:         * @since 3.0
029:         * @see org.eclipse.ui.model.IWorkbenchAdapter
030:         */
031:        public class AdaptableList extends WorkbenchAdapter implements 
032:                IAdaptable {
033:
034:            protected List children = null;
035:
036:            /**
037:             * Creates a new adaptable list. All of the elements in the list must 
038:             * implement <code>IAdaptable</code>.
039:             */
040:            public AdaptableList() {
041:                children = new ArrayList();
042:            }
043:
044:            /**
045:             * Creates a new adaptable list with the given initial capacity.
046:             * All of the elements in the list must implement <code>IAdaptable</code>.
047:             * 
048:             * @param initialCapacity the initial capacity of the list
049:             */
050:            public AdaptableList(int initialCapacity) {
051:                children = new ArrayList(initialCapacity);
052:            }
053:
054:            /**
055:             * Creates a new adaptable list containing the given children.
056:             * 
057:             * @param newChildren the list of children
058:             */
059:            public AdaptableList(IAdaptable[] newChildren) {
060:                this (newChildren.length);
061:                for (int i = 0; i < newChildren.length; i++) {
062:                    children.add(newChildren[i]);
063:                }
064:            }
065:
066:            /**
067:             * Creates a new adaptable list containing the elements of the specified
068:             * collection, in the order they are returned by the collection's iterator.
069:             * All of the elements in the list must implement <code>IAdaptable</code>.
070:             * 
071:             * @param c the initial elements of this list (element type: 
072:             * <code>IAdaptable</code>)
073:             */
074:            public AdaptableList(Collection c) {
075:                this (c.size());
076:                children.addAll(c);
077:            }
078:
079:            /**
080:             * Adds the given adaptable object to this list.  
081:             * 
082:             * @param adaptable the new element
083:             * @return this list
084:             */
085:            public AdaptableList add(IAdaptable adaptable) {
086:                Assert.isNotNull(adaptable);
087:                children.add(adaptable);
088:                return this ;
089:            }
090:
091:            /**
092:             * Removes the given adaptable object from this list.
093:             * 
094:             * @param adaptable the element to remove
095:             */
096:            public void remove(IAdaptable adaptable) {
097:                Assert.isNotNull(adaptable);
098:                children.remove(adaptable);
099:            }
100:
101:            /**
102:             * Returns the number of children in this list.
103:             * 
104:             * @return the length of this list
105:             */
106:            public int size() {
107:                return children.size();
108:            }
109:
110:            /* (non-Javadoc)
111:             * @see IAdaptable#getAdapter
112:             */
113:            public Object getAdapter(Class adapter) {
114:                if (adapter == IWorkbenchAdapter.class) {
115:                    return this ;
116:                }
117:                return null;
118:            }
119:
120:            /* (non-Javadoc)
121:             * @see IWorkbenchAdapter
122:             */
123:            public Object[] getChildren(Object o) {
124:                // @issue suspicious - does not reference parameter
125:                return children.toArray();
126:            }
127:
128:            /**
129:             * Returns the elements in this list.
130:             * 
131:             * @return the elements in this list
132:             */
133:            public Object[] getChildren() {
134:                return children.toArray();
135:            }
136:
137:            /**
138:             * Return the elements in this list in an array of the given type.
139:             * 
140:             * @param type the type of the array to create
141:             * @return the elements in the list
142:             * @since 3.1
143:             */
144:            public Object[] getTypedChildren(Class type) {
145:                return children.toArray((Object[]) Array.newInstance(type,
146:                        children.size()));
147:            }
148:
149:            /* (non-javadoc)
150:             * For debugging purposes only.
151:             */
152:            public String toString() {
153:                return children.toString();
154:            }
155:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.