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 ofEObject
- 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
FieldsModifier and TypeFieldDescriptionstatic 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 -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Bind given model instance and given editor site.protected void
close
(boolean save) Close this editor after optionally saving changes.protected DtGranularEditorPageBuilder<?>
Returns a newly createdDtGranularEditorPageBuilder
instance.protected abstract void
createFormContent
(DtGranularEditorPageBuilder<?> builder) 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
dispose()
protected abstract void
Saves the model content of this editor.void
doSave
(org.eclipse.core.runtime.IProgressMonitor monitor) void
doSaveAs()
protected String
formatHeaderText
(String collectionLabel, String itemLabel) Formats the header textprotected DtGranularEditorPageBuilder<?>
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 editorIEngine
.getModel()
Returns model instance, opened in this editor.protected String
getPageTitle
(M model) Returns page title for this editor.protected IScene
getScene()
Returns the AEF scene, that contains page AEF container component.void
init
(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input) protected void
initializeEngine
(IEngine engine) Initializes the pageIEngine
.boolean
isDirty()
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 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
setFocus()
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_CONTROLSThe boolean property that indicates the control mode. If the value istrue
then heavy (SWT) controls are preferred. Otherwise - light (LWT) ones.
-
-
Constructor Details
-
AbstractAefBoundEditor
public AbstractAefBoundEditor()Constructor ofAbstractAefBoundEditor
.
-
-
Method Details
-
doSaveAs
public void doSaveAs()- Specified by:
doSaveAs
in interfaceorg.eclipse.ui.ISaveablePart
- Specified by:
doSaveAs
in classorg.eclipse.ui.part.EditorPart
-
isSaveAsAllowed
public boolean isSaveAsAllowed()- Specified by:
isSaveAsAllowed
in interfaceorg.eclipse.ui.ISaveablePart
- Specified by:
isSaveAsAllowed
in classorg.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 interfaceorg.eclipse.ui.IEditorPart
- Specified by:
init
in classorg.eclipse.ui.part.EditorPart
- Throws:
org.eclipse.ui.PartInitException
-
createPartControl
public void createPartControl(org.eclipse.swt.widgets.Composite parent) - Specified by:
createPartControl
in interfaceorg.eclipse.ui.IWorkbenchPart
- Specified by:
createPartControl
in classorg.eclipse.ui.part.WorkbenchPart
-
dispose
public void dispose()- Specified by:
dispose
in interfaceorg.eclipse.ui.IWorkbenchPart
- Overrides:
dispose
in classorg.eclipse.ui.part.WorkbenchPart
-
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
-
setFocus
public void setFocus()- Specified by:
setFocus
in interfaceorg.eclipse.ui.IWorkbenchPart
- Specified by:
setFocus
in classorg.eclipse.ui.part.WorkbenchPart
-
isDirty
public boolean isDirty()- Specified by:
isDirty
in interfaceorg.eclipse.ui.ISaveablePart
- Specified by:
isDirty
in classorg.eclipse.ui.part.EditorPart
-
getModel
Returns model instance, opened in this editor.- Returns:
- model instance, opened in this editor, never
null
-
updateHeaderText
Updates the editor header text.- Parameters:
model
- the current model value, cannot benull
text
- the new editor header title, cannot benull
-
formatHeaderText
Formats the header text- Parameters:
collectionLabel
- the collection label, cannot benull
itemLabel
- the item label, cannot benull
- Returns:
- the formatted header text, never
null
-
initializeEngine
Initializes the pageIEngine
.- Parameters:
engine
- the engine.- See Also:
-
getBuilder
Returns AEF builder instance, that can build this editor UI.- Returns:
- AEF builder instance, never
null
-
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 benull
then no AEF-editors will be focued by default
-
normalize
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 benull
- Returns:
- normalized model instance, never
null
-
bind
Bind given model instance and given editor site.- Parameters:
site
- editor site, cannot benull
model
- new model instance, opened in this editor, cannot benull
-
createPageLwtLayout
Create page LWT layout for this editor. Sub-classes can usedefinition
to create it.- Parameters:
definition
- the definition, that can be used to create page layout, cannot benull
.- 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 usedefinition
to create it.- Parameters:
definition
- the definition, that can be used to create page layout, cannot benull
.- Returns:
- page layout, never
null
.
-
getPageTitle
Returns page title for this editor. Default implementation returns featurename
value of the editor model instance, if exists. Otherwise returns<Unnamed>
.- Parameters:
model
- the model instance, opened in this editor, cannot benull
- 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, andfalse
if unsaved changed should be discarded
-
getEngine
Returns the editorIEngine
.- Returns:
- the
IEngine
instance, nevernull
.
-
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 benull
changedObject
- a changed object to check affecting, cannot benull
featureChanges
- a list of feature changes, cannot benull
- Returns:
- whether current model is affected by given changes
-
createBuilder
Returns a newly createdDtGranularEditorPageBuilder
instance.- Returns:
- a newly created
DtGranularEditorPageBuilder
instance, nevernull
.
-
createFormContent
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 benull
-
doSave
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 benull
monitor
- the progress monitor to report progress to, cannot benull
-