Class AbstractAefBoundEditor<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
com._1c.g5.v8.dt.internal.platform.services.ui.AbstractAefBoundEditor<M>
Type Parameters:
M - model type for this editor, sub-class of EObject
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.IEditorPart, org.eclipse.ui.ISaveablePart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.IWorkbenchPart3, org.eclipse.ui.part.IWorkbenchPartOrientation
Direct Known Subclasses:
AbstractPublicationEditor, InfobaseEditor, WebServerEditor

public abstract class AbstractAefBoundEditor<M extends org.eclipse.emf.ecore.EObject> extends org.eclipse.ui.part.EditorPart
Abstract EMF object editor implementation, bound with AEF framework. AEF bind is based on TransactionalEditingDomain, so opened model instance is intended to have resource set, associated with one.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final boolean
    The boolean property that indicates the control mode.

    Fields inherited from interface org.eclipse.ui.IEditorPart

    PROP_DIRTY, PROP_INPUT

    Fields inherited from interface org.eclipse.ui.IWorkbenchPart

    PROP_TITLE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor of AbstractAefBoundEditor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    bind(org.eclipse.ui.IEditorSite site, M model)
    Bind given model instance and given editor site.
    protected void
    close(boolean save)
    Close this editor after optionally saving changes.
    Returns a newly created DtGranularEditorPageBuilder instance.
    protected abstract void
    Subclasses should override this method to create content in the form hosted in this page.
    protected ILightLayout
    Create page LWT layout for this editor.
    protected org.eclipse.swt.widgets.Layout
    Create page SWT layout for this editor.
    void
    createPartControl(org.eclipse.swt.widgets.Composite parent)
     
    void
     
    protected abstract void
    doSave(M model, org.eclipse.core.runtime.IProgressMonitor monitor)
    Saves the model content of this editor.
    void
    doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
     
    void
     
    protected String
    formatHeaderText(String collectionLabel, String itemLabel)
    Formats the header text
    Returns AEF builder instance, that can build this editor UI.
    protected ContainerComponent<?,?>
    Returns container AEF component for this editor.
    protected org.eclipse.emf.transaction.TransactionalEditingDomain
    Returns EMF editing domain, associated with instance of model, opened in this editor.
    protected IEngine
    Returns the editor IEngine.
    Returns model instance, opened in this editor.
    protected String
    getPageTitle(M model)
    Returns page title for this editor.
    protected IScene
    Returns the AEF scene, that contains page AEF container component.
    void
    init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input)
     
    protected void
    Initializes the page IEngine.
    boolean
     
    protected boolean
    isModelAffected(M model, org.eclipse.emf.ecore.EObject changedObject, org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.change.FeatureChange> featureChanges)
    Check if given model changes affects current model instance.
    boolean
     
    protected M
    normalize(M model)
    Normalize given model instance before binding with editor UI elements.
    protected void
    Refresh current dirty state of the editor.
    protected void
    setDefaultFeature(org.eclipse.emf.ecore.EStructuralFeature feature)
    Set default feature for this AEF bounded editor.
    void
     
    protected void
    updateHeaderText(M model, String text)
    Updates the editor header text.

    Methods inherited from class org.eclipse.ui.part.EditorPart

    checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartName

    Methods inherited from class org.eclipse.ui.part.WorkbenchPart

    addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, 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.core.runtime.IAdaptable

    getAdapter

    Methods inherited from interface org.eclipse.ui.IWorkbenchPart

    addPropertyListener, getSite, getTitle, getTitleImage, removePropertyListener
  • Field Details

    • PREFER_HEAVY_CONTROLS

      public static final boolean PREFER_HEAVY_CONTROLS
      The boolean property that indicates the control mode. If the value is true then heavy (SWT) controls are preferred. Otherwise - light (LWT) ones.
  • Constructor Details

  • Method Details

    • doSaveAs

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

      public boolean isSaveAsAllowed()
      Specified by:
      isSaveAsAllowed in interface org.eclipse.ui.ISaveablePart
      Specified by:
      isSaveAsAllowed in class org.eclipse.ui.part.EditorPart
    • 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
      Specified by:
      init in class org.eclipse.ui.part.EditorPart
      Throws:
      org.eclipse.ui.PartInitException
    • createPartControl

      public void createPartControl(org.eclipse.swt.widgets.Composite parent)
      Specified by:
      createPartControl in interface org.eclipse.ui.IWorkbenchPart
      Specified by:
      createPartControl in class org.eclipse.ui.part.WorkbenchPart
    • dispose

      public void dispose()
      Specified by:
      dispose in interface org.eclipse.ui.IWorkbenchPart
      Overrides:
      dispose in class org.eclipse.ui.part.WorkbenchPart
    • 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
    • setFocus

      public void setFocus()
      Specified by:
      setFocus in interface org.eclipse.ui.IWorkbenchPart
      Specified by:
      setFocus in class org.eclipse.ui.part.WorkbenchPart
    • isDirty

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

      public M getModel()
      Returns model instance, opened in this editor.
      Returns:
      model instance, opened in this editor, never null
    • updateHeaderText

      protected void updateHeaderText(M model, String text)
      Updates the editor header text.
      Parameters:
      model - the current model value, cannot be null
      text - the new editor header title, cannot be null
    • formatHeaderText

      protected String formatHeaderText(String collectionLabel, String itemLabel)
      Formats the header text
      Parameters:
      collectionLabel - the collection label, cannot be null
      itemLabel - the item label, cannot be null
      Returns:
      the formatted header text, never null
    • initializeEngine

      protected void initializeEngine(IEngine engine)
      Initializes the page IEngine.
      Parameters:
      engine - the engine.
      See Also:
    • getBuilder

      protected DtGranularEditorPageBuilder<?> getBuilder()
      Returns AEF builder instance, that can build this editor UI.
      Returns:
      AEF builder instance, never null
    • getContainerComponent

      protected ContainerComponent<?,?> getContainerComponent()
      Returns container AEF component for this editor. Returns if content is not created yet.
      Returns:
      the container AEF component for this editor or if content is not created yet
    • getEditingDomain

      protected org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain()
      Returns EMF editing domain, associated with instance of model, opened in this editor.
      Returns:
      EMF editing domain, never null
    • setDefaultFeature

      protected void setDefaultFeature(org.eclipse.emf.ecore.EStructuralFeature feature)
      Set default feature for this AEF bounded editor. AEF-editor, associated with given feature will focused on editor activation.
      Parameters:
      feature - feature to set default, can be null then no AEF-editors will be focued by default
    • normalize

      protected M normalize(M model)
      Normalize given model instance before binding with editor UI elements.

      Default implementation does nothing, and returns unchanged model instance.

      Parameters:
      model - model instance ot normalize, cannot be null
      Returns:
      normalized model instance, never null
    • bind

      protected void bind(org.eclipse.ui.IEditorSite site, M model)
      Bind given model instance and given editor site.
      Parameters:
      site - editor site, cannot be null
      model - new model instance, opened in this editor, cannot be null
    • createPageLwtLayout

      protected ILightLayout createPageLwtLayout(IDtGranularEditorManagingDefinition definition)
      Create page LWT layout for this editor. Sub-classes can use definition to create it.
      Parameters:
      definition - the definition, that can be used to create page layout, cannot be null.
      Returns:
      page layout, never null.
    • createPageSwtLayout

      protected org.eclipse.swt.widgets.Layout createPageSwtLayout(IDtGranularEditorManagingDefinition definition)
      Create page SWT layout for this editor. Sub-classes can use definition to create it.
      Parameters:
      definition - the definition, that can be used to create page layout, cannot be null.
      Returns:
      page layout, never null.
    • getPageTitle

      protected String getPageTitle(M model)
      Returns page title for this editor. Default implementation returns feature name value of the editor model instance, if exists. Otherwise returns <Unnamed>.
      Parameters:
      model - the model instance, opened in this editor, cannot be null
      Returns:
      the page title, never null
    • refreshDirty

      protected void refreshDirty()
      Refresh current dirty state of the editor.
    • close

      protected void close(boolean save)
      Close this editor after optionally saving changes.
      Parameters:
      save - true if unsaved changed should be saved, and false if unsaved changed should be discarded
    • getEngine

      protected IEngine getEngine()
      Returns the editor IEngine.
      Returns:
      the IEngine instance, never null.
    • getScene

      protected IScene getScene()
      Returns the AEF scene, that contains page AEF container component.
      Returns:
      the AEF scene, that contains page AEF container component, never null after page content creation
    • isModelAffected

      protected boolean isModelAffected(M model, org.eclipse.emf.ecore.EObject changedObject, org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.change.FeatureChange> featureChanges)
      Check if given model changes affects current model instance.

      Default implementation checks if changed object is ancestor of model instance, but subclasses can override this behavior.

      Parameters:
      model - the current model instance, cannot be null
      changedObject - a changed object to check affecting, cannot be null
      featureChanges - a list of feature changes, cannot be null
      Returns:
      whether current model is affected by given changes
    • createBuilder

      protected DtGranularEditorPageBuilder<?> createBuilder()
      Returns a newly created DtGranularEditorPageBuilder instance.
      Returns:
      a newly created DtGranularEditorPageBuilder instance, never null.
    • createFormContent

      protected abstract void createFormContent(DtGranularEditorPageBuilder<?> builder)
      Subclasses should override this method to create content in the form hosted in this page.
      Parameters:
      builder - the AEF UI builder to construct UI, cannot be null
    • doSave

      protected abstract void doSave(M model, org.eclipse.core.runtime.IProgressMonitor monitor)
      Saves the model content of this editor.

      Subclasses must override this method to implement the open-save-close lifecycle for an editor.

      Parameters:
      model - the model instance to save, cannot be null
      monitor - the progress monitor to report progress to, cannot be null