Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.ui.dialogs
Class WizardNewFileCreationPage  view WizardNewFileCreationPage download WizardNewFileCreationPage.java

java.lang.Object
  extended byorg.eclipse.jface.dialogs.DialogPage
      extended byorg.eclipse.jface.wizard.WizardPage
          extended byorg.eclipse.ui.dialogs.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

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

Subclasses may extend


Field Summary
private  org.eclipse.swt.widgets.Button advancedButton
           
private  org.eclipse.jface.viewers.IStructuredSelection currentSelection
           
private  boolean firstLinkCheck
          First time the advanced group is validated.
private  org.eclipse.core.runtime.IPath initialContainerFullPath
           
private  java.lang.String initialFileName
           
private  org.eclipse.swt.widgets.Composite linkedResourceComposite
           
private  org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup linkedResourceGroup
           
private  int linkedResourceGroupHeight
          Height of the "advanced" linked resource group.
private  org.eclipse.swt.widgets.Composite linkedResourceParent
           
private  org.eclipse.core.runtime.IPath linkTargetPath
           
private  org.eclipse.core.resources.IFile newFile
           
private  org.eclipse.ui.internal.ide.misc.ResourceAndContainerGroup resourceGroup
           
private static int SIZING_CONTAINER_GROUP_HEIGHT
           
 
Fields inherited from class org.eclipse.jface.wizard.WizardPage
 
Fields inherited from class org.eclipse.jface.dialogs.DialogPage
 
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
protected  void createAdvancedControls(org.eclipse.swt.widgets.Composite parent)
          Creates the widget for advanced options.
 void createControl(org.eclipse.swt.widgets.Composite parent)
          (non-Javadoc) Method declared on IDialogPage.
protected  void createFile(org.eclipse.core.resources.IFile fileHandle, java.io.InputStream contents, org.eclipse.core.runtime.IProgressMonitor monitor)
          Creates a file resource given the file handle and contents.
protected  org.eclipse.core.resources.IFile createFileHandle(org.eclipse.core.runtime.IPath filePath)
          Creates a file resource handle for the file with the given workspace path.
protected  void createLinkTarget()
          Creates the link target path if a link target has been specified.
 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.
protected  java.io.InputStream getInitialContents()
          Returns a stream containing the initial contents to be given to new file resource instances.
protected  java.lang.String getNewFileLabel()
          Returns the label to display in the file name specification visual component group.
protected  void handleAdvancedButtonSelect()
          Shows/hides the advanced option widgets.
 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.
protected  void initialPopulateContainerNameField()
          Sets the initial contents of the container name entry field, based upon either a previously-specified initial value or the ability to determine such a value.
 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)
          Sets the visibility of this dialog page.
protected  org.eclipse.core.runtime.IStatus validateLinkedResource()
          Checks whether the linked resource target is valid.
protected  boolean validatePage()
          Returns whether this page's controls currently all contain valid values.
 
Methods inherited from class org.eclipse.jface.wizard.WizardPage
canFlipToNextPage, getContainer, getDialogSettings, getImage, getName, getNextPage, getPreviousPage, getShell, getWizard, isCurrentPage, isPageComplete, setDescription, setErrorMessage, setImageDescriptor, setMessage, setPageComplete, setPreviousPage, setTitle, setWizard, toString
 
Methods inherited from class org.eclipse.jface.dialogs.DialogPage
convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, dispose, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getMessage, getMessageType, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, performHelp, setButtonLayoutData, setControl, setMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.dialogs.IDialogPage
dispose, getControl, getDescription, getErrorMessage, getMessage, getTitle, performHelp
 

Field Detail

SIZING_CONTAINER_GROUP_HEIGHT

private static final int SIZING_CONTAINER_GROUP_HEIGHT
See Also:
Constant Field Values

currentSelection

private org.eclipse.jface.viewers.IStructuredSelection currentSelection

newFile

private org.eclipse.core.resources.IFile newFile

linkTargetPath

private org.eclipse.core.runtime.IPath linkTargetPath

resourceGroup

private org.eclipse.ui.internal.ide.misc.ResourceAndContainerGroup resourceGroup

advancedButton

private org.eclipse.swt.widgets.Button advancedButton

linkedResourceGroup

private org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup linkedResourceGroup

linkedResourceParent

private org.eclipse.swt.widgets.Composite linkedResourceParent

linkedResourceComposite

private org.eclipse.swt.widgets.Composite linkedResourceComposite

initialFileName

private java.lang.String initialFileName

initialContainerFullPath

private org.eclipse.core.runtime.IPath initialContainerFullPath

linkedResourceGroupHeight

private int linkedResourceGroupHeight
Height of the "advanced" linked resource group. Set when the advanced group is first made visible.


firstLinkCheck

private boolean firstLinkCheck
First time the advanced group is validated.

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.

Method Detail

createAdvancedControls

protected void createAdvancedControls(org.eclipse.swt.widgets.Composite parent)
Creates the widget for advanced options.


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

createFile

protected void createFile(org.eclipse.core.resources.IFile fileHandle,
                          java.io.InputStream contents,
                          org.eclipse.core.runtime.IProgressMonitor monitor)
                   throws org.eclipse.core.runtime.CoreException
Creates a file resource given the file handle and contents.


createFileHandle

protected org.eclipse.core.resources.IFile createFileHandle(org.eclipse.core.runtime.IPath filePath)
Creates a file resource handle for the file with the given workspace path. This method does not create the file resource; this is the responsibility of createFile.


createLinkTarget

protected void createLinkTarget()
Creates the link target path if a link target has been specified.


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.


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.


getFileName

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


getInitialContents

protected java.io.InputStream getInitialContents()
Returns a stream containing the initial contents to be given to new file resource instances. Subclasses may wish to override. This default implementation provides no initial contents.


getNewFileLabel

protected java.lang.String getNewFileLabel()
Returns the label to display in the file name specification visual component group.

Subclasses may reimplement.


handleAdvancedButtonSelect

protected void handleAdvancedButtonSelect()
Shows/hides the advanced option widgets.


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

initialPopulateContainerNameField

protected void initialPopulateContainerNameField()
Sets the initial contents of the container name entry field, based upon either a previously-specified initial value or the ability to determine such a value.


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.


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.


validateLinkedResource

protected org.eclipse.core.runtime.IStatus validateLinkedResource()
Checks whether the linked resource target is valid. Sets the error message accordingly and returns the status.


validatePage

protected boolean validatePage()
Returns whether this page's controls currently all contain valid values.


setVisible

public void setVisible(boolean visible)
Description copied from interface: org.eclipse.jface.dialogs.IDialogPage
Sets the visibility of this dialog page.

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