Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.ui.texteditor.templates
Class TemplatesView


java.lang.Object
  extended by 

org.eclipse.core.commands.common.EventManager
      extended by 

org.eclipse.ui.part.WorkbenchPart
          extended by 

org.eclipse.ui.part.ViewPart
              extended by 

org.eclipse.ui.part.PageBookView
                  extended by 
org.eclipse.ui.texteditor.templates.TemplatesView
All Implemented Interfaces:
IAdaptable, IExecutableExtension, IPartListener, IPersistable, IViewPart, IWorkbenchPart, IWorkbenchPart2, IWorkbenchPart3, IWorkbenchPartOrientation

public final class TemplatesView
extends PageBookView

The Templates view.hosts 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. Cients 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.gif"
          category="org.eclipse.ui"
          class="org.eclipse.ui.texteditor.templates.TemplatesView"
          id="org.eclipse.ui.texteditor.TemplatesView">
    </view>
 </extension>
 
The templates.gif 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
static  String ID
          The id for this view.
 
Fields inherited from interface org.eclipse.ui. IWorkbenchPart
PROP_TITLE
 
Constructor Summary
TemplatesView ()
          Creates a templates view.
 
Method Summary
protected   IPage createDefaultPage ( PageBook book)
          Creates and returns the default page for this view.
 void createPartControl ( Composite parent)
          The PageBookView implementation of this IWorkbenchPart method creates a PageBook control with its default page showing.
protected   PageBookView.PageRec doCreatePage ( IWorkbenchPart part)
          Creates a new page in the pagebook for a particular part.
protected  void doDestroyPage ( IWorkbenchPart part, PageBookView.PageRec rec)
          Destroys a page in the pagebook for a particular part.
protected   IWorkbenchPart getBootstrapPart ()
          Returns the active, important workbench part for this view.
protected  boolean isImportant ( IWorkbenchPart part)
          Returns whether the given part should be added to this view.
 void partBroughtToTop ( IWorkbenchPart part)
          The PageBookView implementation of this IPartListener method does nothing.
 
Methods inherited from class org.eclipse.ui.part. PageBookView
dispose, doesPageExist, getAdapter, getCurrentContributingPart, getCurrentPage, getDefaultPage, getPageBook, getPageRec, getPageRec, getPageSite, getSelectionProvider, getViewAdapter, init, initPage, partActivated, partClosed, partDeactivated, partHidden, partOpened, partVisible, setFocus, showPageRec
 
Methods inherited from class org.eclipse.ui.part. ViewPart
checkSite, getViewSite, init, saveState, setContentDescription, setInitializationData, setPartName
 
Methods 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, showBusy
 
Methods inherited from class org.eclipse.core.commands.common. EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui. IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
 

Field Detail

ID

public static final 
String ID
The id for this view.

Note: Only this id is allowed when contributing this view via extension point.

See Also:
Constant Field Values
Constructor Detail

TemplatesView

public TemplatesView()
Creates a templates view.

Method Detail

createDefaultPage

protected 
IPage createDefaultPage(
PageBook book)
Description copied from class: PageBookView
Creates 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:
createDefaultPage in class PageBookView
Parameters:
book - the pagebook control
Returns:
the default page

createPartControl

public void createPartControl(
Composite parent)
Description copied from class: PageBookView
The PageBookView implementation of this IWorkbenchPart method creates a PageBook control with its default page showing. Subclasses may extend.

Specified by:
createPartControl in interface IWorkbenchPart
Overrides:
createPartControl in class PageBookView
Parameters:
parent - the parent control

doCreatePage

protected 
PageBookView.PageRec doCreatePage(
IWorkbenchPart part)
Description copied from class: PageBookView
Creates 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 to doDestroyPage.

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:
doCreatePage in class PageBookView
Parameters:
part - the input part
Returns:
the record describing a new page for this view
See Also:
PageBookView.doDestroyPage(org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.part.PageBookView.PageRec)

doDestroyPage

protected void doDestroyPage(
IWorkbenchPart part,
                             
PageBookView.PageRec rec)
Description copied from class: PageBookView
Destroys a page in the pagebook for a particular part. This page was returned as a result from doCreatePage.

Subclasses must implement this method.

Specified by:
doDestroyPage in class PageBookView
Parameters:
part - the input part
rec - a page record for the part
See Also:
PageBookView.doCreatePage(org.eclipse.ui.IWorkbenchPart)

getBootstrapPart

protected 
IWorkbenchPart getBootstrapPart()
Description copied from class: PageBookView
Returns 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 null if none found.

Subclasses must implement this method.

Specified by:
getBootstrapPart in class PageBookView
Returns:
the active important part, or null if none

isImportant

protected boolean isImportant(
IWorkbenchPart part)
Description copied from class: PageBookView
Returns whether the given part should be added to this view.

Subclasses must implement this method.

Specified by:
isImportant in class PageBookView
Parameters:
part - the input part
Returns:
true if the part is relevant, and false otherwise

partBroughtToTop

public void partBroughtToTop(
IWorkbenchPart part)
Description copied from class: PageBookView
The PageBookView implementation of this IPartListener method does nothing. Subclasses may extend.

Specified by:
partBroughtToTop in interface IPartListener
Overrides:
partBroughtToTop in class PageBookView
Parameters:
part - the part that was surfaced
See Also:
IWorkbenchPage.bringToTop(org.eclipse.ui.IWorkbenchPart)

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire