Source Code Cross Referenced for PatchSpecPage.java in  » IDE-Eclipse » Eclipse-plug-in-development » org » eclipse » pde » internal » ui » wizards » feature » 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.feature 
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.feature;
011:
012:        import org.eclipse.jface.dialogs.IMessageProvider;
013:        import org.eclipse.jface.window.Window;
014:        import org.eclipse.jface.wizard.IWizardPage;
015:        import org.eclipse.osgi.util.NLS;
016:        import org.eclipse.pde.internal.core.PDECore;
017:        import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
018:        import org.eclipse.pde.internal.core.util.IdUtil;
019:        import org.eclipse.pde.internal.ui.IHelpContextIds;
020:        import org.eclipse.pde.internal.ui.PDEUIMessages;
021:        import org.eclipse.pde.internal.ui.util.SWTUtil;
022:        import org.eclipse.pde.internal.ui.wizards.FeatureSelectionDialog;
023:        import org.eclipse.swt.SWT;
024:        import org.eclipse.swt.events.ModifyListener;
025:        import org.eclipse.swt.events.SelectionAdapter;
026:        import org.eclipse.swt.events.SelectionEvent;
027:        import org.eclipse.swt.layout.GridData;
028:        import org.eclipse.swt.layout.GridLayout;
029:        import org.eclipse.swt.widgets.Button;
030:        import org.eclipse.swt.widgets.Composite;
031:        import org.eclipse.swt.widgets.Group;
032:        import org.eclipse.swt.widgets.Label;
033:        import org.eclipse.swt.widgets.Text;
034:
035:        public class PatchSpecPage extends AbstractFeatureSpecPage {
036:
037:            private Text fPatchProviderText;
038:            private Button fBrowseButton;
039:            private Text fPatchIdText;
040:            private Text fPatchNameText;
041:            private Text fFeatureIdText;
042:
043:            public PatchSpecPage() {
044:                super ();
045:                setTitle(PDEUIMessages.PatchSpec_title);
046:                setDescription(PDEUIMessages.NewFeatureWizard_SpecPage_desc);
047:            }
048:
049:            protected void initialize() {
050:                String projectName = getProjectName();
051:                if (fInitialId == null)
052:                    fPatchIdText.setText(IdUtil.getValidId(projectName));
053:                if (fInitialName == null)
054:                    fPatchNameText.setText(projectName);
055:                setMessage(PDEUIMessages.FeaturePatch_MainPage_desc);
056:            }
057:
058:            protected String validateContent() {
059:                fFeatureToPatch = PDECore.getDefault().getFeatureModelManager()
060:                        .findFeatureModel(fFeatureIdText.getText(),
061:                                fFeatureVersionText.getText());
062:                if (fFeatureToPatch != null) {
063:                    setMessage(null);
064:                    return null;
065:                }
066:
067:                setMessage(NLS
068:                        .bind(PDEUIMessages.NewFeaturePatch_SpecPage_notFound,
069:                                fFeatureIdText.getText(), fFeatureVersionText
070:                                        .getText()), IMessageProvider.WARNING);
071:                getContainer().updateButtons();
072:                return null;
073:            }
074:
075:            /* (non-Javadoc)
076:             * @see org.eclipse.jface.wizard.WizardPage#getNextPage()
077:             */
078:            public IWizardPage getNextPage() {
079:                if (fFeatureToPatch == null)
080:                    return null;
081:                return super .getNextPage();
082:            }
083:
084:            private String getPatchId() {
085:                if (fPatchIdText == null)
086:                    return ""; //$NON-NLS-1$
087:                return fPatchIdText.getText();
088:            }
089:
090:            private String getPatchName() {
091:                if (fPatchNameText == null)
092:                    return ""; //$NON-NLS-1$
093:                return fPatchNameText.getText();
094:            }
095:
096:            private String getPatchProvider() {
097:                if (fPatchProviderText == null)
098:                    return ""; //$NON-NLS-1$
099:                return fPatchProviderText.getText();
100:            }
101:
102:            public FeatureData getFeatureData() {
103:                FeatureData data = new FeatureData();
104:                data.id = getPatchId();
105:                data.version = "1.0.0"; //$NON-NLS-1$
106:                data.provider = getPatchProvider();
107:                data.name = getPatchName();
108:                data.library = getInstallHandlerLibrary();
109:                data.isPatch = true;
110:                data.featureToPatchId = fFeatureIdText.getText();
111:                data.featureToPatchVersion = fFeatureVersionText.getText();
112:                return data;
113:            }
114:
115:            protected String verifyIdRules() {
116:                String id = fPatchIdText.getText();
117:                if (id == null || id.length() == 0)
118:                    return PDEUIMessages.NewFeatureWizard_SpecPage_pmissing;
119:                if (!IdUtil.isValidCompositeID(id)) {
120:                    return PDEUIMessages.NewFeatureWizard_SpecPage_invalidId;
121:                }
122:                return super .verifyIdRules();
123:            }
124:
125:            protected String getHelpId() {
126:                return IHelpContextIds.NEW_PATCH_REQUIRED_DATA;
127:            }
128:
129:            protected void createTopGroup(Composite container) {
130:                Group patchGroup = new Group(container, SWT.NULL);
131:                patchGroup.setLayout(new GridLayout(2, false));
132:                GridData gd = new GridData(GridData.FILL_HORIZONTAL);
133:                gd.verticalIndent = 10;
134:                patchGroup.setLayoutData(gd);
135:                patchGroup
136:                        .setText(PDEUIMessages.NewFeatureWizard_SpecPage_patchProperties);
137:                Label label = new Label(patchGroup, SWT.NULL);
138:                label.setText(PDEUIMessages.NewFeaturePatch_SpecPage_id);
139:                fPatchIdText = new Text(patchGroup, SWT.BORDER);
140:                fPatchIdText.setLayoutData(new GridData(
141:                        GridData.FILL_HORIZONTAL));
142:
143:                label = new Label(patchGroup, SWT.NULL);
144:                label.setText(PDEUIMessages.NewFeaturePatch_SpecPage_name);
145:                fPatchNameText = new Text(patchGroup, SWT.BORDER);
146:                fPatchNameText.setLayoutData(new GridData(
147:                        GridData.FILL_HORIZONTAL));
148:
149:                label = new Label(patchGroup, SWT.NULL);
150:                label.setText(PDEUIMessages.NewFeaturePatch_SpecPage_provider);
151:                fPatchProviderText = new Text(patchGroup, SWT.BORDER);
152:                fPatchProviderText.setLayoutData(new GridData(
153:                        GridData.FILL_HORIZONTAL));
154:
155:                createInstallHandlerText(patchGroup);
156:            }
157:
158:            protected void createContents(Composite container) {
159:
160:                createTopGroup(container);
161:
162:                Group group = new Group(container, SWT.NULL);
163:                group.setLayout(new GridLayout(2, false));
164:                GridData gd = new GridData(GridData.FILL_HORIZONTAL);
165:                gd.verticalIndent = 10;
166:                group.setLayoutData(gd);
167:                group
168:                        .setText(PDEUIMessages.BaseFeatureSpecPage_patchGroup_title);
169:
170:                Label label = new Label(group, SWT.NULL);
171:                label.setText(PDEUIMessages.NewFeatureWizard_SpecPage_id);
172:
173:                Composite patchcontainer = new Composite(group, SWT.NULL);
174:                GridLayout layout = new GridLayout(2, false);
175:                layout.marginHeight = layout.marginWidth = 0;
176:                layout.horizontalSpacing = 5;
177:                patchcontainer.setLayout(layout);
178:                patchcontainer.setLayoutData(new GridData(
179:                        GridData.FILL_HORIZONTAL));
180:
181:                fFeatureIdText = new Text(patchcontainer, SWT.BORDER);
182:                fFeatureIdText.setLayoutData(new GridData(
183:                        GridData.FILL_HORIZONTAL));
184:
185:                fBrowseButton = new Button(patchcontainer, SWT.PUSH);
186:                fBrowseButton.setText(PDEUIMessages.BaseFeatureSpecPage_browse);
187:                fBrowseButton.setLayoutData(new GridData(
188:                        GridData.HORIZONTAL_ALIGN_END));
189:                fBrowseButton.addSelectionListener(new SelectionAdapter() {
190:
191:                    public void widgetSelected(SelectionEvent e) {
192:                        FeatureSelectionDialog dialog = new FeatureSelectionDialog(
193:                                getShell(), PDECore.getDefault()
194:                                        .getFeatureModelManager().getModels(),
195:                                false);
196:                        dialog.create();
197:                        if (dialog.open() == Window.OK) {
198:                            Object[] result = dialog.getResult();
199:                            IFeatureModel selectedModel = (IFeatureModel) result[0];
200:
201:                            // block auto validation till last setText
202:                            fSelfModification = true;
203:                            fFeatureIdText.setText(selectedModel.getFeature()
204:                                    .getId());
205:                            fFeatureNameText.setText(selectedModel.getFeature()
206:                                    .getLabel());
207:                            fSelfModification = false;
208:                            fFeatureVersionText.setText(selectedModel
209:                                    .getFeature().getVersion());
210:
211:                            fFeatureToPatch = selectedModel;
212:                        }
213:                    }
214:                });
215:                SWTUtil.setButtonDimensionHint(fBrowseButton);
216:
217:                createCommonInput(group);
218:            }
219:
220:            protected void attachListeners(ModifyListener listener) {
221:                fPatchIdText.addModifyListener(listener);
222:                fPatchNameText.addModifyListener(listener);
223:                fPatchProviderText.addModifyListener(listener);
224:                fFeatureIdText.addModifyListener(listener);
225:            }
226:
227:            protected String getFeatureId() {
228:                return fFeatureIdText.getText();
229:            }
230:
231:            protected void updateNameRelativeFields() {
232:                if (fPatchIdText == null || fPatchNameText == null)
233:                    return;
234:                fSelfModification = true;
235:                String id = IdUtil.getValidId(getProjectName());
236:                fPatchIdText.setText(id);
237:                fPatchNameText.setText(IdUtil.getValidName(id,
238:                        PDEUIMessages.PatchSpecPage_feature));
239:                fPatchProviderText.setText(IdUtil.getValidProvider(id));
240:                fSelfModification = false;
241:            }
242:        }
w___w_w_.j___a___v__a__2___s___._com__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.