Source Code Cross Referenced for ViewPart.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » part » 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.part 
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.ui.part;
011:
012:        import org.eclipse.core.runtime.Assert;
013:        import org.eclipse.core.runtime.IConfigurationElement;
014:        import org.eclipse.ui.IMemento;
015:        import org.eclipse.ui.IPropertyListener;
016:        import org.eclipse.ui.IViewPart;
017:        import org.eclipse.ui.IViewSite;
018:        import org.eclipse.ui.IWorkbenchPartConstants;
019:        import org.eclipse.ui.IWorkbenchPartSite;
020:        import org.eclipse.ui.PartInitException;
021:        import org.eclipse.ui.internal.util.Util;
022:
023:        /**
024:         * Abstract base implementation of all workbench views.
025:         * <p>
026:         * This class should be subclassed by clients wishing to define new views.
027:         * The name of the subclass should be given as the <code>"class"</code> 
028:         * attribute in a <code>view</code> extension contributed to the workbench's
029:         * view extension point (named <code>"org.eclipse.ui.views"</code>).
030:         * For example, the plug-in's XML markup might contain:
031:         * <pre>
032:         * &LT;extension point="org.eclipse.ui.views"&GT;
033:         *      &LT;view id="com.example.myplugin.view"
034:         *         name="My View"
035:         *         class="com.example.myplugin.MyView"
036:         *         icon="images/eview.gif"
037:         *      /&GT;
038:         * &LT;/extension&GT;
039:         * </pre>
040:         * where <code>com.example.myplugin.MyView</code> is the name of the
041:         * <code>ViewPart</code> subclass.
042:         * </p>
043:         * <p>
044:         * Subclasses must implement the following methods:
045:         * <ul>
046:         *   <li><code>createPartControl</code> - to create the view's controls </li>
047:         *   <li><code>setFocus</code> - to accept focus</li>
048:         * </ul>
049:         * </p>
050:         * <p>
051:         * Subclasses may extend or reimplement the following methods as required:
052:         * <ul>
053:         *   <li><code>setInitializationData</code> - extend to provide additional 
054:         *       initialization when view extension is instantiated</li>
055:         *   <li><code>init(IWorkbenchPartSite)</code> - extend to provide additional
056:         *       initialization when view is assigned its site</li>
057:         *   <li><code>dispose</code> - extend to provide additional cleanup</li>
058:         *   <li><code>getAdapter</code> - reimplement to make their view adaptable</li>
059:         * </ul>
060:         * </p>
061:         */
062:        public abstract class ViewPart extends WorkbenchPart implements 
063:                IViewPart {
064:
065:            /**
066:             * Listens to PROP_TITLE property changes in this object until the first call to
067:             * setContentDescription. Used for compatibility with old parts that call setTitle
068:             * or overload getTitle instead of using setContentDescription. 
069:             */
070:            private IPropertyListener compatibilityTitleListener = new IPropertyListener() {
071:                /* (non-Javadoc)
072:                 * @see org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.Object, int)
073:                 */
074:                public void propertyChanged(Object source, int propId) {
075:                    if (propId == IWorkbenchPartConstants.PROP_TITLE) {
076:                        setDefaultContentDescription();
077:                    }
078:                }
079:            };
080:
081:            /**
082:             * Creates a new view.
083:             */
084:            protected ViewPart() {
085:                super ();
086:
087:                addPropertyListener(compatibilityTitleListener);
088:            }
089:
090:            /* (non-Javadoc)
091:             * Method declared on IViewPart.
092:             */
093:            public IViewSite getViewSite() {
094:                return (IViewSite) getSite();
095:            }
096:
097:            /* (non-Javadoc)
098:             * @see org.eclipse.ui.IViewPart#init(org.eclipse.ui.IViewSite)
099:             */
100:            public void init(IViewSite site) throws PartInitException {
101:                setSite(site);
102:
103:                setDefaultContentDescription();
104:            }
105:
106:            /* 
107:             * (non-Javadoc)
108:             * @see org.eclipse.ui.IViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)
109:             */
110:            public void init(IViewSite site, IMemento memento)
111:                    throws PartInitException {
112:                /*
113:                 * Initializes this view with the given view site.  A memento is passed to
114:                 * the view which contains a snapshot of the views state from a previous
115:                 * session.  Where possible, the view should try to recreate that state
116:                 * within the part controls.
117:                 * <p>
118:                 * This implementation will ignore the memento and initialize the view in
119:                 * a fresh state.  Subclasses may override the implementation to perform any
120:                 * state restoration as needed.
121:                 */
122:                init(site);
123:            }
124:
125:            /* (non-Javadoc)
126:             * @see org.eclipse.ui.IViewPart#saveState(org.eclipse.ui.IMemento)
127:             */
128:            public void saveState(IMemento memento) {
129:                // do nothing
130:            }
131:
132:            /* (non-Javadoc)
133:             * @see org.eclipse.ui.part.WorkbenchPart#setPartName(java.lang.String)
134:             */
135:            protected void setPartName(String partName) {
136:                if (compatibilityTitleListener != null) {
137:                    removePropertyListener(compatibilityTitleListener);
138:                    compatibilityTitleListener = null;
139:                }
140:
141:                super .setPartName(partName);
142:            }
143:
144:            /* (non-Javadoc)
145:             * @see org.eclipse.ui.part.WorkbenchPart#setContentDescription(java.lang.String)
146:             */
147:            protected void setContentDescription(String description) {
148:                if (compatibilityTitleListener != null) {
149:                    removePropertyListener(compatibilityTitleListener);
150:                    compatibilityTitleListener = null;
151:                }
152:
153:                super .setContentDescription(description);
154:            }
155:
156:            /* (non-Javadoc)
157:             * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
158:             */
159:            public void setInitializationData(IConfigurationElement cfig,
160:                    String propertyName, Object data) {
161:                super .setInitializationData(cfig, propertyName, data);
162:
163:                setDefaultContentDescription();
164:            }
165:
166:            private void setDefaultContentDescription() {
167:                if (compatibilityTitleListener == null) {
168:                    return;
169:                }
170:
171:                String partName = getPartName();
172:                String title = getTitle();
173:
174:                if (Util.equals(partName, title)) {
175:                    internalSetContentDescription(""); //$NON-NLS-1$
176:                } else {
177:                    internalSetContentDescription(title);
178:                }
179:            }
180:
181:            /**
182:             * Checks that the given site is valid for this type of part.
183:             * The site for a view must be an <code>IViewSite</code>.
184:             * 
185:             * @param site the site to check
186:             * @since 3.1
187:             */
188:            protected final void checkSite(IWorkbenchPartSite site) {
189:                super .checkSite(site);
190:                Assert.isTrue(site instanceof  IViewSite,
191:                        "The site for a view must be an IViewSite"); //$NON-NLS-1$
192:            }
193:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.