Class AbstractFiletypeWizard
- java.lang.Object
-
- org.eclipse.jface.wizard.Wizard
-
- net.ssehub.easy.dslCore.ui.wizards.AbstractFiletypeWizard
-
- All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider,org.eclipse.jface.wizard.IWizard,org.eclipse.ui.INewWizard,org.eclipse.ui.IWorkbenchWizard
- Direct Known Subclasses:
CommentsFiletypeWizard,IVMLFiletypeWizard,VILFiletypeWizard,VTLFiletypeWizard
public abstract class AbstractFiletypeWizard extends org.eclipse.jface.wizard.Wizard implements org.eclipse.ui.INewWizardThis is the common super class for wizards creating new variability definition/realization files.- Author:
- El-Sharkawy
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringINDENTIONprotected static java.lang.StringLINEFEEDprivate AbstractFiletypeWizardPagepageprivate IWizardPageFactorypageCreatorprivate java.lang.StringpluginIDprivate org.eclipse.jface.viewers.ISelectionselection
-
Constructor Summary
Constructors Constructor Description AbstractFiletypeWizard(IWizardPageFactory pageCreator, java.lang.String pluginID)Constructor for FiletypeWizard.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddPages()private java.lang.StringconstructInitialProjectName(java.lang.String filename)Returns the file name without the file extension.private voiddoFinish(java.lang.String containerName, java.lang.String fileName, org.eclipse.core.runtime.IProgressMonitor monitor)The worker method.voidinit(org.eclipse.ui.IWorkbench workbench, org.eclipse.jface.viewers.IStructuredSelection selection)protected abstract java.io.InputStreamopenContentStream(java.lang.String fileName)We will initialize file contents.booleanperformFinish()private voidthrowCoreException(java.lang.String message)Creates a core exception.-
Methods inherited from class org.eclipse.jface.wizard.Wizard
addPage, canFinish, createPageControls, dispose, getContainer, getDefaultPageImage, getDialogSettings, getNextPage, 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
-
Methods inherited from interface org.eclipse.jface.wizard.IWizard
canFinish, createPageControls, dispose, getContainer, getDefaultPageImage, getDialogSettings, getNextPage, getPage, getPageCount, getPages, getPreviousPage, getStartingPage, getTitleBarColor, getWindowTitle, isHelpAvailable, needsPreviousAndNextButtons, needsProgressMonitor, performCancel, setContainer
-
-
-
-
Field Detail
-
LINEFEED
protected static final java.lang.String LINEFEED
- See Also:
- Constant Field Values
-
INDENTION
protected static final java.lang.String INDENTION
- See Also:
- Constant Field Values
-
page
private AbstractFiletypeWizardPage page
-
pageCreator
private IWizardPageFactory pageCreator
-
selection
private org.eclipse.jface.viewers.ISelection selection
-
pluginID
private java.lang.String pluginID
-
-
Constructor Detail
-
AbstractFiletypeWizard
public AbstractFiletypeWizard(IWizardPageFactory pageCreator, java.lang.String pluginID)
Constructor for FiletypeWizard.- Parameters:
pageCreator- A Factory for creating the individual page/content of the wizard.pluginID- The ID of the plug-in, where the concrete wizard is created (needed for error messages).
-
-
Method Detail
-
addPages
public void addPages()
- Specified by:
addPagesin interfaceorg.eclipse.jface.wizard.IWizard- Overrides:
addPagesin classorg.eclipse.jface.wizard.Wizard
-
performFinish
public boolean performFinish()
- Specified by:
performFinishin interfaceorg.eclipse.jface.wizard.IWizard- Specified by:
performFinishin classorg.eclipse.jface.wizard.Wizard
-
doFinish
private void doFinish(java.lang.String containerName, java.lang.String fileName, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreExceptionThe worker method. It will find the container, create the file if missing or just replace its contents, and open the editor on the newly created file.- Parameters:
containerName- The path/folder of the file to be create.fileName- The file of to create inside the container.monitor- a progress monitor, must not be null.- Throws:
org.eclipse.core.runtime.CoreException- if this method fails. Reasons include:- This resource does not exist.
- The corresponding location in the local file system is occupied by a directory.
- The workspace is not in sync with the corresponding location
in the local file system and
forceisfalse. - Resource changes are disallowed during certain types of resource change
event notification. See
IResourceChangeEventfor more details. - The file modification validator disallowed the change.
-
openContentStream
protected abstract java.io.InputStream openContentStream(java.lang.String fileName)
We will initialize file contents.- Parameters:
fileName- the name of the file without the extension.- Returns:
- the Contents to insert in the newly created file.
-
throwCoreException
private void throwCoreException(java.lang.String message) throws org.eclipse.core.runtime.CoreExceptionCreates a core exception.- Parameters:
message- a human-readable message- Throws:
org.eclipse.core.runtime.CoreException- The Exception which shall be created by this helper method.
-
init
public void init(org.eclipse.ui.IWorkbench workbench, org.eclipse.jface.viewers.IStructuredSelection selection)- Specified by:
initin interfaceorg.eclipse.ui.IWorkbenchWizard
-
constructInitialProjectName
private java.lang.String constructInitialProjectName(java.lang.String filename)
Returns the file name without the file extension. Needed for theopenContentStream(String)method.- Parameters:
filename- The contents of the current file name dialog.- Returns:
- The file name without the file extension.
-
-