Class AbstractTemplatePreferencePage
- java.lang.Object
-
- org.eclipse.jface.dialogs.DialogPage
-
- org.eclipse.jface.preference.PreferencePage
-
- com.e1c.g5.v8.dt.lcore.ui.templates.preferences.AbstractTemplatePreferencePage
-
- All Implemented Interfaces:
org.eclipse.jface.dialogs.IDialogPage
,org.eclipse.jface.dialogs.IMessageProvider
,org.eclipse.jface.preference.IPreferencePage
,org.eclipse.ui.IWorkbenchPreferencePage
- Direct Known Subclasses:
BslTemplatePreferencePage
public abstract class AbstractTemplatePreferencePage extends org.eclipse.jface.preference.PreferencePage implements org.eclipse.ui.IWorkbenchPreferencePage
Abstract implementation of Preference page for templates to have the same main page
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractTemplatePreferencePage.DefaultTemplateLabelProvider
Default LabelProvider fortemplatesTableViewer
protected class
AbstractTemplatePreferencePage.TemplateColumnSelectionAdapter
Default SelectionAdapter fortemplatesTableViewer
protected class
AbstractTemplatePreferencePage.TemplateViewerComparator
Default ViewerComparator fortemplatesTableViewer
-
Field Summary
Fields Modifier and Type Field Description protected String
currentSearchText
protected TableViewer
templatesTableViewer
protected TemplateStorageManager
templateStorageManager
protected String
templateStorageSnapshot
-
Constructor Summary
Constructors Constructor Description AbstractTemplatePreferencePage()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
adjustDescriptionPreview(org.eclipse.swt.custom.StyledText descriptionPreview, ITemplate template)
Adjusts the preview of the description text field with given templateprotected void
adjustPatternPreview(org.eclipse.swt.custom.StyledText patternPreview, ITemplate template)
Adjusts the preview of the pattern text field with given templateprotected void
adjustPreviewField()
Adjusts pattern's text to the selected template'sprotected org.eclipse.swt.widgets.Control
createContents(org.eclipse.swt.widgets.Composite parent)
protected TableViewer
createTable(org.eclipse.swt.widgets.Composite parent, AbstractTemplatePreferencePage.TemplateViewerComparator viewerComparator)
Creates table on the given composite with given viwerComparatorprotected abstract TemplateStorageManager
createTemplateStorageManager()
GetsTemplateStorageManager
for this preference pageprotected abstract ITemplate
doAdd()
Creates new template and returns itprotected abstract boolean
doEdit(ITemplate template)
Edits the given templateprotected org.eclipse.swt.events.SelectionAdapter
getTemplateColumnSelectionAdapter(org.eclipse.swt.widgets.TableColumn tableColumn, int columnIndex, AbstractTemplatePreferencePage.TemplateViewerComparator viewerComparator, TableViewer tableViewer)
Returns new SelectionAdapter for tableColumn with given parametersprotected abstract String
getTemplateContextPresentation(ITemplateContext templateContext)
Returns presentation of context of given templateContext.protected void
handleAdd()
Handles add button selection.protected void
handleEdit()
Handles edit button selection.protected void
handleExport()
Handle export button selection.protected void
handleImport()
Handles import button selectionprotected void
handleRemove()
Handles remove button selectionprotected void
handleSelection()
Handles table selection changedvoid
init(org.eclipse.ui.IWorkbench workbench)
protected boolean
isAccebtableTemplate(ITemplate template, String entry)
Checks if given template shall be shown with given search entryboolean
performCancel()
boolean
performOk()
protected void
setNewTemplateStorageManager(TemplateStorageManager manager)
Changes TemplateStorageManager to given one-
Methods inherited from class org.eclipse.jface.preference.PreferencePage
applyData, applyDialogFont, computeSize, contributeButtons, createControl, createDescriptionLabel, createNoteComposite, doComputeSize, doGetPreferenceStore, getApplyButton, getContainer, getDefaultsButton, getPreferenceStore, isValid, noDefaultAndApplyButton, noDefaultButton, okToLeave, performApply, performDefaults, performHelp, setContainer, setErrorMessage, setMessage, setPreferenceStore, setSize, setTitle, setValid, toString, updateApplyButton
-
Methods inherited from class org.eclipse.jface.dialogs.DialogPage
convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, dispose, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getImage, getMessage, getMessageType, getShell, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, setButtonLayoutData, setControl, setDescription, setImageDescriptor, setMessage, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
templateStorageManager
protected TemplateStorageManager templateStorageManager
-
templateStorageSnapshot
protected String templateStorageSnapshot
-
templatesTableViewer
protected TableViewer templatesTableViewer
-
currentSearchText
protected String currentSearchText
-
-
Method Detail
-
init
public void init(org.eclipse.ui.IWorkbench workbench)
- Specified by:
init
in interfaceorg.eclipse.ui.IWorkbenchPreferencePage
-
performOk
public boolean performOk()
- Specified by:
performOk
in interfaceorg.eclipse.jface.preference.IPreferencePage
- Overrides:
performOk
in classorg.eclipse.jface.preference.PreferencePage
-
performCancel
public boolean performCancel()
- Specified by:
performCancel
in interfaceorg.eclipse.jface.preference.IPreferencePage
- Overrides:
performCancel
in classorg.eclipse.jface.preference.PreferencePage
-
createContents
protected org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite parent)
- Specified by:
createContents
in classorg.eclipse.jface.preference.PreferencePage
-
handleImport
protected void handleImport()
Handles import button selection
-
handleAdd
protected void handleAdd()
Handles add button selection. Delegates creating new template todoAdd()
-
handleRemove
protected void handleRemove()
Handles remove button selection
-
handleEdit
protected void handleEdit()
Handles edit button selection. Delegates editing template todoEdit(ITemplate)
-
handleExport
protected void handleExport()
Handle export button selection. Exports templates from file.
-
handleSelection
protected void handleSelection()
Handles table selection changed
-
doEdit
protected abstract boolean doEdit(ITemplate template)
Edits the given template- Parameters:
template
- The template to edit, cannot benull
- Returns:
- Whether editing was completed
-
doAdd
protected abstract ITemplate doAdd()
Creates new template and returns it- Returns:
- The newly created template, can be
null
when adding is canceled
-
adjustPreviewField
protected void adjustPreviewField()
Adjusts pattern's text to the selected template's
-
adjustPatternPreview
protected void adjustPatternPreview(org.eclipse.swt.custom.StyledText patternPreview, ITemplate template)
Adjusts the preview of the pattern text field with given template- Parameters:
patternPreview
- The pattern preview text field to adjust, cannot benull
template
- The template to adjust to, can benull
-
adjustDescriptionPreview
protected void adjustDescriptionPreview(org.eclipse.swt.custom.StyledText descriptionPreview, ITemplate template)
Adjusts the preview of the description text field with given template- Parameters:
descriptionPreview
- The description preview text field to adjust, cannot benull
template
- The template to adjust to, can benull
-
getTemplateColumnSelectionAdapter
protected org.eclipse.swt.events.SelectionAdapter getTemplateColumnSelectionAdapter(org.eclipse.swt.widgets.TableColumn tableColumn, int columnIndex, AbstractTemplatePreferencePage.TemplateViewerComparator viewerComparator, TableViewer tableViewer)
Returns new SelectionAdapter for tableColumn with given parameters- Parameters:
tableColumn
- The tableColumn for this adapter, cannot benull
columnIndex
- The index of the columnviewerComparator
- The viewerComparator for this SelectiionAdapter, cannot benull
tableViewer
- The tableViewer of table, cannot benull
- Returns:
- The newly created SelectionAdapter, cannot be
null
-
createTable
protected final TableViewer createTable(org.eclipse.swt.widgets.Composite parent, AbstractTemplatePreferencePage.TemplateViewerComparator viewerComparator)
Creates table on the given composite with given viwerComparator- Parameters:
parent
- The composite parent, cannot benull
viewerComparator
- The viewer comparator for this table, cannot benull
- Returns:
- The TableViewer of created table, cannot be
null
-
createTemplateStorageManager
protected abstract TemplateStorageManager createTemplateStorageManager()
GetsTemplateStorageManager
for this preference page- Returns:
- The
TemplateStorageManager
actual for this preferene page, cannot benull
-
getTemplateContextPresentation
protected abstract String getTemplateContextPresentation(ITemplateContext templateContext)
Returns presentation of context of given templateContext. It shall be human-readable description on which context this template supports- Parameters:
templateContext
- The templateContext to get presentation, cannot benull
- Returns:
- The presentation of the templateContext, cannot be
null
-
setNewTemplateStorageManager
protected void setNewTemplateStorageManager(TemplateStorageManager manager)
Changes TemplateStorageManager to given one- Parameters:
manager
- The manager to set, cannot benull
-
isAccebtableTemplate
protected boolean isAccebtableTemplate(ITemplate template, String entry)
Checks if given template shall be shown with given search entry- Parameters:
template
- The template to check, cannot benull
entry
- The search entry, cannot benull
- Returns:
- Whether given template shall be shown with given entry
-
-