|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.core.commands.common.EventManager org.eclipse.ui.part.WorkbenchPart org.eclipse.ui.part.EditorPart sk.uniba.euromath.editor.EditorSite
public final class EditorSite
TODO STUDVA recoment
This class houses instances of IEditors: chooses from available, creates and/or destroys instances of IEditors when required and creates and positions Composites for them.
Is is also ISelectionProvider and owns XMLSelection. Other
IXMLSelectionProviders refernces this XMLSelection, modifies it and send
changes back to EditorSite through methods setSelection(...) or
selectionChanged(...)
Is also responsible for loading, transforming, saving. Main functionality is driven by GENE.
Acts as view in MultiViewXMLEditor.
IEditor
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 | |
---|---|
EditorSite(MultiViewXMLEditor parentMultiEditor)
Constructor. |
Method Summary | |
---|---|
void |
addFocusListener(IFocusListener listener)
Adds listener as focus listener. |
void |
addSelectionChangedListener(IDOMSelectionChangedListener listener)
Adds a listener for selection changes in this selection provider. |
void |
addSelectionChangedListener(ISelectionChangedListener listener)
|
void |
createPartControl(Composite parent)
|
void |
dataChanged(Map<CoordinatorInputKey,GeneDataProvider.RendererSite> rendererKeys,
CoordinatorInputKey rootKey,
Map<CoordinatorInputKey,Set<CoordinatorInputKey>> nametreeHierarchy,
Map<String,CoordinatorInputKey> geneIdMapping,
Set<CoordinatorInputKey> newKeys,
Set<CoordinatorInputKey> deletedKeys)
Editor site instance receives data change events using this method. |
void |
dispose()
|
void |
doSave(IProgressMonitor monitor)
|
void |
doSaveAs()
|
void |
focusGained(IEditor editor)
IEditor has gained focus. |
void |
focusLost(IEditor editor)
IEditor has lost focus. |
MultiViewActionContributor |
getActionContributor()
|
IEditor |
getActiveEditor()
Returns active editor. |
Object |
getAdapter(Class adapter)
Returns the adapter for the specified class. |
Collection<IEditor> |
getAllIEditors()
Returns all IEditors in this site. |
DOMIntervalSet |
getDOMSelection()
Returns copy of the current selection of provider. |
XMLOutlinePage |
getOutlinePage()
Returns outline page instance. |
MultiViewXMLEditor |
getParentMultiEditor()
Returns multi editor containing this EditorSite instance as child view. |
Composite |
getRootComposite()
|
IEditor |
getRootEditor()
Returns root editor. |
ISelection |
getSelection()
|
Set<String> |
getVisualizedIds()
Returns ids of nodes which are graphically rendered(represented) by at least one IEditor. |
XMLAccess |
getXMLAccess()
Returns document instance. |
void |
init(IEditorSite site,
IEditorInput input)
|
void |
initReceiver()
Initializes the receiver. |
boolean |
isDirty()
|
boolean |
isRootEditor(IEditor editor)
Test if IEditor is root editor. |
boolean |
isSaveAsAllowed()
|
void |
removeFocusListener(IFocusListener listener)
Removes listener. |
void |
removeSelectionChangedListener(IDOMSelectionChangedListener listener)
Removes the given selection change listener from this selection provider. |
void |
removeSelectionChangedListener(ISelectionChangedListener listener)
|
void |
selectionChanged(DOMSelectionChangedEvent event)
Source of event can be IEditor ContentOutline something else for future All this sources should be IXMLSelectionProviders, but more imporatant is that their IXMLSelection have to be "synchronized" with other IXMLSelectionProviders |
void |
setActionContributor(MultiViewActionContributor actionContributor)
Initializes every IEditor with shared action registry. |
void |
setFocus()
Sets focus to activete this EditorSite. |
void |
setSelection(DOMIntervalSet selection)
Routes this new IXMLSelection to all listeners |
void |
setSelection(DOMIntervalSet selection,
Boolean toAll)
Fires SelectionEvent to all listeners, if toAll is true . |
void |
setSelection(ISelection selection)
|
protected void |
startSelectionListening()
Starts listening to selection change events. |
protected void |
stopSelectionListening()
Stops listening to selection change events. |
Methods inherited from class org.eclipse.ui.part.EditorPart |
---|
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartName |
Methods inherited from class org.eclipse.ui.part.WorkbenchPart |
---|
addPropertyListener, firePropertyChange, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getSite, getTitle, getTitleImage, removePropertyListener, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy |
Methods inherited from class org.eclipse.core.commands.common.EventManager |
---|
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject |
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 |
Constructor Detail |
---|
public EditorSite(MultiViewXMLEditor parentMultiEditor)
parentMultiEditor
- host for this EditorSite.Method Detail |
---|
public void doSave(IProgressMonitor monitor)
doSave
in interface ISaveablePart
doSave
in class EditorPart
ISaveablePart.doSave(org.eclipse.core.runtime.IProgressMonitor)
public void doSaveAs()
doSaveAs
in interface ISaveablePart
doSaveAs
in class EditorPart
ISaveablePart.doSaveAs()
public void init(IEditorSite site, IEditorInput input) throws PartInitException
init
in interface IEditorPart
init
in class EditorPart
PartInitException
IEditorPart.init(org.eclipse.ui.IEditorSite,
org.eclipse.ui.IEditorInput)
public boolean isDirty()
isDirty
in interface ISaveablePart
isDirty
in class EditorPart
ISaveablePart.isDirty()
public boolean isSaveAsAllowed()
isSaveAsAllowed
in interface ISaveablePart
isSaveAsAllowed
in class EditorPart
ISaveablePart.isSaveAsAllowed()
public void initReceiver()
IEditorDataReceiver
initReceiver
in interface IEditorDataReceiver
public void dataChanged(Map<CoordinatorInputKey,GeneDataProvider.RendererSite> rendererKeys, CoordinatorInputKey rootKey, Map<CoordinatorInputKey,Set<CoordinatorInputKey>> nametreeHierarchy, Map<String,CoordinatorInputKey> geneIdMapping, Set<CoordinatorInputKey> newKeys, Set<CoordinatorInputKey> deletedKeys) throws EditorException
IEditorDataReceiver
Editor site instance receives data change events using this method.
Parameters must NOT be changed. For more info on the parameters see
GeneDataProvider
class.
dataChanged
in interface IEditorDataReceiver
rendererKeys
- Maps input pipe ID to a renderer instance. Shows
current state - keys recently deleted (keys present in the
deletedKeys
set) are not present.rootKey
- The root key of the hierarchy. It is not expected to be
changed between dataChanged
calls, only in extreme
situation when whole document is scraped and recreated.nametreeHierarchy
- The nametree (key) hierarchy. Maps key to a set
of its children. If key is missing from the map, maps to
null
value or an empty set then the nametree does not have
any children. Shows current state - keys recently deleted (keys present
in the deletedKeys
set) are not present.geneIdMapping
- Maps GENE-generated ids to the coordinator input key
instance. Used by renderer context to map from GENE id (provided to the
renderer) to child renderer instance. Shows current state - keys recently
deleted (keys present in the deletedKeys
set) are not
present.newKeys
- Contains set of new keys (keys that were not introduced in
previous GENE output processing).deletedKeys
- Contains set of keys that were introduced in previous
GENE output processing but they are missing in current data.
EditorException
- if fatal exception occurs. Editor errors should
be handled by the receiver properly (for example by replacing the editor
canvas with an Error banner).IEditorDataReceiver.dataChanged(java.util.Map,
CoordinatorInputKey, java.util.Map, java.util.Map,
java.util.Set, java.util.Set)
public void createPartControl(Composite parent)
createPartControl
in interface IWorkbenchPart
createPartControl
in class WorkbenchPart
public XMLOutlinePage getOutlinePage()
public void setFocus()
setFocus
in interface IWorkbenchPart
setFocus
in class WorkbenchPart
public IEditor getActiveEditor()
public IEditor getRootEditor()
public MultiViewXMLEditor getParentMultiEditor()
public XMLAccess getXMLAccess()
public void addSelectionChangedListener(IDOMSelectionChangedListener listener)
IDOMSelectionProvider
addSelectionChangedListener
in interface IDOMSelectionProvider
listener
- a DOM selection changed listenerpublic void removeSelectionChangedListener(IDOMSelectionChangedListener listener)
IDOMSelectionProvider
removeSelectionChangedListener
in interface IDOMSelectionProvider
listener
- a DOM selection changed listenerpublic DOMIntervalSet getDOMSelection()
IDOMSelectionProvider
getDOMSelection
in interface IDOMSelectionProvider
public void setSelection(DOMIntervalSet selection)
setSelection
in interface IDOMSelectionProvider
selection
- DOM selection to setpublic void setSelection(DOMIntervalSet selection, Boolean toAll)
true
.
Otherwise fires SelectionEvent only to active editor, if it provides
selections (is IXMLSelectionProvider)
selection
- IXMLSelectiontoAll
- true
means route in all IEditors, that
provides selections false
route only in
active editor, if it provides selectionsprotected void stopSelectionListening()
protected void startSelectionListening()
public void selectionChanged(DOMSelectionChangedEvent event)
selectionChanged
in interface IDOMSelectionChangedListener
event
- SelectionChangedEvent If event.getSelection() is
not instance of XMLSelection, does nothing.public void setActionContributor(MultiViewActionContributor actionContributor)
actionContributor
- public Object getAdapter(Class adapter)
getAdapter
in interface IAdaptable
getAdapter
in class WorkbenchPart
public boolean isRootEditor(IEditor editor)
editor
- to test
true
if editor is a rootEditorpublic MultiViewActionContributor getActionContributor()
public void addFocusListener(IFocusListener listener)
listener
- to addpublic void removeFocusListener(IFocusListener listener)
listener
- to removepublic void focusGained(IEditor editor)
focusGained
in interface IFocusListener
editor
- which has acquired focuspublic void focusLost(IEditor editor)
focusLost
in interface IFocusListener
editor
- which has lost focuspublic Collection<IEditor> getAllIEditors()
public Set<String> getVisualizedIds()
public Composite getRootComposite()
public void addSelectionChangedListener(ISelectionChangedListener listener)
addSelectionChangedListener
in interface ISelectionProvider
public ISelection getSelection()
getSelection
in interface ISelectionProvider
public void removeSelectionChangedListener(ISelectionChangedListener listener)
removeSelectionChangedListener
in interface ISelectionProvider
public void setSelection(ISelection selection)
setSelection
in interface ISelectionProvider
public void dispose()
dispose
in interface IWorkbenchPart
dispose
in class WorkbenchPart
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |