org.eclipse.gmt.umlx.editor
Class MultiSheetEditor

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.ui.part.WorkbenchPart
          extended by org.eclipse.ui.part.EditorPart
              extended by org.eclipse.ui.part.MultiPageEditorPart
                  extended by org.eclipse.gmt.umlx.editor.MultiSheetEditor
All Implemented Interfaces:
java.util.EventListener, org.eclipse.core.resources.IResourceChangeListener, org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.ide.IGotoMarker, org.eclipse.ui.IEditorPart, org.eclipse.ui.ISaveablePart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.part.IWorkbenchPartOrientation

public class MultiSheetEditor
extends org.eclipse.ui.part.MultiPageEditorPart
implements org.eclipse.core.resources.IResourceChangeListener, org.eclipse.ui.ide.IGotoMarker

An example showing how to create a multi-page editor. This example has 3 pages:


Field Summary
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
MultiSheetEditor()
          Creates a multi-page editor example.
 
Method Summary
 int closeSheet(GSheet sheet)
           
 OutlinePage createContentOutlinePage()
           
 int createPageForSheet(GSheet sheet, int sheetIndex)
           
 org.eclipse.ui.views.properties.IPropertySheetPage createPropertySheetPage()
           
 void dispose()
          The MultiPageEditorPart implementation of this IWorkbenchPart method disposes all nested editors.
 void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
          Saves the multi-page editor's document.
 void doSaveAs()
          Saves the multi-page editor's document as another file.
 int findSheet(GSheet sheet)
          Return the page index for the first editor for sheet, -ve if none.
 int findSheetId(java.lang.String sheetName)
          Return the page index for the first editor for sheet, -ve if none.
 org.eclipse.ui.IEditorPart getActiveEditor()
           
 java.lang.Object getAdapter(java.lang.Class adapter)
          Returns the adapter for the specified key.
 SharedCommandStack getCommandStack()
          Returns the command stack.
 OutlinePage getContentOutlinePage()
           
 ActiveEditDomain getEditDomain()
          Returns the edit domain.
 void gotoMarker(org.eclipse.core.resources.IMarker marker)
          Show the marker, preferably in the Outline, but failing that in the first page in which the marker is visible.
 void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput editorInput)
          The MultiPageEditorExample implementation of this method checks that the input is an instance of IFileEditorInput.
 boolean isDirty()
          Returns true if the command stack is dirty
 boolean isSaveAsAllowed()
           
 void openSheet(GSheet sheet, int sheetIndex)
           
 void refreshPageImageAndText()
          Refreshes the tabs.
 void resourceChanged(org.eclipse.core.resources.IResourceChangeEvent event)
          Closes all project files on project close.
 
Methods inherited from class org.eclipse.ui.part.MultiPageEditorPart
addPage, addPage, addPage, addPage, createPartControl, removePage, setFocus
 
Methods inherited from class org.eclipse.ui.part.EditorPart
getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setInitializationData
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, getContentDescription, getOrientation, getPartName, getSite, getTitle, getTitleImage, removePropertyListener, showBusy
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, removePropertyListener
 

Constructor Detail

MultiSheetEditor

public MultiSheetEditor()
Creates a multi-page editor example.

Method Detail

closeSheet

public int closeSheet(GSheet sheet)

createContentOutlinePage

public OutlinePage createContentOutlinePage()

createPageForSheet

public int createPageForSheet(GSheet sheet,
                              int sheetIndex)

createPropertySheetPage

public org.eclipse.ui.views.properties.IPropertySheetPage createPropertySheetPage()

dispose

public void dispose()
The MultiPageEditorPart implementation of this IWorkbenchPart method disposes all nested editors. Subclasses may extend.

Specified by:
dispose in interface org.eclipse.ui.IWorkbenchPart
Overrides:
dispose in class org.eclipse.ui.part.MultiPageEditorPart

doSave

public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
Saves the multi-page editor's document.

Specified by:
doSave in interface org.eclipse.ui.ISaveablePart
Specified by:
doSave in class org.eclipse.ui.part.EditorPart

doSaveAs

public void doSaveAs()
Saves the multi-page editor's document as another file. Also updates the text for page 0's tab, and updates this multi-page editor's input to correspond to the nested editor's.

Specified by:
doSaveAs in interface org.eclipse.ui.ISaveablePart
Specified by:
doSaveAs in class org.eclipse.ui.part.EditorPart

findSheet

public int findSheet(GSheet sheet)
Return the page index for the first editor for sheet, -ve if none.


findSheetId

public int findSheetId(java.lang.String sheetName)
Return the page index for the first editor for sheet, -ve if none.


getActiveEditor

public org.eclipse.ui.IEditorPart getActiveEditor()
Overrides:
getActiveEditor in class org.eclipse.ui.part.MultiPageEditorPart

getAdapter

public java.lang.Object getAdapter(java.lang.Class adapter)
Returns the adapter for the specified key.

IMPORTANT certain requests, such as the property sheet, may be made before or after MultiPageEditorPart.createPartControl(Composite) is called. The order is unspecified by the Workbench.

Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable
Overrides:
getAdapter in class org.eclipse.ui.part.WorkbenchPart
See Also:
IAdaptable.getAdapter(java.lang.Class)

getCommandStack

public SharedCommandStack getCommandStack()
Returns the command stack.

Returns:
the command stack

getContentOutlinePage

public OutlinePage getContentOutlinePage()

getEditDomain

public ActiveEditDomain getEditDomain()
Returns the edit domain.

Returns:
the edit domain

gotoMarker

public void gotoMarker(org.eclipse.core.resources.IMarker marker)
Show the marker, preferably in the Outline, but failing that in the first page in which the marker is visible.

Specified by:
gotoMarker in interface org.eclipse.ui.ide.IGotoMarker

init

public void init(org.eclipse.ui.IEditorSite site,
                 org.eclipse.ui.IEditorInput editorInput)
          throws org.eclipse.ui.PartInitException
The MultiPageEditorExample implementation of this method checks that the input is an instance of IFileEditorInput.

Specified by:
init in interface org.eclipse.ui.IEditorPart
Overrides:
init in class org.eclipse.ui.part.MultiPageEditorPart
Throws:
org.eclipse.ui.PartInitException

isDirty

public boolean isDirty()
Returns true if the command stack is dirty

Specified by:
isDirty in interface org.eclipse.ui.ISaveablePart
Overrides:
isDirty in class org.eclipse.ui.part.MultiPageEditorPart
See Also:
ISaveablePart.isDirty()

isSaveAsAllowed

public boolean isSaveAsAllowed()
Specified by:
isSaveAsAllowed in interface org.eclipse.ui.ISaveablePart
Specified by:
isSaveAsAllowed in class org.eclipse.ui.part.EditorPart

openSheet

public void openSheet(GSheet sheet,
                      int sheetIndex)

refreshPageImageAndText

public void refreshPageImageAndText()
Refreshes the tabs.


resourceChanged

public void resourceChanged(org.eclipse.core.resources.IResourceChangeEvent event)
Closes all project files on project close.

Specified by:
resourceChanged in interface org.eclipse.core.resources.IResourceChangeListener