Source Code Cross Referenced for TabContents.java in  » IDE-Eclipse » ui » org » eclipse » ui » views » properties » tabbed » 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.views.properties.tabbed 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2007 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.views.properties.tabbed;
011:
012:        import org.eclipse.core.runtime.ISafeRunnable;
013:        import org.eclipse.jface.util.SafeRunnable;
014:        import org.eclipse.jface.viewers.ISelection;
015:        import org.eclipse.swt.SWT;
016:        import org.eclipse.swt.layout.FillLayout;
017:        import org.eclipse.swt.layout.GridData;
018:        import org.eclipse.swt.layout.GridLayout;
019:        import org.eclipse.swt.widgets.Composite;
020:        import org.eclipse.ui.IWorkbenchPart;
021:
022:        /**
023:         * A property tab is composed by one or more property sections and is used to
024:         * categorize sections.
025:         * 
026:         * @author Anthony Hunter
027:         * @since 3.4
028:         */
029:        public final class TabContents {
030:
031:            private ISection[] sections;
032:
033:            private boolean controlsCreated;
034:
035:            /**
036:             * 
037:             */
038:            public TabContents() {
039:                controlsCreated = false;
040:            }
041:
042:            /**
043:             * Retrieve a numbered index for the section.
044:             * @param section the section.
045:             * @return the section index.
046:             */
047:            public int getSectionIndex(ISection section) {
048:                for (int i = 0; i < sections.length; i++) {
049:                    if (section == sections[i]) {
050:                        return i;
051:                    }
052:                }
053:                return -1;
054:            }
055:
056:            /**
057:             * Retrieve the section at a numbered index.
058:             * @param i a numbered index.
059:             * @return the section.
060:             */
061:            public ISection getSectionAtIndex(int i) {
062:                if (i >= 0 && i < sections.length) {
063:                    return sections[i];
064:                }
065:                return null;
066:            }
067:
068:            /**
069:             * Retrieve the sections on the tab.
070:             * 
071:             * @return the sections on the tab.
072:             */
073:            public ISection[] getSections() {
074:                return sections;
075:            }
076:
077:            /**
078:             * Creates page's sections controls.
079:             * 
080:             * @param parent
081:             * @param page
082:             */
083:            public void createControls(Composite parent,
084:                    final TabbedPropertySheetPage page) {
085:                Composite pageComposite = page.getWidgetFactory()
086:                        .createComposite(parent, SWT.NO_FOCUS);
087:                GridLayout layout = new GridLayout();
088:                layout.marginWidth = 0;
089:                layout.marginHeight = 0;
090:                layout.verticalSpacing = 0;
091:                pageComposite.setLayout(layout);
092:
093:                for (int i = 0; i < sections.length; i++) {
094:                    final ISection section = sections[i];
095:                    final Composite sectionComposite = page.getWidgetFactory()
096:                            .createComposite(pageComposite, SWT.NO_FOCUS);
097:                    sectionComposite.setLayout(new FillLayout());
098:                    int style = (section.shouldUseExtraSpace()) ? GridData.FILL_BOTH
099:                            : GridData.FILL_HORIZONTAL;
100:                    GridData data = new GridData(style);
101:                    data.heightHint = section.getMinimumHeight();
102:                    sectionComposite.setLayoutData(data);
103:
104:                    ISafeRunnable runnable = new ISafeRunnable() {
105:
106:                        public void run() throws Exception {
107:                            section.createControls(sectionComposite, page);
108:                        }
109:
110:                        public void handleException(Throwable exception) {
111:                            /* not used */
112:                        }
113:                    };
114:                    SafeRunnable.run(runnable);
115:                }
116:                controlsCreated = true;
117:            }
118:
119:            /**
120:             * Dispose of page's sections controls.
121:             */
122:            public void dispose() {
123:                for (int i = 0; i < sections.length; i++) {
124:                    final ISection section = sections[i];
125:                    ISafeRunnable runnable = new ISafeRunnable() {
126:
127:                        public void run() throws Exception {
128:                            section.dispose();
129:                        }
130:
131:                        public void handleException(Throwable exception) {
132:                            /* not used */
133:                        }
134:                    };
135:                    SafeRunnable.run(runnable);
136:                }
137:            }
138:
139:            /**
140:             * Sends the lifecycle event to the page's sections.
141:             */
142:            public void aboutToBeShown() {
143:                for (int i = 0; i < sections.length; i++) {
144:                    final ISection section = sections[i];
145:                    ISafeRunnable runnable = new ISafeRunnable() {
146:
147:                        public void run() throws Exception {
148:                            section.aboutToBeShown();
149:                        }
150:
151:                        public void handleException(Throwable exception) {
152:                            /* not used */
153:                        }
154:                    };
155:                    SafeRunnable.run(runnable);
156:                }
157:            }
158:
159:            /**
160:             * Sends the lifecycle event to the page's sections.
161:             */
162:            public void aboutToBeHidden() {
163:                for (int i = 0; i < sections.length; i++) {
164:                    final ISection section = sections[i];
165:                    ISafeRunnable runnable = new ISafeRunnable() {
166:
167:                        public void run() throws Exception {
168:                            section.aboutToBeHidden();
169:                        }
170:
171:                        public void handleException(Throwable exception) {
172:                            /* not used */
173:                        }
174:                    };
175:                    SafeRunnable.run(runnable);
176:                }
177:            }
178:
179:            /**
180:             * Sets page's sections input objects.
181:             * 
182:             * @param part
183:             * @param selection
184:             */
185:            public void setInput(final IWorkbenchPart part,
186:                    final ISelection selection) {
187:                for (int i = 0; i < sections.length; i++) {
188:                    final ISection section = sections[i];
189:                    ISafeRunnable runnable = new ISafeRunnable() {
190:
191:                        public void run() throws Exception {
192:                            section.setInput(part, selection);
193:                        }
194:
195:                        public void handleException(Throwable throwable) {
196:                            throwable.printStackTrace();
197:                        }
198:                    };
199:                    SafeRunnable.run(runnable);
200:                }
201:            }
202:
203:            /**
204:             * Set the sections for the tab.
205:             * 
206:             * @param sections the sections for the tab.
207:             */
208:            public void setSections(ISection[] sections) {
209:                this .sections = sections;
210:            }
211:
212:            /**
213:             * Determine if the controls have been created.
214:             * 
215:             * @return <code>true</code> if controls have been created.
216:             */
217:            public boolean controlsHaveBeenCreated() {
218:                return controlsCreated;
219:            }
220:
221:            /**
222:             * If controls have been created, refresh all sections on the page.
223:             */
224:            public void refresh() {
225:                if (controlsCreated) {
226:                    for (int i = 0; i < sections.length; i++) {
227:                        final ISection section = sections[i];
228:                        ISafeRunnable runnable = new ISafeRunnable() {
229:
230:                            public void run() throws Exception {
231:                                section.refresh();
232:                            }
233:
234:                            public void handleException(Throwable throwable) {
235:                                throwable.printStackTrace();
236:                            }
237:                        };
238:                        SafeRunnable.run(runnable);
239:                    }
240:                }
241:            }
242:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.