/** * Returns whether this context information popup is active. I.e., either * a context selector or context information is displayed. * * @return <code>true</code> if the context selector is active */ public boolean isActive() { return (Helper.okToUse(fContextInfoPopup) || Helper.okToUse(fContextSelectorShell)); }
/** * Returns whether this context information popup is active. I.e., either * a context selector or context information is displayed. * * @return <code>true</code> if the context selector is active */ public boolean isActive() { return (Helper.okToUse(fContextInfoPopup) || Helper.okToUse(fContextSelectorShell)); }
@Override public void keyReleased(KeyEvent e) { if (!Helper.okToUse(fProposalShell)) return; if (e.character == 0 && e.keyCode == SWT.CTRL) { // http://dev.eclipse.org/bugs/show_bug.cgi?id=34754 int index= fProposalTable.getSelectionIndex(); if (index >= 0) selectProposal(index, false); } } }
/** *Returns whether the context selector has the focus. * * @return <code>true</code> if the context selector has the focus */ public boolean hasFocus() { if (Helper.okToUse(fContextSelectorShell)) return fContextSelectorShell.getDisplay().getActiveShell() == fContextSelectorShell; return false; }
@Override public void keyReleased(KeyEvent e) { if (!Helper.okToUse(fProposalShell)) return; if (e.character == 0 && e.keyCode == SWT.CTRL) { // http://dev.eclipse.org/bugs/show_bug.cgi?id=34754 int index= fProposalTable.getSelectionIndex(); if (index >= 0) selectProposal(index, false); } } }
/** * Requests the proposal shell to take focus. * * @since 3.0 */ public void setFocus() { if (Helper.okToUse(fProposalShell)) { fProposalShell.setFocus(); } }
/** *Returns whether the context selector has the focus. * * @return <code>true</code> if the context selector has the focus */ public boolean hasFocus() { if (Helper.okToUse(fContextSelectorShell)) return fContextSelectorShell.getDisplay().getActiveShell() == fContextSelectorShell; return false; }
@Override public void keyPressed(KeyEvent e) { if (!Helper.okToUse(fProposalShell)) return; if (e.character == 0 && e.keyCode == SWT.CTRL) { // http://dev.eclipse.org/bugs/show_bug.cgi?id=34754 int index= fProposalTable.getSelectionIndex(); if (index >= 0) selectProposal(index, true); } }
@Override public void keyPressed(KeyEvent e) { if (!Helper.okToUse(fProposalShell)) return; if (e.character == 0 && e.keyCode == SWT.CTRL) { // http://dev.eclipse.org/bugs/show_bug.cgi?id=34754 int index= fProposalTable.getSelectionIndex(); if (index >= 0) selectProposal(index, true); } }
/** * Requests the proposal shell to take focus. * * @since 3.0 */ public void setFocus() { if (Helper.okToUse(fProposalShell)) { fProposalShell.setFocus(); } }
protected void adjustListeners(int type) { switch (type) { case LAYOUT_PROPOSAL_SELECTOR: if (fContextType == LAYOUT_CONTEXT_SELECTOR && Helper.okToUse(fShells[LAYOUT_CONTEXT_SELECTOR])) // Disable event notification to the tip selector. removeContentAssistListener((IContentAssistListener) fPopups[LAYOUT_CONTEXT_SELECTOR], CONTEXT_SELECTOR); break; case LAYOUT_CONTEXT_SELECTOR: if (Helper.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR])) // Disable event notification to the proposal selector. removeContentAssistListener((IContentAssistListener) fPopups[LAYOUT_PROPOSAL_SELECTOR], PROPOSAL_SELECTOR); break; case LAYOUT_CONTEXT_INFO_POPUP: break; } }
@Override public void focusLost(FocusEvent e) { Control control= fControl; if (Helper.okToUse(control)) { Display d= control.getDisplay(); if (d != null) { d.asyncExec(new Runnable() { @Override public void run() { if (!fProposalPopup.hasFocus() && (fContextInfoPopup == null || !fContextInfoPopup.hasFocus())) hide(); } }); } } }
protected void adjustListeners(int type) { switch (type) { case LAYOUT_PROPOSAL_SELECTOR: if (fContextType == LAYOUT_CONTEXT_SELECTOR && Helper.okToUse(fShells[LAYOUT_CONTEXT_SELECTOR])) // Disable event notification to the tip selector. removeContentAssistListener((IContentAssistListener) fPopups[LAYOUT_CONTEXT_SELECTOR], CONTEXT_SELECTOR); break; case LAYOUT_CONTEXT_SELECTOR: if (Helper.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR])) // Disable event notification to the proposal selector. removeContentAssistListener((IContentAssistListener) fPopups[LAYOUT_PROPOSAL_SELECTOR], PROPOSAL_SELECTOR); break; case LAYOUT_CONTEXT_INFO_POPUP: break; } }
/** * Returns the proposal selected in the proposal selector. * * @return the selected proposal * @since 2.0 */ private ICompletionProposal getSelectedProposal() { /* Make sure that there is no filter runnable pending. * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=31427 */ if (fIsFilterPending) fFilterRunnable.run(); // filter runnable may have hidden the proposals if (!Helper.okToUse(fProposalTable)) return null; int i= fProposalTable.getSelectionIndex(); if (fFilteredProposals == null || i < 0 || i >= fFilteredProposals.size()) return null; return fFilteredProposals.get(i); }
/** * Returns the minimal required height for the proposal, may return 0 if the popup has not been * created yet. * * @return the minimal height * @since 3.3 */ int getMinimalHeight() { int height= 0; if (Helper.okToUse(fProposalTable)) { int items= fProposalTable.getItemHeight() * 10; Rectangle trim= fProposalTable.computeTrim(0, 0, SWT.DEFAULT, items); height= trim.height; } if (Helper.okToUse(fMessageText)) height+= fMessageText.getSize().y + 1; return height; }
/** * Installs a key listener on the text viewer's widget. */ private void installKeyListener() { if (!fVerifyKeyListenerHooked) { if (Helper.okToUse(fContentAssistSubjectControlAdapter.getControl())) { fVerifyKeyListenerHooked= fContentAssistSubjectControlAdapter.prependVerifyKeyListener(fInternalListener); } } }