|
|||||||||
| Home >> All >> org >> eclipse >> jface >> text >> [ contentassist overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.jface.text.contentassist
Class CompletionProposalPopup

java.lang.Objectorg.eclipse.jface.text.contentassist.CompletionProposalPopup
- All Implemented Interfaces:
- IContentAssistListener, org.eclipse.jface.text.IEventConsumer
- class CompletionProposalPopup
- extends java.lang.Object
- implements IContentAssistListener
- extends java.lang.Object
This class is used to present proposals to the user. If additional information exists for a proposal, then selecting that proposal will result in the information being displayed in a secondary window.
| Nested Class Summary | |
private class |
CompletionProposalPopup.ProposalSelectionListener
|
| Field Summary | |
private AdditionalInfoController |
fAdditionalInfoController
The used additional info controller. |
private ICompletionProposal[] |
fComputedProposals
The computed list of proposals. |
private ContentAssistant |
fContentAssistant
The associated content assistant. |
private org.eclipse.jface.contentassist.IContentAssistSubjectControl |
fContentAssistSubjectControl
The content assist subject control. |
private ContentAssistSubjectControlAdapter |
fContentAssistSubjectControlAdapter
The content assist subject control adapter. |
private java.util.List |
fDocumentEvents
List of document events used for filtering proposals. |
private org.eclipse.jface.text.IDocumentListener |
fDocumentListener
Listener filling the document event queue. |
private ICompletionProposal[] |
fFilteredProposals
The filter list of proposals. |
private int |
fFilterOffset
The offset for which the computed proposals have been filtered. |
private boolean |
fInserting
Indicates whether a completion proposal is being inserted. |
private long |
fInvocationCounter
Reentrance count for filtered proposals. |
private int |
fInvocationOffset
The offset for which the proposals have been computed. |
private CompletionProposalPopup.ProposalSelectionListener |
fKeyListener
The key listener to control navigation. |
private ICompletionProposal |
fLastProposal
The most recently selected proposal. |
private java.lang.String |
fLineDelimiter
The default line delimiter of the viewer's widget, |
private PopupCloser |
fPopupCloser
The closing strategy for this completion proposal popup. |
private org.eclipse.swt.widgets.Shell |
fProposalShell
The popup shell. |
private org.eclipse.swt.widgets.Table |
fProposalTable
The proposal table. |
private org.eclipse.swt.graphics.Point |
fSize
Remembers the size for this completion proposal popup. |
private org.eclipse.jface.text.ITextViewer |
fViewer
The associated text viewer. |
| Constructor Summary | |
CompletionProposalPopup(ContentAssistant contentAssistant,
org.eclipse.jface.contentassist.IContentAssistSubjectControl contentAssistSubjectControl,
AdditionalInfoController infoController)
Creates a new completion proposal popup for the given elements. |
|
CompletionProposalPopup(ContentAssistant contentAssistant,
org.eclipse.jface.text.ITextViewer viewer,
AdditionalInfoController infoController)
Creates a new completion proposal popup for the given elements. |
|
| Method Summary | |
private boolean |
completeCommonPrefix()
Acts upon fFilteredProposals: if there is just one valid
proposal, it is inserted, otherwise, the common prefix of all proposals
is inserted into the document. |
private ICompletionProposal[] |
computeFilteredProposals(int offset,
org.eclipse.jface.text.DocumentEvent event)
Computes the subset of already computed proposals that are still valid for the given offset. |
private ICompletionProposal[] |
computeProposals(int offset)
Returns the completion proposal available at the given offset of the viewer's document. |
private boolean |
contains(char[] characters,
char c)
Returns whether the given character is contained in the given array of characters. |
private void |
createProposalSelector()
Creates the proposal selector. |
private void |
displayProposals()
Displays this popup and install the additional info controller, so that additional info is displayed when a proposal is selected and additional info is available. |
private void |
filterProposals()
Filters the displayed proposal based on the given cursor position and the offset of the original invocation of the content assistant. |
private java.lang.String |
getErrorMessage()
Returns the error message. |
private org.eclipse.swt.graphics.Point |
getLocation()
Returns the graphical location at which this popup should be made visible. |
private int |
getReplacementOffset(ICompletionProposal proposal)
Extracts the completion offset of an ICompletionProposal. |
private java.lang.CharSequence |
getReplacementString(ICompletionProposal proposal)
Extracts the replacement string from an ICompletionProposal. |
private ICompletionProposal |
getSelectedProposal()
Returns the proposal selected in the proposal selector. |
(package private) org.eclipse.swt.graphics.Point |
getSize()
Returns the size of this completion proposal popup. |
boolean |
hasFocus()
Returns whether this popup has the focus. |
void |
hide()
Hides this popup. |
java.lang.String |
incrementalComplete()
Completes the common prefix of all proposals directly in the code. |
private void |
insertProposal(ICompletionProposal p,
char trigger,
int stateMask,
int offset)
Applies the given proposal at the given offset. |
boolean |
isActive()
Returns whether this popup is active. |
private boolean |
isCaseSensitive()
Returns whether common prefix completion should be case sensitive or not. |
void |
processEvent(org.eclipse.swt.events.VerifyEvent e)
Processes the given event and marks it as done if it should be ignored by subsequent receivers. |
private void |
selectProposal(int index,
boolean smartToggle)
Selects the entry with the given index in the proposal selector and feeds the selection to the additional info controller. |
private void |
selectProposalWithMask(int stateMask)
Takes the selected proposal and applies it. |
void |
setFocus()
Requests the proposal shell to take focus. |
private void |
setProposals(ICompletionProposal[] proposals)
Initializes the proposal selector with these given proposals. |
java.lang.String |
showProposals(boolean autoActivated)
Computes and presents completion proposals. |
private boolean |
truncatePrefix(java.lang.StringBuffer prefix,
java.lang.CharSequence sequence)
Truncates prefix to the longest prefix it has in common with
sequence and returns true if the common prefix
has the same case for prefix and sequence. |
private void |
unregister()
Unregister this completion proposal popup. |
boolean |
verifyKey(org.eclipse.swt.events.VerifyEvent e)
Verifies the key event. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
fViewer
private org.eclipse.jface.text.ITextViewer fViewer
- The associated text viewer.
fContentAssistant
private ContentAssistant fContentAssistant
- The associated content assistant.
fAdditionalInfoController
private AdditionalInfoController fAdditionalInfoController
- The used additional info controller.
fPopupCloser
private PopupCloser fPopupCloser
- The closing strategy for this completion proposal popup.
fProposalShell
private org.eclipse.swt.widgets.Shell fProposalShell
- The popup shell.
fProposalTable
private org.eclipse.swt.widgets.Table fProposalTable
- The proposal table.
fInserting
private boolean fInserting
- Indicates whether a completion proposal is being inserted.
fKeyListener
private CompletionProposalPopup.ProposalSelectionListener fKeyListener
- The key listener to control navigation.
fDocumentEvents
private java.util.List fDocumentEvents
- List of document events used for filtering proposals.
fDocumentListener
private org.eclipse.jface.text.IDocumentListener fDocumentListener
- Listener filling the document event queue.
fInvocationCounter
private long fInvocationCounter
- Reentrance count for filtered proposals.
fFilteredProposals
private ICompletionProposal[] fFilteredProposals
- The filter list of proposals.
fComputedProposals
private ICompletionProposal[] fComputedProposals
- The computed list of proposals.
fInvocationOffset
private int fInvocationOffset
- The offset for which the proposals have been computed.
fFilterOffset
private int fFilterOffset
- The offset for which the computed proposals have been filtered.
fLineDelimiter
private java.lang.String fLineDelimiter
- The default line delimiter of the viewer's widget,
fLastProposal
private ICompletionProposal fLastProposal
- The most recently selected proposal.
- Since:
- 3.0
fContentAssistSubjectControl
private org.eclipse.jface.contentassist.IContentAssistSubjectControl fContentAssistSubjectControl
- The content assist subject control.
This replaces
fViewer- Since:
- 3.0
fContentAssistSubjectControlAdapter
private ContentAssistSubjectControlAdapter fContentAssistSubjectControlAdapter
- The content assist subject control adapter.
This replaces
fViewer- Since:
- 3.0
fSize
private org.eclipse.swt.graphics.Point fSize
- Remembers the size for this completion proposal popup.
- Since:
- 3.0
| Constructor Detail |
CompletionProposalPopup
public CompletionProposalPopup(ContentAssistant contentAssistant, org.eclipse.jface.text.ITextViewer viewer, AdditionalInfoController infoController)
- Creates a new completion proposal popup for the given elements.
- Since:
- 2.0
CompletionProposalPopup
public CompletionProposalPopup(ContentAssistant contentAssistant, org.eclipse.jface.contentassist.IContentAssistSubjectControl contentAssistSubjectControl, AdditionalInfoController infoController)
- Creates a new completion proposal popup for the given elements.
- Since:
- 3.0
| Method Detail |
showProposals
public java.lang.String showProposals(boolean autoActivated)
- Computes and presents completion proposals. The flag indicates whether this call has
be made out of an auto activation context.
computeProposals
private ICompletionProposal[] computeProposals(int offset)
- Returns the completion proposal available at the given offset of the
viewer's document. Delegates the work to the content assistant.
getErrorMessage
private java.lang.String getErrorMessage()
- Returns the error message.
createProposalSelector
private void createProposalSelector()
- Creates the proposal selector.
getSelectedProposal
private ICompletionProposal getSelectedProposal()
- Returns the proposal selected in the proposal selector.
- Since:
- 2.0
selectProposalWithMask
private void selectProposalWithMask(int stateMask)
- Takes the selected proposal and applies it.
- Since:
- 2.1
insertProposal
private void insertProposal(ICompletionProposal p, char trigger, int stateMask, int offset)
- Applies the given proposal at the given offset. The given character is the
one that triggered the insertion of this proposal.
- Since:
- 2.1
hasFocus
public boolean hasFocus()
- Returns whether this popup has the focus.
hide
public void hide()
- Hides this popup.
unregister
private void unregister()
- Unregister this completion proposal popup.
- Since:
- 3.0
isActive
public boolean isActive()
- Returns whether this popup is active. It is active if the proposal selector is visible.
setProposals
private void setProposals(ICompletionProposal[] proposals)
- Initializes the proposal selector with these given proposals.
getLocation
private org.eclipse.swt.graphics.Point getLocation()
- Returns the graphical location at which this popup should be made visible.
getSize
org.eclipse.swt.graphics.Point getSize()
- Returns the size of this completion proposal popup.
- Since:
- 3.0
displayProposals
private void displayProposals()
- Displays this popup and install the additional info controller, so that additional info
is displayed when a proposal is selected and additional info is available.
verifyKey
public boolean verifyKey(org.eclipse.swt.events.VerifyEvent e)
- Description copied from interface:
IContentAssistListener - Verifies the key event.
- Specified by:
verifyKeyin interfaceIContentAssistListener
selectProposal
private void selectProposal(int index,
boolean smartToggle)
- Selects the entry with the given index in the proposal selector and feeds
the selection to the additional info controller.
- Since:
- 2.1
contains
private boolean contains(char[] characters,
char c)
- Returns whether the given character is contained in the given array of
characters.
- Since:
- 2.0
processEvent
public void processEvent(org.eclipse.swt.events.VerifyEvent e)
- Description copied from interface:
org.eclipse.jface.text.IEventConsumer - Processes the given event and marks it as done if it should
be ignored by subsequent receivers.
- Specified by:
processEventin interfaceorg.eclipse.jface.text.IEventConsumer
filterProposals
private void filterProposals()
- Filters the displayed proposal based on the given cursor position and the
offset of the original invocation of the content assistant.
computeFilteredProposals
private ICompletionProposal[] computeFilteredProposals(int offset, org.eclipse.jface.text.DocumentEvent event)
- Computes the subset of already computed proposals that are still valid for
the given offset.
- Since:
- 3.0
setFocus
public void setFocus()
- Requests the proposal shell to take focus.
- Since:
- 3.0
incrementalComplete
public java.lang.String incrementalComplete()
- Completes the common prefix of all proposals directly in the code. If no
common prefix can be found, the proposal popup is shown.
- Since:
- 3.0
completeCommonPrefix
private boolean completeCommonPrefix()
- Acts upon
fFilteredProposals: if there is just one valid proposal, it is inserted, otherwise, the common prefix of all proposals is inserted into the document. If there is no common prefix,falseis returned.- Since:
- 3.0
truncatePrefix
private boolean truncatePrefix(java.lang.StringBuffer prefix, java.lang.CharSequence sequence)
- Truncates
prefixto the longest prefix it has in common withsequenceand returnstrueif the common prefix has the same case forprefixandsequence.- Since:
- 3.0
isCaseSensitive
private boolean isCaseSensitive()
- Returns whether common prefix completion should be case sensitive or not.
Returns
trueif no proposal popup is currently showing,falseif there is.- Since:
- 3.0
getReplacementOffset
private int getReplacementOffset(ICompletionProposal proposal)
- Extracts the completion offset of an
ICompletionProposal. Ifproposalis aICompletionProposalExtension3, itsgetCompletionOffsetmethod is called, otherwise, the invocation offset of this popup is shown.- Since:
- 3.0
getReplacementString
private java.lang.CharSequence getReplacementString(ICompletionProposal proposal)
- Extracts the replacement string from an
ICompletionProposal. Ifproposalis aICompletionProposalExtension3, itsgetCompletionTextmethod is called, otherwise, the display string is used.- Since:
- 3.0
|
|||||||||
| Home >> All >> org >> eclipse >> jface >> text >> [ contentassist overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.eclipse.jface.text.contentassist.CompletionProposalPopup