Class SelectSubclassAndTemplateWizard
- java.lang.Object
-
- org.eclipse.jface.wizard.Wizard
-
- org.eclipse.emfforms.internal.core.services.datatemplate.SelectSubclassAndTemplateWizard
-
- All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider
,org.eclipse.jface.wizard.IWizard
public class SelectSubclassAndTemplateWizard extends org.eclipse.jface.wizard.Wizard
Wizard that allows to select anEClass
on the first page and a model element on the second page. Thereby, the second page only shows model elements that are an instance of the selected EClass.If there is only one possible EClass, the class selection page is skipped and the template selection is shown directly.
If there is only one template left after selecting the EClass, the template selection page is skipped and the remainingTemplate
counts as selected.- Author:
- Lucas Koehler
-
-
Constructor Summary
Constructors Constructor Description SelectSubclassAndTemplateWizard(java.lang.String windowTitle, java.util.Set<org.eclipse.emf.ecore.EClass> subClasses, java.util.Set<Template> templates, EMFFormsLocalizationService localizationService)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPages()
boolean
canFinish()
protected java.util.Set<Template>
getAvailableTemplates(org.eclipse.emf.ecore.EClass eClass)
Get all available templates for the givenEClass
.org.eclipse.jface.wizard.IWizardPage
getNextPage(org.eclipse.jface.wizard.IWizardPage page)
Optional<Template>
getSelectedTemplate()
Returns the template selected by the user.boolean
performFinish()
protected void
setSubClass(org.eclipse.emf.ecore.EClass subClass)
Update the selected sub class.-
Methods inherited from class org.eclipse.jface.wizard.Wizard
addPage, createPageControls, dispose, 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
-
SelectSubclassAndTemplateWizard
public SelectSubclassAndTemplateWizard(java.lang.String windowTitle, java.util.Set<org.eclipse.emf.ecore.EClass> subClasses, java.util.Set<Template> templates, EMFFormsLocalizationService localizationService)
Creates a new instance.- Parameters:
windowTitle
- The title of the wizardsubClasses
- The EClasses to choose fromtemplates
- The available templates for all given EClasseslocalizationService
- TheEMFFormsLocalizationService
-
-
Method Detail
-
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
-
getSelectedTemplate
public Optional<Template> getSelectedTemplate()
Returns the template selected by the user. If there is only one valid template left after selecting a sub class, this template is selected automatically without showing the second wizard page.- Returns:
- The selected
Template
, or the empty Optional if none was selected
-
addPages
public void addPages()
- Specified by:
addPages
in interfaceorg.eclipse.jface.wizard.IWizard
- Overrides:
addPages
in classorg.eclipse.jface.wizard.Wizard
-
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
-
setSubClass
protected void setSubClass(org.eclipse.emf.ecore.EClass subClass)
Update the selected sub class. This is typically called by theSelectSubclassAndTemplateWizard.SubClassSelectionPage
.- Parameters:
subClass
- The selected sub class
-
getAvailableTemplates
protected java.util.Set<Template> getAvailableTemplates(org.eclipse.emf.ecore.EClass eClass)
Get all available templates for the givenEClass
. Thereby, only templates whose instance exactly match the given EClass are returned. This does not include templates for sub classes of the given EClass.- Parameters:
eClass
- TheEClass
- Returns:
- The available templates
-
-