Class CreateSegmentDmrWizard
- java.lang.Object
-
- org.eclipse.jface.wizard.Wizard
-
- org.eclipse.emf.ecp.view.internal.editor.handler.CreateSegmentDmrWizard
-
- All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider
,org.eclipse.jface.wizard.IWizard
public class CreateSegmentDmrWizard extends org.eclipse.jface.wizard.Wizard
An advanced DMR creation wizard that allows the user to create a segment based DMR. It allows to either create a simple reference path consisting only of feature segments or switching to an advanced mode. The advanced mode allows to create the reference path one segment at a time. Thereby, all available segment types can be created.- Author:
- Lucas Koehler
-
-
Constructor Summary
Constructors Constructor Description CreateSegmentDmrWizard(java.lang.String windowTitle, EStructuralFeatureSelectionValidator selectionValidator, SegmentGenerator segmentGenerator, org.eclipse.emf.ecore.EClass lastSegmentType, boolean ignoreSegmentIdeRestriction)
A wizard used for creating a new DomainModelReference.CreateSegmentDmrWizard(org.eclipse.emf.ecore.EClass rootEClass, java.lang.String windowTitle, VDomainModelReference existingDMR, EStructuralFeatureSelectionValidator selectionValidator)
Creates a new dmr creation with default values for segment generation (= a simple feature segment path), segment types (all none restricted types), and the required last segment type (all are allowed) in advanced mode.CreateSegmentDmrWizard(org.eclipse.emf.ecore.EClass rootEClass, java.lang.String windowTitle, VDomainModelReference existingDMR, EStructuralFeatureSelectionValidator selectionValidator, SegmentGenerator segmentGenerator, org.eclipse.emf.ecore.EClass lastSegmentType, boolean ignoreSegmentIdeRestriction)
A wizard used for creating and configuring a DomainModelReference.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPages()
boolean
canFinish()
protected java.util.Collection<SegmentIdeDescriptor>
collectSegmentIdeDescriptors(boolean ignoreSegmentIdeRestriction)
Collect allSegmentIdeDescriptors
for the advanced mode.void
dispose()
java.util.Optional<VDomainModelReference>
getDomainModelReference()
Returns the configuredVDomainModelReference
.org.eclipse.jface.wizard.IWizardPage
getNextPage(org.eclipse.jface.wizard.IWizardPage page)
java.util.Optional<org.eclipse.emf.ecore.EClass>
getRootEClass()
Returns the rootEClass
of the domain model reference.java.util.Optional<org.eclipse.core.resources.IFile>
getSelectedEcore()
boolean
performFinish()
-
Methods inherited from class org.eclipse.jface.wizard.Wizard
addPage, createPageControls, getContainer, getDefaultPageImage, getDialogSettings, getPage, getPageCount, getPages, getPreviousPage, getShell, getStartingPage, getTitleBarColor, getWindowTitle, isHelpAvailable, needsPreviousAndNextButtons, needsProgressMonitor, performCancel, setContainer, setDefaultPageImageDescriptor, setDialogSettings, setForcePreviousAndNextButtons, setHelpAvailable, setNeedsProgressMonitor, setTitleBarColor, setWindowTitle
-
-
-
-
Constructor Detail
-
CreateSegmentDmrWizard
public CreateSegmentDmrWizard(org.eclipse.emf.ecore.EClass rootEClass, java.lang.String windowTitle, VDomainModelReference existingDMR, EStructuralFeatureSelectionValidator selectionValidator, SegmentGenerator segmentGenerator, org.eclipse.emf.ecore.EClass lastSegmentType, boolean ignoreSegmentIdeRestriction)
A wizard used for creating and configuring a DomainModelReference.- Parameters:
rootEClass
- The rootEClass
of the DMR to create. IF this isnull
, the wizard offers to chose a root EClass. To make this clear, you might want to use the constructorCreateSegmentDmrWizard(String, EStructuralFeatureSelectionValidator, SegmentGenerator, EClass, boolean)
.windowTitle
- The title for the wizard windowexistingDMR
- The domain model reference to configure. May be null. If this is given the initial selection of the wizard is based on this but the given DMR will not be changed. A new one is returned.selectionValidator
- Validates whether a selected structural feature is a valid selection (e.g. the selection could be required to be a multi reference)segmentGenerator
- TheSegmentGenerator
used in the simple dmr creation modelastSegmentType
- The type that the last segment in advanced creation mode must have, or null if there is no restrictionignoreSegmentIdeRestriction
- Iftrue
, all types of segments are available independently of the configuration in theirSegmentIdeDescriptor
.
-
CreateSegmentDmrWizard
public CreateSegmentDmrWizard(java.lang.String windowTitle, EStructuralFeatureSelectionValidator selectionValidator, SegmentGenerator segmentGenerator, org.eclipse.emf.ecore.EClass lastSegmentType, boolean ignoreSegmentIdeRestriction)
A wizard used for creating a new DomainModelReference. Before the DMR is created, the wizard allows to select a root EClass for the new DMR.- Parameters:
windowTitle
- The title for the wizard windowselectionValidator
- Validates whether a selected structural feature is a valid selection (e.g. the selection could be required to be a multi reference)segmentGenerator
- TheSegmentGenerator
used in the simple dmr creation modelastSegmentType
- The type that the last segment in advanced creation mode must have, or null if there is no restrictionignoreSegmentIdeRestriction
- Iftrue
, all types of segments are available independently of the configuration in theirSegmentIdeDescriptor
.
-
CreateSegmentDmrWizard
public CreateSegmentDmrWizard(org.eclipse.emf.ecore.EClass rootEClass, java.lang.String windowTitle, VDomainModelReference existingDMR, EStructuralFeatureSelectionValidator selectionValidator)
Creates a new dmr creation with default values for segment generation (= a simple feature segment path), segment types (all none restricted types), and the required last segment type (all are allowed) in advanced mode.- Parameters:
rootEClass
- The rootEClass
of the DMR to create. IF this isnull
, the wizard offers to chose a root EClass. To make this clear, you might want to use the constructorCreateSegmentDmrWizard(String, EStructuralFeatureSelectionValidator, SegmentGenerator, EClass, boolean)
.windowTitle
- The title for the wizard windowexistingDMR
- The domain model reference to configure. May be null. If this is given the initial selection of the wizard is based on this but the given DMR will not be changed. A new one is returned.selectionValidator
- Validates whether a selected structural feature is a valid selection (e.g. the selection could be required to be a multi reference)
-
-
Method Detail
-
collectSegmentIdeDescriptors
protected java.util.Collection<SegmentIdeDescriptor> collectSegmentIdeDescriptors(boolean ignoreSegmentIdeRestriction)
Collect allSegmentIdeDescriptors
for the advanced mode.- Parameters:
ignoreSegmentIdeRestriction
- Whether the descriptors' availability flag must be considered when collecting the descriptors- Returns:
- The collection of
SegmentIdeDescriptors
; might be empty but nevernull
- See Also:
SegmentIdeDescriptor.isAvailableInIde()
-
getDomainModelReference
public java.util.Optional<VDomainModelReference> getDomainModelReference()
Returns the configuredVDomainModelReference
. This is either a new DMR or the edited input DMR. The return value is empty if the dialog was cancelled or the dialog is still open.- Returns:
- The configured
VDomainModelReference
or an empty value if the dialog was cancelled
-
getNextPage
public org.eclipse.jface.wizard.IWizardPage getNextPage(org.eclipse.jface.wizard.IWizardPage page)
- Specified by:
getNextPage
in interfaceorg.eclipse.jface.wizard.IWizard
- Overrides:
getNextPage
in classorg.eclipse.jface.wizard.Wizard
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceorg.eclipse.jface.wizard.IWizard
- Overrides:
dispose
in classorg.eclipse.jface.wizard.Wizard
-
addPages
public void addPages()
- Specified by:
addPages
in interfaceorg.eclipse.jface.wizard.IWizard
- Overrides:
addPages
in classorg.eclipse.jface.wizard.Wizard
-
getSelectedEcore
public java.util.Optional<org.eclipse.core.resources.IFile> getSelectedEcore()
- Returns:
- The selected ecore file, IF a root EClass was selected and it is located in a local ecore file.
-
getRootEClass
public java.util.Optional<org.eclipse.emf.ecore.EClass> getRootEClass()
Returns the rootEClass
of the domain model reference. IF a root EClass was given when this wizard was created, it is returned. Otherwise, the EClass selected by the user is returned. If no EClass was given and the dialog was cancelled before an EClass was selected, nothing is returned.- Returns:
- The root
EClass
of the created/configured domain model reference or nothing if no EClass was given and selected.
-
performFinish
public boolean performFinish()
- Specified by:
performFinish
in interfaceorg.eclipse.jface.wizard.IWizard
- Specified by:
performFinish
in classorg.eclipse.jface.wizard.Wizard
-
canFinish
public boolean canFinish()
- Specified by:
canFinish
in interfaceorg.eclipse.jface.wizard.IWizard
- Overrides:
canFinish
in classorg.eclipse.jface.wizard.Wizard
-
-