Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.CompletionProposal


    public Image getImage() {
        if (this.image != null) {
            return this.image;
        }
        CompletionProposalLabelProvider provider = new CompletionProposalLabelProvider();
        CompletionProposal generatedProposal = CompletionProposal.create(completionProposalKind, 0);
        generatedProposal.setFlags(completionProposalFlags);
        if (HAS_ADDITIONAL_FLAGS) {
            generatedProposal.setAdditionalFlags(completionProposalAdditionalFlags);
        }
        generatedProposal.setDeclarationSignature(completionPropsoalSignature);
        generatedProposal.setSignature(completionPropsoalSignature);

        //uses: kind, flags, signature to create an image.
        ImageDescriptor descriptor = provider.createImageDescriptor(generatedProposal);
        return descriptor.createImage();
    }
View Full Code Here


      LazyJavaCompletionProposal lazy = (LazyJavaCompletionProposal)proposal;
      completion = lazy.getReplacementString();
      Method getProposal = LazyJavaCompletionProposal.class
        .getDeclaredMethod("getProposal");
      getProposal.setAccessible(true);
      CompletionProposal cproposal = (CompletionProposal)getProposal.invoke(lazy);
      if (cproposal != null){
        kind = cproposal.getKind();
      }
    }

    switch(kind){
      case CompletionProposal.METHOD_REF:
View Full Code Here

          relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for keywords
          relevance += R_ANNOTATION; // this proposal is most relevant than annotation proposals

          this.noProposal = false;
          if(!this.requestor.isIgnored(CompletionProposal.KEYWORD)) {
            CompletionProposal proposal = createProposal(CompletionProposal.KEYWORD, this.actualCompletionPosition);
            proposal.setName(Keywords.INTERFACE);
            proposal.setCompletion(Keywords.INTERFACE);
            proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
            proposal.setTokenRange(this.tokenStart - this.offset, this.tokenEnd - this.offset);
            proposal.setRelevance(relevance);
            this.requestor.accept(proposal);
            if(DEBUG) {
              this.printDebug(proposal);
            }
          }
View Full Code Here

      relevance += computeRelevanceForQualification(false);
      relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE);

      this.noProposal = false;
      if(!this.requestor.isIgnored(CompletionProposal.ANNOTATION_ATTRIBUTE_REF)) {
        CompletionProposal proposal = createProposal(CompletionProposal.ANNOTATION_ATTRIBUTE_REF, this.actualCompletionPosition);
        proposal.setDeclarationSignature(getSignature(method.declaringClass));
        proposal.setSignature(getSignature(method.returnType));
        proposal.setName(method.selector);
        proposal.setCompletion(method.selector);
        proposal.setFlags(method.modifiers);
        proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
        proposal.setTokenRange(this.tokenStart - this.offset, this.tokenEnd - this.offset);
        proposal.setRelevance(relevance);
        this.requestor.accept(proposal);
        if(DEBUG) {
          this.printDebug(proposal);
        }
      }
View Full Code Here

        LazyJavaCompletionProposal javaProposal = (LazyJavaCompletionProposal) o;
        //TODO: FIXME: this is very fragile as it uses reflection to access the private completion field.
        //Yet this is needed to do mvel filtering based on the method signtures, IF we use the richer JDT completion
        Object field = ReflectionUtils.getField(o, "fProposal");
        if ( field != null && field instanceof CompletionProposal ) {
            CompletionProposal proposal = (CompletionProposal) field;

            String completion = new String( proposal.getCompletion() );

            String propertyOrMethodName = null;

            boolean isSetter = false;
            boolean isAccessor = false;
            if ( settersOnly ) {
                // get the eventual writable property name for that method name and signature
                propertyOrMethodName = CompletionUtil.getWritablePropertyName( completion,
                                                                               proposal.getSignature() );
                //                      if we got a property name that differs from the orginal method name
                //then this is a bean accessor
                isSetter = !completion.equals( propertyOrMethodName );

            } else {
                // get the eventual property name for that method name and signature
                propertyOrMethodName = CompletionUtil.getPropertyName( completion,
                                                                       proposal.getSignature() );
                //if we got a property name that differs from the orginal method name
                //then this is a bean accessor
                isAccessor = !completion.equals( propertyOrMethodName );
            }
View Full Code Here

      if (paramType.getSimpleName().toLowerCase().startsWith(filter.toLowerCase())) {
        // proposals
        // .add(new
        // RequestMappingParamTypeCompletionProposal(methodDecl,
        // paramType, toBeRemoved, context));
        CompletionProposal proposal = CompletionProposal.create(CompletionProposal.TYPE_REF,
            context.getInvocationOffset());
        proposal.setCompletion(paramType.getCanonicalName().toCharArray());
        proposal.setDeclarationSignature(paramType.getPackage().getName().toCharArray());
        proposal.setFlags(paramType.getModifiers());
        proposal.setRelevance(Integer.MAX_VALUE);
        proposal.setReplaceRange(context.getInvocationOffset() - filter.length(), context.getInvocationOffset());
        proposal.setSignature(Signature.createTypeSignature(paramType.getCanonicalName(), true).toCharArray());
        LazyJavaTypeCompletionProposal typeProposal = new LazyJavaTypeCompletionProposal(proposal, context);
        typeProposal.setRelevance(Integer.MAX_VALUE);
        proposals.add(typeProposal);
      }
    }
View Full Code Here

TOP

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

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.