本文整理汇总了Java中org.eclipse.jdt.core.IMethod.getNumberOfParameters方法的典型用法代码示例。如果您正苦于以下问题:Java IMethod.getNumberOfParameters方法的具体用法?Java IMethod.getNumberOfParameters怎么用?Java IMethod.getNumberOfParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IMethod
的用法示例。
在下文中一共展示了IMethod.getNumberOfParameters方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
private void invoke(IObjectModel model, IMethod m, Label resultLabel) {
PandionJUI.InvocationAction action = new PandionJUI.InvocationAction() {
public void invoke(String expression, String[] paramValues) {
model.invoke(m.getElementName(), new InvocationResult() {
public void valueReturn(Object o) {
PandionJUI.executeUpdate(() -> {
for(MethodWidget w : methodWidgets)
w.clear();
try {
if(PrimitiveType.isPrimitive(Signature.getSignatureSimpleName(m.getReturnType()))) {
String val = o.toString();
if(m.getReturnType().equals("char"))
val = "'" + val + "'";
resultLabel.setText(" = " + val);
}
else if(!m.getReturnType().equals("V")) {
if(o == null)
resultLabel.setText(" = null");
else
RuntimeViewer.getInstance().addObject((IEntityModel) o);
}
} catch (JavaModelException e) {
e.printStackTrace();
}
getModel().getRuntimeModel().evaluationNotify();
});
}
}, paramValues);
}
};
if(m.getNumberOfParameters() != 0)
PandionJUI.openInvocation(m, action);
else
action.invoke("", NO_PARAMS);
}
示例2: StaticInvocationWidget
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
public StaticInvocationWidget(Composite parent, InvokeDialog invokeDialog, IMethod method, InvocationAction action) {
super(parent, SWT.NONE);
this.invokeDialog = invokeDialog;
this.method = method;
setLayout(rowLayout);
methodName = method.getElementName();
parameterTypes = method.getParameterTypes();
Label label = new Label(this, SWT.NONE);
FontManager.setFont(label, PandionJConstants.VAR_FONT_SIZE);
label.setText(method.getElementName() + " (");
paramBoxes = new Combo[method.getNumberOfParameters()];
String[] parameterNames = null;
try {
parameterNames = method.getParameterNames();
} catch (JavaModelException e1) {
e1.printStackTrace();
}
for(int i = 0; i < parameterTypes.length; i++) {
if(i != 0) {
Label comma = new Label(this, SWT.NONE);
FontManager.setFont(comma, PandionJConstants.VAR_FONT_SIZE);
comma.setText(", ");
}
paramBoxes[i] = createCombo(invokeDialog, parameterNames[i], parameterTypes[i]);
}
Label close = new Label(this, SWT.NONE);
FontManager.setFont(close, PandionJConstants.VAR_FONT_SIZE);
close.setText(")");
addCacheValues(paramBoxes);
checkValidity();
}
示例3: getParameters
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
protected List<String> getParameters(IMethod method) throws JavaModelException {
List<String> parameters = new ArrayList<>(method.getNumberOfParameters());
for (String parameterType : method.getParameterTypes()) {
parameters.add(getFullyQualifiedName(method.getDeclaringType(), parameterType));
}
return parameters;
}
示例4: shortSig
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
private String shortSig(IMethod method) {
return method.getElementName() + (method.getNumberOfParameters() == 0 ? "()" : "(...)");
}