java.lang.Objectorg.eclipse.ui.part.WorkbenchPart
org.eclipse.ui.part.EditorPart
com.ibm.jdg2e.msseditor.ui.AbstractMiniSSEditor
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 |
protected MiniSS miniSpreadsheet
| Constructor Detail |
public AbstractMiniSSEditor()
| Method Detail |
public void appendRow()
public abstract org.eclipse.ui.IEditorInput createNewInput(java.lang.String message)
throws org.eclipse.core.runtime.CoreException
IEditorInput for this concrete
implementation (e.g., by opening a "new dialog" or launching a
creation wizard).
org.eclipse.core.runtime.CoreExceptionpublic void createPartControl(org.eclipse.swt.widgets.Composite parent)
createPartControl in interface org.eclipse.ui.IWorkbenchPartIWorkbenchPart.createPartControl(Composite)public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
doSave in interface org.eclipse.ui.ISaveablePartISaveablePart.doSave(IProgressMonitor)public void doSaveAs()
doSaveAs in interface org.eclipse.ui.ISaveablePartISaveablePart.doSaveAs()public int getDefaultAlignment()
public MiniSS getMiniSpreadsheet()
public void init(org.eclipse.ui.IEditorSite site,
org.eclipse.ui.IEditorInput editorInput)
throws org.eclipse.ui.PartInitException
init in interface org.eclipse.ui.IEditorPartorg.eclipse.ui.PartInitExceptionIEditorPart.init(IEditorSite, IEditorInput)public boolean isDirty()
isDirty in interface org.eclipse.ui.ISaveablePartISaveablePart.isDirty()public boolean isSaveAsAllowed()
isSaveAsAllowed in interface org.eclipse.ui.ISaveablePartISaveablePart.isSaveAsAllowed()public void rowsChanged(MiniSS miniSpreadsheet)
IMiniSSListener
rowsChanged in interface IMiniSSListenerIMiniSSListener.rowsChanged(MiniSS)
public abstract boolean saveContents()
throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreExceptionpublic void selectAll()
public void selectionChanged(org.eclipse.jface.viewers.ISelection selection)
MiniSSContentOutlinePagepublic void setAlignment(int alignment)
alignment - SWT.LEFT, SWT.RIGHT, SWT.CENTER.
public abstract void setContents(org.eclipse.ui.IEditorInput editorInput)
throws org.eclipse.core.runtime.CoreException
IEditorInput
(subclasses can assume it has previously been validated
by validateEditorInput.
org.eclipse.core.runtime.CoreExceptionpublic void setFocus()
setFocus in interface org.eclipse.ui.IWorkbenchPartprotected void setIsDirty(boolean isDirty)
public abstract org.eclipse.ui.IEditorInput validateEditorInput(org.eclipse.ui.IEditorInput editorInput)
IEditorInput), or null if the
input is unacceptable.
public void valueChanged(MiniSS miniSpreadsheet,
int row,
int column,
java.lang.String newValue)
IMiniSSListener
valueChanged in interface IMiniSSListenerminiSpreadsheet - changed MiniSSrow - row index (0-based)column - column index (0-based)newValue - new string value of changed cellIMiniSSListener.valueChanged(MiniSS,
int, int, String)