public class LinkedFileCreationMainPage
extends org.eclipse.jface.wizard.WizardPage
implements org.eclipse.swt.widgets.Listener
Constructor and Description |
---|
LinkedFileCreationMainPage(org.eclipse.jface.viewers.IStructuredSelection selection)
Creates a new file creation wizard page.
|
Modifier and Type | Method and Description |
---|---|
void |
createControl(org.eclipse.swt.widgets.Composite parent)
(non-Javadoc) Method declared on IDialogPage.
|
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.
|
protected void |
doCreateControls(org.eclipse.swt.widgets.Composite parent)
Creates the widget for advanced options.
|
protected void |
doShellResizing(org.eclipse.swt.widgets.Composite parent)
Resize the shell.
|
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.
|
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 |
setFileExtension(java.lang.String value)
Set the only file extension allowed for this page's file name field.
|
void |
setFileName(java.lang.String value)
Called when the user select his file to link
|
void |
setFilterExtensions(java.lang.String[] filterExtensions)
Set the file extensions which the
FileDialog will use to filter the files it shows to the argument, which
may be null. |
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.
|
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, setVisible
public LinkedFileCreationMainPage(org.eclipse.jface.viewers.IStructuredSelection selection)
selection
- the current resource selectionpublic void createControl(org.eclipse.swt.widgets.Composite parent)
createControl
in interface org.eclipse.jface.dialogs.IDialogPage
protected void doCreateControls(org.eclipse.swt.widgets.Composite parent)
parent
- the parent compositeprotected org.eclipse.core.resources.IFile createFileHandle(org.eclipse.core.runtime.IPath filePath)
createFile
.filePath
- the path of the file resource to create a handle forprotected void createLinkTarget()
public org.eclipse.core.resources.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 createdpublic org.eclipse.core.runtime.IPath getContainerFullPath()
null
if no path is knownpublic java.lang.String getFileName()
null
if no file name is knownWizardNewFileCreationPage.setFileExtension(String)
protected java.io.InputStream getInitialContents()
protected void doShellResizing(org.eclipse.swt.widgets.Composite parent)
public void handleEvent(org.eclipse.swt.widgets.Event event)
WizardNewFileCreationPage
implementation of this Listener
method handles all events
and enablements for controls on this page. Subclasses may extend.handleEvent
in interface org.eclipse.swt.widgets.Listener
public void setFileName(java.lang.String value)
public void setFileExtension(java.lang.String value)
value
- The file extension without the '.' prefix (e.g. 'java', 'xml')protected org.eclipse.core.runtime.IStatus validateLinkedResource()
protected boolean validatePage()
true
if all controls are valid, and false
if at least one is invalidpublic void setFilterExtensions(java.lang.String[] filterExtensions)
FileDialog
will use to filter the files it shows to the argument, which
may be null.
The strings are platform specific. For example, on some platforms, an extension filter string is typically of the form "*.extension", where "*.*" matches all files. For filters with multiple extensions, use semicolon as a separator, e.g. "*.jpg;*.png".
filterExtensions
- the filterExtensions to set on the FileDialog
opened when the user select the browse button.