/** * Hides context selector and context information popup. */ public void hide() { hideContextSelector(); hideContextInfoPopup(); }
/** * Hides context selector and context information popup. */ public void hide() { hideContextSelector(); hideContextInfoPopup(); }
/** * Processes a key stroke while the info popup is up. * * @param e the verify event describing the key stroke * @return <code>true</code> if processing can be stopped */ private boolean contextInfoPopupKeyPressed(KeyEvent e) { char key= e.character; if (key == 0) { switch (e.keyCode) { case SWT.ARROW_LEFT: case SWT.ARROW_RIGHT: case SWT.ARROW_UP: case SWT.ARROW_DOWN: validateContextInformation(); break; default: if (e.keyCode != SWT.MOD1 && e.keyCode != SWT.MOD2 && e.keyCode != SWT.MOD3 && e.keyCode != SWT.MOD4) hideContextInfoPopup(); break; } } else if (key == SWT.ESC) { e.doit= false; hideContextInfoPopup(); } else { validateContextInformation(); } return true; }
/** * Processes a key stroke while the info popup is up. * * @param e the verify event describing the key stroke * @return <code>true</code> if processing can be stopped */ private boolean contextInfoPopupKeyPressed(KeyEvent e) { char key= e.character; if (key == 0) { switch (e.keyCode) { case SWT.ARROW_LEFT: case SWT.ARROW_RIGHT: case SWT.ARROW_UP: case SWT.ARROW_DOWN: validateContextInformation(); break; default: if (e.keyCode != SWT.MOD1 && e.keyCode != SWT.MOD2 && e.keyCode != SWT.MOD3 && e.keyCode != SWT.MOD4) hideContextInfoPopup(); break; } } else if (key == SWT.ESC) { e.doit= false; hideContextInfoPopup(); } else { validateContextInformation(); } return true; }
/** * Shows all possible contexts for the given cursor position of the viewer. * * @param autoActivated <code>true</code> if auto activated * @return a potential error message or <code>null</code> in case of no error */ public String showContextProposals(final boolean autoActivated) { final StyledText styledText= fViewer.getTextWidget(); BusyIndicator.showWhile(styledText.getDisplay(), () -> { int position= fViewer.getSelectedRange().x; IContextInformation[] contexts= computeContextInformation(position); int count= (contexts == null ? 0 : contexts.length); if (count == 1) { // Show context information directly internalShowContextInfo(contexts[0], position); } else if (count > 0) { // Precise context must be selected if (fLineDelimiter == null) fLineDelimiter= styledText.getLineDelimiter(); createContextSelector(); setContexts(contexts); displayContextSelector(); hideContextInfoPopup(); } }); return getErrorMessage(); }