Source Code Cross Referenced for MultiPageEditor.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » part » 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.part 
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.part;
011:
012:        import java.util.ArrayList;
013:        import java.util.Iterator;
014:        import java.util.List;
015:
016:        import org.eclipse.swt.SWT;
017:        import org.eclipse.swt.events.SelectionAdapter;
018:        import org.eclipse.swt.events.SelectionEvent;
019:        import org.eclipse.swt.widgets.Composite;
020:        import org.eclipse.swt.widgets.Control;
021:        import org.eclipse.swt.widgets.TabFolder;
022:
023:        /**
024:         * Abstract superclass of all multi-page workbench editors.
025:         * <p>
026:         * This class should be subclassed by clients wishing to define new 
027:         * multi-page editor.
028:         * </p>
029:         * <p>
030:         * Subclasses must implement the following methods:
031:         * <ul>
032:         *   <li><code>createPartControl</code> - to create the view's controls </li>
033:         *   <li><code>setFocus</code> - to accept focus</li>
034:         *   <li><code>isDirty</code> - to decide whether a significant change has
035:         *       occurred</li>
036:         *   <li><code>doSave</code> - to save contents of editor</li>
037:         *   <li><code>doSaveAs</code> - to save contents of editor</li>
038:         * </ul>
039:         * </p>
040:         * <p>
041:         * Subclasses may extend or reimplement the following methods as required:
042:         * <ul>
043:         *   <li><code>setInitializationData</code> - extend to provide additional 
044:         *       initialization when editor extension is instantiated</li>
045:         *   <li><code>init(IEditorSite,IEditorInput)</code> - extend to provide 
046:         *       additional initialization when editor is assigned its site</li>
047:         *   <li><code>isSaveOnCloseNeeded</code> - override to control saving</li>
048:         *   <li><code>isSaveAsAllowed</code> - override to control saving</li>
049:         *   <li><code>gotoMarker</code> - reimplement to make selections based on
050:         *       markers</li>
051:         *   <li><code>dispose</code> - extend to provide additional cleanup</li>
052:         *   <li><code>getAdapter</code> - reimplement to make their editor
053:         *       adaptable</li>
054:         * </ul>
055:         * </p>
056:         * 
057:         * @deprecated Use the class <code>MultiPageEditorPart</code> instead
058:         */
059:        public abstract class MultiPageEditor extends EditorPart {
060:            private List syncVector;
061:
062:            private TabFolder tabFolder;
063:
064:            /**
065:             * Creates a new multi-page editor.
066:             * 
067:             * @deprecated Use the class <code>MultiPageEditorPart</code> instead
068:             */
069:            public MultiPageEditor() {
070:                super ();
071:            }
072:
073:            /**
074:             * Adds a synchronized pagebook to this editor.  Once added, the
075:             * visible page of the pagebook and the visible page of the editor 
076:             * will be synchronized.
077:             *
078:             * @param pageBook the pagebook to add
079:             */
080:            protected void addSyncroPageBook(PageBook pageBook) {
081:                // Add the page.
082:                if (syncVector == null) {
083:                    syncVector = new ArrayList(1);
084:                }
085:                syncVector.add(pageBook);
086:
087:                // Set the visible page.
088:                syncPageBook(pageBook);
089:            }
090:
091:            /**
092:             * The <code>MultiPageEditor</code> implementation of this <code>IWorkbenchPart</code>
093:             * method creates a <code>TabFolder</code> control.
094:             */
095:            public void createPartControl(Composite parent) {
096:                tabFolder = new TabFolder(parent, SWT.NONE);
097:                tabFolder.addSelectionListener(new SelectionAdapter() {
098:                    public void widgetSelected(SelectionEvent e) {
099:                        sync();
100:                    }
101:                });
102:            }
103:
104:            /**
105:             * Returns this editor's workbook.
106:             *
107:             * @return the editor workbook
108:             */
109:            protected TabFolder getFolder() {
110:                return tabFolder;
111:            }
112:
113:            /**
114:             * Indicates that a page change has occurred.  Updates the sync vector.
115:             */
116:            protected void onPageChange() {
117:                if (syncVector != null) {
118:                    Iterator itr = syncVector.iterator();
119:                    while (itr.hasNext()) {
120:                        PageBook pageBook = (PageBook) itr.next();
121:                        syncPageBook(pageBook);
122:                    }
123:                }
124:            }
125:
126:            /**
127:             * Removes a synchronized pagebook from this editor. 
128:             *
129:             * @param pageBook the pagebook to remove 
130:             * @see #addSyncroPageBook(PageBook)
131:             */
132:            protected void removeSyncroPageBook(PageBook pageBook) {
133:                if (syncVector != null) {
134:                    syncVector.remove(pageBook);
135:                }
136:                pageBook.dispose();
137:            }
138:
139:            /**
140:             * Synchronizes each registered pagebook with the editor page.
141:             */
142:            protected void sync() {
143:                if (syncVector != null) {
144:                    Iterator itr = syncVector.iterator();
145:                    while (itr.hasNext()) {
146:                        PageBook pageBook = (PageBook) itr.next();
147:                        syncPageBook(pageBook);
148:                    }
149:                }
150:            }
151:
152:            /**
153:             * Sets the visible page of the given pagebook to be the same as
154:             * the visible page of this editor.
155:             *
156:             * @param pageBook a pagebook to synchronize
157:             */
158:            protected void syncPageBook(PageBook pageBook) {
159:                int pos = tabFolder.getSelectionIndex();
160:                Control children[] = pageBook.getChildren();
161:                int size = children.length;
162:                if (pos < size) {
163:                    pageBook.showPage(children[pos]);
164:                }
165:            }
166:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.