Package com.iizigo.editor
Class MultiSelectionProvider
java.lang.Object
com.iizigo.editor.MultiSelectionProvider
- All Implemented Interfaces:
- EventListener,- org.eclipse.jface.viewers.ISelectionChangedListener,- org.eclipse.jface.viewers.ISelectionProvider,- org.eclipse.swt.custom.CaretListener,- org.eclipse.swt.events.DisposeListener,- org.eclipse.swt.events.FocusListener,- org.eclipse.swt.events.KeyListener,- org.eclipse.swt.events.ModifyListener,- org.eclipse.swt.events.MouseListener,- org.eclipse.swt.events.SelectionListener,- org.eclipse.swt.internal.SWTEventListener
public class MultiSelectionProvider extends Object implements org.eclipse.jface.viewers.ISelectionProvider, org.eclipse.swt.events.DisposeListener, org.eclipse.swt.events.FocusListener, org.eclipse.jface.viewers.ISelectionChangedListener, org.eclipse.swt.events.ModifyListener, org.eclipse.swt.events.KeyListener, org.eclipse.swt.events.MouseListener, org.eclipse.swt.events.SelectionListener, org.eclipse.swt.custom.CaretListener
Class used as selection provider for a part consisting of multiple types of components that would support the selection interface.
Supported components:
- Text capable widgets: Text, Combo, CCombo, Tree, Table, etc...
- Other selection providers such as viewers.
- Constructor SummaryConstructorsConstructorDescriptionCreates the instance without a default provider.- MultiSelectionProvider- (org.eclipse.jface.viewers.ISelectionProvider defaultProvider) Creates the instance with a default provider.
- Method SummaryModifier and TypeMethodDescription- void- addComposite- (org.eclipse.swt.widgets.Composite composite, org.eclipse.jface.viewers.ISelectionProvider selectionProvider) Adds a composite that is part of the selection process.- void- addControl- (org.eclipse.swt.widgets.Control control) Adds a control that is part of the selection process.- void- addControl- (org.eclipse.swt.widgets.Control control, org.eclipse.jface.viewers.ISelectionProvider selectionProvider) Adds a control that is part of the selection process.- void- addSelectionChangedListener- (org.eclipse.jface.viewers.ISelectionChangedListener listener) Adds a listener for selection changes in this selection provider.- void- caretMoved- (org.eclipse.swt.custom.CaretEvent event) This method is called after the caret offset is changed.- void- dispose()Disposes of the selection provider.- voidFires the current selection to the listeners.- void- fireSelection- (org.eclipse.jface.viewers.ISelection selection) Fires the selection to the listeners.- voidFires the selection asynchronously.- void- focusGained- (org.eclipse.swt.events.FocusEvent e) Focus gained.- void- focusLost- (org.eclipse.swt.events.FocusEvent e) Focus lost.Gets the current IClipboardSelection interface for the current control.- org.eclipse.swt.widgets.ControlGets the current control.- org.eclipse.jface.viewers.ISelectionReturns the current selection for this provider.- static org.eclipse.jface.text.TextViewer- getTextViewer- (org.eclipse.swt.custom.StyledText styledText) Gets the text viewer for a StyledText control.- void- keyPressed- (org.eclipse.swt.events.KeyEvent e) - void- keyReleased- (org.eclipse.swt.events.KeyEvent e) - void- modifyText- (org.eclipse.swt.events.ModifyEvent e) Entry field control modification.- void- mouseDoubleClick- (org.eclipse.swt.events.MouseEvent e) - void- mouseDown- (org.eclipse.swt.events.MouseEvent e) - void- mouseUp- (org.eclipse.swt.events.MouseEvent e) - voidDrag finished, called by the part when all drags complete.- void- onPartActivated- (boolean isActive) Clears the current focus control due to part inactivation.- static void- registerViewer- (org.eclipse.jface.text.TextViewer viewer) Registers the TextViewer or similar (e.g.- void- removeControl- (org.eclipse.swt.widgets.Control control, boolean fireEventIfFocusLost) Removes a control that was part of the selection process.- void- removeSelectionChangedListener- (org.eclipse.jface.viewers.ISelectionChangedListener listener) Removes the given selection change listener from this selection provider.- void- selectionChanged- (org.eclipse.jface.viewers.SelectionChangedEvent event) Notifies that the selection has changed.- void- setDefaultProvider- (org.eclipse.jface.viewers.ISelectionProvider defaultProvider) Sets the default provider when no provider is found for a control.- void- setDraggingFix- (IDraggingFix dragFixer) Sets the dragging fix interface.- voidMarks the selection provider as initialized on the owner side, i.e.- void- setSelection- (org.eclipse.jface.viewers.ISelection selection) Sets the current selection for this selection provider.- void- widgetDefaultSelected- (org.eclipse.swt.events.SelectionEvent e) Sent when default selection occurs in the control.- void- widgetDisposed- (org.eclipse.swt.events.DisposeEvent e) Called when a widget is disposed of.- void- widgetSelected- (org.eclipse.swt.events.SelectionEvent e) Sent when selection occurs in the control.
- Constructor Details- MultiSelectionProviderpublic MultiSelectionProvider()Creates the instance without a default provider.
- MultiSelectionProviderpublic MultiSelectionProvider- (org.eclipse.jface.viewers.ISelectionProvider defaultProvider) Creates the instance with a default provider.
 
- Method Details- registerViewerpublic static void registerViewer- (org.eclipse.jface.text.TextViewer viewer) Registers the TextViewer or similar (e.g. SourceViewer) as the controller class for it's StyledText. This is used to be able to extract the viewer for the MultiSelectionProvider and the IIZI actions for undo/redo, clipboard, etc...
- getTextViewerpublic static org.eclipse.jface.text.TextViewer getTextViewer- (org.eclipse.swt.custom.StyledText styledText) Gets the text viewer for a StyledText control.- Parameters:
- styledText- The styled text control.
- Returns:
- The text viewer, or null for none.
 
- setDefaultProviderpublic void setDefaultProvider- (org.eclipse.jface.viewers.ISelectionProvider defaultProvider) Sets the default provider when no provider is found for a control.
- disposepublic void dispose()Disposes of the selection provider.
- setDraggingFixSets the dragging fix interface.
- onDragEndpublic void onDragEnd()Drag finished, called by the part when all drags complete.
- setInitializedpublic void setInitialized()Marks the selection provider as initialized on the owner side, i.e. that all controls, etc, are created and that selection events should be sent.
- onPartActivatedpublic void onPartActivated- (boolean isActive) Clears the current focus control due to part inactivation.
- addCompositepublic void addComposite- (org.eclipse.swt.widgets.Composite composite, org.eclipse.jface.viewers.ISelectionProvider selectionProvider) Adds a composite that is part of the selection process.- Recursion will be done to find all Text, Combo, CCombo, StyledText, Spinner, then special clipboard routines also applies. - Parameters:
- composite- The composite.
- selectionProvider- The selection provider to use.
 
- addControlpublic void addControl- (org.eclipse.swt.widgets.Control control) Adds a control that is part of the selection process.- If the control is Text, Combo, CCombo, StyledText, Spinner, then special clipboard routines also applies. - Parameters:
- control- The control.
 
- addControlpublic void addControl- (org.eclipse.swt.widgets.Control control, org.eclipse.jface.viewers.ISelectionProvider selectionProvider) Adds a control that is part of the selection process.- Parameters:
- control- The control.
- selectionProvider- Potential selection provider (e.g. the Viewer for Tree or Table).- If the - selectionProviderimplements the interface- IClipboardSelectionthis interface can be returned with the method- getClipboardSelectionProvider().
 
- widgetDisposedpublic void widgetDisposed- (org.eclipse.swt.events.DisposeEvent e) Called when a widget is disposed of.- Specified by:
- widgetDisposedin interface- org.eclipse.swt.events.DisposeListener
 
- removeControlpublic void removeControl- (org.eclipse.swt.widgets.Control control, boolean fireEventIfFocusLost) Removes a control that was part of the selection process.- Parameters:
- control- The control.
 
- addSelectionChangedListenerpublic void addSelectionChangedListener- (org.eclipse.jface.viewers.ISelectionChangedListener listener) Adds a listener for selection changes in this selection provider. Has no effect if an identical listener is already registered.- Specified by:
- addSelectionChangedListenerin interface- org.eclipse.jface.viewers.ISelectionProvider
- Parameters:
- listener- A selection changed listener.
 
- removeSelectionChangedListenerpublic void removeSelectionChangedListener- (org.eclipse.jface.viewers.ISelectionChangedListener listener) Removes the given selection change listener from this selection provider. Has no effect if an identical listener is not registered.- Specified by:
- removeSelectionChangedListenerin interface- org.eclipse.jface.viewers.ISelectionProvider
- Parameters:
- listener- A selection changed listener.
 
- selectionChangedpublic void selectionChanged- (org.eclipse.jface.viewers.SelectionChangedEvent event) Notifies that the selection has changed. Called by Structured Viewers due to added controls. This will fire a selection change to all listeners, when potential dragging is completed.- Specified by:
- selectionChangedin interface- org.eclipse.jface.viewers.ISelectionChangedListener
- Parameters:
- event- Event object describing the change.
 
- fireCurrentSelectionpublic void fireCurrentSelection()Fires the current selection to the listeners.
- fireSelectionpublic void fireSelection- (org.eclipse.jface.viewers.ISelection selection) Fires the selection to the listeners.
- getSelectionpublic org.eclipse.jface.viewers.ISelection getSelection()Returns the current selection for this provider.- Specified by:
- getSelectionin interface- org.eclipse.jface.viewers.ISelectionProvider
- Returns:
- The current selection.
 
- setSelectionpublic void setSelection- (org.eclipse.jface.viewers.ISelection selection) Sets the current selection for this selection provider.- Specified by:
- setSelectionin interface- org.eclipse.jface.viewers.ISelectionProvider
- Parameters:
- selection- the new selection
 
- focusGainedpublic void focusGained- (org.eclipse.swt.events.FocusEvent e) Focus gained.- Specified by:
- focusGainedin interface- org.eclipse.swt.events.FocusListener
 
- focusLostpublic void focusLost- (org.eclipse.swt.events.FocusEvent e) Focus lost.- Specified by:
- focusLostin interface- org.eclipse.swt.events.FocusListener
 
- getClipboardSelectionProviderGets the current IClipboardSelection interface for the current control.- Returns:
- null If not available.
 
- getCurrentControlpublic org.eclipse.swt.widgets.Control getCurrentControl()Gets the current control.- Returns:
- The control in focus, or null for none.
 
- modifyTextpublic void modifyText- (org.eclipse.swt.events.ModifyEvent e) Entry field control modification.- Specified by:
- modifyTextin interface- org.eclipse.swt.events.ModifyListener
 
- widgetSelectedpublic void widgetSelected- (org.eclipse.swt.events.SelectionEvent e) Sent when selection occurs in the control.- Specified by:
- widgetSelectedin interface- org.eclipse.swt.events.SelectionListener
- Parameters:
- e- An event containing information about the selection.
 
- widgetDefaultSelectedpublic void widgetDefaultSelected- (org.eclipse.swt.events.SelectionEvent e) Sent when default selection occurs in the control.- Specified by:
- widgetDefaultSelectedin interface- org.eclipse.swt.events.SelectionListener
- Parameters:
- e- An event containing information about the default selection.
 
- caretMovedpublic void caretMoved- (org.eclipse.swt.custom.CaretEvent event) This method is called after the caret offset is changed.- Specified by:
- caretMovedin interface- org.eclipse.swt.custom.CaretListener
- Parameters:
- event- The given event.
- See Also:
- CaretEvent
 
 
- fireSelectionAsyncpublic void fireSelectionAsync()Fires the selection asynchronously. The selection is fired only once, even if called multiple times within the same "sync" call (if from called from the SWT thread).
- mouseDoubleClickpublic void mouseDoubleClick- (org.eclipse.swt.events.MouseEvent e) - Specified by:
- mouseDoubleClickin interface- org.eclipse.swt.events.MouseListener
 
- mouseDownpublic void mouseDown- (org.eclipse.swt.events.MouseEvent e) - Specified by:
- mouseDownin interface- org.eclipse.swt.events.MouseListener
 
- mouseUppublic void mouseUp- (org.eclipse.swt.events.MouseEvent e) - Specified by:
- mouseUpin interface- org.eclipse.swt.events.MouseListener
 
- keyPressedpublic void keyPressed- (org.eclipse.swt.events.KeyEvent e) - Specified by:
- keyPressedin interface- org.eclipse.swt.events.KeyListener
 
- keyReleasedpublic void keyReleased- (org.eclipse.swt.events.KeyEvent e) - Specified by:
- keyReleasedin interface- org.eclipse.swt.events.KeyListener