本文整理匯總了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;
}
}