Source Code Cross Referenced for AbstractFeatureSpecPage.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.core.runtime.IStatus;
013:        import org.eclipse.jface.dialogs.Dialog;
014:        import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
015:        import org.eclipse.pde.internal.core.util.IdUtil;
016:        import org.eclipse.pde.internal.core.util.VersionUtil;
017:        import org.eclipse.pde.internal.ui.PDEUIMessages;
018:        import org.eclipse.swt.SWT;
019:        import org.eclipse.swt.events.ModifyEvent;
020:        import org.eclipse.swt.events.ModifyListener;
021:        import org.eclipse.swt.layout.GridData;
022:        import org.eclipse.swt.widgets.Composite;
023:        import org.eclipse.swt.widgets.Label;
024:        import org.eclipse.swt.widgets.Text;
025:        import org.eclipse.ui.PlatformUI;
026:        import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
027:
028:        public abstract class AbstractFeatureSpecPage extends
029:                WizardNewProjectCreationPage {
030:
031:            protected Text fFeatureNameText;
032:            protected Text fFeatureVersionText;
033:            protected Text fLibraryText;
034:            protected String fInitialId;
035:            protected String fInitialName;
036:            protected IFeatureModel fFeatureToPatch;
037:            protected boolean fSelfModification;
038:            private boolean fUpdateName = true;
039:
040:            public AbstractFeatureSpecPage() {
041:                super ("specPage"); //$NON-NLS-1$
042:            }
043:
044:            public void createControl(Composite parent) {
045:                super .createControl(parent);
046:                Composite comp = (Composite) getControl();
047:
048:                createContents(comp);
049:
050:                initialize();
051:                attachListeners();
052:
053:                Dialog.applyDialogFont(comp);
054:                PlatformUI.getWorkbench().getHelpSystem().setHelp(comp,
055:                        getHelpId());
056:            }
057:
058:            protected abstract void createContents(Composite container);
059:
060:            protected abstract void initialize();
061:
062:            protected abstract void attachListeners(ModifyListener listener);
063:
064:            protected abstract String getHelpId();
065:
066:            protected void createCommonInput(Composite common) {
067:                Label label = new Label(common, SWT.NULL);
068:                label.setText(PDEUIMessages.NewFeatureWizard_SpecPage_name);
069:                fFeatureNameText = new Text(common, SWT.BORDER);
070:                fFeatureNameText.setLayoutData(new GridData(
071:                        GridData.FILL_HORIZONTAL));
072:
073:                label = new Label(common, SWT.NULL);
074:                label.setText(PDEUIMessages.NewFeatureWizard_SpecPage_version);
075:                fFeatureVersionText = new Text(common, SWT.BORDER);
076:                fFeatureVersionText.setLayoutData(new GridData(
077:                        GridData.FILL_HORIZONTAL));
078:            }
079:
080:            protected void createInstallHandlerText(Composite parent) {
081:                Label libraryLabel = new Label(parent, SWT.NULL);
082:                libraryLabel
083:                        .setText(PDEUIMessages.NewFeatureWizard_SpecPage_library);
084:                fLibraryText = new Text(parent, SWT.SINGLE | SWT.BORDER);
085:                fLibraryText.setLayoutData(new GridData(
086:                        GridData.FILL_HORIZONTAL));
087:            }
088:
089:            protected abstract void updateNameRelativeFields();
090:
091:            protected boolean validatePage() {
092:                boolean valid = super .validatePage();
093:                if (!valid)
094:                    return valid;
095:                if (fUpdateName)
096:                    updateNameRelativeFields();
097:                return validateBaseContent(false);
098:            }
099:
100:            private boolean validateBaseContent(boolean validateSuper) {
101:                if (validateSuper && !super .validatePage())
102:                    return false;
103:                if (!setValidationMessage(verifyIdRules()))
104:                    return false;
105:                if (!setValidationMessage(verifyVersion()))
106:                    return false;
107:                if (!setValidationMessage(validateContent()))
108:                    return false;
109:
110:                setPageComplete(true);
111:                setErrorMessage(null);
112:                return true;
113:            }
114:
115:            private boolean setValidationMessage(String message) {
116:                if (message == null)
117:                    return true;
118:                setPageComplete(false);
119:                setErrorMessage(message);
120:                return false;
121:            }
122:
123:            protected abstract String validateContent();
124:
125:            public String getInitialName() {
126:                return fInitialName;
127:            }
128:
129:            public void setInitialName(String initialName) {
130:                fInitialName = initialName;
131:            }
132:
133:            public void setInitialId(String initialId) {
134:                fInitialId = initialId;
135:            }
136:
137:            public String getInitialId() {
138:                return fInitialId;
139:            }
140:
141:            protected String verifyVersion() {
142:                String value = fFeatureVersionText.getText();
143:                if (VersionUtil.validateVersion(value).getSeverity() != IStatus.OK)
144:                    return PDEUIMessages.NewFeatureWizard_SpecPage_versionFormat;
145:                return null;
146:            }
147:
148:            protected abstract String getFeatureId();
149:
150:            protected String verifyIdRules() {
151:                String id = getFeatureId();
152:                if (id == null || id.length() == 0)
153:                    return PDEUIMessages.NewFeatureWizard_SpecPage_missing;
154:                if (!IdUtil.isValidCompositeID(id)) {
155:                    return PDEUIMessages.NewFeatureWizard_SpecPage_invalidId;
156:                }
157:                return null;
158:            }
159:
160:            public IFeatureModel getFeatureToPatch() {
161:                return fFeatureToPatch;
162:            }
163:
164:            protected String getInstallHandlerLibrary() {
165:                String library = fLibraryText.getText();
166:                if (library == null || library.length() == 0)
167:                    return null;
168:                if (!library.endsWith(".jar") && !library.endsWith("/") && !library.equals(".")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
169:                    library += "/"; //$NON-NLS-1$
170:                return library;
171:            }
172:
173:            private void attachListeners() {
174:                ModifyListener listener = new ModifyListener() {
175:                    public void modifyText(ModifyEvent e) {
176:                        if (!fSelfModification) {
177:                            fUpdateName = false;
178:                            setPageComplete(validateBaseContent(true));
179:                        }
180:                    }
181:                };
182:                attachListeners(listener);
183:                fFeatureNameText.addModifyListener(listener);
184:                fFeatureVersionText.addModifyListener(listener);
185:                fLibraryText.addModifyListener(listener);
186:            }
187:
188:            public abstract FeatureData getFeatureData();
189:        }
w__w_w__.___jav__a___2s__.__co___m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.