Class DtGranularEditor<M extends org.eclipse.emf.ecore.EObject>
- java.lang.Object
-
- org.eclipse.core.commands.common.EventManager
-
- org.eclipse.ui.part.WorkbenchPart
-
- org.eclipse.ui.part.EditorPart
-
- org.eclipse.ui.part.MultiPageEditorPart
-
- org.eclipse.ui.forms.editor.FormEditor
-
- com._1c.g5.v8.dt.md.ui.editor.base.DtGranularEditor<M>
-
- All Implemented Interfaces:
IDtEditor<M>
,IDtGranularEditor<M>
,IGotoSelection
,org.eclipse.core.runtime.IAdaptable
,org.eclipse.core.runtime.IExecutableExtension
,org.eclipse.jface.dialogs.IPageChangeProvider
,org.eclipse.ui.IEditorPart
,org.eclipse.ui.INavigationLocationProvider
,org.eclipse.ui.ISaveablePart
,org.eclipse.ui.IShowEditorInput
,org.eclipse.ui.IWorkbenchPart
,org.eclipse.ui.IWorkbenchPart2
,org.eclipse.ui.IWorkbenchPart3
,org.eclipse.ui.part.ISetSelectionTarget
,org.eclipse.ui.part.IShowInSource
,org.eclipse.ui.part.IWorkbenchPartOrientation
- Direct Known Subclasses:
FormEditor
,RightsEditor
public abstract class DtGranularEditor<M extends org.eclipse.emf.ecore.EObject> extends org.eclipse.ui.forms.editor.FormEditor implements IDtGranularEditor<M>, org.eclipse.ui.part.ISetSelectionTarget, org.eclipse.ui.INavigationLocationProvider
Base class for all DT granular editors. The editor uses a declarative page descriptions with 'com._1c.g5.v8.dt.md.ui.granularEditorPages' and 'com._1c.g5.v8.dt.md.ui.granularEditorContentPages' extension points.
-
-
Constructor Summary
Constructors Constructor Description DtGranularEditor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addDefaultPage(IDtGranularEditorPage<M> page)
Adds the default/main page of the editor.protected <P extends DtGranularEditorPage<M>>
PaddPage(String pageId)
Create and ddd page by its id, based on 'com._1c.g5.v8.dt.md.ui.granularEditorPages' extension.int
addPageForFeatures(IDtGranularEditorPage<M> page, org.eclipse.emf.ecore.EStructuralFeature... features)
Adds the page and marks it as a target page for a givenfeatures
.protected void
addPages()
org.eclipse.ui.IEditorSite
createEmbeddedEditorSite(org.eclipse.ui.IEditorPart editor)
Creates an embedded editor site for the giveneditor
.org.eclipse.ui.INavigationLocation
createEmptyNavigationLocation()
org.eclipse.ui.INavigationLocation
createNavigationLocation()
protected <P extends DtGranularEditorPage<M>>
PcreatePage(String pageId)
Create page by its id, based on 'com._1c.g5.v8.dt.md.ui.granularEditorPages' extension.protected org.eclipse.swt.widgets.Composite
createPageContainer(org.eclipse.swt.widgets.Composite parent)
protected void
createPages()
protected org.eclipse.ui.forms.widgets.FormToolkit
createToolkit(org.eclipse.swt.widgets.Display display)
void
dispose()
void
doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
void
doSaveAs()
org.eclipse.jface.action.IAction
getAction(String actionId)
Returns the editor action by the givenactionId
.<T> T
getAdapter(Class<T> adapter)
IEditingContext
getApiEditingContext()
Returns theIEditingContext
instance associated with the editor.IBmEditingContext
getEditingContext()
Deprecated.IEditingLanguageManager
getEditingLanguageManager()
ReturnsIEditingLanguageManager
instance.protected org.eclipse.ui.IEditorPart
getEditor(int pageIndex)
protected abstract String
getEditorId()
Returns the editor id used in extension to declare pages.IDtEditorInput<M>
getEditorInput()
IEngine
getEngine()
Returns the AEF 2.0 engine.IEventBroker
getEventBroker()
ReturnsIEventBroker
instance.M
getModel()
IBmModelManager
getModelManager()
Get instance ofIBmModelManager
protected org.eclipse.ui.forms.editor.IFormPage
getPageForFeature(org.eclipse.emf.ecore.EStructuralFeature feature)
Returns the editor page that was created and assigned for the provided feature.protected IProjectOperationApi
getProjectOperationApi()
Returns the project operation API.org.eclipse.ui.part.ShowInContext
getShowInContext()
org.eclipse.swt.graphics.Image
getTitleImage()
IV8ProjectManager
getV8projectManager()
ReturnsIV8ProjectManager
instance.void
gotoSelection(ISelection selection)
Sets selection to the editorvoid
init(org.eclipse.ui.IEditorSite site, IDtEditorInput<M> input)
Initializes the editor.void
init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input)
protected void
initializeEngine(IEngine engine)
Initializes the pageIEngine
.boolean
isActive()
boolean
isDirty()
boolean
isSaveAsAllowed()
protected boolean
isUsePurposesChanged(BmChangeEvent changeEvent)
The method checks need to update title of this editor.protected boolean
needShowErrorInPageTitle(org.eclipse.ui.forms.editor.IFormPage page)
Returnstrue
if error/warning messages should be displayed in the title of the specifiedpage
.void
notifyEmbeddedEditorPropertyChanged(int propertyId)
Handles a property change notification from a nested editor.protected void
pageChange(int newPageIndex)
protected void
processChangeEvent(IBmLongMap<BmChangeEvent> changeEvents)
Process change events.protected void
refreshDirty()
Forces update of editor's dirty state.void
removePage(IDtGranularEditorPage<M> page)
Removes the page.void
selectReveal(ISelection selection)
void
setActiveFeature(org.eclipse.emf.ecore.EStructuralFeature feature)
Sets the active feature of the editor.void
setActiveSelection(ISelection selection, DtEditorSelectionProcessingPolicy policy)
Sets the active selection of the editor.void
setFocus()
void
showEditorInput(IDtEditorInput<M> editorInput)
Shows the editor input.void
showEditorInput(org.eclipse.ui.IEditorInput editorInput)
-
Methods inherited from class org.eclipse.ui.forms.editor.FormEditor
addPage, addPage, addPage, addPage, addPage, addPage, close, commitPages, configurePage, editorDirtyStateChanged, findPage, getActiveEditor, getActivePageInstance, getCurrentPage, getSelectedPage, getToolkit, removePage, selectReveal, setActivePage, setActivePage, setActivePage, updateActionBarContributor
-
Methods inherited from class org.eclipse.ui.part.MultiPageEditorPart
activateSite, addPageChangedListener, createContainer, createItem, createPartControl, createSite, deactivateSite, findEditors, getActivePage, getContainer, getControl, getPageCount, getPageImage, getPageSite, getPageText, handlePropertyChange, initializePageSwitching, removePageChangedListener, setActiveEditor, setControl, setPageImage, setPageText
-
Methods inherited from class org.eclipse.ui.part.EditorPart
checkSite, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartName
-
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
-
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
-
-
-
Method Detail
-
addDefaultPage
public void addDefaultPage(IDtGranularEditorPage<M> page)
Description copied from interface:IDtGranularEditor
Adds the default/main page of the editor. This page will be shown when it is not possible to infer a more specific page fromIDtEditorInput
.- Specified by:
addDefaultPage
in interfaceIDtGranularEditor<M extends org.eclipse.emf.ecore.EObject>
- Parameters:
page
- page to add as default.
-
addPageForFeatures
public int addPageForFeatures(IDtGranularEditorPage<M> page, org.eclipse.emf.ecore.EStructuralFeature... features) throws org.eclipse.ui.PartInitException
Description copied from interface:IDtGranularEditor
Adds the page and marks it as a target page for a givenfeatures
. One may think that this information may be inferred from page's controls creation procedure, but creation of controls for an editor page may be postponed until the page become active.- Specified by:
addPageForFeatures
in interfaceIDtGranularEditor<M extends org.eclipse.emf.ecore.EObject>
- Parameters:
page
- page to add.features
- model features to associate with a page.- Returns:
- the index of the new page
- Throws:
org.eclipse.ui.PartInitException
-
removePage
public void removePage(IDtGranularEditorPage<M> page)
Description copied from interface:IDtGranularEditor
Removes the page.- Specified by:
removePage
in interfaceIDtGranularEditor<M extends org.eclipse.emf.ecore.EObject>
- Parameters:
page
- page to removes.
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceorg.eclipse.ui.IWorkbenchPart
- Overrides:
dispose
in classorg.eclipse.ui.forms.editor.FormEditor
-
doSave
public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
- Specified by:
doSave
in interfaceorg.eclipse.ui.ISaveablePart
- Specified by:
doSave
in classorg.eclipse.ui.part.EditorPart
-
doSaveAs
public void doSaveAs()
- Specified by:
doSaveAs
in interfaceorg.eclipse.ui.ISaveablePart
- Specified by:
doSaveAs
in classorg.eclipse.ui.part.EditorPart
-
getV8projectManager
public IV8ProjectManager getV8projectManager()
ReturnsIV8ProjectManager
instance.- Returns:
IV8ProjectManager
instance.
-
getEditingLanguageManager
public IEditingLanguageManager getEditingLanguageManager()
ReturnsIEditingLanguageManager
instance.- Returns:
IEditingLanguageManager
instance.
-
getEventBroker
public IEventBroker getEventBroker()
ReturnsIEventBroker
instance.- Returns:
IEventBroker
instance, nevernull
.
-
getAdapter
public <T> T getAdapter(Class<T> adapter)
- Specified by:
getAdapter
in interfaceorg.eclipse.core.runtime.IAdaptable
- Overrides:
getAdapter
in classorg.eclipse.ui.part.MultiPageEditorPart
-
getEditorInput
public IDtEditorInput<M> getEditorInput()
- Specified by:
getEditorInput
in interfaceIDtEditor<M extends org.eclipse.emf.ecore.EObject>
- Specified by:
getEditorInput
in interfaceorg.eclipse.ui.IEditorPart
- Overrides:
getEditorInput
in classorg.eclipse.ui.part.EditorPart
-
getModel
public M getModel()
-
getEditingContext
@Deprecated public IBmEditingContext getEditingContext()
Deprecated.- Specified by:
getEditingContext
in interfaceIDtEditor<M extends org.eclipse.emf.ecore.EObject>
- Returns:
- BM editing context associated with the editor.
-
getApiEditingContext
public IEditingContext getApiEditingContext()
Description copied from interface:IDtEditor
Returns theIEditingContext
instance associated with the editor.- Specified by:
getApiEditingContext
in interfaceIDtEditor<M extends org.eclipse.emf.ecore.EObject>
- Returns:
- the
IEditingContext
instance associated with the editor, can benull
if the editor is not initialized or it is already disposed.
-
gotoSelection
public void gotoSelection(ISelection selection)
Description copied from interface:IGotoSelection
Sets selection to the editor- Specified by:
gotoSelection
in interfaceIGotoSelection
- Parameters:
selection
- actual selection, can benull
-
init
public void init(org.eclipse.ui.IEditorSite site, IDtEditorInput<M> input) throws org.eclipse.ui.PartInitException
Description copied from interface:IDtEditor
Initializes the editor.- Specified by:
init
in interfaceIDtEditor<M extends org.eclipse.emf.ecore.EObject>
- Parameters:
site
- the editor site, cannot benull
.input
- the editor input, cannot benull
.- Throws:
org.eclipse.ui.PartInitException
- if this editor was not initialized successfully- See Also:
IEditorPart.init(IEditorSite, org.eclipse.ui.IEditorInput)
-
init
public void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input) throws org.eclipse.ui.PartInitException
- Specified by:
init
in interfaceorg.eclipse.ui.IEditorPart
- Overrides:
init
in classorg.eclipse.ui.forms.editor.FormEditor
- Throws:
org.eclipse.ui.PartInitException
-
isDirty
public boolean isDirty()
- Specified by:
isDirty
in interfaceorg.eclipse.ui.ISaveablePart
- Overrides:
isDirty
in classorg.eclipse.ui.forms.editor.FormEditor
-
isSaveAsAllowed
public boolean isSaveAsAllowed()
- Specified by:
isSaveAsAllowed
in interfaceorg.eclipse.ui.ISaveablePart
- Specified by:
isSaveAsAllowed
in classorg.eclipse.ui.part.EditorPart
-
selectReveal
public void selectReveal(ISelection selection)
- Specified by:
selectReveal
in interfaceorg.eclipse.ui.part.ISetSelectionTarget
-
setActiveFeature
public void setActiveFeature(org.eclipse.emf.ecore.EStructuralFeature feature)
Description copied from interface:IDtEditor
Sets the active feature of the editor.- Specified by:
setActiveFeature
in interfaceIDtEditor<M extends org.eclipse.emf.ecore.EObject>
- Parameters:
feature
- the feature active at this moment, ornull
if there is no active feature.
-
setActiveSelection
public void setActiveSelection(ISelection selection, DtEditorSelectionProcessingPolicy policy)
Description copied from interface:IDtEditor
Sets the active selection of the editor.- Specified by:
setActiveSelection
in interfaceIDtEditor<M extends org.eclipse.emf.ecore.EObject>
- Parameters:
selection
- selection active at this moment.policy
- selection processing policy.
-
setFocus
public void setFocus()
- Specified by:
setFocus
in interfaceorg.eclipse.ui.IWorkbenchPart
- Overrides:
setFocus
in classorg.eclipse.ui.part.MultiPageEditorPart
-
showEditorInput
public void showEditorInput(IDtEditorInput<M> editorInput)
Description copied from interface:IDtEditor
Shows the editor input.- Specified by:
showEditorInput
in interfaceIDtEditor<M extends org.eclipse.emf.ecore.EObject>
- Parameters:
editorInput
- the editor input to show, cannot benull
.- See Also:
IShowEditorInput.showEditorInput(org.eclipse.ui.IEditorInput)
-
showEditorInput
public void showEditorInput(org.eclipse.ui.IEditorInput editorInput)
- Specified by:
showEditorInput
in interfaceorg.eclipse.ui.IShowEditorInput
-
getModelManager
public IBmModelManager getModelManager()
Get instance ofIBmModelManager
- Returns:
IBmModelManager
-
getShowInContext
public org.eclipse.ui.part.ShowInContext getShowInContext()
- Specified by:
getShowInContext
in interfaceorg.eclipse.ui.part.IShowInSource
-
getEngine
public IEngine getEngine()
Returns the AEF 2.0 engine.- Returns:
- the engine.
-
notifyEmbeddedEditorPropertyChanged
public void notifyEmbeddedEditorPropertyChanged(int propertyId)
Handles a property change notification from a nested editor.- Parameters:
propertyId
- the id of the property that changed, can not benull
-
getTitleImage
public org.eclipse.swt.graphics.Image getTitleImage()
- Specified by:
getTitleImage
in interfaceorg.eclipse.ui.IWorkbenchPart
- Overrides:
getTitleImage
in classorg.eclipse.ui.part.WorkbenchPart
-
createEmbeddedEditorSite
public org.eclipse.ui.IEditorSite createEmbeddedEditorSite(org.eclipse.ui.IEditorPart editor)
Creates an embedded editor site for the giveneditor
.- Parameters:
editor
- the editor part, cannot benull
.- Returns:
- the editor site for the embedded editor.
-
isActive
public boolean isActive()
- Returns:
true
if editor is active.
-
getAction
public org.eclipse.jface.action.IAction getAction(String actionId)
Returns the editor action by the givenactionId
.- Parameters:
actionId
- the action id, cannot benull
.- Returns:
- the
IAction
corresponding to the givenactionId
.
-
createEmptyNavigationLocation
public org.eclipse.ui.INavigationLocation createEmptyNavigationLocation()
- Specified by:
createEmptyNavigationLocation
in interfaceorg.eclipse.ui.INavigationLocationProvider
-
createNavigationLocation
public org.eclipse.ui.INavigationLocation createNavigationLocation()
- Specified by:
createNavigationLocation
in interfaceorg.eclipse.ui.INavigationLocationProvider
-
addPages
protected void addPages()
- Specified by:
addPages
in classorg.eclipse.ui.forms.editor.FormEditor
-
createPageContainer
protected org.eclipse.swt.widgets.Composite createPageContainer(org.eclipse.swt.widgets.Composite parent)
- Overrides:
createPageContainer
in classorg.eclipse.ui.forms.editor.FormEditor
-
createPages
protected void createPages()
- Overrides:
createPages
in classorg.eclipse.ui.forms.editor.FormEditor
-
createToolkit
protected org.eclipse.ui.forms.widgets.FormToolkit createToolkit(org.eclipse.swt.widgets.Display display)
- Overrides:
createToolkit
in classorg.eclipse.ui.forms.editor.FormEditor
-
getEditor
protected org.eclipse.ui.IEditorPart getEditor(int pageIndex)
- Overrides:
getEditor
in classorg.eclipse.ui.part.MultiPageEditorPart
-
initializeEngine
protected void initializeEngine(IEngine engine)
Initializes the pageIEngine
.- Parameters:
engine
- the engine.- See Also:
IEngine.registerRenderer(Class, Class)
,IEngine.setDialogRenderer(Class)
-
getEditorId
protected abstract String getEditorId()
Returns the editor id used in extension to declare pages.- Returns:
- the editor id used in extension to declare pages
-
pageChange
protected void pageChange(int newPageIndex)
- Overrides:
pageChange
in classorg.eclipse.ui.forms.editor.FormEditor
-
needShowErrorInPageTitle
protected boolean needShowErrorInPageTitle(org.eclipse.ui.forms.editor.IFormPage page)
Returnstrue
if error/warning messages should be displayed in the title of the specifiedpage
.false
- otherwise.- Parameters:
page
- the form page, cannot benull
.- Returns:
true
if error/warning messages should be displayed in the title of the specifiedpage
.
-
isUsePurposesChanged
protected boolean isUsePurposesChanged(BmChangeEvent changeEvent)
The method checks need to update title of this editor.- Parameters:
changeEvent
- the BM event on the editor session.- Returns:
- if returns
true
then editor updateWorkbenchPart.getPartName()
,false
- otherwise.
-
processChangeEvent
protected void processChangeEvent(IBmLongMap<BmChangeEvent> changeEvents)
Process change events.- Parameters:
changeEvents
- the change events
-
addPage
protected <P extends DtGranularEditorPage<M>> P addPage(String pageId)
Create and ddd page by its id, based on 'com._1c.g5.v8.dt.md.ui.granularEditorPages' extension.- Parameters:
pageId
- the page id to add, cannot benull
- Returns:
- created page or
null
if creation fails
-
createPage
protected <P extends DtGranularEditorPage<M>> P createPage(String pageId)
Create page by its id, based on 'com._1c.g5.v8.dt.md.ui.granularEditorPages' extension.- Parameters:
pageId
- the page id to add, cannot benull
- Returns:
- created page or
null
if creation fails
-
refreshDirty
protected void refreshDirty()
Forces update of editor's dirty state.
-
getProjectOperationApi
protected IProjectOperationApi getProjectOperationApi()
Returns the project operation API.- Returns:
- the
IProjectOperationApi
instance, nevernull
.
-
getPageForFeature
protected org.eclipse.ui.forms.editor.IFormPage getPageForFeature(org.eclipse.emf.ecore.EStructuralFeature feature)
Returns the editor page that was created and assigned for the provided feature.- Parameters:
feature
- the feature, cannot benull
- Returns:
- the editor page that was created and assigned for the provided feature or
null
if none
-
-