Examples of JavaCompletionProposal


Examples of org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal

    String completion = null;
    String menu = proposal.getDisplayString();

    int kind = -1;
    if(proposal instanceof JavaCompletionProposal){
      JavaCompletionProposal lazy = (JavaCompletionProposal)proposal;
      completion = lazy.getReplacementString();
    }else if(proposal instanceof LazyJavaCompletionProposal){
      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){
View Full Code Here

Examples of org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal

          String replaceString = null;
          if(proposals[j] instanceof LazyJavaTypeCompletionProposal){
            LazyJavaTypeCompletionProposal p = (LazyJavaTypeCompletionProposal)proposals[j];
            replaceString = p.getReplacementString();
          } else if(proposals[j] instanceof JavaCompletionProposal){
            JavaCompletionProposal p = (JavaCompletionProposal)proposals[j];
            replaceString = p.getReplacementString();
          }
          if(replaceString!=null && replaceString.startsWith(contents)){
            result.add(new FieldAssistUtils.ContentProposalImpl(replaceString, position));
          }
        }
View Full Code Here

Examples of org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal

          String replaceString = null;
          if(proposals[j] instanceof LazyJavaTypeCompletionProposal){
            LazyJavaTypeCompletionProposal p = (LazyJavaTypeCompletionProposal)proposals[j];
            replaceString = p.getReplacementString();
          } else if(proposals[j] instanceof JavaCompletionProposal){
            JavaCompletionProposal p = (JavaCompletionProposal)proposals[j];
            replaceString = p.getReplacementString();
          }
         
          if(ClickUtils.isNotEmpty(replaceString)){
            if(replaceString.equals("_xxx")){
              continue;
View Full Code Here

Examples of org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal

    private static void processesJavaCompletionProposal(boolean settersOnly,
                                                        final Collection<ICompletionProposal> set,
                                                        ICompletionProposal o) {
        if ( settersOnly ) {
            JavaCompletionProposal jcp = (JavaCompletionProposal) 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" );
            IJavaElement javaElement = jcp.getJavaElement();
            if ( javaElement.getElementType() == IJavaElement.FIELD ) {
                set.add( o );

            }
        } else {
View Full Code Here

Examples of org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal

  }

  private static void processJavaCompletionProposal(IContentAssistProposalRecorder recorder,
      ICompletionProposal comProposal, String packageName, char enclosingChar) {
    if (comProposal instanceof JavaCompletionProposal) {
      JavaCompletionProposal prop = (JavaCompletionProposal) comProposal;
      recorder.recordProposal(prop.getImage(), prop.getRelevance(), prop.getDisplayString(), prop
          .getReplacementString(), prop.getJavaElement());
    }
    else if (comProposal instanceof LazyJavaTypeCompletionProposal) {
      LazyJavaTypeCompletionProposal prop = (LazyJavaTypeCompletionProposal) comProposal;

      if (prop.getQualifiedTypeName().equals(packageName + "." + CLASS_NAME)
          || prop.getQualifiedTypeName().equals(CLASS_NAME)) {
        return;
      }

      if (prop.getJavaElement() instanceof IType) {
        // Make sure that JDT's type filter preferences are applied
        if (TypeFilter.isFiltered((IType) prop.getJavaElement())) {
          return;
        }

        String replacementString = ((IType) prop.getJavaElement()).getFullyQualifiedName(enclosingChar);

        recorder.recordProposal(prop.getImage(), prop.getRelevance(), prop.getDisplayString(),
            replacementString, prop.getJavaElement());
      }
    }
    else if (comProposal instanceof LazyJavaCompletionProposal) {
      LazyJavaCompletionProposal prop = (LazyJavaCompletionProposal) comProposal;
      recorder.recordProposal(prop.getImage(), prop.getRelevance(), prop.getDisplayString(), prop
          .getReplacementString(), prop.getJavaElement());
    }
  }
View Full Code Here

Examples of org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal

          }

          replacementText = prefix + replacementText + postfix;

          if (matchesFilter) {
            proposals.add(new JavaCompletionProposal(replacementText, invocationOffset - filter.length(),
                filter.length(), BeansModelImages.getImage(config), displayText, 0));
          }
        }
      }
    }
View Full Code Here

Examples of org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal

    assertTrue(proposals.size() > 0);
    assertEquals(expectedResultsArray.length, proposals.size());
    int expectedResultsIndex = 0;
    for (Object element : proposals) {
      if (element instanceof JavaCompletionProposal) {
        JavaCompletionProposal proposal = (JavaCompletionProposal) element;

        String replacementString = proposal.getReplacementString();

        // There is always a proposal (from somewhere else) of
        // "ContextConfigurationTest", skip the one at index 0
        if (!(replacementString.equals("ContextConfigurationTest"))) {
          String expectedProposal = expectedResultsArray[expectedResultsIndex];
View Full Code Here

Examples of org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal

    if (typeBinding != null) {
      Set<String> matchingBeans = ProposalCalculatorUtil.getMatchingBeans(javaContext, typeBinding);
      for (String matchingBean : matchingBeans) {
        if (matchingBean.startsWith(filter)) {
          if (isQuoted) {
            proposals.add(new JavaCompletionProposal(matchingBean, locationOffset, locationLength,
                BeansUIImages.getImage(BeansUIImages.IMG_OBJS_BEAN), matchingBean, 0));
          }
          else {
            proposals.add(new JavaCompletionProposal("\"" + matchingBean + "\"", locationOffset,
                locationLength, BeansUIImages.getImage(BeansUIImages.IMG_OBJS_BEAN), matchingBean, 0));
          }
        }
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.