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


Java ITypeBinding.isInterface方法代碼示例

本文整理匯總了Java中org.eclipse.jdt.core.dom.ITypeBinding.isInterface方法的典型用法代碼示例。如果您正苦於以下問題:Java ITypeBinding.isInterface方法的具體用法?Java ITypeBinding.isInterface怎麽用?Java ITypeBinding.isInterface使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jdt.core.dom.ITypeBinding的用法示例。


在下文中一共展示了ITypeBinding.isInterface方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getCastFavorite

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
private ITypeBinding getCastFavorite(ITypeBinding[] suggestedCasts, ITypeBinding nodeToCastBinding) {
	if (nodeToCastBinding == null) {
		return suggestedCasts[0];
	}
	ITypeBinding favourite= suggestedCasts[0];
	for (int i = 0; i < suggestedCasts.length; i++) {
		ITypeBinding curr= suggestedCasts[i];
		if (nodeToCastBinding.isCastCompatible(curr)) {
			return curr;
		}
		if (curr.isInterface()) {
			favourite= curr;
		}
	}
	return favourite;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:17,代碼來源:CastCorrectionProposal.java

示例2: isFieldOfAtLeastOneGeneralType

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
public boolean isFieldOfAtLeastOneGeneralType(String fullyQualifiedName) {
	boolean genField = false;

	model = m.getModel();
	Set<String> javaLibList = model.getJavaLibTypes();
	ITypeBinding typeBinding = getTypeBinding(fullyQualifiedName);
	String frameworkType = getRawTypeName(fullyQualifiedName);
	if (typeBinding != null) {
		if (typeBinding.isInterface() || Modifier.isAbstract(typeBinding.getModifiers())
		        || javaLibList.contains(frameworkType)) {
			genField = true;
		}
	}

	return genField;
}
 
開發者ID:aroog,項目名稱:code,代碼行數:17,代碼來源:QualUtils.java

示例3: isVisibleInHierarchy

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
public static boolean isVisibleInHierarchy(IMethodBinding member, IPackageBinding pack) {
	int otherflags= member.getModifiers();
	ITypeBinding declaringType= member.getDeclaringClass();
	if (Modifier.isPublic(otherflags) || Modifier.isProtected(otherflags) || (declaringType != null && declaringType.isInterface())) {
		return true;
	} else if (Modifier.isPrivate(otherflags)) {
		return false;
	}
	return declaringType != null && pack == declaringType.getPackage();
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:11,代碼來源:Bindings.java

示例4: isSuperType

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
/**
 * Returns <code>true</code> if the given type is a super type of a candidate.
 * <code>true</code> is returned if the two type bindings are identical (TODO)
 * @param possibleSuperType the type to inspect
 * @param type the type whose super types are looked at
 * @param considerTypeArguments if <code>true</code>, consider type arguments of <code>type</code>
 * @return <code>true</code> iff <code>possibleSuperType</code> is
 * 		a super type of <code>type</code> or is equal to it
 */
public static boolean isSuperType(ITypeBinding possibleSuperType, ITypeBinding type, boolean considerTypeArguments) {
	if (type.isArray() || type.isPrimitive()) {
		return false;
	}
	if (! considerTypeArguments) {
		type= type.getTypeDeclaration();
	}
	if (Bindings.equals(type, possibleSuperType)) {
		return true;
	}
	ITypeBinding superClass= type.getSuperclass();
	if (superClass != null) {
		if (isSuperType(possibleSuperType, superClass, considerTypeArguments)) {
			return true;
		}
	}

	if (possibleSuperType.isInterface()) {
		ITypeBinding[] superInterfaces= type.getInterfaces();
		for (int i= 0; i < superInterfaces.length; i++) {
			if (isSuperType(possibleSuperType, superInterfaces[i], considerTypeArguments)) {
				return true;
			}
		}
	}
	return false;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:37,代碼來源:Bindings.java

示例5: isContainerOfGeneralType

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
public boolean isContainerOfGeneralType(String fullyQualifiedName) {
	boolean oneItf = false;

	model = m.getModel();
	Set<String> containerList = model.getContainerTypes();
	// Get the type of container;
	String containerType = getRawTypeName(fullyQualifiedName);
	if (containerList.contains(containerType)) {
		ITypeBinding typeBinding = getTypeBinding(fullyQualifiedName);
		if (typeBinding != null) {
			ITypeBinding[] typeArguments = typeBinding.getTypeArguments();
			if (typeArguments != null) {
				for (int ii = 0; ii < typeArguments.length; ii++) {
					ITypeBinding typeArgument = typeArguments[ii];
					// Changed this to container of a general type
					// (Interface and Abstract classes)
					if (typeArgument != null && typeArgument.isInterface()
					        || Modifier.isAbstract(typeArgument.getModifiers())
					        || isJavaTypes(typeArgument.getQualifiedName())) {
						// TODO: Are we checking that at least one is an
						// interface; or that all are interfaces?
						oneItf = true;
						break;
					}
				}
			}
		}
	}

	return oneItf;
}
 
開發者ID:aroog,項目名稱:code,代碼行數:32,代碼來源:QualUtils.java

示例6: isInterfaceType

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
public boolean isInterfaceType(String fullyQualifiedName) {
	boolean genInterfaceType = false;
	ITypeBinding typeBinding = getTypeBinding(fullyQualifiedName);
	if (typeBinding != null) {
		if (typeBinding.isInterface()) {
			genInterfaceType = true;
		}
	}
	return genInterfaceType;
}
 
開發者ID:aroog,項目名稱:code,代碼行數:11,代碼來源:QualUtils.java

示例7: updateReplacementString

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
public String updateReplacementString(IDocument document, int offset, ImportRewrite importRewrite,
		boolean snippetStringSupport)
				throws CoreException, BadLocationException {
	Document recoveredDocument= new Document();
	CompilationUnit unit= getRecoveredAST(document, offset, recoveredDocument);
	ImportRewriteContext context = new ContextSensitiveImportRewriteContext(unit, offset, importRewrite);

	ITypeBinding declaringType= null;
	ChildListPropertyDescriptor descriptor= null;
	ASTNode node= NodeFinder.perform(unit, offset, 1);
	node= ASTResolving.findParentType(node);
	String result = null;
	if (node instanceof AnonymousClassDeclaration) {
		declaringType= ((AnonymousClassDeclaration) node).resolveBinding();
		descriptor= AnonymousClassDeclaration.BODY_DECLARATIONS_PROPERTY;
	} else if (node instanceof AbstractTypeDeclaration) {
		AbstractTypeDeclaration declaration= (AbstractTypeDeclaration) node;
		descriptor= declaration.getBodyDeclarationsProperty();
		declaringType= declaration.resolveBinding();
	}
	if (declaringType != null) {
		ASTRewrite rewrite= ASTRewrite.create(unit.getAST());
		IMethodBinding methodToOverride= Bindings.findMethodInHierarchy(declaringType, fMethodName, fParamTypes);
		if (methodToOverride == null && declaringType.isInterface()) {
			methodToOverride= Bindings.findMethodInType(node.getAST().resolveWellKnownType("java.lang.Object"), fMethodName, fParamTypes); //$NON-NLS-1$
		}
		if (methodToOverride != null) {
			CodeGenerationSettings settings = PreferenceManager.getCodeGenerationSettings(fJavaProject.getProject());
			MethodDeclaration stub = StubUtility2.createImplementationStub(fCompilationUnit, rewrite, importRewrite,
					context, methodToOverride, declaringType, settings, declaringType.isInterface(), declaringType,
					snippetStringSupport);
			ListRewrite rewriter= rewrite.getListRewrite(node, descriptor);
			rewriter.insertFirst(stub, null);

			ITrackedNodePosition position= rewrite.track(stub);
			try {
				Map<String, String> options = fJavaProject.getOptions(true);

				rewrite.rewriteAST(recoveredDocument, options).apply(recoveredDocument);

				String generatedCode = recoveredDocument.get(position.getStartPosition(), position.getLength());

				String indentAt = getIndentAt(recoveredDocument, position.getStartPosition(), settings);
				int generatedIndent = IndentManipulation.measureIndentUnits(indentAt, settings.tabWidth,
						settings.indentWidth);
				// Kinda fishy but empirical data shows Override needs to change indent by at
				// least 1
				generatedIndent = Math.max(1, generatedIndent);

				// Cancel generated code indent
				String delimiter = TextUtilities.getDefaultLineDelimiter(document);
				result = IndentManipulation.changeIndent(generatedCode, generatedIndent, settings.tabWidth,
						settings.indentWidth, "", delimiter);

			} catch (MalformedTreeException | BadLocationException exception) {
				JavaLanguageServerPlugin.logException("Unable to compute override proposal", exception);
			}
		}
	}
	return result;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:62,代碼來源:OverrideCompletionProposal.java

示例8: visit

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
@Override
public boolean visit(ITypeBinding type) {
	IMethodBinding[] methods= type.getDeclaredMethods();
	for (int i= 0; i < methods.length; i++) {
		IMethodBinding candidate= methods[i];
		if (candidate.getMethodDeclaration() == fOriginalMethod.getMethodDeclaration()) {
			continue;
		}
		ITypeBinding candidateDeclaringType= candidate.getDeclaringClass();
		if (fDeclaringType != candidateDeclaringType) {
			int modifiers= candidate.getModifiers();
			if (candidateDeclaringType.isInterface() && Modifier.isStatic(modifiers)) {
				continue;
			}
			if (Modifier.isPrivate(modifiers)) {
				continue;
			}
		}
		if (fOriginalMethod.getName().equals(candidate.getName()) && !fOriginalMethod.overrides(candidate)) {
			ITypeBinding[] originalParameterTypes= fOriginalMethod.getParameterTypes();
			ITypeBinding[] candidateParameterTypes= candidate.getParameterTypes();

			boolean couldBeAmbiguous;
			if (originalParameterTypes.length == candidateParameterTypes.length) {
				couldBeAmbiguous= true;
			} else if (fOriginalMethod.isVarargs() || candidate.isVarargs() ) {
				int candidateMinArgumentCount= candidateParameterTypes.length;
				if (candidate.isVarargs()) {
					candidateMinArgumentCount--;
				}
				couldBeAmbiguous= fArgumentCount >= candidateMinArgumentCount;
			} else {
				couldBeAmbiguous= false;
			}
			if (couldBeAmbiguous) {
				ITypeBinding parameterType= ASTResolving.getParameterTypeBinding(candidate, fArgIndex);
				if (parameterType != null && parameterType.getFunctionalInterfaceMethod() != null) {
					if (!fExpressionIsExplicitlyTyped) {
						/* According to JLS8 15.12.2.2, implicitly typed lambda expressions are not "pertinent to applicability"
						 * and hence potentially applicable methods are always "applicable by strict invocation",
						 * regardless of whether argument expressions are compatible with the method's parameter types or not.
						 * If there are multiple such methods, 15.12.2.5 results in an ambiguous method invocation.
						 */
						return false;
					}
					/* Explicitly typed lambda expressions are pertinent to applicability, and hence
					 * compatibility with the corresponding method parameter type is checked. And since this check
					 * separates functional interface methods by their void-compatibility state, functional interfaces
					 * with a different void compatibility are not applicable any more and hence can't cause
					 * an ambiguous method invocation.
					 */
					ITypeBinding origParamType= ASTResolving.getParameterTypeBinding(fOriginalMethod, fArgIndex);
					boolean originalIsVoidCompatible=  Bindings.isVoidType(origParamType.getFunctionalInterfaceMethod().getReturnType());
					boolean candidateIsVoidCompatible= Bindings.isVoidType(parameterType.getFunctionalInterfaceMethod().getReturnType());
					if (originalIsVoidCompatible == candidateIsVoidCompatible) {
						return false;
					}
				}
			}
		}
	}
	return true;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:64,代碼來源:ASTNodes.java

示例9: addIncompatibleReturnTypeProposals

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
public static void addIncompatibleReturnTypeProposals(IInvocationContext context, IProblemLocation problem,
		Collection<CUCorrectionProposal> proposals) throws JavaModelException {
	CompilationUnit astRoot= context.getASTRoot();
	ASTNode selectedNode= problem.getCoveringNode(astRoot);
	if (selectedNode == null) {
		return;
	}
	MethodDeclaration decl= ASTResolving.findParentMethodDeclaration(selectedNode);
	if (decl == null) {
		return;
	}
	IMethodBinding methodDeclBinding= decl.resolveBinding();
	if (methodDeclBinding == null) {
		return;
	}

	ITypeBinding returnType= methodDeclBinding.getReturnType();
	IMethodBinding overridden= Bindings.findOverriddenMethod(methodDeclBinding, false);
	if (overridden == null || overridden.getReturnType() == returnType) {
		return;
	}


	ICompilationUnit cu= context.getCompilationUnit();
	IMethodBinding methodDecl= methodDeclBinding.getMethodDeclaration();
	ITypeBinding overriddenReturnType= overridden.getReturnType();
	if (! JavaModelUtil.is50OrHigher(context.getCompilationUnit().getJavaProject())) {
		overriddenReturnType= overriddenReturnType.getErasure();
	}
	proposals.add(new TypeChangeCorrectionProposal(cu, methodDecl, astRoot, overriddenReturnType, false, IProposalRelevance.CHANGE_RETURN_TYPE));

	ICompilationUnit targetCu= cu;

	IMethodBinding overriddenDecl= overridden.getMethodDeclaration();
	ITypeBinding overridenDeclType= overriddenDecl.getDeclaringClass();

	if (overridenDeclType.isFromSource()) {
		targetCu= ASTResolving.findCompilationUnitForBinding(cu, astRoot, overridenDeclType);
		if (targetCu != null && ASTResolving.isUseableTypeInContext(returnType, overriddenDecl, false)) {
			TypeChangeCorrectionProposal proposal= new TypeChangeCorrectionProposal(targetCu, overriddenDecl, astRoot, returnType, false, IProposalRelevance.CHANGE_RETURN_TYPE_OF_OVERRIDDEN);
			if (overridenDeclType.isInterface()) {
				proposal.setDisplayName(Messages.format(CorrectionMessages.TypeMismatchSubProcessor_changereturnofimplemented_description, BasicElementLabels.getJavaElementName(overriddenDecl.getName())));
			} else {
				proposal.setDisplayName(Messages.format(CorrectionMessages.TypeMismatchSubProcessor_changereturnofoverridden_description, BasicElementLabels.getJavaElementName(overriddenDecl.getName())));
			}
			proposals.add(proposal);
		}
	}
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:50,代碼來源:TypeMismatchSubProcessor.java

示例10: addNewMethodProposals

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
private static void addNewMethodProposals(ICompilationUnit cu, CompilationUnit astRoot, Expression sender,
		List<Expression> arguments, boolean isSuperInvocation, ASTNode invocationNode, String methodName,
		Collection<CUCorrectionProposal> proposals) throws JavaModelException {
	ITypeBinding nodeParentType= Bindings.getBindingOfParentType(invocationNode);
	ITypeBinding binding= null;
	if (sender != null) {
		binding= sender.resolveTypeBinding();
	} else {
		binding= nodeParentType;
		if (isSuperInvocation && binding != null) {
			binding= binding.getSuperclass();
		}
	}
	if (binding != null && binding.isFromSource()) {
		ITypeBinding senderDeclBinding= binding.getTypeDeclaration();

		ICompilationUnit targetCU= ASTResolving.findCompilationUnitForBinding(cu, astRoot, senderDeclBinding);
		if (targetCU != null) {
			String label;
			ITypeBinding[] parameterTypes= getParameterTypes(arguments);
			if (parameterTypes != null) {
				String sig = ASTResolving.getMethodSignature(methodName, parameterTypes, false);
				boolean is18OrHigher= JavaModelUtil.is18OrHigher(targetCU.getJavaProject());

				boolean isSenderBindingInterface= senderDeclBinding.isInterface();
				if (nodeParentType == senderDeclBinding) {
					label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_createmethod_description, sig);
				} else {
					label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_createmethod_other_description, new Object[] { sig, BasicElementLabels.getJavaElementName(senderDeclBinding.getName()) } );
				}
				if (is18OrHigher || !isSenderBindingInterface
						|| (nodeParentType != senderDeclBinding && (!(sender instanceof SimpleName) || !((SimpleName) sender).getIdentifier().equals(senderDeclBinding.getName())))) {
					proposals.add(new NewMethodCorrectionProposal(label, targetCU, invocationNode, arguments,
							senderDeclBinding, IProposalRelevance.CREATE_METHOD));
				}

				if (senderDeclBinding.isNested() && cu.equals(targetCU) && sender == null && Bindings.findMethodInHierarchy(senderDeclBinding, methodName, (ITypeBinding[]) null) == null) { // no covering method
					ASTNode anonymDecl= astRoot.findDeclaringNode(senderDeclBinding);
					if (anonymDecl != null) {
						senderDeclBinding= Bindings.getBindingOfParentType(anonymDecl.getParent());
						isSenderBindingInterface= senderDeclBinding.isInterface();
						if (!senderDeclBinding.isAnonymous()) {
							if (is18OrHigher || !isSenderBindingInterface) {
								String[] args = new String[] { sig,
										ASTResolving.getTypeSignature(senderDeclBinding) };
								label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_createmethod_other_description, args);
								proposals.add(new NewMethodCorrectionProposal(label, targetCU, invocationNode,
										arguments, senderDeclBinding, IProposalRelevance.CREATE_METHOD));
							}
						}
					}
				}
			}
		}
	}
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:57,代碼來源:UnresolvedElementsSubProcessor.java

示例11: compute

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
public void compute(Set<IObject> allObjects) {
	// store this
	this.allObjects = allObjects;
	this.objectInfos = new HashSet<ObjectInfo>(); 
	
	Crystal crystal = Crystal.getInstance();
	
	for (IObject object : allObjects) {
		Type objectType = object.getC();
		
		String typeName = objectType.getFullyQualifiedName();
		
		Set<String> allSuperClasses = new HashSet<String>();
		
		// TODO: Include transitive supertypes, starting from the current one
		// TODO: Exclude maybe abstract classes and interfaces, things that cannot be instantiated?
		// NOTE: Here, we include interfaces.
		
		if (includeSuperClasses) {
			Util.getSuperClasses(objectType, allSuperClasses, includeInterfaces);
		}
		else {
			allSuperClasses.add(typeName);
		}
		
		for (String type : allSuperClasses) {
			ObjectTypeInfo typeInfo = new ObjectTypeInfo();
			
			ITypeBinding typeBinding = crystal.getTypeBindingFromName(type);
			if (typeBinding != null ) {
				typeInfo.isAbstract = Modifier.isAbstract(typeBinding.getModifiers());
				typeInfo.isInterface = typeBinding.isInterface();
			}

			typeInfo.type = type;
			// Update calculated fields
			typeInfo.calculate();
			this.objectInfos.add(typeInfo);
		}
	}
}
 
開發者ID:aroog,項目名稱:code,代碼行數:42,代碼來源:AllObjectTypes.java

示例12: setLogs

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
public static void setLogs(ITypeBinding type, Set elements, String mark) {
	String ClassType = "";
	String AllTypes = "";
	int AllTypesNum = 0;
	if (type.isInterface()){
		ClassType = "INTERFACE";
	}
	else{
		ClassType = "CLASS";
	}

	int Rank = 0;
	int ARS = 0;
	int NewTypeNum = 0;
	String NewType = "";
	String timeStamp = getTime();
	ArrayList<InfoIElement> adjacentTypes = new ArrayList<InfoIElement>();
	ArrayList<Integer> adjacentRanks = new ArrayList<Integer>();
	int i = 1;

	if (elements!=null) {
		for (Iterator iter = elements.iterator(); iter.hasNext(); i++) {
			InfoIElement element = (InfoIElement) iter.next();
			// System.out.println(element.getNumber());
			if (!isFromLibrary(element)) {
				adjacentTypes.add(element);
				adjacentRanks.add(i);
			}
		}
		//ARS = i - 1; //if include library types
		ARS = adjacentTypes.size(); //if filter out library types
		//get NewTypeNum and NewType
		if (adjacentTypes.size() != 0) {
			for (int j = 0; j < adjacentTypes.size(); j++) {
				if (newTypes.add(adjacentTypes.get(j).getKey().toString())) {
					NewTypeNum++;
					NewType += adjacentTypes.get(j).getKey().toString() + ", ";
				}
			}
		}
	}

	// write a log for current type
	writeALineInCSV(type.getQualifiedName(), "", "", ClassType, mark,
			Rank, ARS, NewTypeNum, NewType, AllTypes, AllTypesNum, "", 0, timeStamp, Reason);
	// write logs for classes in MIRC
	if (adjacentTypes.size() != 0) {
		for (int j = 0; j < adjacentTypes.size(); j++)
			writeALineInCSV(adjacentTypes.get(j).getKey(), "", "",
					adjacentTypes.get(j).getType().toString(), "",
					(int) adjacentRanks.get(j), 0, 0, "", "", 0, "", 0, timeStamp, "");
	}
}
 
開發者ID:aroog,項目名稱:code,代碼行數:54,代碼來源:LogWriter.java

示例13: selectionChanged

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
	TabItem[] tabItems = SummaryView.this.tabFolder.getSelection();
	if(tabItems != null && tabItems.length > 1 ) {
	TabItem tabItem = tabItems[0];
	if (tabItem.getText().compareTo("MCBI") == 0) {
		if (selection instanceof ITextSelection) {
			ASTNode node = ASTUtils.getASTNode((ITextSelection) selection);
			// XXX. Why convert everything into SimpleName? There are more interesting nodes that can be considered.
			//if (node.getNodeType() == ASTNode.SIMPLE_NAME) {
			if (node != null && node instanceof org.eclipse.jdt.core.dom.FieldDeclaration ) {
				org.eclipse.jdt.core.dom.FieldDeclaration  eclipseFieldDecl = (org.eclipse.jdt.core.dom.FieldDeclaration)node;
				ASTNode parent = eclipseFieldDecl.getParent();
				if (parent instanceof org.eclipse.jdt.core.dom.TypeDeclaration ) {
					org.eclipse.jdt.core.dom.TypeDeclaration typedecl = (org.eclipse.jdt.core.dom.TypeDeclaration)parent;
				
				String fieldName = getFieldName(eclipseFieldDecl);
				String enclosingType = typedecl.resolveBinding().getQualifiedName();
				// System.out.println("node: " + node.toString());
				ITypeBinding typeBinding = eclipseFieldDecl.getType().resolveBinding();
				if (typeBinding.isInterface() || Modifier.isAbstract(typeBinding.getModifiers())) {

					String fieldType = typeBinding.getQualifiedName();
					Set<Info<IElement>> classesBehindInterface = edgeSummaryAll.getClassesBehindInterface(enclosingType, fieldType, fieldName);
					RankedTableViewer.resetRank();
					tableViewer.setInput(classesBehindInterface);
					setContentDescription(fieldType);
					
					ITypeBinding binding = Crystal.getInstance().getTypeBindingFromName(enclosingType);
					//Set opened type as Visited
					updateVisitedType(binding.getQualifiedName());

					if (LogWriter.LogState == 1)
						if (LogWriter.CheckedInterfaces.add(fieldType)) {									
							if(binding != null){
								LogComment lc = new LogComment();
								synchronized (lc) {
									while (!LogWriter.CmmLock) {
										try {
											lc.wait();
										} catch (InterruptedException e) {
											e.printStackTrace();
										}
									}
								}
								LogWriter.CmmLock = false;
								LogWriter.setLogForDelaration(
										binding,
										fieldName,
										fieldType,
										classesBehindInterface);
								LogWriter.OrderNum++;
							}
						}
				}
				} else {
					tableViewer.setInput(null);
				}
			}
		}
	}
	}
}
 
開發者ID:aroog,項目名稱:code,代碼行數:64,代碼來源:SummaryView.java

示例14: getHoverInfo

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
@Override
// XXX. Refactor logic to avoid code duplication with SummaryView
// XXX. This is triggering way too early, before the UI is ready!
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
	
	RuntimeModel instance = RuntimeModel.getInstance();
	if(instance != null ) {
		summary = instance.getSummaryInfo();
	}
	
	if(summary!=null){
		ASTNode node = ASTUtils.getASTNode(hoverRegion.getOffset(),
				hoverRegion.getLength(), this.editor);
		if (node != null) {
			if (node.getNodeType() == ASTNode.SIMPLE_NAME) {
				
				SimpleName simpleName = (SimpleName) node;
				ITypeBinding typeBinding = simpleName.resolveTypeBinding();
				if(typeBinding != null)
					if (typeBinding.isInterface() || Modifier.isAbstract(typeBinding.getModifiers())) {

					String fieldType = typeBinding.getQualifiedName();
					
					// XXX. Fill in the rest of the arguments
					Set<Info<IElement>> classesBehindInterface = summary.getClassesBehindInterface("", fieldType, "");

					StringBuffer buffer = new StringBuffer();

					
					if (classesBehindInterface != null) {

						HTMLPrinter.addSmallHeader(buffer, fieldType);
						HTMLPrinter.startBulletList(buffer);
						for (Info i : classesBehindInterface) {
							HTMLPrinter.addBullet(buffer, i.getKey());
						}
						HTMLPrinter.endBulletList(buffer);
					}else{
						return null;
					}

					return buffer.toString();
				}

			}
		}
	}

	return null;
}
 
開發者ID:aroog,項目名稱:code,代碼行數:51,代碼來源:InterfaceTextHover.java


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