org.eclipse.ocl.examples.xtext.base.ui.wizards
Class AbstractFileNewWizardPage

java.lang.Object
  extended by org.eclipse.jface.dialogs.DialogPage
      extended by org.eclipse.jface.wizard.WizardPage
          extended by org.eclipse.ocl.examples.xtext.base.ui.wizards.AbstractFileNewWizardPage
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 AbstractFileNewWizardPage
extends org.eclipse.jface.wizard.WizardPage
implements org.eclipse.swt.widgets.Listener

Wizard page allowing creation of OCL rule files in the workspace.


Field Summary
protected  org.eclipse.core.resources.IResource initialSelection
           
protected  AbstractFileNewWizard wizard
           
 
Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider
ERROR, INFORMATION, NONE, WARNING
 
Constructor Summary
AbstractFileNewWizardPage(AbstractFileNewWizard wizard, org.eclipse.core.resources.IResource initialSelection)
          Creates a new complete OCL 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 complete OCL file resource in the selected container and with the selected name.
 java.io.InputStream getInitialContents()
          Returns a stream containing the initial contents to be given to new complete OCL 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.
 AbstractFileDialog initDialog(org.eclipse.core.resources.IResource initialSelection)
           
 void setVisible(boolean visible)
           
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

wizard

@NonNull
protected final AbstractFileNewWizard wizard

initialSelection

@Nullable
protected final org.eclipse.core.resources.IResource initialSelection
Constructor Detail

AbstractFileNewWizardPage

public AbstractFileNewWizardPage(@NonNull
                                 AbstractFileNewWizard wizard,
                                 @Nullable
                                 org.eclipse.core.resources.IResource initialSelection)
Creates a new complete OCL 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

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 complete OCL 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 complete OCL 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

getInitialContents

public java.io.InputStream getInitialContents()
Returns a stream containing the initial contents to be given to new complete OCL file resource instances.

Returns:
initial contents to be given to new complete OCL file resource instances

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

initDialog

@NonNull
public AbstractFileDialog initDialog(@Nullable
                                             org.eclipse.core.resources.IResource initialSelection)

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

validatePage

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

Returns:
true if all controls are valid, and false if at least one is invalid