Source Code Cross Referenced for IncludedFeaturesDetailsSection.java in  » IDE-Eclipse » Eclipse-plug-in-development » org » eclipse » pde » internal » ui » editor » 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.editor.feature 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2007 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.feature;
011:
012:        import org.eclipse.core.runtime.CoreException;
013:        import org.eclipse.jface.viewers.ISelection;
014:        import org.eclipse.jface.viewers.IStructuredSelection;
015:        import org.eclipse.pde.core.IModelChangedEvent;
016:        import org.eclipse.pde.internal.core.ifeature.IFeatureChild;
017:        import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
018:        import org.eclipse.pde.internal.ui.PDEPlugin;
019:        import org.eclipse.pde.internal.ui.PDEUIMessages;
020:        import org.eclipse.pde.internal.ui.editor.FormEntryAdapter;
021:        import org.eclipse.pde.internal.ui.editor.FormLayoutFactory;
022:        import org.eclipse.pde.internal.ui.editor.PDEFormPage;
023:        import org.eclipse.pde.internal.ui.editor.PDESection;
024:        import org.eclipse.pde.internal.ui.parts.FormEntry;
025:        import org.eclipse.swt.SWT;
026:        import org.eclipse.swt.events.SelectionAdapter;
027:        import org.eclipse.swt.events.SelectionEvent;
028:        import org.eclipse.swt.layout.GridData;
029:        import org.eclipse.swt.widgets.Button;
030:        import org.eclipse.swt.widgets.Composite;
031:        import org.eclipse.swt.widgets.Label;
032:        import org.eclipse.ui.forms.IFormPart;
033:        import org.eclipse.ui.forms.IManagedForm;
034:        import org.eclipse.ui.forms.IPartSelectionListener;
035:        import org.eclipse.ui.forms.widgets.FormToolkit;
036:        import org.eclipse.ui.forms.widgets.Section;
037:        import org.eclipse.ui.forms.widgets.TableWrapData;
038:
039:        public class IncludedFeaturesDetailsSection extends PDESection
040:                implements  IFormPart, IPartSelectionListener {
041:            protected IFeatureChild fInput;
042:
043:            private FormEntry fNameText;
044:
045:            private FormEntry fVersionText;
046:
047:            private Button fOptionalButton;
048:
049:            private Button fSearchRootButton;
050:
051:            private Button fSearchSelfButton;
052:
053:            private Button fSearchBothButton;
054:
055:            private boolean fBlockNotification;
056:
057:            public IncludedFeaturesDetailsSection(PDEFormPage page,
058:                    Composite parent) {
059:                this (
060:                        page,
061:                        parent,
062:                        PDEUIMessages.SiteEditor_IncludedFeaturesDetailsSection_title,
063:                        PDEUIMessages.SiteEditor_IncludedFeaturesDetailsSection_desc,
064:                        SWT.NULL);
065:            }
066:
067:            public IncludedFeaturesDetailsSection(PDEFormPage page,
068:                    Composite parent, String title, String desc, int toggleStyle) {
069:                super (page, parent, Section.DESCRIPTION | toggleStyle);
070:                getSection().setText(title);
071:                getSection().setDescription(desc);
072:                createClient(getSection(), page.getManagedForm().getToolkit());
073:            }
074:
075:            public void cancelEdit() {
076:                fNameText.cancelEdit();
077:                fVersionText.cancelEdit();
078:                super .cancelEdit();
079:            }
080:
081:            public void commit(boolean onSave) {
082:                fNameText.commit();
083:                fVersionText.commit();
084:                super .commit(onSave);
085:            }
086:
087:            public void createClient(Section section, FormToolkit toolkit) {
088:
089:                section.setLayout(FormLayoutFactory.createClearGridLayout(
090:                        false, 1));
091:                GridData data = new GridData(GridData.FILL_HORIZONTAL
092:                        | GridData.VERTICAL_ALIGN_BEGINNING);
093:                section.setLayoutData(data);
094:
095:                Composite container = toolkit.createComposite(section);
096:                container.setLayout(FormLayoutFactory
097:                        .createSectionClientTableWrapLayout(false, 2));
098:
099:                fNameText = new FormEntry(
100:                        container,
101:                        toolkit,
102:                        PDEUIMessages.SiteEditor_IncludedFeaturesDetailsSection_featureLabel,
103:                        null, false);
104:                fNameText.setFormEntryListener(new FormEntryAdapter(this ) {
105:                    public void textValueChanged(FormEntry text) {
106:                        if (fInput != null)
107:                            try {
108:                                fInput.setName(text.getValue());
109:                            } catch (CoreException e) {
110:                                PDEPlugin.logException(e);
111:                            }
112:                    }
113:                });
114:                fNameText.setEditable(isEditable());
115:
116:                fVersionText = new FormEntry(container, toolkit,
117:                        PDEUIMessages.FeatureEditor_SpecSection_version, null,
118:                        false);
119:                fVersionText.setFormEntryListener(new FormEntryAdapter(this ) {
120:                    public void textValueChanged(FormEntry text) {
121:                        if (fInput != null)
122:                            try {
123:                                fInput.setVersion(text.getValue());
124:                            } catch (CoreException e) {
125:                                PDEPlugin.logException(e);
126:                            }
127:                    }
128:                });
129:                fVersionText.setEditable(isEditable());
130:
131:                fOptionalButton = toolkit
132:                        .createButton(
133:                                container,
134:                                PDEUIMessages.SiteEditor_IncludedFeaturesDetailsSection_optional,
135:                                SWT.CHECK);
136:
137:                TableWrapData gd = new TableWrapData(TableWrapData.FILL);
138:                gd.colspan = 2;
139:                fOptionalButton.setLayoutData(gd);
140:                fOptionalButton.addSelectionListener(new SelectionAdapter() {
141:                    public void widgetSelected(SelectionEvent e) {
142:                        if (!fBlockNotification) {
143:                            try {
144:                                fInput.setOptional(fOptionalButton
145:                                        .getSelection());
146:                            } catch (CoreException ce) {
147:                            }
148:                        }
149:                    }
150:                });
151:                Label fSearchLocationDescLabel = toolkit
152:                        .createLabel(
153:                                container,
154:                                PDEUIMessages.SiteEditor_IncludedFeaturesDetailsSection_searchLocation,
155:                                SWT.WRAP);
156:                gd = new TableWrapData(TableWrapData.FILL);
157:                gd.colspan = 2;
158:                fSearchLocationDescLabel.setLayoutData(gd);
159:
160:                fSearchRootButton = toolkit
161:                        .createButton(
162:                                container,
163:                                PDEUIMessages.SiteEditor_IncludedFeaturesDetailsSection_root,
164:                                SWT.RADIO);
165:                fSearchRootButton.setSelection(true);
166:                gd = new TableWrapData(TableWrapData.FILL);
167:                gd.colspan = 2;
168:                gd.indent = 5;
169:                fSearchRootButton.setLayoutData(gd);
170:                fSearchRootButton.addSelectionListener(new SelectionAdapter() {
171:                    public void widgetSelected(SelectionEvent e) {
172:                        if (!fBlockNotification) {
173:                            try {
174:                                if (fSearchRootButton.getSelection())
175:                                    fInput
176:                                            .setSearchLocation(IFeatureChild.ROOT);
177:                            } catch (CoreException ce) {
178:                            }
179:                        }
180:                    }
181:                });
182:
183:                fSearchSelfButton = toolkit
184:                        .createButton(
185:                                container,
186:                                PDEUIMessages.SiteEditor_IncludedFeaturesDetailsSection_self,
187:                                SWT.RADIO);
188:                fSearchSelfButton.setSelection(true);
189:                gd = new TableWrapData(TableWrapData.FILL);
190:                gd.colspan = 2;
191:                gd.indent = 5;
192:                fSearchSelfButton.setLayoutData(gd);
193:                fSearchSelfButton.addSelectionListener(new SelectionAdapter() {
194:                    public void widgetSelected(SelectionEvent e) {
195:                        if (!fBlockNotification) {
196:                            try {
197:                                if (fSearchSelfButton.getSelection())
198:                                    fInput
199:                                            .setSearchLocation(IFeatureChild.SELF);
200:                            } catch (CoreException ce) {
201:                            }
202:                        }
203:                    }
204:                });
205:
206:                fSearchBothButton = toolkit
207:                        .createButton(
208:                                container,
209:                                PDEUIMessages.SiteEditor_IncludedFeaturesDetailsSection_both,
210:                                SWT.RADIO);
211:                fSearchBothButton.setSelection(true);
212:                gd = new TableWrapData(TableWrapData.FILL);
213:                gd.colspan = 2;
214:                gd.indent = 5;
215:                fSearchBothButton.setLayoutData(gd);
216:                fSearchBothButton.addSelectionListener(new SelectionAdapter() {
217:                    public void widgetSelected(SelectionEvent e) {
218:                        if (!fBlockNotification) {
219:                            try {
220:                                if (fSearchBothButton.getSelection())
221:                                    fInput
222:                                            .setSearchLocation(IFeatureChild.BOTH);
223:                            } catch (CoreException ce) {
224:                            }
225:                        }
226:                    }
227:                });
228:
229:                toolkit.paintBordersFor(container);
230:                section.setClient(container);
231:            }
232:
233:            public void dispose() {
234:                IFeatureModel model = (IFeatureModel) getPage().getModel();
235:                if (model != null)
236:                    model.removeModelChangedListener(this );
237:                super .dispose();
238:            }
239:
240:            /*
241:             * (non-Javadoc)
242:             * 
243:             * @see org.eclipse.ui.forms.AbstractFormPart#initialize(org.eclipse.ui.forms.IManagedForm)
244:             */
245:            public void initialize(IManagedForm form) {
246:                IFeatureModel model = (IFeatureModel) getPage().getModel();
247:                if (model != null)
248:                    model.addModelChangedListener(this );
249:                super .initialize(form);
250:            }
251:
252:            public void modelChanged(IModelChangedEvent e) {
253:                markStale();
254:            }
255:
256:            public void refresh() {
257:                update();
258:                super .refresh();
259:            }
260:
261:            public void selectionChanged(IFormPart part, ISelection selection) {
262:                if (selection instanceof  IStructuredSelection
263:                        && !selection.isEmpty()) {
264:                    Object o = ((IStructuredSelection) selection)
265:                            .getFirstElement();
266:                    if (o instanceof  IFeatureChild) {
267:                        fInput = (IFeatureChild) o;
268:                    } else {
269:                        fInput = null;
270:                    }
271:                } else
272:                    fInput = null;
273:                update();
274:            }
275:
276:            public void setFocus() {
277:                if (fNameText != null)
278:                    fNameText.getText().setFocus();
279:            }
280:
281:            private void update() {
282:                fBlockNotification = true;
283:
284:                if (fInput != null) {
285:                    fNameText.setValue(fInput.getName(), true);
286:                    fVersionText.setValue(fInput.getVersion(), true);
287:                    fOptionalButton.setSelection(fInput.isOptional());
288:                    int searchLocation = fInput.getSearchLocation();
289:                    fSearchRootButton
290:                            .setSelection(searchLocation == IFeatureChild.ROOT);
291:                    fSearchSelfButton
292:                            .setSelection(searchLocation == IFeatureChild.SELF);
293:                    fSearchBothButton
294:                            .setSelection(searchLocation == IFeatureChild.BOTH);
295:                } else {
296:                    fNameText.setValue(null, true);
297:                    fVersionText.setValue(null, true);
298:                    fOptionalButton.setSelection(false);
299:                    fSearchRootButton.setSelection(true);
300:                    fSearchSelfButton.setSelection(false);
301:                    fSearchBothButton.setSelection(false);
302:                }
303:                boolean editable = fInput != null && isEditable();
304:                fNameText.setEditable(editable);
305:                fVersionText.setEditable(editable);
306:                fOptionalButton.setEnabled(editable);
307:                fSearchRootButton.setEnabled(editable);
308:                fSearchSelfButton.setEnabled(editable);
309:                fSearchBothButton.setEnabled(editable);
310:
311:                fBlockNotification = false;
312:            }
313:
314:            public boolean isEditable() {
315:                return getPage().getPDEEditor().getAggregateModel()
316:                        .isEditable();
317:            }
318:        }
w_w_w___.__j__av___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.