LinkedEnvironment environment= LinkedEnvironment.createLinkedEnvironment(document);
LinkedEnvironment environment= new LinkedEnvironment();
	private void enterLinkedMode(CompilationUnitChange change, ITextViewer viewer, GroupDescription[] linked, GroupDescription selection) throws BadLocationException {		IDocument document= viewer.getDocument();				HashMap map= new HashMap();				for (int i= 0; i < linked.length; i++) {			GroupDescription curr= linked[i];			String name= curr.getName(); // name used as key for link mode proposals & as kind for linked mode			LinkedPositionGroup group= (LinkedPositionGroup) map.get(name);			if (group == null) {				group= new LinkedPositionGroup();				map.put(name, group);			}							TextEdit[] textEdits= curr.getTextEdits();			if (name != null && textEdits.length > 0) {				IRegion range= change.getNewTextRange(textEdits);				if (range != null) {	// all edits could be deleted					ICompletionProposal[] linkedModeProposals= getLinkedModeProposals(name);					if (linkedModeProposals != null && linkedModeProposals.length > 1) {						group.createPosition(document, range.getOffset(), range.getLength(), i, linkedModeProposals);					} else {						group.createPosition(document, range.getOffset(), range.getLength(), i);					}				}			}		}				LinkedEnvironment environment= LinkedEnvironment.createLinkedEnvironment(document);		boolean added= false;		for (Iterator it= map.values().iterator(); it.hasNext(); ) {			LinkedPositionGroup group= (LinkedPositionGroup) it.next();			if (!group.isEmtpy()) {				environment.addGroup(group);				added= true;			}		}				if (added) { // only set up UI if there are any positions set			LinkedUIControl ui= new LinkedUIControl(environment, viewer);			if (selection != null) {				TextEdit[] textEdits= selection.getTextEdits();				if (textEdits.length > 0) {					IRegion range= change.getNewTextRange(textEdits);					if (range != null)						ui.setExitPosition(viewer, range.getOffset() + range.getLength(), 0, true);				}								} else {				int cursorPosition= viewer.getSelectedRange().x;				if (cursorPosition != 0) {					ui.setExitPosition(viewer, cursorPosition, 0, true);				}			}				ui.enter();						IRegion region= ui.getSelectedRegion();			viewer.setSelectedRange(region.getOffset(), region.getLength());				viewer.revealRange(region.getOffset(), region.getLength());		}	}