sk.uniba.euromath.editor.textEditor.viewers
Class ScrollingTextGraphicalViewer

java.lang.Object
  extended by org.eclipse.gef.ui.parts.AbstractEditPartViewer
      extended by org.eclipse.gef.ui.parts.GraphicalViewerImpl
          extended by org.eclipse.gef.ui.parts.ScrollingGraphicalViewer
              extended by sk.uniba.euromath.editor.textEditor.viewers.ScrollingTextGraphicalViewer
All Implemented Interfaces:
org.eclipse.gef.EditPartViewer, org.eclipse.gef.GraphicalViewer, ISelectionProvider, IDOMSelectionChangedListener, IDOMSelectionProvider, IXMLGraphicalViewer

public class ScrollingTextGraphicalViewer
extends org.eclipse.gef.ui.parts.ScrollingGraphicalViewer
implements IXMLGraphicalViewer

Overrides selection funcionality of ScrollingGraphicalViewer. Selection is represented by DOMIntervalSet. Converts DOMIntervals from DOMIntervalSet to EditParts and start offset and end offset in this EditParts Call @see #commitSelection() when selecting ends (mouse up, button up), this fires selection to selectionChangedListeners

Author:
Martin Kollar

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.gef.EditPartViewer
org.eclipse.gef.EditPartViewer.Conditional
 
Field Summary
protected  List<IDOMSelectionChangedListener> selectionChangedListeners
           
 
Fields inherited from class org.eclipse.gef.ui.parts.AbstractEditPartViewer
constantSelection, focusPart, selection, selectionListeners
 
Constructor Summary
ScrollingTextGraphicalViewer(XMLEditor editor)
           
 
Method Summary
 void addSelectionChangedListener(IDOMSelectionChangedListener listener)
          Adds a listener for selection changes in this selection provider.
 void commitSelection()
          This tells to DOMSelectionChangeListeners(probably only TextEditor), about new selection.
 void deselect(org.eclipse.gef.EditPart editpart)
          Deselecting whole EditPart.
 void deselectAll()
          Deselects all selected editparts.
protected  void fireSelectionChanged()
          This is called when selecting ends (mouse up or button up)
 sk.baka.ikslibs.interval.DOMIntervalSet getDOMSelection()
          Returns copy of the current selection of provider.
 List getSelectedEditParts()
           
 void removeSelectionChangedListener(IDOMSelectionChangedListener listener)
          Removes the given selection change listener from this selection provider.
 void select(org.eclipse.gef.EditPart editpart)
          Selecting whole EditPart.
protected  void select(ITextPieceKeeper keeper, int start, int end)
           
 void selectionChanged(DOMSelectionChangedEvent event)
          Effect is same as using setSelection
 void setSelection(sk.baka.ikslibs.interval.DOMIntervalSet selection)
          Deselects editparts with Ids, that were in previous selection and select editparts that are in DOMIntervalSet
 void showSelection(sk.baka.ikslibs.interval.DOMIntervalSet selection)
          Shows selection, but actual selection doesn't changes.
 
Methods inherited from class org.eclipse.gef.ui.parts.ScrollingGraphicalViewer
createControl, getFigureCanvas, reveal, setRootFigure
 
Methods inherited from class org.eclipse.gef.ui.parts.GraphicalViewerImpl
createDefaultRoot, createLightweightSystem, findHandleAt, findObjectAtExcluding, flush, getEventDispatcher, getLayerManager, getLightweightSystem, getRootFigure, handleDispose, handleFocusGained, handleFocusLost, hookControl, hookDropTarget, registerAccessibleEditPart, setContextMenu, setCursor, setDragSource, setEditDomain, setRootEditPart, setRouteEventsToEditDomain, unhookControl, unregisterAccessibleEditPart
 
Methods inherited from class org.eclipse.gef.ui.parts.AbstractEditPartViewer
addDragSourceListener, addDragSourceListener, addDropTargetListener, addDropTargetListener, addPropertyChangeListener, addSelectionChangedListener, appendSelection, findObjectAt, findObjectAtExcluding, getContents, getContextMenu, getControl, getDelegatingDragAdapter, getDelegatingDropAdapter, getDragSource, getDropTarget, getEditDomain, getEditPartFactory, getEditPartRegistry, getFocusEditPart, getKeyHandler, getProperty, getRootEditPart, getSelection, getSelectionManager, getVisualPartMap, hookDragSource, init, primGetSelectedEditParts, refreshDragSourceAdapter, refreshDropTargetAdapter, removeDragSourceListener, removeDragSourceListener, removeDropTargetListener, removeDropTargetListener, removePropertyChangeListener, removeSelectionChangedListener, setContents, setContents, setControl, setDropTarget, setEditPartFactory, setFocus, setKeyHandler, setProperty, setSelection, setSelectionManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.gef.GraphicalViewer
findHandleAt
 
Methods inherited from interface org.eclipse.gef.EditPartViewer
addDragSourceListener, addDragSourceListener, addDropTargetListener, addDropTargetListener, addPropertyChangeListener, appendSelection, createControl, findObjectAt, findObjectAtExcluding, findObjectAtExcluding, flush, getContents, getContextMenu, getControl, getEditDomain, getEditPartFactory, getEditPartRegistry, getFocusEditPart, getKeyHandler, getProperty, getRootEditPart, getSelection, getSelectionManager, getVisualPartMap, registerAccessibleEditPart, removeDragSourceListener, removeDragSourceListener, removeDropTargetListener, removeDropTargetListener, removePropertyChangeListener, reveal, setContents, setContents, setContextMenu, setControl, setCursor, setEditDomain, setEditPartFactory, setFocus, setKeyHandler, setProperty, setRootEditPart, setRouteEventsToEditDomain, setSelectionManager, unregisterAccessibleEditPart
 
Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
addSelectionChangedListener, removeSelectionChangedListener, setSelection
 

Field Detail

selectionChangedListeners

protected List<IDOMSelectionChangedListener> selectionChangedListeners
Constructor Detail

ScrollingTextGraphicalViewer

public ScrollingTextGraphicalViewer(XMLEditor editor)
Parameters:
editor - Editor that uses this viewer to view its state
Method Detail

addSelectionChangedListener

public void addSelectionChangedListener(IDOMSelectionChangedListener listener)
Description copied from interface: IDOMSelectionProvider
Adds a listener for selection changes in this selection provider. Has no effect if an identical listener is already registered.

Specified by:
addSelectionChangedListener in interface IDOMSelectionProvider
Parameters:
listener - new listener to be add from selectionChangedListeners

removeSelectionChangedListener

public void removeSelectionChangedListener(IDOMSelectionChangedListener listener)
Description copied from interface: IDOMSelectionProvider
Removes the given selection change listener from this selection provider. Has no affect if an identical listener is not registered.

Specified by:
removeSelectionChangedListener in interface IDOMSelectionProvider
Parameters:
listener - listener to be removed from selectionChangedListeners

showSelection

public void showSelection(sk.baka.ikslibs.interval.DOMIntervalSet selection)
Description copied from interface: IXMLGraphicalViewer
Shows selection, but actual selection doesn't changes.

Specified by:
showSelection in interface IXMLGraphicalViewer
Parameters:
selection - the selection to show

setSelection

public void setSelection(sk.baka.ikslibs.interval.DOMIntervalSet selection)
Deselects editparts with Ids, that were in previous selection and select editparts that are in DOMIntervalSet

Specified by:
setSelection in interface IDOMSelectionProvider
Parameters:
selection - DOMIntervalSet containing DOMInetervals, that have to be selected

selectionChanged

public void selectionChanged(DOMSelectionChangedEvent event)
Effect is same as using setSelection

Specified by:
selectionChanged in interface IDOMSelectionChangedListener
Parameters:
event - DOMSelectionChangedEvent that contains source of new selction, that should be some XMLEditor and DOMIntervalSet as selection

fireSelectionChanged

protected void fireSelectionChanged()
This is called when selecting ends (mouse up or button up)

Overrides:
fireSelectionChanged in class org.eclipse.gef.ui.parts.AbstractEditPartViewer

select

protected void select(ITextPieceKeeper keeper,
                      int start,
                      int end)

select

public void select(org.eclipse.gef.EditPart editpart)
Selecting whole EditPart. When this EditPart was not in selected EditParts, than fireSelectionChanged() If editpart is ITextPieceKeeper then visualization is left on

Specified by:
select in interface org.eclipse.gef.EditPartViewer
Overrides:
select in class org.eclipse.gef.ui.parts.AbstractEditPartViewer
Parameters:
editpart - EditPart that is going to be selected
See Also:
If editpart is not ITextPieceKeeper then visualization is left on this editpart., EditPart#setSelected(EditPart.SELECTED)

deselect

public void deselect(org.eclipse.gef.EditPart editpart)
Deselecting whole EditPart. Alwas fires selection change If editpart is ITextPieceKeeper then visualization is left on

Specified by:
deselect in interface org.eclipse.gef.EditPartViewer
Overrides:
deselect in class org.eclipse.gef.ui.parts.AbstractEditPartViewer
Parameters:
editpart - EditPart that is going to be deselected
See Also:
If editpart is not ITextPieceKeeper then visualization is left on this editpart., EditPart#setSelected(EditPart.SELECTED_NONE)

deselectAll

public void deselectAll()
Deselects all selected editparts. At the end fires selection change

Specified by:
deselectAll in interface org.eclipse.gef.EditPartViewer
Overrides:
deselectAll in class org.eclipse.gef.ui.parts.AbstractEditPartViewer

commitSelection

public void commitSelection()
This tells to DOMSelectionChangeListeners(probably only TextEditor), about new selection. Local selection of this GraphiclViewer becomes a globalSelction Call this method when selction ends - mouse up, Shift key up, etc.


getSelectedEditParts

public List getSelectedEditParts()
Specified by:
getSelectedEditParts in interface org.eclipse.gef.EditPartViewer
Overrides:
getSelectedEditParts in class org.eclipse.gef.ui.parts.AbstractEditPartViewer

getDOMSelection

public sk.baka.ikslibs.interval.DOMIntervalSet getDOMSelection()
Description copied from interface: IDOMSelectionProvider
Returns copy of the current selection of provider.

Specified by:
getDOMSelection in interface IDOMSelectionProvider
Returns:
global selection


Copyright © 2003-2006 null. All Rights Reserved.