本文整理匯總了Java中org.eclipse.jdt.core.IMethod.getElementName方法的典型用法代碼示例。如果您正苦於以下問題:Java IMethod.getElementName方法的具體用法?Java IMethod.getElementName怎麽用?Java IMethod.getElementName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.IMethod
的用法示例。
在下文中一共展示了IMethod.getElementName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleType
import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
private void handleType(IType type, IFile file, List<ServiceImplementation> serviceImplementations) throws JavaModelException {
/* Parcourt les méthodes. */
for (IMethod method : type.getMethods()) {
/* Filtre pour ne garder que les méthodes publiques d'instance */
if (method.isConstructor() || Flags.isStatic(method.getFlags()) || Flags.isPrivate(method.getFlags())) {
continue;
}
/* Créé le ServiceImplementation. */
String javaName = method.getElementName();
ISourceRange nameRange = method.getNameRange();
FileRegion fileRegion = new FileRegion(file, nameRange.getOffset(), nameRange.getLength());
ServiceImplementation serviceImplementation = new ServiceImplementation(fileRegion, javaName);
serviceImplementations.add(serviceImplementation);
}
}
示例2: handleType
import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
private void handleType(IType type, IFile file, List<DaoImplementation> daoImplementations) throws JavaModelException {
/* Parcourt les méthodes. */
for (IMethod method : type.getMethods()) {
/* Filtre pour ne garder que les méthodes publiques d'instance */
if (method.isConstructor() || Flags.isStatic(method.getFlags()) || Flags.isPrivate(method.getFlags())) {
continue;
}
/* Créé le DaoImplementation. */
String javaName = method.getElementName();
ISourceRange nameRange = method.getNameRange();
FileRegion fileRegion = new FileRegion(file, nameRange.getOffset(), nameRange.getLength());
DaoImplementation daoImplementation = new DaoImplementation(fileRegion, javaName);
daoImplementations.add(daoImplementation);
}
}
示例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: checkMethodsWithSharedAttributes
import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
/**
* Method to check with methods share common attributes, according to
* CK definition.
* @author Mariana Azevedo
* @since 13/07/2014
* @param methods
*/
private void checkMethodsWithSharedAttributes(IMethod[] methods){
IScanner scanner = null;
for (IMethod method : methods) {
String methodName = method.getElementName();
try {
scanner = ToolFactory.createScanner(false, false, false, false);
scanner.setSource(method.getSource().toCharArray());
while(true){
int charactere = scanner.getNextToken();
if (charactere == ITerminalSymbols.TokenNameEOF) break;
if (charactere == ITerminalSymbols.TokenNameIdentifier) {
addMethods(new String(scanner.getCurrentTokenSource()), methodName);
}
}
} catch (JavaModelException exception1) {
logger.error(exception1);
} catch (InvalidInputException exception2) {
logger.error(exception2);
}
}
}
示例6: build
import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
/**
* @see IBuilder#build
*/
@Override
public void build(Measure measure, ItemMeasured item) {
try {
for (IType unit : myClass.getAllTypes()) {
for (IMethod method : unit.getMethods()) {
ItemMeasured methodItem = new ItemMeasured(method.getElementName(), item);
measure.measure(method);
methodItem.setValue(measure.getCalculatedValue());
methodItem.setMean(measure.getMeanValue());
item.addValue(measure.getCalculatedValue());
item.addMean(measure.getMeanValue());
item.setMax(measure.getMaxValue());
item.setClassWithMax(measure.getClassWithMaxValue());
item.addChild(methodItem);
}
}
} catch (JavaModelException exception) {
logger.error(exception);
}
}
示例7: MethodDetails
import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
public MethodDetails(IMethod iMethod, String className, boolean isSourceAvailable) throws JavaModelException {
methodName = iMethod.getElementName();
signature = createSignature(iMethod);
if (isSourceAvailable) {
createFormattedJavaDoc(iMethod);
createPlaceHolderFromSource(iMethod, className);
} else {
placeHolder = createDefaultPlaceHolder(iMethod, className);
}
}
示例8: handleMethod
import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
private void handleMethod(IMethod method, String pathPrefix, IFile file, List<WsRoute> wsRoutes) throws JavaModelException {
/* Filtre pour ne garder que les méthodes publiques d'instance */
if (method.isConstructor() || Flags.isStatic(method.getFlags()) || Flags.isPrivate(method.getFlags())) {
return;
}
/* Parcourt les verbes HTTP */
for (String verb : HTTP_VERBS) {
/* Extrait l'annotation du verbe. */
IAnnotation verbAnnotation = JdtUtils.getAnnotation(method, verb);
if (verbAnnotation == null) {
continue;
}
/* Extrait la route partielle. */
String routePatternSuffix = JdtUtils.getMemberValue(verbAnnotation);
/* Calcule la route complète. */
String routePattern = pathPrefix + routePatternSuffix;
/* Créé la WsRoute. */
String javaName = method.getElementName();
ISourceRange nameRange = method.getNameRange();
FileRegion fileRegion = new FileRegion(file, nameRange.getOffset(), nameRange.getLength());
WsRoute wsRoute = new WsRoute(fileRegion, javaName, routePattern, verb);
wsRoutes.add(wsRoute);
}
}
示例9: parseKasper3BeanFieldGetter
import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
private static DtoField parseKasper3BeanFieldGetter(IMethod method) throws JavaModelException {
if (method.isConstructor() || !Flags.isPublic(method.getFlags()) || !Flags.isFinal(method.getFlags())) {
return null;
}
String methodName = method.getElementName();
if (!methodName.startsWith("get")) {
return null;
}
String constantCaseName = StringUtils.toConstantCase(KspStringUtils.getFieldNameFromGetter(method.getElementName()));
String label = "Unknown";
Boolean persistent = false;
return new DtoField(constantCaseName, label, "Unknown", persistent);
}
示例10: longSig
import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
private String longSig(IMethod method) {
try {
return Signature.getSignatureSimpleName(method.getReturnType()) + " " + method.getElementName() + "(" + String.join(", ", method.getParameterNames()) + ")";
} catch (JavaModelException e) {
return method.getElementName() + "(...)";
}
}
示例11: 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();
}
示例12: 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;
}
}
示例13: createLaunchConfigurationNameProposal
import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
@Override
protected String createLaunchConfigurationNameProposal(String projectName, IResource resource,
Object additionalScope) {
String name = super.createLaunchConfigurationNameProposal(projectName, resource, additionalScope);
if (resource instanceof IFile) {
String fileName = getResourceHelper().getFileName(resource);
name = name + "#" + fileName;
}
if (additionalScope instanceof IMethod) {
IMethod method = (IMethod) additionalScope;
name = name + "." + method.getElementName();
}
return name;
}
示例14: shortSig
import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
private String shortSig(IMethod method) {
return method.getElementName() + (method.getNumberOfParameters() == 0 ? "()" : "(...)");
}
示例15: createMethodElement
import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
protected MethodElement createMethodElement(IMethod method) throws JavaModelException {
return new MethodElement(getFullyQualifiedClassName(method), method.getElementName(), getParameters(method),
getLineNumber(method));
}