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


001:        /*******************************************************************************
002:         * Copyright (c) 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.toc.details;
011:
012:        import org.eclipse.core.resources.IFile;
013:        import org.eclipse.jface.viewers.ISelection;
014:        import org.eclipse.jface.window.Window;
015:        import org.eclipse.pde.internal.core.text.toc.TocLink;
016:        import org.eclipse.pde.internal.core.text.toc.TocObject;
017:        import org.eclipse.pde.internal.ui.PDEPlugin;
018:        import org.eclipse.pde.internal.ui.PDEUIMessages;
019:        import org.eclipse.pde.internal.ui.editor.FormEntryAdapter;
020:        import org.eclipse.pde.internal.ui.editor.toc.TocExtensionUtil;
021:        import org.eclipse.pde.internal.ui.editor.toc.TocFileValidator;
022:        import org.eclipse.pde.internal.ui.editor.toc.TocInputContext;
023:        import org.eclipse.pde.internal.ui.editor.toc.TocTreeSection;
024:        import org.eclipse.pde.internal.ui.parts.FormEntry;
025:        import org.eclipse.pde.internal.ui.util.FileExtensionFilter;
026:        import org.eclipse.swt.widgets.Composite;
027:        import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
028:        import org.eclipse.ui.forms.IFormPart;
029:        import org.eclipse.ui.forms.events.HyperlinkEvent;
030:        import org.eclipse.ui.model.WorkbenchContentProvider;
031:        import org.eclipse.ui.model.WorkbenchLabelProvider;
032:
033:        public class TocLinkDetails extends TocAbstractDetails {
034:
035:            private TocLink fDataTOCLink;
036:
037:            private FormEntry fTocPathEntry;
038:
039:            /**
040:             * @param masterSection
041:             */
042:            public TocLinkDetails(TocTreeSection masterSection) {
043:                super (masterSection, TocInputContext.CONTEXT_ID);
044:                fDataTOCLink = null;
045:
046:                fTocPathEntry = null;
047:            }
048:
049:            /**
050:             * @param object
051:             */
052:            public void setData(TocLink object) {
053:                // Set data
054:                fDataTOCLink = object;
055:            }
056:
057:            protected TocObject getDataObject() {
058:                return fDataTOCLink;
059:            }
060:
061:            protected FormEntry getPathEntryField() {
062:                return fTocPathEntry;
063:            }
064:
065:            protected boolean isTocPath() {
066:                return true;
067:            }
068:
069:            /* (non-Javadoc)
070:             * @see org.eclipse.pde.internal.ui.editor.cheatsheet.CSAbstractDetails#createDetails(org.eclipse.swt.widgets.Composite)
071:             */
072:            public void createFields(Composite parent) {
073:                createTocPathWidget(parent);
074:            }
075:
076:            /**
077:             * @param parent
078:             */
079:            private void createTocPathWidget(Composite parent) {
080:                createLabel(parent, getManagedForm().getToolkit(),
081:                        PDEUIMessages.TocLinkDetails_tocPath_desc);
082:
083:                fTocPathEntry = new FormEntry(parent, getManagedForm()
084:                        .getToolkit(), PDEUIMessages.TocLinkDetails_tocPath,
085:                        PDEUIMessages.GeneralInfoSection_browse, isEditable());
086:            }
087:
088:            protected String getDetailsTitle() {
089:                return PDEUIMessages.TocLinkDetails_title;
090:            }
091:
092:            protected String getDetailsDescription() {
093:                return null;
094:            }
095:
096:            /* (non-Javadoc)
097:             * @see org.eclipse.pde.internal.ui.editor.toc.TocAbstractDetails#hookListeners()
098:             */
099:            public void hookListeners() {
100:                createTocPathEntryListeners();
101:            }
102:
103:            /**
104:             * 
105:             */
106:            private void createTocPathEntryListeners() {
107:                fTocPathEntry.setFormEntryListener(new FormEntryAdapter(this ) {
108:                    public void textValueChanged(FormEntry entry) {
109:                        // Ensure data object is defined
110:                        if (fDataTOCLink != null) {
111:                            fDataTOCLink.setFieldTocPath(fTocPathEntry
112:                                    .getValue());
113:                        }
114:                    }
115:
116:                    public void browseButtonSelected(FormEntry entry) {
117:                        handleBrowse();
118:                    }
119:
120:                    public void linkActivated(HyperlinkEvent e) {
121:                        handleOpen();
122:                    }
123:                });
124:            }
125:
126:            private void handleBrowse() {
127:                ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
128:                        getPage().getSite().getShell(),
129:                        new WorkbenchLabelProvider(),
130:                        new WorkbenchContentProvider());
131:
132:                dialog.setValidator(new TocFileValidator(fDataTOCLink
133:                        .getModel()));
134:                dialog.setAllowMultiple(false);
135:                dialog.setTitle(PDEUIMessages.TocLinkDetails_browseSelection);
136:                dialog.setMessage(PDEUIMessages.TocLinkDetails_browseMessage);
137:                dialog.addFilter(new FileExtensionFilter(
138:                        TocExtensionUtil.tocExtension));
139:
140:                dialog.setInput(PDEPlugin.getWorkspace().getRoot());
141:
142:                if (dialog.open() == Window.OK) {
143:                    IFile file = (IFile) dialog.getFirstResult();
144:                    setPathEntry(file);
145:                }
146:            }
147:
148:            /* (non-Javadoc)
149:             * @see org.eclipse.pde.internal.ui.editor.toc.TocAbstractDetails#updateFields()
150:             */
151:            public void updateFields() {
152:                // Ensure data object is defined
153:                if (fDataTOCLink != null) { // Update name entry
154:                    updateTocPathEntry(isEditableElement());
155:                }
156:            }
157:
158:            /**
159:             * @param editable
160:             */
161:            private void updateTocPathEntry(boolean editable) {
162:                fTocPathEntry.setValue(fDataTOCLink.getFieldTocPath(), true);
163:                fTocPathEntry.setEditable(editable);
164:            }
165:
166:            /* (non-Javadoc)
167:             * @see org.eclipse.ui.forms.AbstractFormPart#commit(boolean)
168:             */
169:            public void commit(boolean onSave) {
170:                super .commit(onSave);
171:                // Only required for form entries
172:                fTocPathEntry.commit();
173:            }
174:
175:            /* (non-Javadoc)
176:             * @see org.eclipse.ui.forms.IPartSelectionListener#selectionChanged(org.eclipse.ui.forms.IFormPart, org.eclipse.jface.viewers.ISelection)
177:             */
178:            public void selectionChanged(IFormPart part, ISelection selection) {
179:                // Get the first selected object
180:                Object object = getFirstSelectedObject(selection);
181:                // Ensure we have the right type
182:                if (object != null && object instanceof  TocLink) {
183:                    // Set data
184:                    setData((TocLink) object);
185:                    // Update the UI given the new data
186:                    updateFields();
187:                }
188:            }
189:        }
ww___w_.___j_a___va2__s_.__co_m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.