Class 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.INewWizard
    This is the common super class for wizards creating new variability definition/realization files.
    Author:
    El-Sharkawy
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void addPages()  
      private java.lang.String constructInitialProjectName​(java.lang.String filename)
      Returns the file name without the file extension.
      private void doFinish​(java.lang.String containerName, java.lang.String fileName, org.eclipse.core.runtime.IProgressMonitor monitor)
      The worker method.
      void init​(org.eclipse.ui.IWorkbench workbench, org.eclipse.jface.viewers.IStructuredSelection selection)  
      protected abstract java.io.InputStream openContentStream​(java.lang.String fileName)
      We will initialize file contents.
      boolean performFinish()  
      private void throwCoreException​(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
    • 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:
        addPages in interface org.eclipse.jface.wizard.IWizard
        Overrides:
        addPages in class org.eclipse.jface.wizard.Wizard
      • performFinish

        public boolean performFinish()
        Specified by:
        performFinish in interface org.eclipse.jface.wizard.IWizard
        Specified by:
        performFinish in class org.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.CoreException
        The 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 force is false.
        • Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for 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.CoreException
        Creates 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:
        init in interface org.eclipse.ui.IWorkbenchWizard
      • constructInitialProjectName

        private java.lang.String constructInitialProjectName​(java.lang.String filename)
        Returns the file name without the file extension. Needed for the openContentStream(String) method.
        Parameters:
        filename - The contents of the current file name dialog.
        Returns:
        The file name without the file extension.