Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.ui.io
Class IOWizard<P extends IOProvider>

java.lang.Object
  extended by org.eclipse.jface.wizard.Wizard
      extended by eu.esdihumboldt.hale.ui.io.IOWizard<P>
Type Parameters:
P - the IOProvider type used in the wizard
All Implemented Interfaces:
org.eclipse.jface.dialogs.IPageChangingListener, org.eclipse.jface.wizard.IWizard
Direct Known Subclasses:
ExportWizard, ImportWizard

public abstract class IOWizard<P extends IOProvider>
extends org.eclipse.jface.wizard.Wizard
implements org.eclipse.jface.dialogs.IPageChangingListener

Abstract I/O wizard based on IOProvider descriptors

Author:
Simon Templer
Partner:
01 / Fraunhofer Institute for Computer Graphics Research

Field Summary
 
Fields inherited from class org.eclipse.jface.wizard.Wizard
DEFAULT_IMAGE
 
Constructor Summary
IOWizard(Class<P> providerType)
          Create an I/O wizard
 
Method Summary
 void addIOWizardListener(IOWizardListener<P,? extends IOWizard<P>> listener)
          Adds an IOWizardListener
 void addPage(org.eclipse.jface.wizard.IWizardPage page)
           
 void addPages()
           
 boolean canFinish()
           
 void dispose()
           
protected  IOReport execute(IOProvider provider, IOReporter defaultReporter)
          Execute the given provider
protected  String getActionId()
          Get the action identifier
protected  IOAdvisor<P> getAdvisor()
          Get the I/O advisor
protected  List<AbstractConfigurationPage<? extends P,? extends IOWizard<P>>> getConfigurationPages()
          Get the list of configuration pages for the currently selected provider factory null if there are none.
 org.eclipse.core.runtime.content.IContentType getContentType()
          Get the content type assigned to the wizard
 List<IOProviderDescriptor> getFactories()
          Get the available provider descriptors.
 org.eclipse.jface.wizard.IWizardPage getNextPage(org.eclipse.jface.wizard.IWizardPage page)
           
 int getPageCount()
           
 org.eclipse.jface.wizard.IWizardPage getPreviousPage(org.eclipse.jface.wizard.IWizardPage page)
           
 P getProvider()
          Get the provider assigned to the wizard.
 IOProviderDescriptor getProviderFactory()
          Get the provider descriptor assigned to the wizard.
 Class<P> getProviderType()
          Get the supported I/O provider type, usually an interface.
 org.eclipse.jface.wizard.IWizardPage getStartingPage()
           
 void handlePageChanging(org.eclipse.jface.dialogs.PageChangingEvent event)
           
 boolean performFinish()
           
 void removeIOWizardListener(IOWizardListener<P,? extends IOWizard<P>> listener)
          Removes an IOWizardListener
 void setAdvisor(IOAdvisor<P> advisor, String actionId)
          Set the I/O advisor
 void setContentType(org.eclipse.core.runtime.content.IContentType contentType)
          Assign a content type to the wizard
 void setProviderFactory(IOProviderDescriptor descriptor)
          Assign an I/O provider factory to the wizard
protected  void updateConfiguration(P provider)
          Update the provider configuration.
protected  boolean validatePage(org.eclipse.jface.wizard.IWizardPage page)
          Validate the given page and update the I/O provider
 
Methods inherited from class org.eclipse.jface.wizard.Wizard
createPageControls, getContainer, getDefaultPageImage, getDialogSettings, getPage, getPages, getShell, 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
 

Constructor Detail

IOWizard

public IOWizard(Class<P> providerType)
Create an I/O wizard

Parameters:
providerType - the I/O provider type
Method Detail

getAdvisor

protected IOAdvisor<P> getAdvisor()
Get the I/O advisor

Returns:
the advisor

getActionId

protected String getActionId()
Get the action identifier

Returns:
the action ID

setAdvisor

public void setAdvisor(IOAdvisor<P> advisor,
                       String actionId)
Set the I/O advisor

Parameters:
advisor - the advisor to set
actionId - the action identifier, null if it has none

addPages

public void addPages()
Specified by:
addPages in interface org.eclipse.jface.wizard.IWizard
Overrides:
addPages in class org.eclipse.jface.wizard.Wizard
See Also:
Wizard.addPages()

handlePageChanging

public void handlePageChanging(org.eclipse.jface.dialogs.PageChangingEvent event)
Specified by:
handlePageChanging in interface org.eclipse.jface.dialogs.IPageChangingListener
See Also:
IPageChangingListener.handlePageChanging(PageChangingEvent)

dispose

public void dispose()
Specified by:
dispose in interface org.eclipse.jface.wizard.IWizard
Overrides:
dispose in class org.eclipse.jface.wizard.Wizard
See Also:
Wizard.dispose()

addPage

public void addPage(org.eclipse.jface.wizard.IWizardPage page)
Overrides:
addPage in class org.eclipse.jface.wizard.Wizard
See Also:
Wizard.addPage(IWizardPage)

getConfigurationPages

protected List<AbstractConfigurationPage<? extends P,? extends IOWizard<P>>> getConfigurationPages()
Get the list of configuration pages for the currently selected provider factory null if there are none.

Returns:
the configuration pages for the current provider

canFinish

public boolean canFinish()
Specified by:
canFinish in interface org.eclipse.jface.wizard.IWizard
Overrides:
canFinish in class org.eclipse.jface.wizard.Wizard
See Also:
Wizard.canFinish()

getNextPage

public org.eclipse.jface.wizard.IWizardPage getNextPage(org.eclipse.jface.wizard.IWizardPage page)
Specified by:
getNextPage in interface org.eclipse.jface.wizard.IWizard
Overrides:
getNextPage in class org.eclipse.jface.wizard.Wizard
See Also:
Wizard.getNextPage(IWizardPage)

getPageCount

public int getPageCount()
Specified by:
getPageCount in interface org.eclipse.jface.wizard.IWizard
Overrides:
getPageCount in class org.eclipse.jface.wizard.Wizard
See Also:
Wizard.getPageCount()

getPreviousPage

public org.eclipse.jface.wizard.IWizardPage getPreviousPage(org.eclipse.jface.wizard.IWizardPage page)
Specified by:
getPreviousPage in interface org.eclipse.jface.wizard.IWizard
Overrides:
getPreviousPage in class org.eclipse.jface.wizard.Wizard
See Also:
Wizard.getPreviousPage(IWizardPage)

getStartingPage

public org.eclipse.jface.wizard.IWizardPage getStartingPage()
Specified by:
getStartingPage in interface org.eclipse.jface.wizard.IWizard
Overrides:
getStartingPage in class org.eclipse.jface.wizard.Wizard
See Also:
Wizard.getStartingPage()

getFactories

public List<IOProviderDescriptor> getFactories()
Get the available provider descriptors. To filter or sort them you can override this method.

Returns:
the available provider descriptors

getProvider

public P getProvider()
Get the provider assigned to the wizard. It will be null if no page assigned a provider factory to the wizard yet.

Returns:
the I/O provider

setProviderFactory

public void setProviderFactory(IOProviderDescriptor descriptor)
Assign an I/O provider factory to the wizard

Parameters:
descriptor - the provider factory to set

getContentType

public org.eclipse.core.runtime.content.IContentType getContentType()
Get the content type assigned to the wizard

Returns:
the content type, may be null

setContentType

public void setContentType(org.eclipse.core.runtime.content.IContentType contentType)
Assign a content type to the wizard

Parameters:
contentType - the content type to set

getProviderFactory

public IOProviderDescriptor getProviderFactory()
Get the provider descriptor assigned to the wizard. It will be null if no page assigned a provider factory to the wizard yet.

Returns:
the I/O provider factory

performFinish

public boolean performFinish()
Specified by:
performFinish in interface org.eclipse.jface.wizard.IWizard
Specified by:
performFinish in class org.eclipse.jface.wizard.Wizard
Returns:
true if executing the I/O provider was successful
See Also:
Wizard.performFinish()

execute

protected IOReport execute(IOProvider provider,
                           IOReporter defaultReporter)
Execute the given provider

Parameters:
provider - the I/O provider
defaultReporter - the default reporter that is used if the provider doesn't supply a report
Returns:
the execution report, if null it will not give feedback to the user and the advisor's handleResult method won't be called either

updateConfiguration

protected void updateConfiguration(P provider)
Update the provider configuration. This will be called just before the I/O provider is executed.

Parameters:
provider - the I/O provider

validatePage

protected boolean validatePage(org.eclipse.jface.wizard.IWizardPage page)
Validate the given page and update the I/O provider

Parameters:
page - the wizard page to validate
Returns:
if the page is valid and updating the I/O provider was successful

getProviderType

public Class<P> getProviderType()
Get the supported I/O provider type, usually an interface.

Returns:
the supported I/O provider type

addIOWizardListener

public void addIOWizardListener(IOWizardListener<P,? extends IOWizard<P>> listener)
Adds an IOWizardListener

Parameters:
listener - the listener to add

removeIOWizardListener

public void removeIOWizardListener(IOWizardListener<P,? extends IOWizard<P>> listener)
Removes an IOWizardListener

Parameters:
listener - the listener to remove

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d