SWT LPEX
v3.0.5

com.ibm.lpex.samples
Class MouseReselect

java.lang.Object
  extended bycom.ibm.lpex.core.LpexViewAdapter
      extended bycom.ibm.lpex.samples.MouseReselect
All Implemented Interfaces:
DisposeListener, EventListener, LpexViewListener, MouseListener, MouseMoveListener, SWTEventListener

public class MouseReselect
extends LpexViewAdapter
implements MouseListener, MouseMoveListener, DisposeListener

Sample class to make new drags of mouse button 1 start new selections.

LPEX non-stream selections are by default extended on mouse drags in the same view. They must be explicitly cleared (with, for example, Alt+U) before marking a new block. Installing this class changes the default behavior of a view such that a new mouse drag action will always start a new selection.

Here is the MouseReselect source code.

A user profile (such as TestUserProfile) can install this feature in a document view by calling:

  MouseReselect.install(lpexView);

See also BlockNewMarkToMouseAction as an example of an editor action that installs this feature when it is run for the first time.

See Also:
All the samples

Method Summary
 void disposed(LpexView lpexView)
          View listener - the view is being disposed.
static void install(LpexView lpexView)
          Installs mouse reselection in the given document view.
 void mouseDoubleClick(MouseEvent e)
          Mouse listener - button double click.
 void mouseDown(MouseEvent e)
          Mouse listener - button pressed.
 void mouseMove(MouseEvent e)
          Mouse move listener.
 void mouseUp(MouseEvent e)
          Mouse listener - button released.
 void shown(LpexView lpexView)
          View listener - the view has been refreshed.
 void widgetDisposed(DisposeEvent e)
          Text window dispose listener - the window is being disposed.
 
Methods inherited from class com.ibm.lpex.core.LpexViewAdapter
readonly, renamed, renaming, saved, saving, showing, updateProfile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

install

public static void install(LpexView lpexView)
Installs mouse reselection in the given document view. Does nothing if already installed.


shown

public void shown(LpexView lpexView)
View listener - the view has been refreshed. Installs our mouse listeners as soon as an LPEX window has been associated with the view. Assumes that the specified document view will only ever be shown in this window.

Specified by:
shown in interface LpexViewListener
Overrides:
shown in class LpexViewAdapter

disposed

public void disposed(LpexView lpexView)
View listener - the view is being disposed. Uninstalls the mouse reselection from this view.

Specified by:
disposed in interface LpexViewListener
Overrides:
disposed in class LpexViewAdapter

widgetDisposed

public void widgetDisposed(DisposeEvent e)
Text window dispose listener - the window is being disposed. Uninstalls the mouse reselection.

Specified by:
widgetDisposed in interface DisposeListener

mouseDoubleClick

public void mouseDoubleClick(MouseEvent e)
Mouse listener - button double click.

Specified by:
mouseDoubleClick in interface MouseListener

mouseUp

public void mouseUp(MouseEvent e)
Mouse listener - button released.

Specified by:
mouseUp in interface MouseListener

mouseDown

public void mouseDown(MouseEvent e)
Mouse listener - button pressed. Records whether it is a sole button 1.

Specified by:
mouseDown in interface MouseListener

mouseMove

public void mouseMove(MouseEvent e)
Mouse move listener. Clears any existing selection if a sole mouse button 1 (i.e., with no key modifiers) was just pressed and is now dragged in our view's window.

Specified by:
mouseMove in interface MouseMoveListener

SWT LPEX
v3.0.5

(C) Copyright IBM Corporation 1998, 2005.  All Rights Reserved.