java.lang.Objectorg.eclipse.ui.part.WorkbenchPart
org.eclipse.ui.part.EditorPart
com.ibm.jdg2e.msseditor.ui.AbstractMiniSSEditor
com.ibm.jdg2e.msseditor.ui.MiniSSResourceEditor
Defines a sample "mini-spreadsheet" editor that demonstrates how to create an editor whose input is based on resources from the workspace.
The mini-spreadsheet editor defines its own toolbar button, main menu bar
pull-down labeled "Calculations," and context menu. It will also allow others
to extend it with their own actions; for example, the
com.ibm.jdg2e.msseditor.extras plug-in contributes toolbar
buttons, menu choices, and editor pop-up menu choices (denoted in the UI with
an asterisk).
| Field Summary |
| Fields inherited from class com.ibm.jdg2e.msseditor.ui.AbstractMiniSSEditor |
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 | |
MiniSSResourceEditor()
|
|
| Method Summary | |
org.eclipse.ui.IEditorInput |
createNewInput(java.lang.String message)
Create a new valid IEditorInput for this concrete
implementation, an editor input of IFile. |
void |
dispose()
|
org.eclipse.ui.part.ShowInContext |
getShowInContext()
|
java.lang.String[] |
getShowInTargetIds()
|
void |
init(org.eclipse.ui.IEditorSite site,
org.eclipse.ui.IEditorInput editorInput)
|
void |
resourceChanged(org.eclipse.core.resources.IResourceChangeEvent event)
This editor is a resource change listener in order to detect "special" situations. |
boolean |
saveContents()
Persist the mini-spreadsheet as a workspace resource, allowing for the Restore from Local History options. |
void |
setContents(org.eclipse.ui.IEditorInput editorInput)
Set the mini-spreadsheet's contents using the given IEditorInput,
knowing that it has already been validated. |
org.eclipse.ui.IEditorInput |
validateEditorInput(org.eclipse.ui.IEditorInput editorInput)
Return the given editor input if it valid without attempting to adapt it. |
| Methods inherited from class com.ibm.jdg2e.msseditor.ui.AbstractMiniSSEditor |
appendRow, createPartControl, doSave, doSaveAs, getDefaultAlignment, getMiniSpreadsheet, isDirty, isSaveAsAllowed, rowsChanged, selectAll, selectionChanged, setAlignment, setFocus, setIsDirty, valueChanged |
| 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, 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, getSite, getTitle, getTitleImage, removePropertyListener |
| Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
getAdapter |
| Constructor Detail |
public MiniSSResourceEditor()
| Method Detail |
public org.eclipse.ui.IEditorInput createNewInput(java.lang.String message)
throws org.eclipse.core.runtime.CoreException
IEditorInput for this concrete
implementation, an editor input of IFile.
createNewInput in class AbstractMiniSSEditororg.eclipse.core.runtime.CoreExceptionpublic void dispose()
dispose in interface org.eclipse.ui.IWorkbenchPartIWorkbenchPart.dispose()public org.eclipse.ui.part.ShowInContext getShowInContext()
getShowInContext in interface org.eclipse.ui.part.IShowInSourcepublic java.lang.String[] getShowInTargetIds()
getShowInTargetIds in interface org.eclipse.ui.part.IShowInTargetList
public void init(org.eclipse.ui.IEditorSite site,
org.eclipse.ui.IEditorInput editorInput)
throws org.eclipse.ui.PartInitException
init in interface org.eclipse.ui.IEditorPartinit in class AbstractMiniSSEditororg.eclipse.ui.PartInitExceptionIEditorPart.init(IEditorSite, IEditorInput)public void resourceChanged(org.eclipse.core.resources.IResourceChangeEvent event)
resourceChanged in interface org.eclipse.core.resources.IResourceChangeListenerIResourceChangeListener.resourceChanged(IResourceChangeEvent)
public boolean saveContents()
throws org.eclipse.core.runtime.CoreException
saveContents in class AbstractMiniSSEditororg.eclipse.core.runtime.CoreException
public void setContents(org.eclipse.ui.IEditorInput editorInput)
throws org.eclipse.core.runtime.CoreException
IEditorInput,
knowing that it has already been validated.
setContents in class AbstractMiniSSEditororg.eclipse.core.runtime.CoreExceptionvalidateEditorInput(IEditorInput)public org.eclipse.ui.IEditorInput validateEditorInput(org.eclipse.ui.IEditorInput editorInput)
Editor Note: A fuller implementation might accept
any input that is adaptable to the ILocationProvider
protocol. As coded, this implementation will only allow
workspace resources, not arbitrary files, such as those
that are accessible from the File > Open External File... menu choice.
Moving the MiniSSEditorInput from the
com.ibm.jdg2e.msseditor.miniwp project to the
com.ibm.jdg2e.msseditor.common project
would accomplish much of this goal, if desired. We decided against
this approach because it would blur the distinction between workspace-centric
and file system-centric implementations. Or to put it another way, allowing
arbitrary file system access in a workspace-oriented editor may serve the
interests of the user, but would complicate the points our book wishes to convey.
Also see related bug 58179 ("Problems with opening external files").
validateEditorInput in class AbstractMiniSSEditororg.eclipse.ui.editors.text.ILocationProvider,
AbstractMiniSSEditor.validateEditorInput(IEditorInput)