EGF Engine
Release 0.1.0

org.eclipse.egf.core.ui.wizard
Class AbstractModelElementWizard

java.lang.Object
  extended by Wizard
      extended by org.eclipse.egf.core.ui.wizard.AbstractModelElementWizard
Direct Known Subclasses:
AbstractPatternLibraryWizard, ContextElementWizard, ContractElementWizard, EditDomainWizard, EditFactoryComponentWizard, FactoryComponentInvocationWizard, MappingWizard, NewDomainWizard, PatternWizard, TaskFactoryHolderWizard

public abstract class AbstractModelElementWizard
extends Wizard

Base class to implement wizards to create or edit EGF model element objects.


Constructor Summary
protected AbstractModelElementWizard(EObject parent_p, NamedModelElementWithId modelElement_p, boolean readOnlyMode_p)
          Constructor.
 
Method Summary
 void addPages()
           
 boolean canFinish()
           
protected  boolean containsChanges(ChangeDescription changes_p)
          Return whether or not specified change description contains changes.
protected abstract  NamedModelElementWithId doCreateModelElement()
          Create concrete model element.
protected  ChangeDescription endChangesRecording()
          End model element changes recording.
protected abstract  Command getAddCommandForCreatedElement(AdapterFactoryEditingDomain editingDomain_p, EObject parent_p, NamedModelElementWithId createdElement_p)
          Get the command responsible of adding the created element to given parent when performing finish.
protected  ChangeDescription getChangeDescription()
          Return the change description when perform finish is called.
protected  ChangeRecorder getChangeRecorder()
          Get the change recorder that listens to model element changes.
protected abstract  String getCreationDescription()
          Returns the description when this wizard creates the displayed object.
 String getDescription()
          Get the wizard description.
protected abstract  String getEditDescription()
          Returns the description when this wizard modifies the displayed object.
 NamedModelElementWithId getModelElement()
          Get the model element object handled by this wizard.
protected  Couple<EStructuralFeature,Object> getModifiedFeature(ChangeDescription changes_p, EObject modifiedObject_p)
          Get the modified feature with its new value from specified change description and given object.
 EObject getParent()
          Get the parent object of the handled model element.
protected abstract  PluginChangeWrapperCommand getPluginChangeCommand(EditingDomain editingDomain_p, EObject modelElement_p, EStructuralFeature feature_p, Object value_p)
          Get the plugin change command.
protected abstract  String getTitle()
          Returns the title message of this wizard.
protected  ImageDescriptor getWizardDefaultPageImageDescriptor()
          Get the wizard default image.
protected  boolean handleCanFinish()
          Handle the canFinish condition in wizard mode (Read only or not) context.
protected  boolean handleChangeDescription()
          Handle change description.
 boolean isInReadOnlyMode()
          Whether or not this wizard is in read only.
 boolean performCancel()
           
 boolean performFinish()
           
protected  void startChangesRecording(EObject modelElement_p)
          Start model element changes recording.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractModelElementWizard

protected AbstractModelElementWizard(EObject parent_p,
                                     NamedModelElementWithId modelElement_p,
                                     boolean readOnlyMode_p)
Constructor.
Both parameters can not be null at the same time.

Parameters:
parent_p - model element used as parent of given model element can NOT be null.
modelElement_p - the model element to display, can not be null if readOnly is set to true
readOnlyMode_p - Whether or not the wizard is in read only mode : data can not be changed.
Method Detail

doCreateModelElement

protected abstract NamedModelElementWithId doCreateModelElement()
Create concrete model element.

Returns:
a not null NamedModelElementWithId object.

getCreationDescription

protected abstract String getCreationDescription()
Returns the description when this wizard creates the displayed object.

Returns:
a not null String instance.

getEditDescription

protected abstract String getEditDescription()
Returns the description when this wizard modifies the displayed object.

Returns:
a not null String instance.

getTitle

protected abstract String getTitle()
Returns the title message of this wizard.

Returns:

startChangesRecording

protected void startChangesRecording(EObject modelElement_p)
Start model element changes recording.

Parameters:
modelElement_p -

endChangesRecording

protected ChangeDescription endChangesRecording()
End model element changes recording.

Returns:

performCancel

public boolean performCancel()
See Also:
org.eclipse.jface.wizard.Wizard#performCancel()

performFinish

public boolean performFinish()
See Also:
org.eclipse.jface.wizard.Wizard#performFinish()

canFinish

public final boolean canFinish()
See Also:
org.eclipse.jface.wizard.Wizard#canFinish()

handleCanFinish

protected boolean handleCanFinish()
Handle the canFinish condition in wizard mode (Read only or not) context.

Returns:
true means (performFinish() method can be called); false otherwise.

getAddCommandForCreatedElement

protected abstract Command getAddCommandForCreatedElement(AdapterFactoryEditingDomain editingDomain_p,
                                                          EObject parent_p,
                                                          NamedModelElementWithId createdElement_p)
Get the command responsible of adding the created element to given parent when performing finish.

Parameters:
parent_p -

handleChangeDescription

protected boolean handleChangeDescription()
Handle change description.


containsChanges

protected boolean containsChanges(ChangeDescription changes_p)
Return whether or not specified change description contains changes.

Parameters:
changes_p -
Returns:

getModifiedFeature

protected Couple<EStructuralFeature,Object> getModifiedFeature(ChangeDescription changes_p,
                                                               EObject modifiedObject_p)
Get the modified feature with its new value from specified change description and given object.

Parameters:
changes_p -
modifiedObject_p -
Returns:
a not null object, key is the modified feature and the value is the new feature value.

getPluginChangeCommand

protected abstract PluginChangeWrapperCommand getPluginChangeCommand(EditingDomain editingDomain_p,
                                                                     EObject modelElement_p,
                                                                     EStructuralFeature feature_p,
                                                                     Object value_p)
Get the plugin change command.

Parameters:
editingDomain_p -
modelElement_p -
feature_p -
value_p -
Returns:

addPages

public void addPages()
See Also:
org.eclipse.jface.wizard.Wizard#addPages()

getChangeRecorder

protected ChangeRecorder getChangeRecorder()
Get the change recorder that listens to model element changes.

Returns:
the changeRecorder

getModelElement

public NamedModelElementWithId getModelElement()
Get the model element object handled by this wizard.

Returns:
a not null model element.

getDescription

public String getDescription()
Get the wizard description.

Returns:
the description

getChangeDescription

protected ChangeDescription getChangeDescription()
Return the change description when perform finish is called.

Returns:
the changeDescription

getParent

public EObject getParent()
Get the parent object of the handled model element.

Returns:
the parent

isInReadOnlyMode

public boolean isInReadOnlyMode()
Whether or not this wizard is in read only.

Returns:
true means data can not be changed.

getWizardDefaultPageImageDescriptor

protected ImageDescriptor getWizardDefaultPageImageDescriptor()
Get the wizard default image.
Recommended image size is 75x66.

Returns:
null means no image set on the wizard.

EGF Engine
Release 0.1.0

Copyright (c) Thales Corporate Services S.A.S, 2009.

This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.