Bug 47874 Change Method Signature: enable if cursor is in signature [refactoring]
M5 Currently the user has to select the method name. Would be better if the refactoring will work if the cursor is inside the method's signature.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/ModifyParametersAction.java
}
	}
		
	private static boolean canEnable(IStructuredSelection selection) throws JavaModelException{
		return canRunOn(getSingleSelectedMethod(selection));
	}
	
	private static IMethod getSingleSelectedMethod(IStructuredSelection selection){
		if (selection.isEmpty() || selection.size() != 1) 
			return null;
		if (selection.getFirstElement() instanceof IMethod)
			return (IMethod)selection.getFirstElement();
		return null;
	}
	
	private IMethod getSingleSelectedMethod(ITextSelection selection) throws JavaModelException{
		IJavaElement[] elements= resolveElements();
		if (elements.length != 1)
			return null;
		if (elements[0] instanceof IMethod)
			return (IMethod)elements[0];
		IJavaElement elementAt= SelectionConverter.getInputAsCompilationUnit(fEditor).getElementAt(selection.getOffset());
		if (elementAt instanceof IMethod)
			return (IMethod)elementAt;
		return null;
	}
	
	private static boolean canRunOn(IMethod method) throws JavaModelException{
		return ChangeSignatureRefactoring.isAvailable(method);
	}