com.ibm.jdg2e.msseditor.ui
Class AbstractMiniSSEditor

java.lang.Object
  extended byorg.eclipse.ui.part.WorkbenchPart
      extended byorg.eclipse.ui.part.EditorPart
          extended bycom.ibm.jdg2e.msseditor.ui.AbstractMiniSSEditor
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.ui.IEditorPart, org.eclipse.core.runtime.IExecutableExtension, IMiniSSListener, org.eclipse.ui.ISaveablePart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2
Direct Known Subclasses:
MiniSSFileEditor, MiniSSResourceEditor

public abstract class AbstractMiniSSEditor
extends org.eclipse.ui.part.EditorPart
implements IMiniSSListener

Defines a sample "mini-spreadsheet" editor that demonstrates how to create an editor whose input is based on either resources from the workspace (IDE) or directly from the file system (RCP).


Field Summary
protected  MiniSS miniSpreadsheet
           
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
AbstractMiniSSEditor()
           
 
Method Summary
 void appendRow()
           
abstract  org.eclipse.ui.IEditorInput createNewInput(java.lang.String message)
          Create a new valid IEditorInput for this concrete implementation (e.g., by opening a "new dialog" or launching a creation wizard).
 void createPartControl(org.eclipse.swt.widgets.Composite parent)
           
 void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
           
 void doSaveAs()
           
 int getDefaultAlignment()
          Return the column alignment.
 MiniSS getMiniSpreadsheet()
          Returns the editor's model, the miniSpreadsheet.
 void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput editorInput)
           
 boolean isDirty()
           
 boolean isSaveAsAllowed()
           
 void rowsChanged(MiniSS miniSpreadsheet)
          Notification of a rows modification; the change is significant enough that a delta is not included in the notification, i.e., the receiver should assume that all rows may have changed.
abstract  boolean saveContents()
          Subclasses should persist the mini-spreadsheet in their implementation-specific manner (in our case, directly in file system or the workspace).
 void selectAll()
          Select all current rows in the mini-spreadsheet.
 void selectionChanged(org.eclipse.jface.viewers.ISelection selection)
          Respond to the Outline view's request to update the selection.
 void setAlignment(int alignment)
          Set alignment for all the columns.
abstract  void setContents(org.eclipse.ui.IEditorInput editorInput)
          Set the mini-spreadsheet's contents using the given IEditorInput (subclasses can assume it has previously been validated by validateEditorInput.
 void setFocus()
          Passing the focus request to the viewer's control.
protected  void setIsDirty(boolean isDirty)
          Flag the mini-spreadsheet as dirty, enable the Save options, an update the editor's modification indicator (*).
abstract  org.eclipse.ui.IEditorInput validateEditorInput(org.eclipse.ui.IEditorInput editorInput)
          Verify the editor input is valid (subclasses may transform it to another implementator of IEditorInput), or null if the input is unacceptable.
 void valueChanged(MiniSS miniSpreadsheet, int row, int column, java.lang.String newValue)
          Notification of a cell modification.
 
Methods inherited from class org.eclipse.ui.part.EditorPart
getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, dispose, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getPartName, getSite, getTitle, getTitleImage, removePropertyListener, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, dispose, getSite, getTitle, getTitleImage, removePropertyListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

miniSpreadsheet

protected MiniSS miniSpreadsheet
Constructor Detail

AbstractMiniSSEditor

public AbstractMiniSSEditor()
Method Detail

appendRow

public void appendRow()

createNewInput

public abstract org.eclipse.ui.IEditorInput createNewInput(java.lang.String message)
                                                    throws org.eclipse.core.runtime.CoreException
Create a new valid IEditorInput for this concrete implementation (e.g., by opening a "new dialog" or launching a creation wizard).

Throws:
org.eclipse.core.runtime.CoreException

createPartControl

public void createPartControl(org.eclipse.swt.widgets.Composite parent)
Specified by:
createPartControl in interface org.eclipse.ui.IWorkbenchPart
See Also:
IWorkbenchPart.createPartControl(Composite)

doSave

public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
Specified by:
doSave in interface org.eclipse.ui.ISaveablePart
See Also:
ISaveablePart.doSave(IProgressMonitor)

doSaveAs

public void doSaveAs()
Specified by:
doSaveAs in interface org.eclipse.ui.ISaveablePart
See Also:
ISaveablePart.doSaveAs()

getDefaultAlignment

public int getDefaultAlignment()
Return the column alignment.


getMiniSpreadsheet

public MiniSS getMiniSpreadsheet()
Returns the editor's model, the miniSpreadsheet.

Returns:
MiniSS

init

public void init(org.eclipse.ui.IEditorSite site,
                 org.eclipse.ui.IEditorInput editorInput)
          throws org.eclipse.ui.PartInitException
Specified by:
init in interface org.eclipse.ui.IEditorPart
Throws:
org.eclipse.ui.PartInitException
See Also:
IEditorPart.init(IEditorSite, IEditorInput)

isDirty

public boolean isDirty()
Specified by:
isDirty in interface org.eclipse.ui.ISaveablePart
See Also:
ISaveablePart.isDirty()

isSaveAsAllowed

public boolean isSaveAsAllowed()
Specified by:
isSaveAsAllowed in interface org.eclipse.ui.ISaveablePart
See Also:
ISaveablePart.isSaveAsAllowed()

rowsChanged

public void rowsChanged(MiniSS miniSpreadsheet)
Description copied from interface: IMiniSSListener
Notification of a rows modification; the change is significant enough that a delta is not included in the notification, i.e., the receiver should assume that all rows may have changed.

Specified by:
rowsChanged in interface IMiniSSListener
See Also:
IMiniSSListener.rowsChanged(MiniSS)

saveContents

public abstract boolean saveContents()
                              throws org.eclipse.core.runtime.CoreException
Subclasses should persist the mini-spreadsheet in their implementation-specific manner (in our case, directly in file system or the workspace).

Throws:
org.eclipse.core.runtime.CoreException

selectAll

public void selectAll()
Select all current rows in the mini-spreadsheet.


selectionChanged

public void selectionChanged(org.eclipse.jface.viewers.ISelection selection)
Respond to the Outline view's request to update the selection.

See Also:
MiniSSContentOutlinePage

setAlignment

public void setAlignment(int alignment)
Set alignment for all the columns.

Parameters:
alignment - SWT.LEFT, SWT.RIGHT, SWT.CENTER.

setContents

public abstract void setContents(org.eclipse.ui.IEditorInput editorInput)
                          throws org.eclipse.core.runtime.CoreException
Set the mini-spreadsheet's contents using the given IEditorInput (subclasses can assume it has previously been validated by validateEditorInput.

Throws:
org.eclipse.core.runtime.CoreException

setFocus

public void setFocus()
Passing the focus request to the viewer's control.

Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart

setIsDirty

protected void setIsDirty(boolean isDirty)
Flag the mini-spreadsheet as dirty, enable the Save options, an update the editor's modification indicator (*).


validateEditorInput

public abstract org.eclipse.ui.IEditorInput validateEditorInput(org.eclipse.ui.IEditorInput editorInput)
Verify the editor input is valid (subclasses may transform it to another implementator of IEditorInput), or null if the input is unacceptable.


valueChanged

public void valueChanged(MiniSS miniSpreadsheet,
                         int row,
                         int column,
                         java.lang.String newValue)
Description copied from interface: IMiniSSListener
Notification of a cell modification.

Specified by:
valueChanged in interface IMiniSSListener
Parameters:
miniSpreadsheet - changed MiniSS
row - row index (0-based)
column - column index (0-based)
newValue - new string value of changed cell
See Also:
IMiniSSListener.valueChanged(MiniSS, int, int, String)