Source Code Cross Referenced for WizardTreeSelectionPage.java in  » IDE-Eclipse » Eclipse-plug-in-development » org » eclipse » pde » internal » ui » wizards » 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.wizards 
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.wizards;
011:
012:        import org.eclipse.jface.viewers.ColumnWeightData;
013:        import org.eclipse.jface.viewers.DoubleClickEvent;
014:        import org.eclipse.jface.viewers.IDoubleClickListener;
015:        import org.eclipse.jface.viewers.ISelectionChangedListener;
016:        import org.eclipse.jface.viewers.IStructuredSelection;
017:        import org.eclipse.jface.viewers.SelectionChangedEvent;
018:        import org.eclipse.jface.viewers.StructuredSelection;
019:        import org.eclipse.jface.viewers.TableLayout;
020:        import org.eclipse.jface.viewers.TableViewer;
021:        import org.eclipse.jface.viewers.TreeViewer;
022:        import org.eclipse.jface.wizard.IWizardNode;
023:        import org.eclipse.pde.internal.ui.elements.ElementLabelProvider;
024:        import org.eclipse.pde.internal.ui.elements.ListContentProvider;
025:        import org.eclipse.pde.internal.ui.elements.TreeContentProvider;
026:        import org.eclipse.swt.SWT;
027:        import org.eclipse.swt.custom.BusyIndicator;
028:        import org.eclipse.swt.custom.SashForm;
029:        import org.eclipse.swt.layout.FillLayout;
030:        import org.eclipse.swt.layout.GridLayout;
031:        import org.eclipse.swt.widgets.Composite;
032:        import org.eclipse.swt.widgets.Table;
033:        import org.eclipse.swt.widgets.TableColumn;
034:        import org.eclipse.swt.widgets.Tree;
035:
036:        public abstract class WizardTreeSelectionPage extends
037:                BaseWizardSelectionPage implements  ISelectionChangedListener {
038:            private TreeViewer categoryTreeViewer;
039:            private String baseCategory;
040:            protected TableViewer wizardSelectionViewer;
041:
042:            private WizardCollectionElement wizardCategories;
043:
044:            public WizardTreeSelectionPage(WizardCollectionElement categories,
045:                    String baseCategory, String message) {
046:                super ("NewExtension", message); //$NON-NLS-1$
047:                this .wizardCategories = categories;
048:                this .baseCategory = baseCategory;
049:            }
050:
051:            public void advanceToNextPage() {
052:                getContainer().showPage(getNextPage());
053:            }
054:
055:            public void createControl(Composite parent) {
056:                // top level group
057:                Composite container = new Composite(parent, SWT.NULL);
058:                FillLayout flayout = new FillLayout();
059:                flayout.marginWidth = 5;
060:                flayout.marginHeight = 5;
061:                container.setLayout(flayout);
062:                SashForm rootSash = new SashForm(container, SWT.VERTICAL);
063:                SashForm outerSash = new SashForm(rootSash, SWT.HORIZONTAL);
064:                GridLayout layout = new GridLayout();
065:                layout.numColumns = 2;
066:
067:                // tree pane
068:                Tree tree = new Tree(outerSash, SWT.BORDER);
069:                categoryTreeViewer = new TreeViewer(tree);
070:                categoryTreeViewer
071:                        .setContentProvider(new TreeContentProvider());
072:                categoryTreeViewer
073:                        .setLabelProvider(ElementLabelProvider.INSTANCE);
074:
075:                categoryTreeViewer
076:                        .setComparator(new WizardCollectionComparator(
077:                                baseCategory));
078:                categoryTreeViewer.addSelectionChangedListener(this );
079:
080:                // wizard actions pane
081:                Table table = new Table(outerSash, SWT.BORDER);
082:                new TableColumn(table, SWT.NONE);
083:                TableLayout tlayout = new TableLayout();
084:                tlayout.addColumnData(new ColumnWeightData(100));
085:                table.setLayout(tlayout);
086:
087:                wizardSelectionViewer = new TableViewer(table);
088:                wizardSelectionViewer
089:                        .setContentProvider(new ListContentProvider());
090:                wizardSelectionViewer
091:                        .setLabelProvider(ListUtil.TABLE_LABEL_PROVIDER);
092:                wizardSelectionViewer.setComparator(ListUtil.NAME_COMPARATOR);
093:                wizardSelectionViewer.addSelectionChangedListener(this );
094:                wizardSelectionViewer
095:                        .addDoubleClickListener(new IDoubleClickListener() {
096:                            public void doubleClick(DoubleClickEvent event) {
097:                                BusyIndicator.showWhile(wizardSelectionViewer
098:                                        .getControl().getDisplay(),
099:                                        new Runnable() {
100:                                            public void run() {
101:                                                selectionChanged(new SelectionChangedEvent(
102:                                                        wizardSelectionViewer,
103:                                                        wizardSelectionViewer
104:                                                                .getSelection()));
105:                                                advanceToNextPage();
106:                                            }
107:                                        });
108:                            }
109:                        });
110:
111:                // the new composite below is needed in order to make the label span the two
112:                // defined columns of outerContainer
113:                Composite descriptionComposite = new Composite(rootSash,
114:                        SWT.NONE);
115:                layout = new GridLayout();
116:                layout.marginHeight = 0;
117:                layout.marginWidth = 0;
118:                descriptionComposite.setLayout(layout);
119:                createDescriptionIn(descriptionComposite);
120:
121:                initializeViewers();
122:                rootSash.setWeights(new int[] { 70, 30 });
123:                setControl(container);
124:            }
125:
126:            protected Object getSingleSelection(IStructuredSelection selection) {
127:                Object selectedObject = selection.getFirstElement();
128:                if (selection.size() > 1)
129:                    selectedObject = null; // ie.- a multi-selection
130:                return selectedObject;
131:            }
132:
133:            private void handleCategorySelection(
134:                    SelectionChangedEvent selectionEvent) {
135:                setErrorMessage(null);
136:                setDescriptionText(""); //$NON-NLS-1$
137:                setSelectedNode(null);
138:
139:                WizardCollectionElement selectedCategory = (WizardCollectionElement) getSingleSelection((IStructuredSelection) selectionEvent
140:                        .getSelection());
141:
142:                if (selectedCategory == null)
143:                    wizardSelectionViewer.setInput(null);
144:                else
145:                    wizardSelectionViewer.setInput(selectedCategory
146:                            .getWizards());
147:            }
148:
149:            private void handleWizardSelection(
150:                    SelectionChangedEvent selectionEvent) {
151:                setErrorMessage(null);
152:
153:                WizardElement currentSelection = (WizardElement) getSingleSelection((IStructuredSelection) selectionEvent
154:                        .getSelection());
155:
156:                // If no single selection, clear and return
157:                if (currentSelection == null) {
158:                    setDescriptionText(""); //$NON-NLS-1$
159:                    setSelectedNode(null);
160:                    return;
161:                }
162:                final WizardElement finalSelection = currentSelection;
163:                /*
164:                	BusyIndicator.showWhile(categoryTreeViewer.getControl().getDisplay(), new Runnable() {
165:                		public void run() {
166:                 */
167:                setSelectedNode(createWizardNode(finalSelection));
168:                setDescriptionText(finalSelection.getDescription());
169:                /*
170:                		}
171:                	});
172:                 */
173:            }
174:
175:            protected void initializeViewers() {
176:                categoryTreeViewer.setInput(wizardCategories);
177:                wizardSelectionViewer.addSelectionChangedListener(this );
178:                Object[] categories = wizardCategories.getChildren();
179:                if (categories.length > 0)
180:                    categoryTreeViewer.setSelection(new StructuredSelection(
181:                            categories[0]));
182:                categoryTreeViewer.getTree().setFocus();
183:            }
184:
185:            public void selectionChanged(SelectionChangedEvent selectionEvent) {
186:                if (selectionEvent.getSelectionProvider().equals(
187:                        categoryTreeViewer))
188:                    handleCategorySelection(selectionEvent);
189:                else
190:                    handleWizardSelection(selectionEvent);
191:            }
192:
193:            public void setSelectedNode(IWizardNode node) {
194:                super.setSelectedNode(node);
195:            }
196:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.