## org.eclipse.emf.common.ui.wizard
Class AbstractExampleInstallerWizard

    java.lang.Object
      org.eclipse.jface.wizard.Wizard
          org.eclipse.emf.common.ui.wizard.AbstractExampleInstallerWizard

All Implemented Interfaces:
  IShellProvider, IWizard, INewWizard, IWorkbenchWizard

Direct Known Subclasses:
  ExampleInstallerWizard

    public abstract class AbstractExampleInstallerWizard

extends Wizard
implements INewWizard, IShellProvider

This abstract example installer wizard simply copies or unzips a number of files and directories into the workspace, creating the projects to hold them. This wizard can be added as a new wizard to the new wizards dialog through the `org.eclipse.ui.newWizards` extension point.

Clients should subclass this class and override the `getProjectDescriptors()` method to provide the location and name of the project content that should be added to the workspace. Note that any projects that are already in the workspace will not be overwritten because the user could have made changes to them that would be lost.

It is highly recommended when registering subclasses to the new wizards extension point that the wizard declaration should have canFinishEarly = true. Any label and icon can be freely given to the wizard to suit the needs of the client.

Since:
  2.2.0

Nested Class Summary
`static class` `AbstractExampleInstallerWizard.FileToOpen`
`static class` `AbstractExampleInstallerWizard.ProjectDescriptor`
`class` `AbstractExampleInstallerWizard.ProjectPage`

Field Summary
`protected static IOverwriteQuery` `OVERWRITE_ALL_QUERY`
`protected AbstractExampleInstallerWizard.ProjectPage` `projectPage`
`protected IStructuredSelection` `structuredSelection`
`protected IWorkbench` `workbench`

Fields inherited from class org.eclipse.jface.wizard.Wizard
`DEFAULT_IMAGE`

Constructor Summary
`AbstractExampleInstallerWizard()`

Method Summary
`void` `addPages()`
`protected ImportOperation` `createDirectoryImportOperation(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor)` Deprecated. Use `installProjectFromDirectory(org.eclipse.emf.common.ui.wizard.AbstractExampleInstallerWizard.ProjectDescriptor, org.eclipse.core.runtime.IProgressMonitor)`, which also actually creates the project and performs the import.
`protected ImportOperation` `createFileImportOperation(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor)` Deprecated. Use `installProjectFromFile(org.eclipse.emf.common.ui.wizard.AbstractExampleInstallerWizard.ProjectDescriptor, org.eclipse.core.runtime.IProgressMonitor)`, which also actually creates the project and performs the import.
`protected ImportOperation` `createImportOperation(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor)` Deprecated. Use `installProject(ProjectDescriptor, IProgressMonitor)`, which also actually creates the project and performs the import.
`protected void` `createProject(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor, IProgressMonitor monitor)`
`protected java.util.zip.ZipFile` `createZipFile(java.io.File file)` Returns a `ZipFile` for reading from the given file, if it is in fact a zip file; null otherwise.

`protected ImportOperation`

`createZipImportOperation(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor, java.io.File file)`
Deprecated. Use `installProjectFromFile(org.eclipse.emf.common.ui.wizard.AbstractExampleInstallerWizard.ProjectDescriptor, org.eclipse.core.runtime.IProgressMonitor)`, which handles zip files directly, and also actually creates the project and performs the import.

`protected Diagnostic` `deleteExistingProjects(IProgressMonitor monitor)`
`void` `dispose()`
`protected abstract java.util.List<AbstractExampleInstallerWizard.FileToOpen>` `getFilesToOpen()`
`protected abstract java.util.List<AbstractExampleInstallerWizard.ProjectDescriptor>` `getProjectDescriptors()` Returns the project descriptors to be used by this wizard.
`protected IStructuredSelection` `getSelection()`
`protected IWorkbench` `getWorkbench()`
`void` `init(IWorkbench workbench, IStructuredSelection selection)`
`protected void` `installExample(IProgressMonitor progressMonitor)` Installs the projects described by `getProjectDescriptors()`.
`protected void` `installProject(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor, ImportOperation importOperation, IProgressMonitor progressMonitor)` Creates the project described by the given `projectDescriptor` and imports its contents using the given `importOperation`.
`protected void` `installProject(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor, IProgressMonitor progressMonitor)` Installs the project described by the given `projectDescriptor`.
`protected void` `installProjectFromDirectory(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor, IProgressMonitor progressMonitor)` Installs the project described by the given `projectDescriptor` from a directory.
`protected void` `installProjectFromFile(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor, IProgressMonitor progressMonitor)` Installs the project described by the given `projectDescriptor` from a file.
`protected boolean` `isZipFile(java.io.File file)` Deprecated. Use `createZipFile(java.io.File)`, which doesn't require creating another `ZipFile`.
`protected void` `openEditor(IFile file, java.lang.String editorID)`
`protected void` `openErrorDialog(java.lang.String message, java.lang.Throwable throwable)`
`protected void` `openFiles(IProgressMonitor progressMonitor)`
`boolean` `performFinish()`

Methods inherited from class org.eclipse.jface.wizard.Wizard

`addPage, canFinish, createPageControls, 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, getContainer, getDefaultPageImage, getDialogSettings, getNextPage, getPage, getPageCount, getPages, getPreviousPage, getStartingPage, getTitleBarColor, getWindowTitle, isHelpAvailable, needsPreviousAndNextButtons, needsProgressMonitor, performCancel, setContainer`

Methods inherited from interface org.eclipse.jface.window.IShellProvider
`getShell`

Field Detail

### OVERWRITE_ALL_QUERY

    protected static final IOverwriteQuery OVERWRITE_ALL_QUERY

### workbench

    protected IWorkbench workbench

### structuredSelection

    protected IStructuredSelection structuredSelection

### projectPage

    protected AbstractExampleInstallerWizard.ProjectPage projectPage

Constructor Detail

### AbstractExampleInstallerWizard

    public AbstractExampleInstallerWizard()

Method Detail

### init

    public void init(IWorkbench workbench,
                     IStructuredSelection selection)

  Specified by:
    `init` in interface `IWorkbenchWizard`

### getProjectDescriptors

    protected abstract java.util.List<AbstractExampleInstallerWizard.ProjectDescriptor> getProjectDescriptors()

  Returns the project descriptors to be used by this wizard. This method is called multiple times, so subclasses are expected to cache this information if necessary.

  Returns:
    a list of ProjectDescriptors

### getFilesToOpen

    protected abstract java.util.List<AbstractExampleInstallerWizard.FileToOpen> getFilesToOpen()

### dispose

    public void dispose()

  Specified by:
    `dispose` in interface `IWizard`
  Overrides:
    `dispose` in class `Wizard`

### addPages

    public void addPages()

  Specified by:
    `addPages` in interface `IWizard`
  Overrides:
    `addPages` in class `Wizard`

### performFinish

    public boolean performFinish()

  Specified by:
    `performFinish` in interface `IWizard`
  Specified by:
    `performFinish` in class `Wizard`

### deleteExistingProjects

    protected Diagnostic deleteExistingProjects(IProgressMonitor monitor)

### installExample

    protected void installExample(IProgressMonitor progressMonitor)
                           throws java.lang.Exception

  Installs the projects described by `getProjectDescriptors()`.

  In EMF 2.4, this worked by obtaining an `ImportOperation` for each descriptor from `createImportOperation(org.eclipse.emf.common.ui.wizard.AbstractExampleInstallerWizard.ProjectDescriptor)`, and then creating the project and running the operation. Beginning in EMF 2.5, `createImportOperation(org.eclipse.emf.common.ui.wizard.AbstractExampleInstallerWizard.ProjectDescriptor)` returns null by default, and `installProject(ProjectDescriptor, IProgressMonitor)` is called to create the project, create the operation, and run it. This allows the same code that creates the operation to do any cleanup required after executing it. This change was needed to stop extending `ImportOperation`, which was an API violation.

  Note that existing overrides of `createImportOperation(org.eclipse.emf.common.ui.wizard.AbstractExampleInstallerWizard.ProjectDescriptor)` and the methods it calls are still supported; however, it is recommended to switch over to the new design.

  Throws:
    `java.lang.Exception`

### openFiles

    protected void openFiles(IProgressMonitor progressMonitor)

### openErrorDialog

    protected void openErrorDialog(java.lang.String message,
                                   java.lang.Throwable throwable)

### installProject

    protected void installProject(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor,
                                  ImportOperation importOperation,
                                  IProgressMonitor progressMonitor)
                           throws java.lang.Exception

  Creates the project described by the given `projectDescriptor` and imports its contents using the given `importOperation`.

  Throws:
    `java.lang.Exception`
  Since:
    2.5

### createProject

    protected void createProject(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor,
                                 IProgressMonitor monitor)
                          throws CoreException

  Throws:
    `CoreException`

### installProject

    protected void installProject(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor,
                                  IProgressMonitor progressMonitor)
                           throws java.lang.Exception

  Installs the project described by the given `projectDescriptor`. This implementation simply looks at the form of its content URI and delegates to `installProjectFromDirectory(org.eclipse.emf.common.ui.wizard.AbstractExampleInstallerWizard.ProjectDescriptor, org.eclipse.core.runtime.IProgressMonitor)` or `installProjectFromFile(org.eclipse.emf.common.ui.wizard.AbstractExampleInstallerWizard.ProjectDescriptor, org.eclipse.core.runtime.IProgressMonitor)`, as appropriate.

  Throws:
    `java.lang.Exception`
  Since:
    2.5

### createImportOperation

    @Deprecated
    protected ImportOperation createImportOperation(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor)
                                             throws java.lang.Exception

  Deprecated. Use `installProject(ProjectDescriptor, IProgressMonitor)`, which also actually creates the project and performs the import.

  This method was used in EMF 2.4 and earlier to obtain an `ImportOperation` for installing a project. This implementation now merely returns null (or throws an exception for unsupported content forms).

  Throws:
    `java.lang.Exception`

### installProjectFromDirectory

    protected void installProjectFromDirectory(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor,
                                               IProgressMonitor progressMonitor)
                                        throws java.lang.Exception

  Installs the project described by the given `projectDescriptor` from a directory. This implementation should handle the directory scenario completely, but will throw an exception if the specified directory is not found or readable.

  Throws:
    `java.lang.Exception`
  Since:
    2.5

### createDirectoryImportOperation

    @Deprecated
    protected ImportOperation createDirectoryImportOperation(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor)
                                                      throws java.lang.Exception

  Deprecated. Use `installProjectFromDirectory(org.eclipse.emf.common.ui.wizard.AbstractExampleInstallerWizard.ProjectDescriptor, org.eclipse.core.runtime.IProgressMonitor)`, which also actually creates the project and performs the import.

  This method was used in EMF 2.4 and earlier to obtain an `ImportOperation` for installing a project from a directory. This implementation now merely returns null.

  Throws:
    `java.lang.Exception`

### installProjectFromFile

    protected void installProjectFromFile(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor,
                                          IProgressMonitor progressMonitor)
                                   throws java.lang.Exception

  Installs the project described by the given `projectDescriptor` from a file. This implementation only handles zip files, throwing an exception otherwise. It may be overridden to handle other cases.

  Throws:
    `java.lang.Exception`
  Since:
    2.5

### createFileImportOperation

    @Deprecated
    protected ImportOperation createFileImportOperation(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor)
                                                 throws java.lang.Exception

  Deprecated. Use `installProjectFromFile(org.eclipse.emf.common.ui.wizard.AbstractExampleInstallerWizard.ProjectDescriptor, org.eclipse.core.runtime.IProgressMonitor)`, which also actually creates the project and performs the import.

  This method was used in EMF 2.4 and earlier to obtain an `ImportOperation` for installing a project from a file. This implementation now merely returns null (or throws an exception for unsupported files).

  Throws:
    `java.lang.Exception`

### createZipFile

    protected java.util.zip.ZipFile createZipFile(java.io.File file)

  Returns a `ZipFile` for reading from the given file, if it is in fact a zip file; null otherwise. The client is responsible for closing the zip file if it is non-null.

  Since:
    2.5

### isZipFile

    @Deprecated
    protected boolean isZipFile(java.io.File file)

  Deprecated. Use `createZipFile(java.io.File)`, which doesn't require creating another `ZipFile`.

  This method was used in EMF 2.4 and earlier to test if a `File` represents a zip file.

### createZipImportOperation

    @Deprecated
    protected ImportOperation createZipImportOperation(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor,
                                                                  java.io.File file)
                                                throws java.lang.Exception

  Deprecated. Use `installProjectFromFile(org.eclipse.emf.common.ui.wizard.AbstractExampleInstallerWizard.ProjectDescriptor, org.eclipse.core.runtime.IProgressMonitor)`, which handles zip files directly, and also actually creates the project and performs the import.

  This method was used in EMF 2.4 and earlier to obtain an `ImportOperation` for installing a project from a zip file. This implementation now merely returns null.

  Throws:
    `java.lang.Exception`

### getWorkbench

    protected IWorkbench getWorkbench()

### getSelection

    protected IStructuredSelection getSelection()

### openEditor

    protected void openEditor(IFile file,
                              java.lang.String editorID)
                       throws PartInitException

  Throws:
    `PartInitException`

Copyright 2001-2006 IBM Corporation and others. All Rights Reserved.