Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.IMember


  public static void openBinding(String bindingValue, IApiBinding binding, IType componentType, boolean onlyIfMissing) throws CoreException {
    BindingValueKeyPath bindingValueKeyPath = new BindingValueKeyPath(bindingValue, componentType, componentType.getJavaProject(), WodParserCache.getTypeCache());
    if (bindingValueKeyPath.isValid()) {
      if (bindingValueKeyPath.exists()) {
        if (!onlyIfMissing) {
          IMember member = bindingValueKeyPath.getLastBindingKey().getBindingMember();
          if (member != null) {
            JavaUI.openInEditor(member, true, true);
          }
        }
      }
View Full Code Here


  public Object doExecute(ExecutionEvent event) throws ExecutionException {
    SearchJavaClassRequestor requestor = new SearchJavaClassRequestor();
    try {
      IJavaElement element = getElementOfJavaEditor();
      if (element instanceof IMethod || element instanceof IType) {
        IMember refs = (IMember) element;
        ASTParser parser = ASTParser.newParser(AST.JLS3);
        parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
        String source = refs.getSource();
        if(source == null){
          return null;
        }
        parser.setSource(source.toCharArray());
        ASTNode node = parser.createAST(new NullProgressMonitor());
        ASTVisitor visitor = new SearchJavaClassFromDocTagVisitor(refs.getDeclaringType(),requestor);
        node.accept(visitor);
      }
      List<IJavaElement> results = requestor.getResults();
      Shell parent = getWorkbenchWindow().getShell();
      if(!results.isEmpty()){ 
View Full Code Here

    }

    @Override
    public String getDocStr() {
        if (javaElement instanceof IMember) {
            IMember member = (IMember) javaElement;
            try {
                return StringUtils.extractTextFromHTML(extractJavadoc(member, new NullProgressMonitor()));
            } catch (JavaModelException e) {
                //just ignore it in this case (that may happen when no docstring is available)
            } catch (Exception e) {
View Full Code Here

  private HashMap<String, Object> formatRoot(
      MethodWrapper root, Comparator<MethodWrapper> comparator, boolean callees)
    throws Exception
  {
    IMember member = root.getMember();
    String memberName = JavaElementLabels.getTextLabel(member,
        AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS |
        JavaElementLabels.ALL_POST_QUALIFIED |
        JavaElementLabels.P_COMPRESSED);
    CallLocation location = root.getMethodCall().getFirstCallLocation();

    HashMap<String,Object> result = new HashMap<String, Object>();
    result.put("name", memberName);

    if (location != null) {
      // If caller, locationMember == member. If callee, locationMember
      // is the function where the callee is called.
      IMember locationMember = location.getMember();
      IResource resource = locationMember.getResource();

      if (resource != null) {
        String file = resource.getLocation().toOSString().replace('\\', '/');
        int offset = location.getStart();
View Full Code Here

        TypeBinding args[] = overridden.parameters;
        String names[] = new String[args.length];
        for (int i = 0; i < args.length; i++) {
          names[i] = Signature.createTypeSignature(args[i].sourceName(), false);
        }
        IMember member = (IMember) requestor1.findMethodFromBinding(overridden, names, overridden.declaringClass);
        if (member == null)
          return InheritDocVisitor.CONTINUE;
        if (member.getAttachedJavadoc(null) != null ) { 
          // for binary methods with attached javadoc and no source attached
          return overridden;
        }
        IOpenable openable = member.getOpenable();
        if (openable == null)
          return InheritDocVisitor.CONTINUE;
        IBuffer buf= openable.getBuffer();
        if (buf == null) {
          // no source attachment found. This method maybe the one. Stop.
          return InheritDocVisitor.STOP_BRANCH;
        }

        ISourceRange javadocRange= member.getJavadocRange();
        if (javadocRange == null)
          return InheritDocVisitor.CONTINUE;  // this method doesn't have javadoc, continue to look.
        String rawJavadoc= buf.getText(javadocRange.getOffset(), javadocRange.getLength());
        if (rawJavadoc != null) {
          return overridden;
View Full Code Here

            newElement = ((IType)parentElement).getType(new String(scope.enclosingSourceType().sourceName));
            break;
          case IJavaElement.FIELD :
          case IJavaElement.INITIALIZER :
          case IJavaElement.METHOD :
              IMember member = (IMember)parentElement;
              if (member.isBinary()) {
                  return null;
              } else {
              newElement = member.getType(new String(scope.enclosingSourceType().sourceName), 1);
              // increment occurrence count if collision is detected
              if (newElement != null) {
                while (!existingElements.add(newElement)) ((SourceRefElement)newElement).occurrenceCount++;
              }
              }
View Full Code Here

  }
  if (pattern instanceof MethodPattern) {
      IType type = ((MethodPattern) pattern).declaringType;
      if (type != null && !type.isBinary()) {
        SourceType sourceType = (SourceType) type;
        IMember local = sourceType.getOuterMostLocalContext();
        if (local instanceof IMethod) { // remember this method's range so we don't purge its statements.
          try {
            ISourceRange range = local.getSourceRange();
            this.sourceStartOfMethodToRetain  = range.getOffset();
            this.sourceEndOfMethodToRetain = this.sourceStartOfMethodToRetain + range.getLength() - 1; // offset is 0 based.
          } catch (JavaModelException e) {
            // drop silently.
          }
View Full Code Here

  if (enclosingElement == null) {
    enclosingElement = createTypeHandle(new String(type.name));
  } else if (enclosingElement instanceof IType) {
    enclosingElement = ((IType) parent).getType(new String(type.name));
  } else if (enclosingElement instanceof IMember) {
      IMember member = (IMember) parent;
    if (member.isBinary())  {
      enclosingElement = ((IClassFile)this.currentPossibleMatch.openable).getType();
    } else {
      enclosingElement = member.getType(new String(type.name), occurrenceCount);
    }
  }
  if (enclosingElement == null) return;
  boolean enclosesElement = encloses(enclosingElement);
View Full Code Here

            newElement = ((IType)parentElement).getType(new String(scope.enclosingSourceType().sourceName));
            break;
          case IJavaElement.FIELD :
          case IJavaElement.INITIALIZER :
          case IJavaElement.METHOD :
              IMember member = (IMember)parentElement;
              if (member.isBinary()) {
                  return null;
              } else {
              newElement = member.getType(new String(scope.enclosingSourceType().sourceName), 1);
              // increment occurrence count if collision is detected
              if (newElement != null) {
                while (!existingElements.add(newElement)) ((SourceRefElement)newElement).occurrenceCount++;
              }
              }
View Full Code Here

    this.findDeclarations = findDeclarations; // set to find declarations & all occurences
    this.findReferences = findReferences; // set to find references & all occurences
    this.typeParameter = typeParameter;
    this.name = typeParameter.getElementName().toCharArray(); // store type parameter name
    IMember member = typeParameter.getDeclaringMember();
    this.declaringMemberName = member.getElementName().toCharArray(); // store type parameter declaring member name

    // For method type parameter, store also declaring class name and parameters type names
    if (member instanceof IMethod) {
      IMethod method = (IMethod) member;
      this.methodDeclaringClassName = method.getParent().getElementName().toCharArray();
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.IMember

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.