public class WizardNewFileCreationPage extends WizardPage implements Listener
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
ERROR, INFORMATION, NONE, WARNING
Constructor and Description |
---|
WizardNewFileCreationPage(String pageName,
IStructuredSelection selection)
Creates a new file creation wizard page.
|
Modifier and Type | Method and Description |
---|---|
protected void |
createAdvancedControls(Composite parent)
Creates the widget for advanced options.
|
void |
createControl(Composite parent)
(non-Javadoc) Method declared on IDialogPage.
|
protected void |
createFile(IFile fileHandle,
InputStream contents,
IProgressMonitor monitor)
Deprecated.
As of 3.3, use or override
createNewFile() which
uses the undoable operation support. To supply customized
file content for a subclass, use
getInitialContents() . |
protected IFile |
createFileHandle(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.
|
IFile |
createNewFile()
Creates a new file resource in the selected container and with the
selected name.
|
protected ISchedulingRule |
createRule(IResource resource)
Deprecated.
As of 3.3, scheduling rules are provided by the undoable
operation that this page creates and executes.
|
IPath |
getContainerFullPath()
Returns the current full path of the containing resource as entered or
selected by the user, or its anticipated initial value.
|
String |
getFileExtension()
Returns the file extension to use when creating the new file.
|
String |
getFileName()
Returns the current file name as entered by the user, or its anticipated
initial value.
|
protected InputStream |
getInitialContents()
Returns a stream containing the initial contents to be given to new file
resource instances.
|
protected 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(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 |
setAllowExistingResources(boolean value)
Sets the flag indicating whether existing resources are permitted to be
specified on this page.
|
void |
setContainerFullPath(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 |
setFileExtension(String value)
Set the only file extension allowed for this page's file name field.
|
void |
setFileName(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)
The
DialogPage implementation of this
IDialogPage method sets the control to the given
visibility state. |
protected IStatus |
validateLinkedResource()
Checks whether the linked resource target is valid.
|
protected boolean |
validatePage()
Returns whether this page's controls currently all contain valid values.
|
canFlipToNextPage, getContainer, getDialogSettings, getImage, getName, getNextPage, getPreviousPage, getShell, getWizard, isCurrentPage, isPageComplete, setDescription, setErrorMessage, setImageDescriptor, setMessage, setPageComplete, setPreviousPage, setTitle, setWizard, toString
convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, dispose, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getMessage, getMessageType, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, performHelp, setButtonLayoutData, setControl, setMessage
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
dispose, getControl, getDescription, getErrorMessage, getMessage, getTitle, performHelp
public WizardNewFileCreationPage(String pageName, IStructuredSelection selection)
pageName
- the name of the pageselection
- the current resource selectionprotected void createAdvancedControls(Composite parent)
parent
- the parent compositepublic void createControl(Composite parent)
createControl
in interface IDialogPage
parent
- the parent composite@Deprecated protected void createFile(IFile fileHandle, InputStream contents, IProgressMonitor monitor) throws CoreException
createNewFile()
which
uses the undoable operation support. To supply customized
file content for a subclass, use
getInitialContents()
.fileHandle
- the file handle to create a file resource withcontents
- the initial contents of the new file resource, or
null
if none (equivalent to an empty stream)monitor
- the progress monitor to show visual progress withCoreException
- if the operation failsOperationCanceledException
- if the operation is canceledprotected IFile createFileHandle(IPath filePath)
createFile
.filePath
- the path of the file resource to create a handle forcreateFile(org.eclipse.core.resources.IFile, java.io.InputStream, org.eclipse.core.runtime.IProgressMonitor)
protected void createLinkTarget()
public IFile createNewFile()
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.
null
if the file was
not created@Deprecated protected ISchedulingRule createRule(IResource resource)
resource
- The resource being createdpublic IPath getContainerFullPath()
null
if no path is knownpublic String getFileName()
null
if no file name is knownsetFileExtension(String)
public String getFileExtension()
null
.setFileExtension(String)
protected InputStream getInitialContents()
protected String getNewFileLabel()
Subclasses may reimplement.
protected void handleAdvancedButtonSelect()
public void handleEvent(Event event)
WizardNewFileCreationPage
implementation of this
Listener
method handles all events and enablements for
controls on this page. Subclasses may extend.handleEvent
in interface Listener
event
- the event which occurredprotected void initialPopulateContainerNameField()
public void setAllowExistingResources(boolean value)
value
- true
if existing resources are permitted, and
false
otherwisepublic void setContainerFullPath(IPath path)
path
- the full path to the containerpublic void setFileName(String value)
value
- new file namepublic void setFileExtension(String value)
value
- The file extension without the '.' prefix (e.g. 'java', 'xml')protected IStatus validateLinkedResource()
protected boolean validatePage()
true
if all controls are valid, and
false
if at least one is invalidpublic void setVisible(boolean visible)
DialogPage
DialogPage
implementation of this
IDialogPage
method sets the control to the given
visibility state. Subclasses may extend.setVisible
in interface IDialogPage
setVisible
in class DialogPage
visible
- true
to make this page visible,
and false
to hide it
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.