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


001:        /*******************************************************************************
002:         * Copyright (c) 2003, 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.plugin;
011:
012:        import org.eclipse.jface.text.source.ISourceViewer;
013:        import org.eclipse.jface.viewers.StructuredSelection;
014:        import org.eclipse.pde.core.plugin.IPluginElement;
015:        import org.eclipse.pde.core.plugin.IPluginExtension;
016:        import org.eclipse.pde.core.plugin.IPluginParent;
017:        import org.eclipse.pde.internal.core.ischema.ISchemaElement;
018:        import org.eclipse.pde.internal.core.ischema.ISchemaSimpleType;
019:        import org.eclipse.pde.internal.core.text.IDocumentAttributeNode;
020:        import org.eclipse.pde.internal.core.text.IDocumentRange;
021:        import org.eclipse.pde.internal.core.text.IDocumentTextNode;
022:        import org.eclipse.pde.internal.ui.IHelpContextIds;
023:        import org.eclipse.pde.internal.ui.IPDEUIConstants;
024:        import org.eclipse.pde.internal.ui.PDEPlugin;
025:        import org.eclipse.pde.internal.ui.PDEPluginImages;
026:        import org.eclipse.pde.internal.ui.PDEUIMessages;
027:        import org.eclipse.pde.internal.ui.editor.PDEFormPage;
028:        import org.eclipse.pde.internal.ui.editor.PDEMasterDetailsBlock;
029:        import org.eclipse.pde.internal.ui.editor.PDESection;
030:        import org.eclipse.swt.custom.StyledText;
031:        import org.eclipse.swt.widgets.Composite;
032:        import org.eclipse.ui.PlatformUI;
033:        import org.eclipse.ui.forms.DetailsPart;
034:        import org.eclipse.ui.forms.IDetailsPage;
035:        import org.eclipse.ui.forms.IDetailsPageProvider;
036:        import org.eclipse.ui.forms.IManagedForm;
037:        import org.eclipse.ui.forms.editor.FormEditor;
038:        import org.eclipse.ui.forms.editor.IFormPage;
039:        import org.eclipse.ui.forms.widgets.ScrolledForm;
040:
041:        public class ExtensionsPage extends PDEFormPage {
042:            public static final String PAGE_ID = "extensions"; //$NON-NLS-1$
043:
044:            private ExtensionsSection fSection;
045:            private ExtensionsBlock fBlock;
046:
047:            public class ExtensionsBlock extends PDEMasterDetailsBlock
048:                    implements  IDetailsPageProvider {
049:
050:                private ExtensionElementBodyTextDetails fBodyTextDetails;
051:
052:                public ExtensionsBlock() {
053:                    super (ExtensionsPage.this );
054:                }
055:
056:                protected PDESection createMasterSection(
057:                        IManagedForm managedForm, Composite parent) {
058:                    fSection = new ExtensionsSection(getPage(), parent);
059:                    return fSection;
060:                }
061:
062:                protected void registerPages(DetailsPart detailsPart) {
063:                    detailsPart.setPageLimit(10);
064:                    // register static page for the extensions
065:                    detailsPart.registerPage(IPluginExtension.class,
066:                            new ExtensionDetails(fSection));
067:                    // Register a static page for the extension elements that contain 
068:                    // only body text (no child elements or attributes)
069:                    // (e.g. schema simple type)
070:                    fBodyTextDetails = new ExtensionElementBodyTextDetails(
071:                            fSection);
072:                    detailsPart.registerPage(
073:                            ExtensionElementBodyTextDetails.class,
074:                            fBodyTextDetails);
075:                    // register a dynamic provider for elements
076:                    detailsPart.setPageProvider(this );
077:                }
078:
079:                public Object getPageKey(Object object) {
080:                    if (object instanceof  IPluginExtension)
081:                        return IPluginExtension.class;
082:                    if (object instanceof  IPluginElement) {
083:                        ISchemaElement element = ExtensionsSection
084:                                .getSchemaElement((IPluginElement) object);
085:                        // Extension point schema exists
086:                        if (element != null) {
087:                            // Use the body text page if the element has no child 
088:                            // elements or attributes
089:                            if (element.getType() instanceof  ISchemaSimpleType) {
090:                                // Set the schema element (to provide hover text 
091:                                // content)
092:                                fBodyTextDetails.setSchemaElement(element);
093:                                return ExtensionElementBodyTextDetails.class;
094:                            }
095:                            return element;
096:                        }
097:                        // No Extension point schema
098:                        // no element - construct one
099:                        IPluginElement pelement = (IPluginElement) object;
100:                        // Use the body text page if the element has no child 
101:                        // elements or attributes
102:                        if ((pelement.getAttributeCount() == 0)
103:                                && (pelement.getChildCount() == 0)) {
104:                            // Unset the previous schema element (no hover text 
105:                            // content)					
106:                            fBodyTextDetails.setSchemaElement(null);
107:                            return ExtensionElementBodyTextDetails.class;
108:                        }
109:                        String ename = pelement.getName();
110:                        IPluginExtension extension = ExtensionsSection
111:                                .getExtension((IPluginParent) pelement
112:                                        .getParent());
113:                        return extension.getPoint() + "/" + ename; //$NON-NLS-1$
114:                    }
115:                    return object.getClass();
116:                }
117:
118:                public IDetailsPage getPage(Object object) {
119:                    if (object instanceof  ISchemaElement)
120:                        return new ExtensionElementDetails(fSection,
121:                                (ISchemaElement) object);
122:                    if (object instanceof  String)
123:                        return new ExtensionElementDetails(fSection, null);
124:                    return null;
125:                }
126:            }
127:
128:            /**
129:             * @param editor
130:             * @param id
131:             * @param title
132:             */
133:            public ExtensionsPage(FormEditor editor) {
134:                super (editor, PAGE_ID, PDEUIMessages.ExtensionsPage_tabName);
135:                fBlock = new ExtensionsBlock();
136:            }
137:
138:            /* (non-Javadoc)
139:             * @see org.eclipse.pde.internal.ui.editor.PDEFormPage#getHelpResource()
140:             */
141:            protected String getHelpResource() {
142:                return IPDEUIConstants.PLUGIN_DOC_ROOT
143:                        + "guide/tools/editors/manifest_editor/extensions.htm"; //$NON-NLS-1$
144:            }
145:
146:            protected void createFormContent(IManagedForm managedForm) {
147:                ScrolledForm form = managedForm.getForm();
148:                form.setText(PDEUIMessages.ExtensionsPage_title);
149:                form.setImage(PDEPlugin.getDefault().getLabelProvider().get(
150:                        PDEPluginImages.DESC_EXTENSIONS_OBJ));
151:                fBlock.createContent(managedForm);
152:                //refire selection
153:                fSection.fireSelection();
154:                PlatformUI.getWorkbench().getHelpSystem().setHelp(
155:                        form.getBody(),
156:                        IHelpContextIds.MANIFEST_PLUGIN_EXTENSIONS);
157:                super .createFormContent(managedForm);
158:            }
159:
160:            public void updateFormSelection() {
161:                super .updateFormSelection();
162:                IFormPage page = getPDEEditor().findPage(
163:                        PluginInputContext.CONTEXT_ID);
164:                if (page instanceof  ManifestSourcePage) {
165:                    ISourceViewer viewer = ((ManifestSourcePage) page)
166:                            .getViewer();
167:                    if (viewer == null)
168:                        return;
169:                    StyledText text = viewer.getTextWidget();
170:                    if (text == null)
171:                        return;
172:                    int offset = text.getCaretOffset();
173:                    if (offset < 0)
174:                        return;
175:
176:                    IDocumentRange range = ((ManifestSourcePage) page)
177:                            .getRangeElement(offset, true);
178:                    if (range instanceof  IDocumentAttributeNode)
179:                        range = ((IDocumentAttributeNode) range)
180:                                .getEnclosingElement();
181:                    else if (range instanceof  IDocumentTextNode)
182:                        range = ((IDocumentTextNode) range)
183:                                .getEnclosingElement();
184:                    if ((range instanceof  IPluginExtension)
185:                            || (range instanceof  IPluginElement)) {
186:                        fSection
187:                                .selectExtensionElement(new StructuredSelection(
188:                                        range));
189:                    }
190:                }
191:            }
192:        }
w_ww_._j_a___v___a2__s___.c_o___m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.