Source Code Cross Referenced for WizardListSelectionPage.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 java.util.Iterator;
013:
014:        import org.eclipse.core.runtime.CoreException;
015:        import org.eclipse.core.runtime.IConfigurationElement;
016:        import org.eclipse.core.runtime.IExecutableExtension;
017:        import org.eclipse.jface.action.Action;
018:        import org.eclipse.jface.dialogs.Dialog;
019:        import org.eclipse.jface.viewers.DoubleClickEvent;
020:        import org.eclipse.jface.viewers.IDoubleClickListener;
021:        import org.eclipse.jface.viewers.ISelectionChangedListener;
022:        import org.eclipse.jface.viewers.IStructuredSelection;
023:        import org.eclipse.jface.viewers.SelectionChangedEvent;
024:        import org.eclipse.jface.viewers.StructuredSelection;
025:        import org.eclipse.jface.viewers.TableViewer;
026:        import org.eclipse.jface.wizard.IWizard;
027:        import org.eclipse.jface.wizard.IWizardNode;
028:        import org.eclipse.jface.wizard.IWizardPage;
029:        import org.eclipse.pde.internal.ui.elements.ElementList;
030:        import org.eclipse.pde.internal.ui.elements.ListContentProvider;
031:        import org.eclipse.pde.ui.IPluginContentWizard;
032:        import org.eclipse.swt.SWT;
033:        import org.eclipse.swt.custom.SashForm;
034:        import org.eclipse.swt.layout.GridData;
035:        import org.eclipse.swt.layout.GridLayout;
036:        import org.eclipse.swt.widgets.Composite;
037:        import org.eclipse.swt.widgets.Label;
038:        import org.eclipse.swt.widgets.Table;
039:        import org.eclipse.swt.widgets.TableItem;
040:
041:        public abstract class WizardListSelectionPage extends
042:                BaseWizardSelectionPage implements  ISelectionChangedListener,
043:                IExecutableExtension {
044:            protected TableViewer wizardSelectionViewer;
045:            protected ElementList wizardElements;
046:            private WizardSelectedAction doubleClickAction = new WizardSelectedAction();
047:
048:            private class WizardSelectedAction extends Action {
049:                public WizardSelectedAction() {
050:                    super ("wizardSelection"); //$NON-NLS-1$
051:                }
052:
053:                public void run() {
054:                    selectionChanged(new SelectionChangedEvent(
055:                            wizardSelectionViewer, wizardSelectionViewer
056:                                    .getSelection()));
057:                    advanceToNextPage();
058:                }
059:            }
060:
061:            public WizardListSelectionPage(ElementList wizardElements,
062:                    String message) {
063:                super ("ListSelection", message); //$NON-NLS-1$
064:                this .wizardElements = wizardElements;
065:            }
066:
067:            public void advanceToNextPage() {
068:                getContainer().showPage(getNextPage());
069:            }
070:
071:            public ElementList getWizardElements() {
072:                return wizardElements;
073:            }
074:
075:            public void createControl(Composite parent) {
076:                Composite container = new Composite(parent, SWT.NONE);
077:                GridLayout layout = new GridLayout();
078:                layout.verticalSpacing = 10;
079:                container.setLayout(layout);
080:                container.setLayoutData(new GridData(GridData.FILL_BOTH));
081:
082:                createAbove(container, 1);
083:                Label label = new Label(container, SWT.NONE);
084:                label.setText(getLabel());
085:                GridData gd = new GridData();
086:                label.setLayoutData(gd);
087:
088:                SashForm sashForm = new SashForm(container, SWT.HORIZONTAL);
089:                gd = new GridData(GridData.FILL_BOTH);
090:                // limit the width of the sash form to avoid the wizard
091:                // opening very wide. This is just preferred size - 
092:                // it can be made bigger by the wizard
093:                // See bug #83356
094:                gd.widthHint = 300;
095:                sashForm.setLayoutData(gd);
096:
097:                wizardSelectionViewer = new TableViewer(sashForm, SWT.BORDER);
098:                wizardSelectionViewer
099:                        .setContentProvider(new ListContentProvider());
100:                wizardSelectionViewer
101:                        .setLabelProvider(ListUtil.TABLE_LABEL_PROVIDER);
102:                wizardSelectionViewer.setComparator(ListUtil.NAME_COMPARATOR);
103:                wizardSelectionViewer
104:                        .addDoubleClickListener(new IDoubleClickListener() {
105:                            public void doubleClick(DoubleClickEvent event) {
106:                                doubleClickAction.run();
107:                            }
108:                        });
109:                createDescriptionIn(sashForm);
110:                createBelow(container, 1);
111:                initializeViewer();
112:                wizardSelectionViewer.setInput(wizardElements);
113:                wizardSelectionViewer.addSelectionChangedListener(this );
114:                Dialog.applyDialogFont(container);
115:                setControl(container);
116:            }
117:
118:            protected void createAbove(Composite container, int span) {
119:            }
120:
121:            protected void createBelow(Composite container, int span) {
122:            }
123:
124:            protected void initializeViewer() {
125:            }
126:
127:            public void selectionChanged(SelectionChangedEvent event) {
128:                setErrorMessage(null);
129:                IStructuredSelection selection = (IStructuredSelection) event
130:                        .getSelection();
131:                WizardElement currentWizardSelection = null;
132:                Iterator iter = selection.iterator();
133:                if (iter.hasNext())
134:                    currentWizardSelection = (WizardElement) iter.next();
135:                if (currentWizardSelection == null) {
136:                    setDescriptionText(""); //$NON-NLS-1$
137:                    setSelectedNode(null);
138:                    return;
139:                }
140:                final WizardElement finalSelection = currentWizardSelection;
141:                setSelectedNode(createWizardNode(finalSelection));
142:                setDescriptionText(finalSelection.getDescription());
143:                getContainer().updateButtons();
144:            }
145:
146:            public IWizardPage getNextPage(boolean shouldCreate) {
147:                if (!shouldCreate)
148:                    return super .getNextPage();
149:                IWizardNode selectedNode = getSelectedNode();
150:                selectedNode.dispose();
151:                IWizard wizard = selectedNode.getWizard();
152:                if (wizard == null) {
153:                    super .setSelectedNode(null);
154:                    return null;
155:                }
156:                if (shouldCreate)
157:                    // Allow the wizard to create its pages
158:                    wizard.addPages();
159:                return wizard.getStartingPage();
160:            }
161:
162:            protected void focusAndSelectFirst() {
163:                Table table = wizardSelectionViewer.getTable();
164:                table.setFocus();
165:                TableItem[] items = table.getItems();
166:                if (items.length > 0) {
167:                    TableItem first = items[0];
168:                    Object obj = first.getData();
169:                    wizardSelectionViewer.setSelection(new StructuredSelection(
170:                            obj));
171:                }
172:            }
173:
174:            /* (non-Javadoc)
175:             * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
176:             */
177:            public void setInitializationData(IConfigurationElement config,
178:                    String propertyName, Object data) throws CoreException {
179:            }
180:
181:            public IPluginContentWizard getSelectedWizard() {
182:                IWizardNode node = getSelectedNode();
183:                if (node != null)
184:                    return (IPluginContentWizard) node.getWizard();
185:                return null;
186:            }
187:
188:            /* (non-Javadoc)
189:             * @see org.eclipse.jface.wizard.WizardSelectionPage#canFlipToNextPage()
190:             */
191:            public boolean canFlipToNextPage() {
192:                IStructuredSelection ssel = (IStructuredSelection) wizardSelectionViewer
193:                        .getSelection();
194:                return ssel != null && !ssel.isEmpty();
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.