Views
Identifier:
org.eclipse.ui.views
Description:
This extension point is used to define additional views
for the workbench. A view is a visual component
within a workbench page. It is typically used to
navigate a hierarchy of information (like the workspace),
open an editor, or display properties for
the active editor. The user can make a view
visible from the Window > Show View menu or close it from the
view local title bar.
In order to reduce the visual clutter in the Show View Dialog, views should be grouped using categories.
Configuration Markup:
<!ELEMENT extension (category | view | stickyView | e4view)*>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
- point - a fully qualified identifier of the target extension point
- id - an optional identifier of the extension instance
- name - an optional name of the extension instance
<!ELEMENT category EMPTY>
<!ATTLIST category
id CDATA #REQUIRED
name CDATA #REQUIRED
parentCategory IDREF #IMPLIED>
A category to group views in the UI.
- id - a unique name that will be used to identify this category
- name - a translatable name that will be used in the UI for this category
- parentCategory - an optional path composed of category IDs separated by '/'. This
allows the creation of a hierarchy of categories.
<!ELEMENT view (description?)>
<!ATTLIST view
id CDATA #REQUIRED
name CDATA #REQUIRED
category IDREF #IMPLIED
class CDATA #REQUIRED
icon CDATA #IMPLIED
fastViewWidthRatio CDATA #IMPLIED
allowMultiple (true | false)
restorable (true | false) "true"
inject (true | false) >
A view.
- id - a unique name that will be used to identify this view
- name - a translatable name that will be used in the UI for this view
- category - an optional attribute that is composed of the category IDs separated
by '/'. Each referenced category must be declared in a corresponding category element.
- class - a fully qualified name of the class that implements
org.eclipse.ui.IViewPart. A common practice
is to subclass org.eclipse.ui.part.ViewPart
in order to inherit the default functionality.
- icon - a relative name of the icon that will
be associated with the view.
- fastViewWidthRatio - the percentage of the width of the workbench that the view will take up as an active fast view.
This must be defined as a floating point value and lie between 0.05 and 0.95.
If no value is supplied, a default ratio will be used.
- allowMultiple - flag indicating whether this view allows multiple instances to be created using IWorkbenchPage.showView(String id, String secondaryId). The default is false.
- restorable - flag indicating whether this view allows to be restored upon workbench restart. If set to false, the view will not be open after a workbench restart. The default is true.
Since: 3.4
- inject - flag indicating whether this view allows to use the Eclipse dependency injection (Eclipse DI) framework.
If set to true, Eclipse DI will be used to inject the view. Otherwise no Eclipse DI is used.
The default is false.
The framework will process the fields and methods in the following order. * steps are in addition to the process without Eclipse DI.
- default constructor
- the IExecutableExtension#setInitializationData method
- the IViewPart#init method
- optionally fields annotated with @Inject *
- optionally methods annoted with @Inject *
- optionally one method annotated with @PostConstruct *
- the IWorkbenchPart#createPartControl method
You cannot use constructor injection with these views, as the framework still requires a parameterless constructor.
On disposal of the view the methods are called in the following order:
- IWorkbenchPart#dispose
- optionally a method annotated with @PreDestroy *
Since: 4.7
<!ELEMENT e4view (description?)>
<!ATTLIST e4view
id CDATA #REQUIRED
name CDATA #REQUIRED
category IDREF #IMPLIED
class CDATA #REQUIRED
icon CDATA #IMPLIED
fastViewWidthRatio CDATA #IMPLIED
allowMultiple (true | false)
restorable (true | false) "true">
An e4-style view.
Since: 3.105
- id - a unique name that will be used to identify this view
- name - a translatable name that will be used in the UI for this view
- category - an optional attribute that is composed of the category IDs separated
by '/'. Each referenced category must be declared in a corresponding category element.
- class - a fully qualified name of the class annotated for injection.
- icon - a relative name of the icon that will
be associated with the view.
- fastViewWidthRatio - the percentage of the width of the workbench that the view will take up as an active fast view.
This must be defined as a floating point value and lie between 0.05 and 0.95.
If no value is supplied, a default ratio will be used.
- allowMultiple - flag indicating whether this view allows multiple instances to be created using IWorkbenchPage.showView(String id, String secondaryId). The default is false.
- restorable - flag indicating whether this view allows to be restored upon workbench restart. If set to false, the view will not be open after a workbench restart. The default is true.
<!ELEMENT description (#PCDATA)>
An optional subelement whose body should contain text providing a short description of the view.
<!ELEMENT stickyView EMPTY>
<!ATTLIST stickyView
id IDREF #REQUIRED
location (RIGHT|LEFT|TOP|BOTTOM)
closeable (true | false)
moveable (true | false) >
A sticky view is a view that will appear by default across all perspectives in a window once it is opened. Its initial placement is governemed by the location attribute, but nothing prevents it from being moved or closed by the user. Use of this element will only cause a placeholder for the view to be created, it will not show the view. Please note that usage of this element should be done with great care and should only be applied to views that truely have a need to live across perspectives.
Since: 3.0
- id - the id of the view to be made sticky.
- location - optional attribute that specifies the location of the sticky view relative to the editor area. If absent, the view will be docked to the right of the editor area.
- closeable - optional attribute that specifies wether the view should be closeable. If absent it will be closeable.
- moveable - optional attribute that specifies wether the view should be moveable. If absent it will be moveable.
Examples:
The following is an example of the extension point:
<extension point="org.eclipse.ui.views">
<category
id="com.xyz.views.XYZviews"
name="XYZ"/>
<view
id="com.xyz.views.XYZView"
name="XYZ View"
category="com.xyz.views.XYZviews"
class="com.xyz.views.XYZView"
icon="icons/XYZ.png"/>
</extension>
The following is an example of a sticky view declaration:
<extension point="org.eclipse.ui.views">
<stickyView
id="com.xyz.views.XYZView" />
</extension>
API Information:
The value of the view element's class attribute must be a
fully qualified name of the class that implements
org.eclipse.ui.IViewPart. It is common
practice to subclass org.eclipse.ui.part.ViewPart
when developing a new view.
Supplied Implementation:
The Eclipse Platform provides a number of standard views including Navigator, Properties, Outline and Tasks. From the user point of view, these views are no different from any other view provided by the plug-ins. All the views can be shown from the "Show View" submenu of the "Window" menu. The position of a view is persistent: it is saved when the view is closed and restored when the view is reopened in a single session. The position is also persisted between workbench sessions.
Copyright (c) 2002, 2013 IBM Corporation and others.
This program and the accompanying materials are made
available under the terms of the Eclipse Public License 2.0 which accompanies
this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html/
SPDX-License-Identifier: EPL-2.0