org.eclipse.xtext.ui.search
Class XtextEObjectSearchDialog

java.lang.Object
  extended by org.eclipse.jface.window.Window
      extended by org.eclipse.jface.dialogs.Dialog
          extended by org.eclipse.jface.dialogs.TrayDialog
              extended by org.eclipse.ui.dialogs.SelectionDialog
                  extended by org.eclipse.ui.dialogs.ListDialog
                      extended by org.eclipse.xtext.ui.search.XtextEObjectSearchDialog
All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider

public class XtextEObjectSearchDialog
extends org.eclipse.ui.dialogs.ListDialog

Author:
Jan Koehnlein - Initial contribution and API, Knut Wannheden

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
org.eclipse.jface.window.Window.IExceptionHandler
 
Field Summary
protected  org.eclipse.swt.widgets.Text searchControl
           
protected  org.eclipse.swt.widgets.Text typeSearchControl
           
 
Fields inherited from class org.eclipse.jface.dialogs.Dialog
blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, dialogArea, DLG_IMG_ERROR, DLG_IMG_HELP, DLG_IMG_INFO, DLG_IMG_MESSAGE_ERROR, DLG_IMG_MESSAGE_INFO, DLG_IMG_MESSAGE_WARNING, DLG_IMG_QUESTION, DLG_IMG_WARNING, ELLIPSIS
 
Fields inherited from class org.eclipse.jface.window.Window
CANCEL, OK
 
Constructor Summary
XtextEObjectSearchDialog(org.eclipse.swt.widgets.Shell parent, IXtextEObjectSearch searchEngine, org.eclipse.jface.viewers.ILabelProvider labelProvider)
           
XtextEObjectSearchDialog(org.eclipse.swt.widgets.Shell parent, IXtextEObjectSearch searchEngine, org.eclipse.jface.viewers.ILabelProvider labelProvider, boolean enableStyledLabels)
           
 
Method Summary
protected  void applyFilter()
          Called when the dialog is initially opened and whenever the input text changes.
protected  org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite container)
          Creates and returns the contents of the upper part of this dialog (above the button bar).
protected  org.eclipse.swt.widgets.Label createMessageArea(org.eclipse.swt.widgets.Composite composite)
          Creates the message area for this dialog.
protected  java.lang.String getInitialPattern()
           
protected  IXtextEObjectSearch getSearchEngine()
           
protected  int getTableStyle()
          Return the style flags for the table viewer.
 int open()
          Opens this window, creating it first if it has not yet been created.
 void setInitialPattern(java.lang.String text)
           
protected  void startSizeCalculation(java.lang.Iterable<IEObjectDescription> matches)
          Called by applyFilter() and is responsible for calling updateMatches(Collection, boolean) with an appropriately sorted list of matches.
 void updateMatches(java.util.Collection<IEObjectDescription> matches, boolean isFinished)
           
 
Methods inherited from class org.eclipse.ui.dialogs.ListDialog
createButtonsForButtonBar, getHeightInChars, getTableViewer, getWidthInChars, okPressed, setAddCancelButton, setContentProvider, setHeightInChars, setInput, setLabelProvider, setWidthInChars
 
Methods inherited from class org.eclipse.ui.dialogs.SelectionDialog
configureShell, getDialogBoundsSettings, getDialogBoundsStrategy, getInitialElementSelections, getInitialSelections, getMessage, getOkButton, getResult, isResizable, setDialogBoundsSettings, setInitialElementSelections, setInitialSelections, setMessage, setResult, setSelectionResult, setTitle
 
Methods inherited from class org.eclipse.jface.dialogs.TrayDialog
close, closeTray, createButtonBar, createHelpControl, getLayout, getTray, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable
 
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, buttonPressed, cancelPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createContents, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
 
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

searchControl

protected org.eclipse.swt.widgets.Text searchControl

typeSearchControl

protected org.eclipse.swt.widgets.Text typeSearchControl
Since:
2.0
Constructor Detail

XtextEObjectSearchDialog

public XtextEObjectSearchDialog(org.eclipse.swt.widgets.Shell parent,
                                IXtextEObjectSearch searchEngine,
                                org.eclipse.jface.viewers.ILabelProvider labelProvider)

XtextEObjectSearchDialog

public XtextEObjectSearchDialog(org.eclipse.swt.widgets.Shell parent,
                                IXtextEObjectSearch searchEngine,
                                org.eclipse.jface.viewers.ILabelProvider labelProvider,
                                boolean enableStyledLabels)
Method Detail

getSearchEngine

protected IXtextEObjectSearch getSearchEngine()
Since:
2.0

setInitialPattern

public void setInitialPattern(java.lang.String text)
Since:
2.0

getInitialPattern

protected java.lang.String getInitialPattern()
Since:
2.0

open

public int open()
Description copied from class: org.eclipse.jface.window.Window
Opens this window, creating it first if it has not yet been created.

If this window has been configured to block on open ( setBlockOnOpen), this method waits until the window is closed by the end user, and then it returns the window's return code; otherwise, this method returns immediately. A window's return codes are window-specific, although two standard return codes are predefined: OK and CANCEL.

Overrides:
open in class org.eclipse.jface.window.Window
Returns:
the return code
See Also:
Window.create()

getTableStyle

protected int getTableStyle()
Description copied from class: org.eclipse.ui.dialogs.ListDialog
Return the style flags for the table viewer.

Overrides:
getTableStyle in class org.eclipse.ui.dialogs.ListDialog
Returns:
int

createDialogArea

protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite container)
Description copied from class: org.eclipse.jface.dialogs.Dialog
Creates and returns the contents of the upper part of this dialog (above the button bar).

The Dialog implementation of this framework method creates and returns a new Composite with standard margins and spacing.

The returned control's layout data must be an instance of GridData. This method must not modify the parent's layout.

Subclasses must override this method but may call super as in the following example:

 Composite composite = (Composite) super.createDialogArea(parent);
 //add controls to composite as necessary
 return composite;
 

Overrides:
createDialogArea in class org.eclipse.ui.dialogs.ListDialog
Parameters:
container - the parent composite to contain the dialog area
Returns:
the dialog area control

createMessageArea

protected org.eclipse.swt.widgets.Label createMessageArea(org.eclipse.swt.widgets.Composite composite)
Description copied from class: org.eclipse.ui.dialogs.SelectionDialog
Creates the message area for this dialog.

This method is provided to allow subclasses to decide where the message will appear on the screen.

Overrides:
createMessageArea in class org.eclipse.ui.dialogs.SelectionDialog
Parameters:
composite - the parent composite
Returns:
the message label

applyFilter

protected void applyFilter()
Called when the dialog is initially opened and whenever the input text changes. Applies the search filter as specified by searchControl and typeSearchControl using getSearchEngine() and updates the result using startSizeCalculation(Iterable).

Since:
2.0

updateMatches

public void updateMatches(java.util.Collection<IEObjectDescription> matches,
                          boolean isFinished)

startSizeCalculation

protected void startSizeCalculation(java.lang.Iterable<IEObjectDescription> matches)
Called by applyFilter() and is responsible for calling updateMatches(Collection, boolean) with an appropriately sorted list of matches.

Since:
2.0