diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index e13d300198c..aa64e67922b 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -1,3 +1,6 @@ +2004-04-21 Hoda Amer + Fix for bug#52823 : Content Assist: No completions available inside an empty document. + 2004-04-21 Bogdan Gheorghe Fixed external markers not working with new Search UI problem. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProcessor.java index 5bf42dcf871..e2eb974cc15 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProcessor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProcessor.java @@ -326,25 +326,27 @@ public class CCompletionProcessor implements IContentAssistProcessor { IWorkingCopy unit = fManager.getWorkingCopy(fEditor.getEditorInput()); IDocument document = viewer.getDocument(); + // check for :: and -> int pos = offset -1; - try{ - //While we aren't on a space, then go back and look for :: or a -> - while(document.getChar(pos) == ' ') { - pos--; - } - if ((document.getChar(pos) == ':') && (document.getChar(pos -1) != ':')) { - // ignore this request - return null; - } else if ((document.getChar(pos) == '>') && (document.getChar(pos - 1) != '-')) { + if(pos >= 0){ + try{ + //While we aren't on a space, then go back and look for :: or a -> + while ((pos >= 0) && (document.getChar(pos) == ' ')) { + pos--; + } + if ((document.getChar(pos) == ':') && (document.getChar(pos -1) != ':')) { + // ignore this request + return null; + } else if ((document.getChar(pos) == '>') && (document.getChar(pos - 1) != '-')) { + // ignore this request + return null; + } + } catch ( BadLocationException ex ){ // ignore this request return null; } - } catch ( BadLocationException ex ){ - // ignore this request - return null; } - ICCompletionProposal[] results = null; try {