Class TemplatesView
- All Implemented Interfaces:
IAdaptable,IExecutableExtension,IPartListener,IPersistable,IViewPart,IWorkbenchPart,IWorkbenchPart2,IWorkbenchPart3,IWorkbenchPartOrientation
ITemplatesPages that shows the templates for
the currently active editor part.
When this view notices an editor being activated, it uses the Eclipse adapter
mechanism to get its ITemplatesPage. Hence, editors that want to
provide a templates page need to provide such an adapter:
Object getAdapter() {
...
if (ITemplatesPage.class.equals(required)) {
if (fTemplatesPage == null)
fTemplatesPage= new JavaTemplatesPage(this);
return fTemplatesPage;
}
}
...
}
Note: This plug-in does not contribute this view. Clients
that want to use this view must check whether it is available and if not,
contribute this view via extension point using the specified view Id
ID:
<extension
point="org.eclipse.ui.views">
<view
name="%templatesViewName"
icon="$nl$/icons/full/eview16/templates.svg"
category="org.eclipse.ui"
class="org.eclipse.ui.texteditor.templates.TemplatesView"
id="org.eclipse.ui.texteditor.TemplatesView">
</view>
</extension>
The templates.svg icon can be copied from this plug-in.
If the editor supports a templates page, the editor instantiates and configures the page, and returns it. This page is then added to this Templates view and immediately made the current page (the Templates view needs not to be visible). If the editor does not support a templates page, the Templates view shows a special default page which makes it clear to the user that no templates are available. When the Templates view notices a different editor being activated, it flips to the editor's corresponding templates page. When the templates view notices an editor being closed, it may destroy the editor's corresponding templates page.
This class is not intended to be instantiated or subclassed by clients.
- Since:
- 3.4
- Restriction:
- This class is not intended to be instantiated by clients.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.ui.part.PageBookView
PageBookView.PageRec, PageBookView.SelectionProvider -
Field Summary
FieldsFields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected IPagecreateDefaultPage(PageBook book) Creates and returns the default page for this view.voidcreatePartControl(Composite parent) ThePageBookViewimplementation of thisIWorkbenchPartmethod creates aPageBookcontrol with its default page showing.protected PageBookView.PageRecdoCreatePage(IWorkbenchPart part) Creates a new page in the pagebook for a particular part.protected voiddoDestroyPage(IWorkbenchPart part, PageBookView.PageRec rec) Destroys a page in the pagebook for a particular part.<T> TgetAdapter(Class<T> key) ThePageBookViewimplementation of thisIAdaptablemethod delegates to the current page, if it implementsIAdaptable.protected IWorkbenchPartReturns the active, important workbench part for this view.Returns the currently selected templates.Returns the template store of the current page.protected booleanisImportant(IWorkbenchPart part) Returns whether the given part should be added to this view.voidThePageBookViewimplementation of thisIPartListenermethod does nothing.Methods inherited from class org.eclipse.ui.part.PageBookView
dispose, doesPageExist, getCurrentContributingPart, getCurrentPage, getDefaultPage, getPageBook, getPageRec, getPageRec, getPageSite, getSelectionProvider, getViewAdapter, init, initPage, partActivated, partClosed, partDeactivated, partHidden, partOpened, partVisible, setFocus, showPageRecMethods inherited from class org.eclipse.ui.part.ViewPart
checkSite, getViewSite, init, saveState, setContentDescription, setInitializationData, setPartNameMethods inherited from class org.eclipse.ui.part.WorkbenchPart
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, getTitleToolTip, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusyMethods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
-
Field Details
-
ID
The id for this view.Note: Only this id is allowed when contributing this view via extension point.
- See Also:
-
-
Constructor Details
-
TemplatesView
public TemplatesView()Creates a templates view.
-
-
Method Details
-
createDefaultPage
Description copied from class:PageBookViewCreates and returns the default page for this view.Subclasses must implement this method.
Subclasses must call initPage with the new page (if it is an
IPageBookViewPage) before calling createControl on the page.- Specified by:
createDefaultPagein classPageBookView- Parameters:
book- the pagebook control- Returns:
- the default page
-
createPartControl
Description copied from class:PageBookViewThePageBookViewimplementation of thisIWorkbenchPartmethod creates aPageBookcontrol with its default page showing. Subclasses may extend.- Specified by:
createPartControlin interfaceIWorkbenchPart- Overrides:
createPartControlin classPageBookView- Parameters:
parent- the parent control
-
doCreatePage
Description copied from class:PageBookViewCreates a new page in the pagebook for a particular part. This page will be made visible whenever the part is active, and will be destroyed with a call todoDestroyPage.Subclasses must implement this method.
Subclasses must call initPage with the new page (if it is an
IPageBookViewPage) before calling createControl on the page.- Specified by:
doCreatePagein classPageBookView- Parameters:
part- the input part- Returns:
- the record describing a new page for this view
- See Also:
-
doDestroyPage
Description copied from class:PageBookViewDestroys a page in the pagebook for a particular part. This page was returned as a result fromdoCreatePage.Subclasses must implement this method.
- Specified by:
doDestroyPagein classPageBookView- Parameters:
part- the input partrec- a page record for the part- See Also:
-
getBootstrapPart
Description copied from class:PageBookViewReturns the active, important workbench part for this view.When the page book view is created it has no idea which part within the workbook should be used to generate the first page. Therefore, it delegates the choice to subclasses of
PageBookView.Implementors of this method should return an active, important part in the workbench or
nullif none found.Subclasses must implement this method.
- Specified by:
getBootstrapPartin classPageBookView- Returns:
- the active important part, or
nullif none
-
isImportant
Description copied from class:PageBookViewReturns whether the given part should be added to this view.Subclasses must implement this method.
- Specified by:
isImportantin classPageBookView- Parameters:
part- the input part- Returns:
trueif the part is relevant, andfalseotherwise
-
partBroughtToTop
Description copied from class:PageBookViewThePageBookViewimplementation of thisIPartListenermethod does nothing. Subclasses may extend.- Specified by:
partBroughtToTopin interfaceIPartListener- Overrides:
partBroughtToTopin classPageBookView- Parameters:
part- the part that was surfaced- See Also:
-
getAdapter
Description copied from class:PageBookViewThePageBookViewimplementation of thisIAdaptablemethod delegates to the current page, if it implementsIAdaptable.- Specified by:
getAdapterin interfaceIAdaptable- Overrides:
getAdapterin classPageBookView- Type Parameters:
T- the class type- Parameters:
key- the adapter class to look up- Returns:
- a object of the given class, or
nullif this object does not have an adapter for the given class
-
getTemplateStore
Returns the template store of the current page.- Returns:
- the template store, or
nullif the current page does not provide that information - Since:
- 3.6
-
getSelectedTemplates
Returns the currently selected templates.- Returns:
- array of selected templates, or
nullif the current page does not provide that information - Since:
- 3.6
-