de.upb.swt.epctools.plugin.wizards
Class EpctoolsWizard

java.lang.Object
  extended by org.eclipse.jface.wizard.Wizard
      extended by de.upb.swt.epctools.plugin.wizards.EpctoolsWizard
All Implemented Interfaces:
org.eclipse.jface.wizard.IWizard, org.eclipse.ui.INewWizard, org.eclipse.ui.IWorkbenchWizard

public class EpctoolsWizard
extends org.eclipse.jface.wizard.Wizard
implements org.eclipse.ui.INewWizard

This class represents the epcsim wizard. Its role is to create a new file resource in the provided container. If the container resource (a folder or a project) is selected in the workspace when the wizard is opened, it will accept it as the target container. The wizard creates one file with the extension "xml". If a multi-page editor (also available as a template) is registered for the same extension, it will be able to open it.


Field Summary
private  EpctoolsNewWizardPage m_page
           
private  org.eclipse.jface.viewers.ISelection m_selection
           
 
Fields inherited from class org.eclipse.jface.wizard.Wizard
DEFAULT_IMAGE
 
Constructor Summary
EpctoolsWizard()
          Constructor for EpcsimWizard.
 
Method Summary
 void addPages()
          This function adds the page to the wizard.
private  void doFinish(java.lang.String containerName, java.lang.String fileName, org.eclipse.core.runtime.IProgressMonitor monitor)
          This function represents the worker method.
 void init(org.eclipse.ui.IWorkbench workbench, org.eclipse.jface.viewers.IStructuredSelection selection)
          This function initializes the wizard.
private  java.io.InputStream openContentStream()
          This function opens the content stream; we will initialize file contents with a sample text.
 boolean performFinish()
          This function is called when 'Finish' button is pressed in the wizard.
private  void throwCoreException(java.lang.String message)
           
 
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

m_page

private EpctoolsNewWizardPage m_page

m_selection

private org.eclipse.jface.viewers.ISelection m_selection
Constructor Detail

EpctoolsWizard

public EpctoolsWizard()
Constructor for EpcsimWizard.

Method Detail

addPages

public void addPages()
This function adds the page to the wizard.

Specified by:
addPages in interface org.eclipse.jface.wizard.IWizard
Overrides:
addPages in class org.eclipse.jface.wizard.Wizard

performFinish

public boolean performFinish()
This function is called when 'Finish' button is pressed in the wizard. We will create an operation and run it using wizard as execution context.

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
This function represents 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.

Throws:
org.eclipse.core.runtime.CoreException

openContentStream

private java.io.InputStream openContentStream()
This function opens the content stream; we will initialize file contents with a sample text.


throwCoreException

private void throwCoreException(java.lang.String message)
                         throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException

init

public void init(org.eclipse.ui.IWorkbench workbench,
                 org.eclipse.jface.viewers.IStructuredSelection selection)
This function initializes the wizard. We will accept the selection in the workbench to see if we can initialize from it.

Specified by:
init in interface org.eclipse.ui.IWorkbenchWizard
See Also:
IWorkbenchWizard.init(IWorkbench, IStructuredSelection)