Class DtGranularEditor<M extends org.eclipse.emf.ecore.EObject>

  • 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 Detail

      • DtGranularEditor

        public DtGranularEditor()
    • Method Detail

      • 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 given features. 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 interface IDtGranularEditor<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
      • dispose

        public void dispose()
        Specified by:
        dispose in interface org.eclipse.ui.IWorkbenchPart
        Overrides:
        dispose in class org.eclipse.ui.forms.editor.FormEditor
      • doSave

        public void doSave​(org.eclipse.core.runtime.IProgressMonitor monitor)
        Specified by:
        doSave in interface org.eclipse.ui.ISaveablePart
        Specified by:
        doSave in class org.eclipse.ui.part.EditorPart
      • doSaveAs

        public void doSaveAs()
        Specified by:
        doSaveAs in interface org.eclipse.ui.ISaveablePart
        Specified by:
        doSaveAs in class org.eclipse.ui.part.EditorPart
      • getAdapter

        public <T> T getAdapter​(Class<T> adapter)
        Specified by:
        getAdapter in interface org.eclipse.core.runtime.IAdaptable
        Overrides:
        getAdapter in class org.eclipse.ui.part.MultiPageEditorPart
      • getEditorInput

        public IDtEditorInput<M> getEditorInput()
        Specified by:
        getEditorInput in interface IDtEditor<M extends org.eclipse.emf.ecore.EObject>
        Specified by:
        getEditorInput in interface org.eclipse.ui.IEditorPart
        Overrides:
        getEditorInput in class org.eclipse.ui.part.EditorPart
      • getModel

        public M getModel()
        Specified by:
        getModel in interface IDtEditor<M extends org.eclipse.emf.ecore.EObject>
        Returns:
        the sessioned model being edited.
      • getApiEditingContext

        public IEditingContext getApiEditingContext()
        Description copied from interface: IDtEditor
        Returns the IEditingContext instance associated with the editor.
        Specified by:
        getApiEditingContext in interface IDtEditor<M extends org.eclipse.emf.ecore.EObject>
        Returns:
        the IEditingContext instance associated with the editor, can be null 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 interface IGotoSelection
        Parameters:
        selection - actual selection, can be null
      • 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 interface IDtEditor<M extends org.eclipse.emf.ecore.EObject>
        Parameters:
        site - the editor site, cannot be null.
        input - the editor input, cannot be null.
        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 interface org.eclipse.ui.IEditorPart
        Overrides:
        init in class org.eclipse.ui.forms.editor.FormEditor
        Throws:
        org.eclipse.ui.PartInitException
      • isDirty

        public boolean isDirty()
        Specified by:
        isDirty in interface org.eclipse.ui.ISaveablePart
        Overrides:
        isDirty in class org.eclipse.ui.forms.editor.FormEditor
      • isSaveAsAllowed

        public boolean isSaveAsAllowed()
        Specified by:
        isSaveAsAllowed in interface org.eclipse.ui.ISaveablePart
        Specified by:
        isSaveAsAllowed in class org.eclipse.ui.part.EditorPart
      • selectReveal

        public void selectReveal​(ISelection selection)
        Specified by:
        selectReveal in interface org.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 interface IDtEditor<M extends org.eclipse.emf.ecore.EObject>
        Parameters:
        feature - the feature active at this moment, or null 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 interface IDtEditor<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 interface org.eclipse.ui.IWorkbenchPart
        Overrides:
        setFocus in class org.eclipse.ui.part.MultiPageEditorPart
      • showEditorInput

        public void showEditorInput​(IDtEditorInput<M> editorInput)
        Description copied from interface: IDtEditor
        Shows the editor input.
        Specified by:
        showEditorInput in interface IDtEditor<M extends org.eclipse.emf.ecore.EObject>
        Parameters:
        editorInput - the editor input to show, cannot be null.
        See Also:
        IShowEditorInput.showEditorInput(org.eclipse.ui.IEditorInput)
      • showEditorInput

        public void showEditorInput​(org.eclipse.ui.IEditorInput editorInput)
        Specified by:
        showEditorInput in interface org.eclipse.ui.IShowEditorInput
      • getShowInContext

        public org.eclipse.ui.part.ShowInContext getShowInContext()
        Specified by:
        getShowInContext in interface org.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 be null
      • getTitleImage

        public org.eclipse.swt.graphics.Image getTitleImage()
        Specified by:
        getTitleImage in interface org.eclipse.ui.IWorkbenchPart
        Overrides:
        getTitleImage in class org.eclipse.ui.part.WorkbenchPart
      • createEmbeddedEditorSite

        public org.eclipse.ui.IEditorSite createEmbeddedEditorSite​(org.eclipse.ui.IEditorPart editor)
        Creates an embedded editor site for the given editor.
        Parameters:
        editor - the editor part, cannot be null.
        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 given actionId.
        Parameters:
        actionId - the action id, cannot be null.
        Returns:
        the IAction corresponding to the given actionId.
      • createEmptyNavigationLocation

        public org.eclipse.ui.INavigationLocation createEmptyNavigationLocation()
        Specified by:
        createEmptyNavigationLocation in interface org.eclipse.ui.INavigationLocationProvider
      • createNavigationLocation

        public org.eclipse.ui.INavigationLocation createNavigationLocation()
        Specified by:
        createNavigationLocation in interface org.eclipse.ui.INavigationLocationProvider
      • addPages

        protected void addPages()
        Specified by:
        addPages in class org.eclipse.ui.forms.editor.FormEditor
      • createPageContainer

        protected org.eclipse.swt.widgets.Composite createPageContainer​(org.eclipse.swt.widgets.Composite parent)
        Overrides:
        createPageContainer in class org.eclipse.ui.forms.editor.FormEditor
      • createPages

        protected void createPages()
        Overrides:
        createPages in class org.eclipse.ui.forms.editor.FormEditor
      • createToolkit

        protected org.eclipse.ui.forms.widgets.FormToolkit createToolkit​(org.eclipse.swt.widgets.Display display)
        Overrides:
        createToolkit in class org.eclipse.ui.forms.editor.FormEditor
      • getEditor

        protected org.eclipse.ui.IEditorPart getEditor​(int pageIndex)
        Overrides:
        getEditor in class org.eclipse.ui.part.MultiPageEditorPart
      • 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 class org.eclipse.ui.forms.editor.FormEditor
      • needShowErrorInPageTitle

        protected boolean needShowErrorInPageTitle​(org.eclipse.ui.forms.editor.IFormPage page)
        Returns true if error/warning messages should be displayed in the title of the specified page. false - otherwise.
        Parameters:
        page - the form page, cannot be null.
        Returns:
        true if error/warning messages should be displayed in the title of the specified page.
      • 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 update WorkbenchPart.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 be null
        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 be null
        Returns:
        created page or null if creation fails
      • refreshDirty

        protected void refreshDirty()
        Forces update of editor's dirty state.
      • 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 be null
        Returns:
        the editor page that was created and assigned for the provided feature or null if none