|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sk.uniba.euromath.editor.xmlEditor.XMLEditor
public class XMLEditor
Common IEditor for any namespaces and any renderer. Used by default, if no editor is registered for namespace. Is implemented using GEF, providing structure(of whole nodes) selections, context menu, editing capabilities. Uses only one type EditPart - XMLEditPart. EditDomain provides one tool - XMLStructureTool. GraphicalViewer is XMLScrollingGraphicalViewer if this is root editor in IEditor "hierarchy" otherwise XMLGraphicalViewerImpl. Uses XMLActionContributor to create context menu and to contribute to global bars and context menu.
Constructor Summary | |
---|---|
XMLEditor()
Constructor. |
Method Summary | |
---|---|
void |
addFocusListener(IFocusListener listener)
Adds listener for focus events. |
void |
addSelectionChangedListener(IDOMSelectionChangedListener listener)
Adds a listener for selection changes in this selection provider. |
protected void |
configureGraphicalViewer()
Configures viewer for work. |
protected IActionContributor |
createActionContributor()
Creates action contributor. |
protected void |
createAndInitKeyHandler()
Creates and inits KeyHandler which handles key events, when no tool is active. |
protected org.eclipse.gef.EditDomain |
createEditDomain()
Creates and configures EditDomain. |
protected XMLEditPartFactory |
createEditPartFactory()
Creates XMLEditPartFactory. |
void |
createGraphicalViewer(Composite parent)
Creates GraphicalViewer on parent Composite for transformed doc source. |
protected org.eclipse.gef.RootEditPart |
createRootEditPart()
Creates root editpart |
protected org.eclipse.gef.EditPart |
createTopEditPart(IEMFigure rootFigure)
Creates top most editpart which is editor dependend - manipulates with model, is used as editpart for editor dependent view - root figure. |
void |
dispose()
Prepares for end of work. |
protected void |
fireSelectionChangeEvent(DOMIntervalSet selection)
Fires selection change event. |
void |
focusGained(FocusEvent e)
|
void |
focusLost(FocusEvent e)
|
IActionContributor |
getActionContributor()
Returns xml action contributor, can be called only after init. |
Composite |
getClientComposite()
Returns Composite where children IEditors will be created. |
protected org.eclipse.gef.commands.CommandStack |
getCommandStack()
Returns the command stack. |
DOMIntervalSet |
getDOMSelection()
Returns copy of the current selection of provider. |
protected org.eclipse.gef.EditDomain |
getEditDomain()
Returns EditDomain. |
EditorSite |
getEditorSite()
Getter. |
XMLEditPartFactory |
getEditPartFactory()
Getter |
List<IFocusListener> |
getFocusListeners()
|
protected org.eclipse.gef.GraphicalViewer |
getGraphicalViewer()
Returns graphical viewer hooked on this Editor's composite. |
Composite |
getHostingComposite()
Returns composite, which host this IEditor. |
protected IEditorSite |
getIEditorSite()
Returns EditorSite's PartSite. |
IRenderer |
getRenderer()
Returns renderer associated with this IEditor. |
ArrayList<IDOMSelectionChangedListener> |
getSelectionListeners()
|
IdVisualInfo |
getVisualInfo()
Returns IdVisualInfo object. |
Set<String> |
getVisualizedIds()
Returns ids of nodes which are graphically rendered(represented) by this editor. |
XMLAccess |
getXMLAccess()
Getter. |
protected void |
hookGraphicalViewer()
Hooks the GraphicalViewer to the rest of the EditorSite. |
void |
init(Source transformedDoc,
IRenderer renderer,
Composite parent,
XMLAccess xmlAccess,
EditorSite editorSite)
Initializes the editor. |
protected void |
initializeGraphicalViewer(IEMFigure rootFigure)
Set the contents of the GraphicalViewer, when is ready. |
boolean |
isRootEditor()
|
void |
performPaintUpdate()
Paints all figures needed to repaint. |
void |
reinit(Source transformedDoc,
IChangeCollector changes)
Reinitialize the editor when a partial change of the transformed document occurs. |
void |
removeFocusListener(IFocusListener listener)
Removes listener for focus events. |
void |
removeSelectionChangedListener(IDOMSelectionChangedListener listener)
Removes the given selection change listener from this selection provider. |
void |
selectionChanged(DOMSelectionChangedEvent event)
If event is IXMLSelection than this selection is routed to SelectionListeners in other way do nothing |
void |
setActionContributor(IActionContributor actionContributor)
|
void |
setEditPartFactory(XMLEditPartFactory editPartFactory)
Setter. |
void |
setFocus()
Sets this Editor active. |
protected void |
setGraphicalViewer(org.eclipse.gef.GraphicalViewer viewer)
Setter for GraphicalViewer. |
protected void |
setKeyHandler(org.eclipse.gef.KeyHandler keyHandler)
|
void |
setSelection(DOMIntervalSet selection)
Routs information about this new IXMLSelection to SelectionListeners |
void |
sortIds(List<String> ids)
Sorts ids in manner as they are graphicaly displayed. |
protected void |
startSelectionListening()
Starts listening to selection change events. |
protected void |
stopSelectionListening()
Stops listening to selection change events. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLEditor()
Method Detail |
---|
public EditorSite getEditorSite()
public boolean isRootEditor()
true
if this is a rootEditorprotected void configureGraphicalViewer()
source
- protected XMLEditPartFactory createEditPartFactory()
protected void createAndInitKeyHandler()
protected void hookGraphicalViewer()
protected org.eclipse.gef.GraphicalViewer getGraphicalViewer()
protected void setGraphicalViewer(org.eclipse.gef.GraphicalViewer viewer)
viewer
- public void createGraphicalViewer(Composite parent)
parent
- source
- protected void initializeGraphicalViewer(IEMFigure rootFigure)
rootFigure
- root of tree of figures, to edit/display.protected org.eclipse.gef.EditPart createTopEditPart(IEMFigure rootFigure)
rootFigure
- root of figure tree to edit/display
public void init(Source transformedDoc, IRenderer renderer, Composite parent, XMLAccess xmlAccess, EditorSite editorSite) throws EditorException
IEditor
Initializes the editor. The editor should retrieve all figures from the renderer and display them on given composite. It must NOT resize nor move the composite or its children - this is handled by the EditorSite itself.
The editor works with two 'kinds' of document:
source
parameter, and it
MUST NOT be modified. This document is given to the renderer instance.xmlAccess
facility.
init
in interface IEditor
transformedDoc
- the transformed document, rendered by the renderer.
May be instance of DOMSource
or ObjectSource
only. Editor is encouraged to throw any exception including
ClassCastException
if it encounters illegal objects, to
detect invalid objects quickly and cleanly.renderer
- instance of the renderer, rendering the transformed
document. The renderer instance is used only in this instance of editor.parent
- Composite
where to install
IFigure
s.xmlAccess
- the source document accessor.editorSite
- host for this class.
EditorException
- if the editor cannot be initialized. In such case
the common text editor/generic editor/read-only editor shall be used.public void reinit(Source transformedDoc, IChangeCollector changes)
IEditor
Reinitialize the editor when a partial change of the transformed document occurs. The reinitialization of renderer is already finished - editor should query for new figures for each changed element.
reinit
in interface IEditor
transformedDoc
- source with all changes already applied.changes
- defines changed elements. Has appropriate type for
transformedDoc
parameter, i.e. DOMChangeCollector
for DOMSource
etc.public IdVisualInfo getVisualInfo()
protected IActionContributor createActionContributor()
public XMLAccess getXMLAccess()
protected IEditorSite getIEditorSite()
public IRenderer getRenderer()
getRenderer
in interface IEditor
public Composite getClientComposite()
getClientComposite
in interface IEditor
public Composite getHostingComposite()
getHostingComposite
in interface IEditor
public void setFocus()
setFocus
in interface IEditor
public void performPaintUpdate()
IEditor
performPaintUpdate
in interface IEditor
protected org.eclipse.gef.commands.CommandStack getCommandStack()
protected org.eclipse.gef.EditDomain getEditDomain()
protected org.eclipse.gef.EditDomain createEditDomain()
protected org.eclipse.gef.RootEditPart createRootEditPart()
public XMLEditPartFactory getEditPartFactory()
public void setEditPartFactory(XMLEditPartFactory editPartFactory)
editPartFactory
- to setpublic void dispose()
IEditor
dispose
in interface IEditor
public DOMIntervalSet getDOMSelection()
IDOMSelectionProvider
getDOMSelection
in interface IDOMSelectionProvider
public void addSelectionChangedListener(IDOMSelectionChangedListener listener)
IDOMSelectionProvider
addSelectionChangedListener
in interface IDOMSelectionProvider
listener
- IDOMSelectionChangedListener to be add to listenerspublic void removeSelectionChangedListener(IDOMSelectionChangedListener listener)
IDOMSelectionProvider
removeSelectionChangedListener
in interface IDOMSelectionProvider
listener
- IDOMSelectionChangedListener to be removed from
listenersprotected void stopSelectionListening()
protected void startSelectionListening()
protected void fireSelectionChangeEvent(DOMIntervalSet selection)
selection
- DOMIntervalSet instance which will be firedpublic void setSelection(DOMIntervalSet selection)
setSelection
in interface IDOMSelectionProvider
selection
- IXMLSelection to setpublic void selectionChanged(DOMSelectionChangedEvent event)
selectionChanged
in interface IDOMSelectionChangedListener
event
- public ArrayList<IDOMSelectionChangedListener> getSelectionListeners()
public IActionContributor getActionContributor()
getActionContributor
in interface IEditor
public void setActionContributor(IActionContributor actionContributor)
actionContributor
- The ActionContributor to set.public void addFocusListener(IFocusListener listener)
IEditor
addFocusListener
in interface IEditor
public void removeFocusListener(IFocusListener listener)
IEditor
removeFocusListener
in interface IEditor
public void focusGained(FocusEvent e)
focusGained
in interface FocusListener
public void focusLost(FocusEvent e)
focusLost
in interface FocusListener
public List<IFocusListener> getFocusListeners()
public Set<String> getVisualizedIds()
IEditor
getVisualizedIds
in interface IEditor
protected void setKeyHandler(org.eclipse.gef.KeyHandler keyHandler)
keyHandler
- The keyHandler to set.public void sortIds(List<String> ids)
IEditor
sortIds
in interface IEditor
ids
- list of ids to sort
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |