本文整理匯總了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 ? "()" : "(...)");
}