TPTP 4.6.0 Platform Project
Public API Specification

org.eclipse.hyades.ui.editor
Interface IHyadesEditorPart

All Superinterfaces:
IDisposable, org.eclipse.jface.viewers.ISelectionProvider
All Known Subinterfaces:
IHyadesEditorPartExtended

public interface IHyadesEditorPart
extends IDisposable, org.eclipse.jface.viewers.ISelectionProvider

Interface for the Hyades editor part. Each page may contain an arbitrary SWT control or an IEditorPart.

The Hyades editor part could be considered a "pseudo" editor. Basically it is a mechanism to allow the definition of one or more editors (or, more specifically, IEditorExtensions) for the same resource or for the same resource file extension. When this editor is opened it checks the content of the resource and calculates which would be the appropriate editor extension to be used.

This interface is not intended to be implemented by clients.


Field Summary
static int PROP_DIRTY
          The property id for isDirty.
static int PROP_INPUT
          The property id for getEditorInput.
static int PROP_OBJECT
          The property id for getEditorObject.
static int PROP_TITLE
          The property id for getTitle and getTitleImage.
 
Method Summary
 int addPage(org.eclipse.swt.widgets.Control control)
          Creates and adds the given control as new page to this HyadesEditorPart.
 int addPage(org.eclipse.ui.IEditorPart editor, org.eclipse.ui.IEditorInput input)
          Creates and adds a new page containing the given editor to this page container.
 void addPropertyListener(org.eclipse.ui.IPropertyListener listener)
          Adds a listener for changes to properties of this workbench part.
 void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
          Adds a listener for selection changes in this selection provider.
 void firePropertyChange(int propertyId)
          Fires a property changed event.
 int getActivePage()
          Returns the index of the currently active page, or -1 if there is no active page.
 org.eclipse.swt.widgets.Composite getContainer()
          Returns the composite control containing this editor part's pages.
 org.eclipse.swt.widgets.Control getControl(int pageIndex)
          Returns the control for the given page index, or null if no control has been set for the page.
 org.eclipse.ui.IEditorPart getEditor(int pageIndex)
          Returns the editor for the given page index.
 IAssociationDescriptor getEditorDescriptor()
          Returns the editor extension definition that is being used by this instance.
 java.lang.Object getEditorObject()
          Returns the object that is edited by this editor.
 org.eclipse.ui.IEditorPart getEditorPart()
          Gets the editor part associated with this instance.
 java.lang.String getFileExtension()
          Returns the file extension.
 int getPageCount()
          Returns the number of pages in this editor part.
 org.eclipse.swt.graphics.Image getPageImage(int pageIndex)
          Returns the image for the page with the given index, or null if no image has been set for the page.
 java.lang.String getPageText(int pageIndex)
          Returns the text label for the page with the given index or an empty string if no text label has been set for the page.
 java.lang.String getTitle()
          Returns the title of this Hyades editor part.
 org.eclipse.swt.graphics.Image getTitleImage()
          Returns the title image of this workbench part.
 java.lang.String getTitleToolTip()
          Returns the title tool tip text of this workbench part.
 boolean isDirty()
          Returns whether the contents of this part have changed since the last save operation.
 boolean isReadOnly()
          Returns whether the content of this editor is read only.
 void removePage(int pageIndex)
          Removes the page with the given index from this editor part.
 void removePropertyListener(org.eclipse.ui.IPropertyListener listener)
          Removes the given property listener from this workbench part.
 void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
          Removes the given selection change listener from this selection provider.
 void setActivePage(int pageIndex)
          Sets the currently active page.
 void setControl(int pageIndex, org.eclipse.swt.widgets.Control control)
          Sets the control for the given page index.
 void setEditorObject(java.lang.Object editorObject)
          Sets or clears the object edited by this Hyades editor part.
 void setPageImage(int pageIndex, org.eclipse.swt.graphics.Image image)
          Sets the image for the page with the given index, or null to clear the image for the page.
 void setPageText(int pageIndex, java.lang.String text)
          Sets the text label for the page with the given index.
 void setTitle(java.lang.String title)
          Deprecated. use IHyadesEditorPartExtended#setEditorTitle(String) instead.
 void setTitleImage(org.eclipse.swt.graphics.Image titleImage)
          Sets or clears the title image of this part.
 void setTitleToolTip(java.lang.String text)
          Sets or clears the title tool tip text of this part.
 
Methods inherited from interface org.eclipse.hyades.ui.util.IDisposable
dispose
 
Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
getSelection, setSelection
 

Field Detail

PROP_TITLE

static final int PROP_TITLE
The property id for getTitle and getTitleImage.

See Also:
Constant Field Values

PROP_DIRTY

static final int PROP_DIRTY
The property id for isDirty.

See Also:
Constant Field Values

PROP_INPUT

static final int PROP_INPUT
The property id for getEditorInput.

See Also:
Constant Field Values

PROP_OBJECT

static final int PROP_OBJECT
The property id for getEditorObject.

See Also:
Constant Field Values
Method Detail

addPropertyListener

void addPropertyListener(org.eclipse.ui.IPropertyListener listener)
Adds a listener for changes to properties of this workbench part. Has no effect if an identical listener is already registered.

The properties ids are as follows:

Parameters:
listener - a property listener

removePropertyListener

void removePropertyListener(org.eclipse.ui.IPropertyListener listener)
Removes the given property listener from this workbench part. Has no affect if an identical listener is not registered.

Parameters:
listener - a property listener

addSelectionChangedListener

void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
Adds a listener for selection changes in this selection provider. Has no effect if an identical listener is already registered.

Specified by:
addSelectionChangedListener in interface org.eclipse.jface.viewers.ISelectionProvider
Parameters:
listener - a selection changed listener

removeSelectionChangedListener

void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
Removes the given selection change listener from this selection provider. Has no affect if an identical listener is not registered.

Specified by:
removeSelectionChangedListener in interface org.eclipse.jface.viewers.ISelectionProvider
Parameters:
listener - a selection changed listener

firePropertyChange

void firePropertyChange(int propertyId)
Fires a property changed event.

Parameters:
propertyId - the id of the property that changed

isDirty

boolean isDirty()
Returns whether the contents of this part have changed since the last save operation. If this value changes the part must fire a property listener event with PROP_DIRTY.

Returns:
true if the contents have been modified and need saving, and false if they have not changed since the last save

isReadOnly

boolean isReadOnly()
Returns whether the content of this editor is read only.

Returns:
boolean

getFileExtension

java.lang.String getFileExtension()
Returns the file extension.

Returns:
int

getTitle

java.lang.String getTitle()
Returns the title of this Hyades editor part. If this value changes the part must fire a property listener event with PROP_TITLE.

The title is used to populate the title bar of this part's visual container.

Returns:
the Hyades editor part title

setTitle

void setTitle(java.lang.String title)
Deprecated. use IHyadesEditorPartExtended#setEditorTitle(String) instead.

Sets or clears the title of this Hyades editor part.

Parameters:
title - the title, or null to clear

getTitleImage

org.eclipse.swt.graphics.Image getTitleImage()
Returns the title image of this workbench part. If this value changes the part must fire a property listener event with PROP_TITLE.

The title image is usually used to populate the title bar of this part's visual container. Since this image is managed by the part itself, callers must not dispose the returned image.

Returns:
the title image

setTitleImage

void setTitleImage(org.eclipse.swt.graphics.Image titleImage)
Sets or clears the title image of this part.

Parameters:
titleImage - the title image, or null to clear

getTitleToolTip

java.lang.String getTitleToolTip()
Returns the title tool tip text of this workbench part. If this value changes the part must fire a property listener event with PROP_TITLE.

The tool tip text is used to populate the title bar of this part's visual container.

Returns:
the workbench part title tool tip

setTitleToolTip

void setTitleToolTip(java.lang.String text)
Sets or clears the title tool tip text of this part.

Parameters:
text - the new tool tip text

setEditorObject

void setEditorObject(java.lang.Object editorObject)
Sets or clears the object edited by this Hyades editor part.

Parameters:
editorObject - the object, or null to clear

getEditorObject

java.lang.Object getEditorObject()
Returns the object that is edited by this editor. If this value changes the part must fire a property listener event with PROP_OBJECT.

Returns:
the edited object

getEditorPart

org.eclipse.ui.IEditorPart getEditorPart()
Gets the editor part associated with this instance.

Returns:
IEditorPart

getContainer

org.eclipse.swt.widgets.Composite getContainer()
Returns the composite control containing this editor part's pages. This should be used as the parent when creating controls for the individual pages. That is, when calling addPage(Object), the container returned by this method should be the parent for any SWT control related to the object.

Warning: Clients should not assume that the container is any particular subclass of Composite. The actual class used may change in order to improve the look and feel of the editor part. Any code making assumptions on the particular subclass would thus be broken.

Returns:
the composite, or null if createPartControl has not been called yet

addPage

int addPage(org.eclipse.swt.widgets.Control control)
Creates and adds the given control as new page to this HyadesEditorPart. The control may be null, allowing it to be created and set later using setControl.

Parameters:
control - the control, or null
Returns:
the index of the new page
See Also:
setControl(int, org.eclipse.swt.widgets.Control)

setControl

void setControl(int pageIndex,
                org.eclipse.swt.widgets.Control control)
Sets the control for the given page index. The page index must be valid.

Parameters:
pageIndex - the index of the page
control - the control for the specified page, or null to clear the control

getControl

org.eclipse.swt.widgets.Control getControl(int pageIndex)
Returns the control for the given page index, or null if no control has been set for the page. The page index must be valid.

Parameters:
pageIndex - the index of the page
Returns:
the control for the specified page, or null if none has been set

addPage

int addPage(org.eclipse.ui.IEditorPart editor,
            org.eclipse.ui.IEditorInput input)
            throws org.eclipse.ui.PartInitException
Creates and adds a new page containing the given editor to this page container. This also hooks a property change listener on the nested editor.

Parameters:
editor - the nested editor
input - the input for the nested editor
Returns:
the index of the new page
Throws:
org.eclipse.ui.PartInitException - if a new page could not be created
See Also:
the handler for property change events from the nested editor

getEditor

org.eclipse.ui.IEditorPart getEditor(int pageIndex)
Returns the editor for the given page index. The page index must be valid.

Parameters:
pageIndex - the index of the page
Returns:
the editor for the specified page, or null if the specified page was not created with addPage(IEditorPart,IEditorInput)

removePage

void removePage(int pageIndex)
Removes the page with the given index from this editor part. The controls for the page are disposed of. The page index must be valid.

Parameters:
pageIndex - the index of the page
See Also:
addPage(org.eclipse.swt.widgets.Control)

getPageCount

int getPageCount()
Returns the number of pages in this editor part.

Returns:
the number of pages

setActivePage

void setActivePage(int pageIndex)
Sets the currently active page.

Parameters:
pageIndex - the index of the page to be activated; the index must be valid

getActivePage

int getActivePage()
Returns the index of the currently active page, or -1 if there is no active page.

Returns:
the index of the active page, or -1 if there is no active page

setPageImage

void setPageImage(int pageIndex,
                  org.eclipse.swt.graphics.Image image)
Sets the image for the page with the given index, or null to clear the image for the page. The page index must be valid.

Parameters:
pageIndex - the index of the page
image - the image, or null

getPageImage

org.eclipse.swt.graphics.Image getPageImage(int pageIndex)
Returns the image for the page with the given index, or null if no image has been set for the page. The page index must be valid.

Parameters:
pageIndex - the index of the page
Returns:
the image, or null if none

setPageText

void setPageText(int pageIndex,
                 java.lang.String text)
Sets the text label for the page with the given index. The page index must be valid. The text label must not be null.

Parameters:
pageIndex - the index of the page
text - the text label

getPageText

java.lang.String getPageText(int pageIndex)
Returns the text label for the page with the given index or an empty string if no text label has been set for the page. The page index must be valid.

Parameters:
pageIndex - the index of the page
Returns:
the text label for the page

getEditorDescriptor

IAssociationDescriptor getEditorDescriptor()
Returns the editor extension definition that is being used by this instance.

Returns:
IAssociationDescriptor

TPTP 4.6.0 Platform Project
Public API Specification