org.eclipse.datatools.sqltools.common.ui.resource
Class WizardNewFileCreationPage

java.lang.Object
  extended by org.eclipse.jface.dialogs.DialogPage
      extended by org.eclipse.jface.wizard.WizardPage
          extended by org.eclipse.datatools.sqltools.common.ui.resource.WizardNewFileCreationPage
All Implemented Interfaces:
org.eclipse.jface.dialogs.IDialogPage, org.eclipse.jface.dialogs.IMessageProvider, org.eclipse.jface.wizard.IWizardPage, org.eclipse.swt.widgets.Listener

public class WizardNewFileCreationPage
extends org.eclipse.jface.wizard.WizardPage
implements org.eclipse.swt.widgets.Listener

Author:
Hui Cao
See Also:
We choose to reimplement the class because we want to a new ResourceAndContainerGroup which can has a "create project..." button. Standard main page for a wizard that creates a file resource.

This page may be used by clients as-is; it may be also be subclassed to suit.

Subclasses may override

  • getInitialContents
  • getNewFileLabel

Subclasses may extend

  • handleEvent


Field Summary
 
Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider
ERROR, INFORMATION, NONE, WARNING
 
Constructor Summary
WizardNewFileCreationPage(java.lang.String pageName, org.eclipse.jface.viewers.IStructuredSelection selection)
          Creates a new file creation wizard page.
 
Method Summary
 void createControl(org.eclipse.swt.widgets.Composite parent)
          (non-Javadoc) Method declared on IDialogPage.
 org.eclipse.core.resources.IFile createNewFile()
          Creates a new file resource in the selected container and with the selected name.
 org.eclipse.core.runtime.IPath getContainerFullPath()
          Returns the current full path of the containing resource as entered or selected by the user, or its anticipated initial value.
 java.lang.String getFileName()
          Returns the current file name as entered by the user, or its anticipated initial value.
 void handleEvent(org.eclipse.swt.widgets.Event event)
          The WizardNewFileCreationPage implementation of this Listener method handles all events and enablements for controls on this page.
 void setContainerFullPath(org.eclipse.core.runtime.IPath path)
          Sets the value of this page's container name field, or stores it for future use if this page's controls do not exist yet.
 void setFileName(java.lang.String value)
          Sets the value of this page's file name field, or stores it for future use if this page's controls do not exist yet.
 void setVisible(boolean visible)
           
 
Methods inherited from class org.eclipse.jface.wizard.WizardPage
canFlipToNextPage, getImage, getName, getNextPage, getPreviousPage, getShell, getWizard, isPageComplete, setDescription, setErrorMessage, setImageDescriptor, setMessage, setPageComplete, setPreviousPage, setTitle, setWizard, toString
 
Methods inherited from class org.eclipse.jface.dialogs.DialogPage
dispose, getControl, getDescription, getErrorMessage, getMessage, getMessageType, getTitle, performHelp, setMessage
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.dialogs.IDialogPage
dispose, getControl, getDescription, getErrorMessage, getMessage, getTitle, performHelp
 

Constructor Detail

WizardNewFileCreationPage

public WizardNewFileCreationPage(java.lang.String pageName,
                                 org.eclipse.jface.viewers.IStructuredSelection selection)
Creates a new file creation wizard page. If the initial resource selection contains exactly one container resource then it will be used as the default container resource.

Parameters:
pageName - the name of the page
selection - the current resource selection
Method Detail

createControl

public void createControl(org.eclipse.swt.widgets.Composite parent)
(non-Javadoc) Method declared on IDialogPage.

Specified by:
createControl in interface org.eclipse.jface.dialogs.IDialogPage

createNewFile

public org.eclipse.core.resources.IFile createNewFile()
Creates a new file resource in the selected container and with the selected name. Creates any missing resource containers along the path; does nothing if the container resources already exist.

In normal usage, this method is invoked after the user has pressed Finish on the wizard; the enablement of the Finish button implies that all controls on on this page currently contain valid values.

Note that this page caches the new file once it has been successfully created; subsequent invocations of this method will answer the same file resource without attempting to create it again.

This method should be called within a workspace modify operation since it creates resources.

Returns:
the created file resource, or null if the file was not created

getContainerFullPath

public org.eclipse.core.runtime.IPath getContainerFullPath()
Returns the current full path of the containing resource as entered or selected by the user, or its anticipated initial value.

Returns:
the container's full path, anticipated initial value, or null if no path is known

getFileName

public java.lang.String getFileName()
Returns the current file name as entered by the user, or its anticipated initial value.

Returns:
the file name, its anticipated initial value, or null if no file name is known

handleEvent

public void handleEvent(org.eclipse.swt.widgets.Event event)
The WizardNewFileCreationPage implementation of this Listener method handles all events and enablements for controls on this page. Subclasses may extend.

Specified by:
handleEvent in interface org.eclipse.swt.widgets.Listener

setContainerFullPath

public void setContainerFullPath(org.eclipse.core.runtime.IPath path)
Sets the value of this page's container name field, or stores it for future use if this page's controls do not exist yet.

Parameters:
path - the full path to the container

setFileName

public void setFileName(java.lang.String value)
Sets the value of this page's file name field, or stores it for future use if this page's controls do not exist yet.

Parameters:
value - new file name

setVisible

public void setVisible(boolean visible)
Specified by:
setVisible in interface org.eclipse.jface.dialogs.IDialogPage
Overrides:
setVisible in class org.eclipse.jface.dialogs.DialogPage