org.openoffice.ide.eclipse.core.wizards.pages
Class NewScopedElementWizardPage

java.lang.Object
  extended by org.eclipse.jface.dialogs.DialogPage
      extended by org.eclipse.jface.wizard.WizardPage
          extended by org.openoffice.ide.eclipse.core.wizards.pages.NewScopedElementWizardPage
All Implemented Interfaces:
org.eclipse.jface.dialogs.IDialogPage, org.eclipse.jface.dialogs.IMessageProvider, org.eclipse.jface.wizard.IWizardPage, IFieldChangedListener, IListenablePage
Direct Known Subclasses:
NewInterfaceWizardPage, NewServiceWizardPage

public abstract class NewScopedElementWizardPage
extends org.eclipse.jface.wizard.WizardPage
implements IFieldChangedListener, IListenablePage

Abstract class for a wizard page to create a scoped element such as a service or an interface.

Author:
cedricbosdo

Field Summary
 
Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider
ERROR, INFORMATION, NONE, WARNING
 
Constructor Summary
NewScopedElementWizardPage(java.lang.String pName)
          Default constructor to use when neither the project nor the OOo instance is known.
NewScopedElementWizardPage(java.lang.String pPageName, IOOo pOOoInstance)
          Creates a default scoped name type wizard page with blank container path and type name.
NewScopedElementWizardPage(java.lang.String pPageName, IUnoidlProject pUnoProject)
          Constructor to use when the UNO project is already created.
NewScopedElementWizardPage(java.lang.String pPageName, IUnoidlProject pProject, java.lang.String pRootName, java.lang.String pElementName)
          Constructor to use when the UNO project is already created, the scoped type name and it's path already known.
NewScopedElementWizardPage(java.lang.String pPageName, java.lang.String pRootName, java.lang.String pElementName, IOOo pOOoInstance)
          Constructor to use when the UNO project is already created, the scoped type name and it's path already known.
 
Method Summary
 void addPageListener(IPageListener pListener)
          Add the page listener.
 void createControl(org.eclipse.swt.widgets.Composite pParent)
          
protected abstract  void createSpecificControl(org.eclipse.swt.widgets.Composite pParent)
          Implement this method to add specific controls for the subclassing wizard page.
 void dispose()
          
static boolean existsIdlFile(java.lang.String pIdlFullName, IUnoidlProject pPrj)
          Checks if an IDL file exists in the project for a given IDL type.
 void fieldChanged(FieldEvent pEvent)
          Method called when the row has changed.
 UnoFactoryData fillData(UnoFactoryData pData)
           
protected  void firePageChanged(UnoFactoryData pData)
          Notifies all the page listeners that the pages data have changed.
 java.lang.String getElementName()
           
abstract  UnoFactoryData getEmptyTypeData()
          Creates an empty factory data for the page UNO type.
protected abstract  org.eclipse.jface.resource.ImageDescriptor getImageDescriptor()
           
 java.lang.String getPackage()
           
 java.lang.String getPackageRoot()
           
 IUnoidlProject getProject()
           
abstract  int getProvidedTypes()
           
static UnoFactoryData getTypeData(UnoFactoryData pData)
           
protected abstract  java.lang.String getTypeLabel()
           
 boolean isPageComplete()
          
 boolean isPublished()
           
 void removePageListener(IPageListener pListener)
          Remove the page listener.
 void setName(java.lang.String pValue, boolean pForced)
          Sets the name of the element to create.
 void setOOoInstance(IOOo pOOoInstance)
          Set the OOo instance to query the types from.
 void setPackage(java.lang.String pValue, boolean pForced)
          the container name of the type to create is composed of two parts: the package root and the package.
 void setPackageRoot(java.lang.String pValue)
          The container name of the type to create is composed of two parts: the package root and the package; this method sets the first part.
 void setPublished(boolean pValue, boolean pForced)
          Sets whether the type is published or not.
 void setUnoidlProject(IUnoidlProject pUnoProject)
          Sets the UNO project in which to create the scoped name type.
 void setVisible(boolean pVisible)
          
 
Methods inherited from class org.eclipse.jface.wizard.WizardPage
canFlipToNextPage, getContainer, getDialogSettings, getImage, getName, getNextPage, getPreviousPage, getShell, getWizard, isCurrentPage, setDescription, setErrorMessage, setImageDescriptor, setMessage, setPageComplete, setPreviousPage, setTitle, setWizard, toString
 
Methods inherited from class org.eclipse.jface.dialogs.DialogPage
convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, 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
getControl, getDescription, getErrorMessage, getMessage, getTitle, performHelp
 

Constructor Detail

NewScopedElementWizardPage

public NewScopedElementWizardPage(java.lang.String pName)
Default constructor to use when neither the project nor the OOo instance is known.

Parameters:
pName - wizard page name

NewScopedElementWizardPage

public NewScopedElementWizardPage(java.lang.String pPageName,
                                  IUnoidlProject pUnoProject)
Constructor to use when the UNO project is already created.

Parameters:
pPageName - name of the page
pUnoProject - UNO project in which to create a scoped type

NewScopedElementWizardPage

public NewScopedElementWizardPage(java.lang.String pPageName,
                                  IUnoidlProject pProject,
                                  java.lang.String pRootName,
                                  java.lang.String pElementName)
Constructor to use when the UNO project is already created, the scoped type name and it's path already known.

Parameters:
pPageName - name of the wizard page
pProject - UNO project in which to create a scoped type
pRootName - scoped name of the module containing the type
pElementName - name of the type, without any '.' or '::'

NewScopedElementWizardPage

public NewScopedElementWizardPage(java.lang.String pPageName,
                                  IOOo pOOoInstance)
Creates a default scoped name type wizard page with blank container path and type name.

Parameters:
pPageName - name of the wizard page
pOOoInstance - the OOo instance to use to retrieve the types

NewScopedElementWizardPage

public NewScopedElementWizardPage(java.lang.String pPageName,
                                  java.lang.String pRootName,
                                  java.lang.String pElementName,
                                  IOOo pOOoInstance)
Constructor to use when the UNO project is already created, the scoped type name and it's path already known.

Parameters:
pPageName - name of the wizard page
pRootName - scoped name of the module containing the type
pElementName - name of the type, without any '.' or '::'
pOOoInstance - the reference to the OOo to use for type selection
Method Detail

getProject

public IUnoidlProject getProject()
Returns:
the project which has been set to the page

getTypeLabel

protected abstract java.lang.String getTypeLabel()
Returns:
the string corresponding to the type name, e.g. "interface".

getImageDescriptor

protected abstract org.eclipse.jface.resource.ImageDescriptor getImageDescriptor()
Returns:
the image descriptor to put on the top-right of the page

createSpecificControl

protected abstract void createSpecificControl(org.eclipse.swt.widgets.Composite pParent)
Implement this method to add specific controls for the subclassing wizard page.

Parameters:
pParent - the composite parent where to put the controls

getProvidedTypes

public abstract int getProvidedTypes()
Returns:
the types to get in the UNO types provider. The returned integer is a
bit or
of the types defined in the UnoTypeProvider class.

setOOoInstance

public void setOOoInstance(IOOo pOOoInstance)
Set the OOo instance to query the types from.

Parameters:
pOOoInstance - OOo instance to use.

setUnoidlProject

public void setUnoidlProject(IUnoidlProject pUnoProject)
Sets the UNO project in which to create the scoped name type.

Parameters:
pUnoProject - the projet for which to create the UNO type.

getPackageRoot

public java.lang.String getPackageRoot()
Returns:
the root module where to create the UNO type.

getPackage

public java.lang.String getPackage()
Returns:
the module containing the UNO type, separated by "::".

getElementName

public java.lang.String getElementName()
Returns:
the name of the element to create.

setPackageRoot

public void setPackageRoot(java.lang.String pValue)
The container name of the type to create is composed of two parts: the package root and the package; this method sets the first part.

Parameters:
pValue - the new package root to set

setPackage

public void setPackage(java.lang.String pValue,
                       boolean pForced)
the container name of the type to create is composed of two parts: the package root and the package. This method sets the second part.

Parameters:
pValue - the new package value
pForced - true will replace the current value, false will set the value only if the current package is empty or null.

setName

public void setName(java.lang.String pValue,
                    boolean pForced)
Sets the name of the element to create.

Parameters:
pValue - the new package value
pForced - true will replace the current value, false will set the value only if the current package is empty or null.

isPublished

public boolean isPublished()
Returns:
whether the service is published or not.

setPublished

public void setPublished(boolean pValue,
                         boolean pForced)
Sets whether the type is published or not.

Parameters:
pValue - true if the type is published, false otherwise
pForced - true to overwrite the existing value.

dispose

public void dispose()

Specified by:
dispose in interface org.eclipse.jface.dialogs.IDialogPage
Overrides:
dispose in class org.eclipse.jface.dialogs.DialogPage

addPageListener

public void addPageListener(IPageListener pListener)
Add the page listener.

Specified by:
addPageListener in interface IListenablePage
Parameters:
pListener - the page listener to add

removePageListener

public void removePageListener(IPageListener pListener)
Remove the page listener.

Specified by:
removePageListener in interface IListenablePage
Parameters:
pListener - the listener to remove.

firePageChanged

protected void firePageChanged(UnoFactoryData pData)
Notifies all the page listeners that the pages data have changed.

Parameters:
pData - the new data of the page.

createControl

public void createControl(org.eclipse.swt.widgets.Composite pParent)

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

setVisible

public void setVisible(boolean pVisible)

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

fillData

public UnoFactoryData fillData(UnoFactoryData pData)
Parameters:
pData - the UNO data to complete
Returns:
the given data with the completed properties, null if the provided data is null

getEmptyTypeData

public abstract UnoFactoryData getEmptyTypeData()
Creates an empty factory data for the page UNO type.

Returns:
the empty UNO factory data

getTypeData

public static UnoFactoryData getTypeData(UnoFactoryData pData)
Parameters:
pData - the data of the project for which to get the default type data.
Returns:
the default type data for the project

fieldChanged

public void fieldChanged(FieldEvent pEvent)
Method called when the row has changed.

Specified by:
fieldChanged in interface IFieldChangedListener
Parameters:
pEvent - the field event thrown

isPageComplete

public boolean isPageComplete()

Specified by:
isPageComplete in interface org.eclipse.jface.wizard.IWizardPage
Overrides:
isPageComplete in class org.eclipse.jface.wizard.WizardPage

existsIdlFile

public static boolean existsIdlFile(java.lang.String pIdlFullName,
                                    IUnoidlProject pPrj)
Checks if an IDL file exists in the project for a given IDL type.

Please note that this method behaves correctly only if the user is respecting the following design rules:

Parameters:
pIdlFullName - the full name of the IDL file check
pPrj - the project where to look for the IDL file
Returns:
true if the an IDL file corresponds to the searched type, false otherwise.