org.eclipse.xtext.ui.editor.doubleClicking
Class AbstractPartitionDoubleClickSelector

java.lang.Object
  extended by org.eclipse.jface.text.DefaultTextDoubleClickStrategy
      extended by org.eclipse.xtext.ui.editor.doubleClicking.AbstractWordAwareDoubleClickStrategy
          extended by org.eclipse.xtext.ui.editor.doubleClicking.AbstractPartitionDoubleClickSelector
All Implemented Interfaces:
org.eclipse.jface.text.ITextDoubleClickStrategy
Direct Known Subclasses:
FixedCharCountPartitionDoubleClickSelector

public abstract class AbstractPartitionDoubleClickSelector
extends AbstractWordAwareDoubleClickStrategy

This strategy treats partition boundaries in a special way. It allows to select a complete partition at once.

Implementors may override getSelectedRegion(IDocument, ITypedRegion) to customize the contents of the partition that should be selected.

.

The implementation was heavily adapted from org.eclipse.jdt.internal.ui.text.java.PartitionDoubleClickSelector

.

Author:
Sebastian Zarnekow - Initial contribution and API
See Also:
FixedCharCountPartitionDoubleClickSelector, PartitionDoubleClickSelector

Constructor Summary
protected AbstractPartitionDoubleClickSelector(java.lang.String partitioning)
          Creates a new partition double click selector for the given document partitioning.
 
Method Summary
protected  org.eclipse.jface.text.IRegion findExtendedDoubleClickSelection(org.eclipse.jface.text.IDocument document, int offset)
          Tries to find a suitable double click selection for the given offset.
protected  org.eclipse.jface.text.IRegion getSelectedRegion(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.ITypedRegion completePartition)
           
 
Methods inherited from class org.eclipse.xtext.ui.editor.doubleClicking.AbstractWordAwareDoubleClickStrategy
createBreakIterator, findWord
 
Methods inherited from class org.eclipse.jface.text.DefaultTextDoubleClickStrategy
doubleClicked
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPartitionDoubleClickSelector

protected AbstractPartitionDoubleClickSelector(java.lang.String partitioning)
Creates a new partition double click selector for the given document partitioning.

Parameters:
partitioning - the document partitioning
Method Detail

findExtendedDoubleClickSelection

protected org.eclipse.jface.text.IRegion findExtendedDoubleClickSelection(org.eclipse.jface.text.IDocument document,
                                                                          int offset)
Description copied from class: org.eclipse.jface.text.DefaultTextDoubleClickStrategy
Tries to find a suitable double click selection for the given offset.

Note: This method must return null if it simply selects the word at the given offset.

Overrides:
findExtendedDoubleClickSelection in class org.eclipse.jface.text.DefaultTextDoubleClickStrategy
Parameters:
document - the document
offset - the offset
Returns:
the selection or null if none to indicate simple word selection

getSelectedRegion

protected org.eclipse.jface.text.IRegion getSelectedRegion(org.eclipse.jface.text.IDocument document,
                                                           org.eclipse.jface.text.ITypedRegion completePartition)
                                                    throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException