當前位置: 首頁>>代碼示例>>Java>>正文


Java IMethod.getElementName方法代碼示例

本文整理匯總了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);
	}
}
 
開發者ID:sebez,項目名稱:vertigo-chroma-kspplugin,代碼行數:17,代碼來源:ServiceManager.java

示例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);
	}
}
 
開發者ID:sebez,項目名稱:vertigo-chroma-kspplugin,代碼行數:17,代碼來源:DaoManager.java

示例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();
	}
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:20,代碼來源:InvokeWidget.java

示例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();
	}
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:20,代碼來源:InvocationArea.java

示例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);
		}
		
	}
}
 
開發者ID:mariazevedo88,項目名稱:o3smeasures-tool,代碼行數:32,代碼來源:LackCohesionMethodsJavaModel.java

示例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);
	}
}
 
開發者ID:mariazevedo88,項目名稱:o3smeasures-tool,代碼行數:27,代碼來源:MethodBuilder.java

示例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);
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:11,代碼來源:MethodDetails.java

示例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);
	}
}
 
開發者ID:sebez,項目名稱:vertigo-chroma-kspplugin,代碼行數:30,代碼來源:WsRouteManager.java

示例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);
}
 
開發者ID:sebez,項目名稱:vertigo-chroma-kspplugin,代碼行數:16,代碼來源:DtoUtils.java

示例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() + "(...)";
	}
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:8,代碼來源:ObjectFigure.java

示例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();
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:36,代碼來源:StaticInvocationWidget.java

示例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;
	}
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:10,代碼來源:StaticInvocationWidget.java

示例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;
}
 
開發者ID:de-jcup,項目名稱:egradle,代碼行數:15,代碼來源:EGradleJUnitLaunchShortCut.java

示例14: shortSig

import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
private String shortSig(IMethod method) {
	return method.getElementName() + (method.getNumberOfParameters() == 0 ? "()" : "(...)");
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:4,代碼來源:ObjectFigure.java

示例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));
}
 
開發者ID:CenterDevice,項目名稱:ClassCleaner,代碼行數:5,代碼來源:JavaElementConverter.java


注:本文中的org.eclipse.jdt.core.IMethod.getElementName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。