/** * Returns the text hover for a given offset and a given state mask. * * @param offset the offset for which to return the text hover * @param stateMask the SWT event state mask * @return the text hover for the given offset and state mask * @since 2.1 */ protected ITextHover getTextHover(int offset, int stateMask) { if (fTextHovers == null) return null; IDocument document= getDocument(); if (document == null) return null; try { TextHoverKey key= new TextHoverKey(TextUtilities.getContentType(document, getDocumentPartitioning(), offset, true), stateMask); Object textHover= fTextHovers.get(key); if (textHover == null) { // Use default text hover key.setStateMask(ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK); textHover= fTextHovers.get(key); } return (ITextHover) textHover; } catch (BadLocationException x) { if (TRACE_ERRORS) System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.selectContentTypePlugin")); //$NON-NLS-1$ } return null; }
/** * Returns the text hover for a given offset and a given state mask. * * @param offset the offset for which to return the text hover * @param stateMask the SWT event state mask * @return the text hover for the given offset and state mask * @since 2.1 */ protected ITextHover getTextHover(int offset, int stateMask) { if (fTextHovers == null) return null; IDocument document= getDocument(); if (document == null) return null; try { TextHoverKey key= new TextHoverKey(TextUtilities.getContentType(document, getDocumentPartitioning(), offset, true), stateMask); Object textHover= fTextHovers.get(key); if (textHover == null) { // Use default text hover key.setStateMask(ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK); textHover= fTextHovers.get(key); } return (ITextHover) textHover; } catch (BadLocationException x) { if (TRACE_ERRORS) System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.selectContentTypePlugin")); //$NON-NLS-1$ } return null; }
/** * Selects from the given map the one which is registered under the content type of the * partition in which the given offset is located. * * @param offset the offset for which to find the plug-in * @param plugins the map from which to choose * @return the plug-in registered under the offset's content type or <code>null</code> if none */ protected Object selectContentTypePlugin(int offset, Map<String, ?> plugins) { final IDocument document= getDocument(); if (document == null) return null; try { return selectContentTypePlugin(TextUtilities.getContentType(document, getDocumentPartitioning(), offset, true), plugins); } catch (BadLocationException x) { if (TRACE_ERRORS) System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.selectContentTypePlugin")); //$NON-NLS-1$ } return null; }
/** * Selects from the given map the one which is registered under the content type of the * partition in which the given offset is located. * * @param offset the offset for which to find the plug-in * @param plugins the map from which to choose * @return the plug-in registered under the offset's content type or <code>null</code> if none */ protected Object selectContentTypePlugin(int offset, Map<String, ?> plugins) { final IDocument document= getDocument(); if (document == null) return null; try { return selectContentTypePlugin(TextUtilities.getContentType(document, getDocumentPartitioning(), offset, true), plugins); } catch (BadLocationException x) { if (TRACE_ERRORS) System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.selectContentTypePlugin")); //$NON-NLS-1$ } return null; }
ITextSelection selection= (ITextSelection) getSelection(); IRegion block= getTextBlockFromSelection(selection); ITypedRegion[] regions= TextUtilities.computePartitioning(d, getDocumentPartitioning(), block.getOffset(), block.getLength(), false);
ITextSelection selection= (ITextSelection) getSelection(); IRegion block= getTextBlockFromSelection(selection); ITypedRegion[] regions= TextUtilities.computePartitioning(d, getDocumentPartitioning(), block.getOffset(), block.getLength(), false);