Source Code Cross Referenced for CompatibleWorkbenchPage.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » internal » 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 » ui workbench » org.eclipse.ui.internal 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2004, 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.ui.internal;
011:
012:        import java.lang.reflect.Constructor;
013:        import java.lang.reflect.InvocationTargetException;
014:        import java.lang.reflect.Method;
015:
016:        import org.eclipse.core.resources.IFile;
017:        import org.eclipse.core.resources.IMarker;
018:        import org.eclipse.core.runtime.IPluginDescriptor;
019:        import org.eclipse.core.runtime.IStatus;
020:        import org.eclipse.core.runtime.Platform;
021:        import org.eclipse.core.runtime.Status;
022:        import org.eclipse.ui.IEditorInput;
023:        import org.eclipse.ui.IEditorPart;
024:        import org.eclipse.ui.IEditorRegistry;
025:        import org.eclipse.ui.IWorkbenchPage;
026:        import org.eclipse.ui.PartInitException;
027:
028:        /**
029:         * Internal class used in providing increased binary compatibility for pre-3.0
030:         * plug-ins. This declaration masks the empty class of the same name declared in
031:         * the Workbench proper. This class implements IWorkbenchPage that existed in
032:         * 2.1 but were removed in 3.0 because they referenced resource API.
033:         * <p>
034:         * Plug-ins should not refer to this type or its containing fragment from their
035:         * class path. It is intended only to provide binary compatibility for pre-3.0
036:         * plug-ins, and should not be referenced at development time.
037:         * </p>
038:         * 
039:         * @since 3.0
040:         */
041:        public class CompatibleWorkbenchPage implements 
042:                ICompatibleWorkbenchPage {
043:
044:            /**
045:             * openEditor(IFile) is declared on IWorkbenchPage in 2.1. This method was
046:             * removed in 3.0 because it references resource API.
047:             */
048:            public IEditorPart openEditor(IFile input) throws PartInitException {
049:                // invoke org.eclipse.ui.ide.IDE.openEditor(IWorkbenchPage, IFile,
050:                // boolean);
051:                return openEditor(new Class[] { IWorkbenchPage.class,
052:                        IFile.class, boolean.class }, new Object[] { this ,
053:                        input, new Boolean(true) });
054:            }
055:
056:            /**
057:             * openEditor(IFile,String) is declared on IWorkbenchPage in 2.1. This
058:             * method was removed in 3.0 because it references resource API.
059:             */
060:            public IEditorPart openEditor(IFile input, String editorID)
061:                    throws PartInitException {
062:                return openEditor(input, editorID, true);
063:            }
064:
065:            /**
066:             * openEditor(IFile,String,boolean) is declared on IWorkbenchPage in 2.1.
067:             * This method was removed in 3.0 because it references resource API.
068:             */
069:            public IEditorPart openEditor(IFile input, String editorID,
070:                    boolean activate) throws PartInitException {
071:                return ((IWorkbenchPage) this ).openEditor(
072:                        getFileEditorInput(input), editorID);
073:            }
074:
075:            /**
076:             * openEditor(IMarker) is declared on IWorkbenchPage in 2.1. This method was
077:             * removed in 3.0 because it references resource API.
078:             */
079:            public IEditorPart openEditor(IMarker marker)
080:                    throws PartInitException {
081:                return openEditor(marker, true);
082:            }
083:
084:            /**
085:             * openEditor(IMarker,boolean) is declared on IWorkbenchPage in 2.1. This
086:             * method was removed in 3.0 because it references resource API.
087:             */
088:            public IEditorPart openEditor(IMarker marker, boolean activate)
089:                    throws PartInitException {
090:                // invoke org.eclipse.ui.ide.IDE.openEditor(IWorkbenchPage, IMarker,
091:                // boolean);
092:                return openEditor(new Class[] { IWorkbenchPage.class,
093:                        IMarker.class, boolean.class }, new Object[] { this ,
094:                        marker, new Boolean(activate) });
095:            }
096:
097:            /**
098:             * openSystemEditor(IFile) is declared on IWorkbenchPage in 2.1. This method
099:             * was removed in 3.0 because it references resource API.
100:             */
101:            public void openSystemEditor(IFile file) throws PartInitException {
102:                ((IWorkbenchPage) this ).openEditor(getFileEditorInput(file),
103:                        IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
104:
105:            }
106:
107:            /*
108:             * Implementation support: Use reflection for the following code pattern:
109:             * new org.eclipse.ui.part.FileEditorInput(file) The class FileEditorInput
110:             * is found in the org.eclipse.ui.ide plug-in.
111:             */
112:            private IEditorInput getFileEditorInput(IFile file)
113:                    throws PartInitException {
114:                IPluginDescriptor desc = Platform.getPluginRegistry()
115:                        .getPluginDescriptor("org.eclipse.ui.ide"); //$NON-NLS-1$		
116:                Exception problem;
117:                try {
118:                    Class clazz = desc.getPluginClassLoader().loadClass(
119:                            "org.eclipse.ui.part.FileEditorInput"); //$NON-NLS-1$
120:                    Constructor constructor = clazz
121:                            .getConstructor(new Class[] { IFile.class });
122:                    return (IEditorInput) constructor
123:                            .newInstance(new Object[] { file });
124:                } catch (NullPointerException e) {
125:                    problem = e;
126:                } catch (ClassNotFoundException e) {
127:                    problem = e;
128:                } catch (NoSuchMethodException e) {
129:                    problem = e;
130:                } catch (IllegalArgumentException e) {
131:                    problem = e;
132:                } catch (IllegalAccessException e) {
133:                    problem = e;
134:                } catch (InvocationTargetException e) {
135:                    problem = e;
136:                } catch (InstantiationException e) {
137:                    problem = e;
138:                }
139:                IStatus status = new Status(
140:                        IStatus.ERROR,
141:                        WorkbenchPlugin.PI_WORKBENCH,
142:                        0,
143:                        "openEditor() compatibility support failed - new FileEditorInput(file)", problem); //$NON-NLS-1$
144:                WorkbenchPlugin.log(status.getMessage(), status);
145:                throw new PartInitException(status);
146:            }
147:
148:            /*
149:             * Implementation support: Use reflection to invoke the appropriate static
150:             * openEditor(...) method on IDE The IDE class is found in the
151:             * org.eclipse.ui.ide plug-in.
152:             */
153:            private IEditorPart openEditor(Class[] argTypes, Object[] args)
154:                    throws PartInitException {
155:                IPluginDescriptor desc = Platform.getPluginRegistry()
156:                        .getPluginDescriptor("org.eclipse.ui.ide"); //$NON-NLS-1$
157:                Throwable problem;
158:                try {
159:                    Class clazz = desc.getPluginClassLoader().loadClass(
160:                            "org.eclipse.ui.ide.IDE"); //$NON-NLS-1$
161:                    Method method = clazz.getMethod("openEditor", argTypes); //$NON-NLS-1$
162:                    return (IEditorPart) method.invoke(null, args);
163:                } catch (NullPointerException e) {
164:                    problem = e;
165:                } catch (ClassNotFoundException e) {
166:                    problem = e;
167:                } catch (NoSuchMethodException e) {
168:                    problem = e;
169:                } catch (IllegalArgumentException e) {
170:                    problem = e;
171:                } catch (IllegalAccessException e) {
172:                    problem = e;
173:                } catch (InvocationTargetException e) {
174:                    problem = e;
175:                }
176:                IStatus status = new Status(
177:                        IStatus.ERROR,
178:                        WorkbenchPlugin.PI_WORKBENCH,
179:                        0,
180:                        "openEditor() compatibility support failed - IDE.openEditor()", problem); //$NON-NLS-1$
181:                WorkbenchPlugin.log(status.getMessage(), status);
182:                throw new PartInitException(status);
183:            }
184:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.