if (DEBUG) System.err.println("Parameter Guessing: " + (System.currentTimeMillis() - millis) + "ms");
if (DEBUG) System.err.println("Parameter Guessing: " + (System.currentTimeMillis() - millis));
	public void apply(IDocument document, char trigger, int offset) {		try {			int parameterCount= fParameterNames.length;			int[] positionOffsets;			int[] positionLengths;			Position[] positions;			String replacementString;			int baseOffset= getReplacementOffset();						if (appendArguments(document, offset)) {				parameterCount= fParameterNames.length;				positionOffsets= new int[parameterCount];				positionLengths= new int[parameterCount];				positions= new Position[parameterCount];								long millis= DEBUG ? System.currentTimeMillis() : 0;				replacementString= computeGuessingCompletion(baseOffset, positionOffsets, positionLengths, document, positions);				if (DEBUG) System.err.println("Parameter Guessing: " + (System.currentTimeMillis() - millis) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$							} else {				parameterCount= 0;				positionOffsets= new int[0];				positionLengths= new int[0];				positions= new Position[0];								replacementString= fName;			}			setReplacementString(replacementString);					super.apply(document, trigger, offset);			if (parameterCount > 0 && fTextViewer != null) {				LinkedModeModel model= new LinkedModeModel();				for (int i= 0; i != parameterCount; i++) {					LinkedPositionGroup group= new LinkedPositionGroup();					int positionOffset= baseOffset + positionOffsets[i];					if (fChoices[i].length < 2) {						group.addPosition(new LinkedPosition(document, positionOffset, positionLengths[i], LinkedPositionGroup.NO_STOP));					} else {						ensurePositionCategoryInstalled(document, model);						document.addPosition(getCategory(), positions[i]);						group.addPosition(new ProposalPosition(document, positionOffset, positionLengths[i], LinkedPositionGroup.NO_STOP, fChoices[i]));					}					model.addGroup(group);				}								model.forceInstall();				JavaEditor editor= getJavaEditor();				if (editor != null) {					model.addLinkingListener(new EditorHighlightingSynchronizer(editor));				}												LinkedModeUI ui= new EditorLinkedModeUI(model, fTextViewer);				ui.setExitPosition(fTextViewer, baseOffset + replacementString.length(), 0, Integer.MAX_VALUE);				ui.setExitPolicy(new ExitPolicy(')'));				ui.setCyclingMode(LinkedModeUI.CYCLE_WHEN_NO_PARENT);				ui.setDoContextInfo(true);				ui.enter();				fSelectedRegion= ui.getSelectedRegion();							} else {				fSelectedRegion= new Region(baseOffset + replacementString.length(), 0);			}		} catch (BadLocationException e) {			ensurePositionCategoryRemoved(document);			JavaPlugin.log(e);				openErrorDialog(e);		} catch (JavaModelException e) {			ensurePositionCategoryRemoved(document);			JavaPlugin.log(e);				openErrorDialog(e);					} catch (BadPositionCategoryException e) {			ensurePositionCategoryRemoved(document);			JavaPlugin.log(e);				openErrorDialog(e);					}	}