Java Code Examples for org.eclipse.jface.text.BadLocationException#getMessage()
The following examples show how to use
org.eclipse.jface.text.BadLocationException#getMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Ch5CompletionEditor.java From http4e with Apache License 2.0 | 6 votes |
public ICompletionProposal[] computeCompletionProposals( ITextViewer textViewer, int documentOffset){ IDocument document = textViewer.getDocument(); int currOffset = documentOffset - 1; try { String currWord = ""; char currChar; while (currOffset > 0 && !Character.isWhitespace(currChar = document.getChar(currOffset))) { currWord = currChar + currWord; currOffset--; } List suggestions = wordTracker.suggest(currWord); ICompletionProposal[] proposals = null; if (suggestions.size() > 0) { proposals = buildProposals(suggestions, currWord, documentOffset - currWord.length()); lastError = null; } return proposals; } catch (BadLocationException e) { e.printStackTrace(); lastError = e.getMessage(); return null; } }
Example 2
Source File: JsonQuickAssistProcessor.java From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 | 6 votes |
@Override public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext) { List<IMarker> markers; try { markers = getMarkersFor(invocationContext.getSourceViewer(), invocationContext.getOffset()); } catch (BadLocationException e) { errorMessage = e.getMessage(); return new ICompletionProposal[0]; } List<MarkerResolutionProposal> result = markers.stream() // .flatMap(e -> generators.stream() .flatMap(generator -> Stream.of(generator.getResolutions(e)) .map(m -> new MarkerResolutionProposal(e, m, invocationContext.getSourceViewer())))) .collect(Collectors.toList()); return result.toArray(new ICompletionProposal[result.size()]); }
Example 3
Source File: DocumentAdapter.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public void append(String text) { try { fDocument.replace(fDocument.getLength(), 0, text); } catch (BadLocationException e) { throw new IndexOutOfBoundsException(e.getMessage()); } }
Example 4
Source File: DocumentAdapter.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public char getChar(int position) { try { return fDocument.getChar(position); } catch (BadLocationException x) { throw new IndexOutOfBoundsException(x.getMessage()); } }
Example 5
Source File: DocumentAdapter.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public String getText(int offset, int length) throws IndexOutOfBoundsException { try { return fDocument.get(offset, length); } catch (BadLocationException x) { throw new IndexOutOfBoundsException(x.getMessage()); } }
Example 6
Source File: DocumentAdapter.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public void replace(int position, int length, String text) { try { fDocument.replace(position, length, text); } catch (BadLocationException e) { throw new IndexOutOfBoundsException(e.getMessage()); } }
Example 7
Source File: JavaCodeReader.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void configureBackwardReader(IDocument document, int offset, boolean skipComments, boolean skipStrings) throws IOException { fDocument= document; fOffset= offset; fSkipComments= skipComments; fSkipStrings= skipStrings; fForward= false; try { fCachedLineNumber= fDocument.getLineOfOffset(fOffset); } catch (BadLocationException x) { throw new IOException(x.getMessage()); } }
Example 8
Source File: JavaCodeReader.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public int read() throws IOException { try { return fForward ? readForwards() : readBackwards(); } catch (BadLocationException x) { throw new IOException(x.getMessage()); } }
Example 9
Source File: ModuleAdapter.java From Pydev with Eclipse Public License 1.0 | 5 votes |
private boolean isSelectionInAdapter(ICoreTextSelection selection, IASTNodeAdapter<? extends SimpleNode> adapter) { int startOffSet = selection.getOffset(); int endOffSet = selection.getOffset() + selection.getLength(); try { int lastLine = adapter.getNodeLastLine() - 1; int adapterStartOffset = doc.getLineOffset(adapter.getNodeFirstLine(false) - 1) + adapter.getNodeIndent(); int adapterEndOffset = doc.getLineOffset(lastLine) + doc.getLineLength(lastLine); return (adapterStartOffset <= startOffSet && adapterEndOffset >= endOffSet); } catch (BadLocationException e) { throw new RuntimeException("Internal error, bad location exception" + e.getMessage()); } }
Example 10
Source File: CleanUpPostSaveListener.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private static CoreException wrapBadLocationException(BadLocationException e) { String message= e.getMessage(); if (message == null) message= "BadLocationException"; //$NON-NLS-1$ return new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IRefactoringCoreStatusCodes.BAD_LOCATION, message, e)); }
Example 11
Source File: LazyGenericTypeProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private void openErrorDialog(BadLocationException e) { Shell shell= getTextViewer().getTextWidget().getShell(); String message= e.getMessage(); MessageDialog.openError(shell, JavaTextMessages.FilledArgumentNamesMethodProposal_error_msg, message == null ? e.toString() : message); }