|
Eclipse Platform Release 3.6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.ui.part.Page
org.eclipse.ui.texteditor.templates.AbstractTemplatesPage
public abstract class AbstractTemplatesPage
Abstract default implementation for ITemplatesPage.
Clients who are defining an editor may elect to provide a corresponding templates page. This templates page will be presented to the user via the Templates View (the user decides whether their workbench window contains this view) whenever that editor is active. This class should be subclassed by clients.
Internally, a AbstractTemplatesPage uses the template store to display different categories. A link to editor mode on the templates page allows to filtering of the categories to only that are supported in this context.
| Constructor Summary | |
|---|---|
protected |
AbstractTemplatesPage(ITextEditor editor,
ISourceViewer viewer)
Creates a new templates page. |
| Method Summary | |
|---|---|
void |
createControl(Composite ancestor)
Creates the SWT control for this page under the given parent control. |
protected SourceViewer |
createPatternViewer(Composite parent)
Creates, configures and returns a source viewer to present the template pattern on the templates page. |
void |
dispose()
The Page implementation of this IPage method
disposes of this page's control (if it has one and it has not already
been disposed). |
protected Template |
editTemplate(Template template,
boolean edit,
boolean isNameModifiable)
Creates and opens a dialog to edit the given template. |
protected abstract java.lang.String[] |
getContextTypeIds(IDocument document,
int offset)
Returns the context type ids supported at the given document offset. |
protected abstract ContextTypeRegistry |
getContextTypeRegistry()
Returns the context type registry used in this page. |
Control |
getControl()
The Page implementation of this IPage method returns
null. |
protected Image |
getImage(Template template)
Returns the image to be used for the given template. |
protected SourceViewer |
getPatternViewer()
Returns the pattern viewer created by createPatternViewer() |
protected abstract java.lang.String |
getPreferencePageId()
Returns the Template preference page id to be used by this template page. |
TemplatePersistenceData[] |
getSelectedTemplates()
Returns the currently selected templates |
protected abstract IPreferenceStore |
getTemplatePreferenceStore()
Returns the preference store used to create the template store returned by getTemplateStore(). |
abstract TemplateStore |
getTemplateStore()
Returns the template store used in this page. |
protected abstract void |
insertTemplate(Template template,
IDocument document)
Inserts the given template into the editor. |
protected abstract boolean |
isValidTemplate(IDocument document,
Template template,
int offset,
int length)
Checks whether the given template is valid for the document at the given offset and length. |
void |
setFocus()
The Page implementation of this IPage method
does nothing. |
protected void |
updatePatternViewer(Template template)
Update the pattern viewer to show the current template. |
| Methods inherited from class org.eclipse.ui.part.Page |
|---|
getSite, init, makeContributions, setActionBars |
| 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.part.IPageBookViewPage |
|---|
getSite, init |
| Methods inherited from interface org.eclipse.ui.part.IPage |
|---|
setActionBars |
| Constructor Detail |
|---|
protected AbstractTemplatesPage(ITextEditor editor,
ISourceViewer viewer)
editor - the editorviewer - the source viewer| Method Detail |
|---|
public void createControl(Composite ancestor)
IPageClients should not call this method (the workbench calls this method when it needs to, which may be never).
createControl in interface IPagecreateControl in class Pageancestor - the parent controlpublic void setFocus()
PagePage implementation of this IPage method
does nothing. Subclasses must implement.
setFocus in interface IPagesetFocus in class Pagepublic Control getControl()
PagePage implementation of this IPage method returns
null. Subclasses must reimplement.
getControl in interface IPagegetControl in class Pagenull if this
page does not have a controlpublic void dispose()
PagePage implementation of this IPage method
disposes of this page's control (if it has one and it has not already
been disposed). Subclasses may extend.
dispose in interface IPagedispose in class Pageprotected Image getImage(Template template)
Clients can override to provide a different image.
template - the template
protected Template editTemplate(Template template,
boolean edit,
boolean isNameModifiable)
template - the template being editededit - true if the dialog allows editingisNameModifiable - true if the template name may be modified
null if the editing failedprotected void updatePatternViewer(Template template)
Subclasses can extend this method to update their own pattern viewer.
template - the templateprotected SourceViewer createPatternViewer(Composite parent)
Clients may override to provide a custom source viewer featuring e.g. syntax coloring.
parent - the parent control
protected final SourceViewer getPatternViewer()
protected abstract void insertTemplate(Template template,
IDocument document)
template - the templatedocument - the documentprotected abstract ContextTypeRegistry getContextTypeRegistry()
public abstract TemplateStore getTemplateStore()
getTemplateStore in interface ITemplatesPageExtensionprotected abstract IPreferenceStore getTemplatePreferenceStore()
getTemplateStore().
protected abstract java.lang.String getPreferencePageId()
null if none exists
protected abstract java.lang.String[] getContextTypeIds(IDocument document,
int offset)
document - the documentoffset - the offset
protected abstract boolean isValidTemplate(IDocument document,
Template template,
int offset,
int length)
document - the documenttemplate - the templateoffset - the offsetlength - the length
true if the template is validpublic TemplatePersistenceData[] getSelectedTemplates()
getSelectedTemplates in interface ITemplatesPageExtension
|
Eclipse Platform Release 3.6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2010. All rights reserved.