Class 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
    • Field Summary

      • Fields inherited from class org.eclipse.jface.wizard.Wizard

        DEFAULT_IMAGE
    • 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 all SegmentIdeDescriptors for the advanced mode.
      void dispose()  
      java.util.Optional<VDomainModelReference> getDomainModelReference()
      Returns the configured VDomainModelReference.
      org.eclipse.jface.wizard.IWizardPage getNextPage​(org.eclipse.jface.wizard.IWizardPage page)  
      java.util.Optional<org.eclipse.emf.ecore.EClass> getRootEClass()
      Returns the root EClass 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 root EClass of the DMR to create. IF this is null, the wizard offers to chose a root EClass. To make this clear, you might want to use the constructor CreateSegmentDmrWizard(String, EStructuralFeatureSelectionValidator, SegmentGenerator, EClass, boolean).
        windowTitle - The title for the wizard window
        existingDMR - 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 - The SegmentGenerator used in the simple dmr creation mode
        lastSegmentType - The type that the last segment in advanced creation mode must have, or null if there is no restriction
        ignoreSegmentIdeRestriction - If true, all types of segments are available independently of the configuration in their SegmentIdeDescriptor.
      • 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 window
        selectionValidator - Validates whether a selected structural feature is a valid selection (e.g. the selection could be required to be a multi reference)
        segmentGenerator - The SegmentGenerator used in the simple dmr creation mode
        lastSegmentType - The type that the last segment in advanced creation mode must have, or null if there is no restriction
        ignoreSegmentIdeRestriction - If true, all types of segments are available independently of the configuration in their SegmentIdeDescriptor.
      • 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 root EClass of the DMR to create. IF this is null, the wizard offers to chose a root EClass. To make this clear, you might want to use the constructor CreateSegmentDmrWizard(String, EStructuralFeatureSelectionValidator, SegmentGenerator, EClass, boolean).
        windowTitle - The title for the wizard window
        existingDMR - 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

      • getDomainModelReference

        public java.util.Optional<VDomainModelReference> getDomainModelReference()
        Returns the configured VDomainModelReference. 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 interface org.eclipse.jface.wizard.IWizard
        Overrides:
        getNextPage in class org.eclipse.jface.wizard.Wizard
      • dispose

        public void dispose()
        Specified by:
        dispose in interface org.eclipse.jface.wizard.IWizard
        Overrides:
        dispose in class org.eclipse.jface.wizard.Wizard
      • addPages

        public void addPages()
        Specified by:
        addPages in interface org.eclipse.jface.wizard.IWizard
        Overrides:
        addPages in class org.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 root EClass 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 interface org.eclipse.jface.wizard.IWizard
        Specified by:
        performFinish in class org.eclipse.jface.wizard.Wizard
      • canFinish

        public boolean canFinish()
        Specified by:
        canFinish in interface org.eclipse.jface.wizard.IWizard
        Overrides:
        canFinish in class org.eclipse.jface.wizard.Wizard