char[] signature= fProposal.getSignature(); char[][] typeArguments= Signature.getTypeArguments(signature); char[][] typeArgumentNames= null;
CharSequence[] typeArgumentNames= computeTypeArgumentNames();
	public void apply(IDocument document, char trigger, int offset) {				char[] signature= fProposal.getSignature();		char[][] typeArguments= Signature.getTypeArguments(signature);		char[][] typeArgumentNames= null;		//		final Map bindings= new HashMap();//		fContext.getExpectedTypesKeys();//		if (expectedTypesKeys != null && expectedTypesKeys.length > 0) {//			final String[] keys= new String[expectedTypesKeys.length];//			for (int i= 0; i < keys.length; i++) {//				keys[i]= String.valueOf(expectedTypesKeys[i]);//			}//			//			final ASTParser parser= ASTParser.newParser(AST.JLS3);//			parser.setProject(fCompilationUnit.getJavaProject());//			parser.setResolveBindings(true);//			//			ASTRequestor requestor= new ASTRequestor() {////				public void acceptBinding(String bindingKey,IBinding binding) {//					bindings.put(bindingKey, binding);//				}//			};//			parser.createASTs(new ICompilationUnit[0], keys, requestor, null);//		}//						// TODO add context awareness		if (typeArguments.length == 0) {			// check for binary types which are not reported as parameterized			if (fCompilationUnit != null) {				String fullType= SignatureUtil.stripSignatureToFQN(String.valueOf(signature));				try {					IType type= fCompilationUnit.getJavaProject().findType(fullType);					if (type != null) {						String[] typeParameterSignatures= type.getTypeParameterSignatures();						if (typeParameterSignatures.length > 0) {							// we've got a parameterized type!							// TODO do parameter guessing based on type signatures							// for now: just add parameters							typeArgumentNames= new char[typeParameterSignatures.length][];							for (int i= 0; i < typeParameterSignatures.length; i++) {								typeArgumentNames[i]= Signature.getTypeVariable(typeParameterSignatures[i].toCharArray());							}						}					}				} catch (JavaModelException e) {					// ignore and return the original proposal				}			}					} else {			typeArgumentNames= new char[typeArguments.length][];			for (int i= 0; i < typeArguments.length; i++) {				typeArgumentNames[i]= Signature.getSignatureSimpleName(typeArguments[i]);			}		}				if (typeArgumentNames == null) {			// not a parameterized type			super.apply(document, trigger, offset);			return;		}				int count;		int[] offsets, lengths;		StringBuffer buffer= new StringBuffer();		buffer.append(getReplacementString());				if (appendArguments(fTextViewer, offset)) {							count= typeArgumentNames.length;			offsets= new int[count];			lengths= new int[count];						buffer.append('<');			for (int i= 0; i != count; i++) {				if (i != 0)					buffer.append(", "); //$NON-NLS-1$									offsets[i]= buffer.length();				buffer.append(typeArgumentNames[i]);				lengths[i]= buffer.length() - offsets[i];			}			buffer.append('>');		} else {			count= 0;			offsets= new int[0];			lengths= new int[0];						}				// set the generic type as replacement string		super.setReplacementString(buffer.toString());		// add import & remove package, update replacement offset		super.apply(document, trigger, offset);		int replacementOffset= getReplacementOffset();		String replacementString= getReplacementString();		int offsetSubtraction= buffer.length() - replacementString.length(); // due to using an import instead of package		if (offsets.length > 0 && fTextViewer != null) {			try {				LinkedModeModel model= new LinkedModeModel();				for (int i= 0; i != offsets.length; i++) {					LinkedPositionGroup group= new LinkedPositionGroup();					group.addPosition(new LinkedPosition(document, replacementOffset + offsets[i] - offsetSubtraction, lengths[i], LinkedPositionGroup.NO_STOP));					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, replacementOffset + replacementString.length(), 0, Integer.MAX_VALUE);				ui.setDoContextInfo(true);				ui.enter();					fSelectedRegion= ui.getSelectedRegion();				} catch (BadLocationException e) {				JavaPlugin.log(e);					openErrorDialog(e);			}				} else			fSelectedRegion= new Region(replacementOffset + replacementString.length(), 0);	}