fillInElementNameCompletionProposals(javaProject, document, path, token, tokenOffset, _offset, completionProposalsList);
fillInElementNameCompletionProposals(javaProject, document, path, token, tokenOffset, _offset, completionProposalsSet);
  public ICompletionProposal[] computeCompletionProposals(ITextViewer _viewer, int _offset) {    List completionProposalsList = new LinkedList();    try {      IDocument document = _viewer.getDocument();      IEditorInput input = myEditor.getEditorInput();      if (input instanceof IPathEditorInput) {        IPathEditorInput pathInput = (IPathEditorInput) input;        IPath path = pathInput.getPath();        IResource file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);        IJavaProject javaProject = JavaModelManager.getJavaModelManager().getJavaModel().getJavaProject(file);        IRegion lineRegion = document.getLineInformationOfOffset(_offset);        WODScanner scanner = WODScanner.newWODScanner();        scanner.setRange(document, lineRegion.getOffset(), lineRegion.getLength());        boolean foundToken = false;        IRule matchingRule = null;        while (!foundToken && (matchingRule = scanner.nextMatchingRule()) != null) {          if (_offset == lineRegion.getOffset() && _offset == scanner.getTokenOffset()) {            foundToken = true;          }          else {            int tokenEndOffset = scanner.getTokenOffset() + scanner.getTokenLength();            if (_offset > scanner.getTokenOffset()) {              if (_offset < tokenEndOffset) {                foundToken = true;              }              else if (_offset == tokenEndOffset) {                if (matchingRule instanceof OperatorRule) {                  foundToken = false;                }                else {                  foundToken = true;                }              }            }          }        }        int tokenOffset = scanner.getTokenOffset();        int tokenLength = scanner.getTokenLength();        // If you make a completion request in the middle of whitespace, we        // don't want to select the whitespace, so zero out the         // whitespace token offsets.        if (matchingRule instanceof WhitespaceRule) {          int partialOffset = (_offset - tokenOffset);          _offset += partialOffset;          tokenOffset += partialOffset;          tokenLength = 0;        }        else {          _viewer.setSelectedRange(_offset, tokenLength - (_offset - tokenOffset));        }        String token = document.get(tokenOffset, tokenLength);        String tokenType = null;        if (foundToken) {          if (matchingRule instanceof ElementNameRule) {            tokenType = PreferenceConstants.ELEMENT_NAME;          }          else if (matchingRule instanceof ElementTypeRule) {            tokenType = PreferenceConstants.ELEMENT_TYPE;          }          else if (matchingRule instanceof AssociationNameRule) {            tokenType = PreferenceConstants.ASSOCIATION_NAME;          }          else if (matchingRule instanceof AssociationValueRule) {            tokenType = PreferenceConstants.ASSOCIATION_VALUE;          }          else if (matchingRule instanceof OperatorRule) {            tokenType = null;//PreferenceConstants.OPERATOR;          }          else {            tokenType = null;          }        }        if (tokenType == null) {          int startOffset = tokenOffset;          if (startOffset != 0 && startOffset == document.getLength()) {            startOffset--;          }          int hintChar = -1;          //for (int startOffset = tokenOffset - 1; tokenType == null && startOffset > 0; startOffset--) {          for (; tokenType == null && startOffset > 0; startOffset--) {            int ch = document.getChar(startOffset);            if (ch == ':') {              tokenType = PreferenceConstants.ELEMENT_TYPE;            }            else if (ch == '{' || ch == ';') {              tokenType = PreferenceConstants.ASSOCIATION_NAME;            }            else if (ch == '=') {              tokenType = PreferenceConstants.ASSOCIATION_VALUE;            }            else if (ch == '}') {              tokenType = PreferenceConstants.ELEMENT_NAME;            }          }        }        if (tokenType == null) {          tokenType = PreferenceConstants.ELEMENT_NAME;        }        if (tokenType == PreferenceConstants.ELEMENT_NAME) {          fillInElementNameCompletionProposals(javaProject, document, path, token, tokenOffset, _offset, completionProposalsList);        }        else if (tokenType == PreferenceConstants.ELEMENT_TYPE) {          fillInElementTypeCompletionProposals(javaProject, token, tokenOffset, _offset, completionProposalsList);        }        else if (tokenType == PreferenceConstants.ASSOCIATION_NAME) {          IType componentType = findElementType(javaProject, document, scanner, tokenOffset);          fillInAssociationNameCompletionProposals(javaProject, componentType, path, token, tokenOffset, _offset, completionProposalsList);        }        else if (tokenType == PreferenceConstants.ASSOCIATION_VALUE) {          String associatedTypeName = path.removeFileExtension().lastSegment();          IType associatedType = findElementType(javaProject, associatedTypeName, true);          fillInAssociationValueCompletionProposals(javaProject, associatedType, token, tokenOffset, _offset, completionProposalsList);        }      }    }    catch (JavaModelException e) {      e.printStackTrace();    }    catch (BadLocationException e) {      // TODO Auto-generated catch block      e.printStackTrace();    }    catch (CoreException e) {      // TODO Auto-generated catch block      e.printStackTrace();    }    catch (IOException e) {      // TODO Auto-generated catch block      e.printStackTrace();    }    ICompletionProposal[] completionProposals = new ICompletionProposal[completionProposalsList.size()];    completionProposalsList.toArray(completionProposals);    return completionProposals;  }