private void enterLinkedModeForPrefix(IDocument document,ITextViewer viewer,IDOMElement rootElement,String prefix) throws BadLocationException {
  int linkedPosSequence=0;
  LinkedPosition pos1=new LinkedPosition(document,startPosition,prefix.length(),linkedPosSequence++);
  LinkedPosition pos2=new LinkedPosition(document,cursorPosition + 2,prefix.length(),linkedPosSequence++);
  IDOMElement rootDomElement=(IDOMElement)rootElement;
  final String xmlnsPrefix="xmlns:";
  String fullPrefixName=xmlnsPrefix + prefix;
  IDOMAttr domAttribute=(IDOMAttr)rootDomElement.getAttributeNode(fullPrefixName);
  LinkedPosition pos3=new LinkedPosition(document,domAttribute.getStartOffset() + xmlnsPrefix.length(),prefix.length(),linkedPosSequence++);
  LinkedPositionGroup group=new LinkedPositionGroup();
  group.addPosition(pos1);
  group.addPosition(pos2);
  group.addPosition(pos3);
  LinkedModeModel model=new LinkedModeModel();
  model.addGroup(group);
  model.forceInstall();
  LinkedModeUI ui=new LinkedModeUI(model,viewer);
  ui.enter();
  wasLinkedModeEntered=true;
}

private void enterLinkedModeForPrefix ( IDocument document , ITextViewer viewer , IDOMElement rootElement , String prefix ) throws BadLocationException { int linkedPosSequence = 0 ; LinkedPosition pos1 = new LinkedPosition ( document , startPosition , prefix . length ( ) , linkedPosSequence ++ ) ; LinkedPosition pos2 = new LinkedPosition ( document , cursorPosition + 2 , prefix . length ( ) , linkedPosSequence ++ ) ; IDOMElement rootDomElement = ( IDOMElement ) rootElement ; final String xmlnsPrefix = "xmlns:" ; String fullPrefixName = xmlnsPrefix + prefix ; IDOMAttr domAttribute = ( IDOMAttr ) rootDomElement . getAttributeNode ( fullPrefixName ) ; LinkedPosition pos3 = new LinkedPosition ( document , domAttribute . getStartOffset ( ) + xmlnsPrefix . length ( ) , prefix . length ( ) , linkedPosSequence ++ ) ; LinkedPositionGroup group = new LinkedPositionGroup ( ) ; group . addPosition ( pos1 ) ; group . addPosition ( pos2 ) ; group . addPosition ( pos3 ) ; LinkedModeModel model = new LinkedModeModel ( ) ; model . addGroup ( group ) ; model . forceInstall ( ) ; LinkedModeUI ui = new LinkedModeUI ( model , viewer ) ; ui . enter ( ) ; wasLinkedModeEntered = true ; }
enters the linked mode for editing the namespace prefix we generated .
