本文整理汇总了Java中org.eclipse.jdt.core.IMethod.getSignature方法的典型用法代码示例。如果您正苦于以下问题:Java IMethod.getSignature方法的具体用法?Java IMethod.getSignature怎么用?Java IMethod.getSignature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IMethod
的用法示例。
在下文中一共展示了IMethod.getSignature方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initByIMethodBinding
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
public void initByIMethodBinding(IMethodBinding mBinding) {
IMethod iMethod = (IMethod) mBinding.getJavaElement();
try {
key = iMethod.getKey().substring(0, iMethod.getKey().indexOf("("))
+ iMethod.getSignature();
projectName = mBinding.getJavaElement().getJavaProject()
.getElementName();
} catch (Exception e) {
projectName = "";
}
packageName = mBinding.getDeclaringClass().getPackage().getName();
className = mBinding.getDeclaringClass().getName();
name = mBinding.getName();
parameters = new ArrayList<>();
ITypeBinding[] parameterBindings = mBinding.getParameterTypes();
for (int i = 0; i < parameterBindings.length; i++) {
parameters.add(parameterBindings[i].getName());
}
}
示例2: resolveMethodSignature
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
/**
* Copied from org.eclipse.jdt.internal.debug.ui.actions.ToggleBreakpointAdapter
* TODO: is there a public API to do this?
*
* Returns the resolved signature of the given method
* @param method method to resolve
* @return the resolved method signature or <code>null</code> if none
* @throws JavaModelException
* @since 3.4
*/
public static String resolveMethodSignature(IMethod method) throws JavaModelException {
String signature = method.getSignature();
String[] parameterTypes = Signature.getParameterTypes(signature);
int length = parameterTypes.length;
String[] resolvedParameterTypes = new String[length];
for (int i = 0; i < length; i++) {
resolvedParameterTypes[i] = resolveTypeSignature(method, parameterTypes[i]);
if (resolvedParameterTypes[i] == null) {
return null;
}
}
String resolvedReturnType = resolveTypeSignature(method, Signature.getReturnType(signature));
if (resolvedReturnType == null) {
return null;
}
return Signature.createMethodSignature(resolvedParameterTypes, resolvedReturnType);
}
示例3: setMethod
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
public void setMethod(IMethod method, InvocationAction a) {
String key = null;
try {
IType type = (IType) method.getParent();
key = type.getFullyQualifiedName() + "|" + method.getElementName() + method.getSignature();
} catch (JavaModelException e) {
e.printStackTrace();
}
if(key != null) {
StaticInvocationWidget2 inv = invWidgetsMap.get(key);
if(inv == null) {
inv = new StaticInvocationWidget2(this, null, method, a);
invWidgetsMap.put(key, inv);
}
inv.refreshItems();
layout.topControl = inv;
layout();
}
}
示例4: setMethod
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
public void setMethod(IFile file, IMethod method, InvocationAction a) {
String key = null;
try {
IType type = (IType) method.getParent();
key = type.getFullyQualifiedName() + "|" + method.getElementName() + method.getSignature();
} catch (JavaModelException e) {
e.printStackTrace();
}
if(key != null) {
StaticInvocationWidget inv = invWidgetsMap.get(key);
if(inv == null) {
inv = new StaticInvocationWidget(this, file, method, a);
invWidgetsMap.put(key, inv);
}
inv.refreshItems(file);
layout.topControl = inv;
layout();
}
}
示例5: getMethodKey
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
private String getMethodKey(IMethod method) {
try {
IType type = (IType) method.getParent();
return type.getFullyQualifiedName() + "|" + method.getElementName() + method.getSignature();
} catch (JavaModelException e) {
e.printStackTrace();
return null;
}
}