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

java.lang.Object
  extended by org.eclipse.jface.wizard.Wizard
      extended by 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)
           
protected  ImportOperation createFileImportOperation(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor)
           
protected  ImportOperation createImportOperation(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor)
           
protected  void createProject(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor, IProgressMonitor monitor)
           
protected  ImportOperation createZipImportOperation(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor, java.io.File file)
           
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)
           
protected  boolean isZipFile(java.io.File file)
           
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
Throws:
java.lang.Exception

openFiles

protected void openFiles(IProgressMonitor progressMonitor)

openErrorDialog

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

createProject

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

createImportOperation

protected ImportOperation createImportOperation(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor)
                                         throws java.lang.Exception
Throws:
java.lang.Exception

createDirectoryImportOperation

protected ImportOperation createDirectoryImportOperation(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor)
                                                  throws java.lang.Exception
Throws:
java.lang.Exception

createFileImportOperation

protected ImportOperation createFileImportOperation(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor)
                                             throws java.lang.Exception
Throws:
java.lang.Exception

isZipFile

protected boolean isZipFile(java.io.File file)

createZipImportOperation

protected ImportOperation createZipImportOperation(AbstractExampleInstallerWizard.ProjectDescriptor projectDescriptor,
                                                   java.io.File file)
                                            throws java.lang.Exception
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.