Source Code Cross Referenced for PDEMultiPageContentOutline.java in  » IDE-Eclipse » Eclipse-plug-in-development » org » eclipse » pde » internal » ui » editor » 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 » Eclipse plug in development » org.eclipse.pde.internal.ui.editor 
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.pde.internal.ui.editor;
011:
012:        import java.util.ArrayList;
013:
014:        import org.eclipse.jface.action.Action;
015:        import org.eclipse.jface.action.IMenuManager;
016:        import org.eclipse.jface.action.IStatusLineManager;
017:        import org.eclipse.jface.action.IToolBarManager;
018:        import org.eclipse.jface.viewers.ISelection;
019:        import org.eclipse.jface.viewers.ISelectionChangedListener;
020:        import org.eclipse.jface.viewers.ISelectionProvider;
021:        import org.eclipse.jface.viewers.SelectionChangedEvent;
022:        import org.eclipse.pde.internal.ui.IHelpContextIds;
023:        import org.eclipse.pde.internal.ui.IPreferenceConstants;
024:        import org.eclipse.pde.internal.ui.PDEPlugin;
025:        import org.eclipse.pde.internal.ui.PDEPluginImages;
026:        import org.eclipse.pde.internal.ui.PDEUIMessages;
027:        import org.eclipse.swt.SWT;
028:        import org.eclipse.swt.events.FocusListener;
029:        import org.eclipse.swt.widgets.Composite;
030:        import org.eclipse.swt.widgets.Control;
031:        import org.eclipse.ui.IActionBars;
032:        import org.eclipse.ui.PlatformUI;
033:        import org.eclipse.ui.part.Page;
034:        import org.eclipse.ui.part.PageBook;
035:        import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
036:
037:        public class PDEMultiPageContentOutline extends Page implements 
038:                IContentOutlinePage, ISelectionProvider,
039:                ISelectionChangedListener, IPreferenceConstants {
040:            private PageBook pagebook;
041:            private ISelection selection;
042:            private ArrayList listeners;
043:            private ISortableContentOutlinePage currentPage;
044:            private ISortableContentOutlinePage emptyPage;
045:            private IActionBars actionBars;
046:            private boolean sortingOn;
047:            private PDEFormEditor editor;
048:
049:            public PDEMultiPageContentOutline(PDEFormEditor editor) {
050:                this .editor = editor;
051:                listeners = new ArrayList();
052:                sortingOn = PDEPlugin
053:                        .getDefault()
054:                        .getPreferenceStore()
055:                        .getBoolean(
056:                                "PDEMultiPageContentOutline.SortingAction.isChecked"); //$NON-NLS-1$
057:
058:            }
059:
060:            public void addFocusListener(FocusListener listener) {
061:            }
062:
063:            public void addSelectionChangedListener(
064:                    ISelectionChangedListener listener) {
065:                listeners.add(listener);
066:            }
067:
068:            public void createControl(Composite parent) {
069:                pagebook = new PageBook(parent, SWT.NONE);
070:            }
071:
072:            public void dispose() {
073:                if (pagebook != null && !pagebook.isDisposed())
074:                    pagebook.dispose();
075:                if (emptyPage != null) {
076:                    emptyPage.dispose();
077:                    emptyPage = null;
078:                }
079:                pagebook = null;
080:                listeners = null;
081:            }
082:
083:            public boolean isDisposed() {
084:                return listeners == null;
085:            }
086:
087:            public Control getControl() {
088:                return pagebook;
089:            }
090:
091:            public PageBook getPagebook() {
092:                return pagebook;
093:            }
094:
095:            public ISelection getSelection() {
096:                return selection;
097:            }
098:
099:            public void makeContributions(IMenuManager menuManager,
100:                    IToolBarManager toolBarManager,
101:                    IStatusLineManager statusLineManager) {
102:            }
103:
104:            public void removeFocusListener(FocusListener listener) {
105:            }
106:
107:            public void removeSelectionChangedListener(
108:                    ISelectionChangedListener listener) {
109:                listeners.remove(listener);
110:            }
111:
112:            public void selectionChanged(SelectionChangedEvent event) {
113:                setSelection(event.getSelection());
114:            }
115:
116:            public void setActionBars(IActionBars actionBars) {
117:                this .actionBars = actionBars;
118:                registerToolbarActions(actionBars);
119:                if (currentPage != null)
120:                    setPageActive(currentPage);
121:
122:            }
123:
124:            public IActionBars getActionBars() {
125:                return actionBars;
126:            }
127:
128:            public void setFocus() {
129:                if (currentPage != null)
130:                    currentPage.setFocus();
131:            }
132:
133:            private ISortableContentOutlinePage getEmptyPage() {
134:                if (emptyPage == null)
135:                    emptyPage = new EmptyOutlinePage();
136:                return emptyPage;
137:            }
138:
139:            public void setPageActive(ISortableContentOutlinePage page) {
140:                if (page == null) {
141:                    page = getEmptyPage();
142:                }
143:                if (currentPage != null) {
144:                    currentPage.removeSelectionChangedListener(this );
145:                }
146:                //page.init(getSite());
147:                page.sort(sortingOn);
148:                page.addSelectionChangedListener(this );
149:                this .currentPage = page;
150:                if (pagebook == null) {
151:                    // still not being made
152:                    return;
153:                }
154:                Control control = page.getControl();
155:                if (control == null || control.isDisposed()) {
156:                    // first time
157:                    page.createControl(pagebook);
158:                    page.setActionBars(getActionBars());
159:                    control = page.getControl();
160:                }
161:                pagebook.showPage(control);
162:                this .currentPage = page;
163:            }
164:
165:            /**
166:             * Set the selection.
167:             */
168:            public void setSelection(ISelection selection) {
169:                this .selection = selection;
170:                if (listeners == null)
171:                    return;
172:                SelectionChangedEvent e = new SelectionChangedEvent(this ,
173:                        selection);
174:                for (int i = 0; i < listeners.size(); i++) {
175:                    ((ISelectionChangedListener) listeners.get(i))
176:                            .selectionChanged(e);
177:                }
178:            }
179:
180:            private void registerToolbarActions(IActionBars actionBars) {
181:
182:                IToolBarManager toolBarManager = actionBars.getToolBarManager();
183:                if (toolBarManager != null) {
184:                    toolBarManager.add(new ToggleLinkWithEditorAction(editor));
185:                    toolBarManager.add(new SortingAction());
186:                }
187:            }
188:
189:            class SortingAction extends Action {
190:
191:                public SortingAction() {
192:                    super ();
193:                    PlatformUI.getWorkbench().getHelpSystem().setHelp(this ,
194:                            IHelpContextIds.OUTLINE_SORT_ACTION);
195:                    setText(PDEUIMessages.PDEMultiPageContentOutline_SortingAction_label);
196:                    setImageDescriptor(PDEPluginImages.DESC_ALPHAB_SORT_CO);
197:                    setDisabledImageDescriptor(PDEPluginImages.DESC_ALPHAB_SORT_CO_DISABLED);
198:                    setToolTipText(PDEUIMessages.PDEMultiPageContentOutline_SortingAction_tooltip);
199:                    setDescription(PDEUIMessages.PDEMultiPageContentOutline_SortingAction_description);
200:                    setChecked(sortingOn);
201:                }
202:
203:                public void run() {
204:                    setChecked(isChecked());
205:                    valueChanged(isChecked());
206:                }
207:
208:                private void valueChanged(final boolean on) {
209:                    sortingOn = on;
210:                    if (currentPage != null)
211:                        currentPage.sort(on);
212:                    PDEPlugin
213:                            .getDefault()
214:                            .getPreferenceStore()
215:                            .setValue(
216:                                    "PDEMultiPageContentOutline.SortingAction.isChecked", on); //$NON-NLS-1$
217:                }
218:
219:            }
220:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.