Package org.eclipse.jface.text.contentassist

Examples of org.eclipse.jface.text.contentassist.CompletionProposal


    completionProposals.addAll(createProposalsFromSymbols(offset, tokenImage, tokenProposals, currentWord));
   
    completionProposals.addAll(createProposalsFromSymbols(offset, productionImage, productionProposals, currentWord));
   
    if(completionProposals.isEmpty()){
      CompletionProposal testProposal = new CompletionProposal(" ", offset, 0, offset-currentWord.length(), null, NO_DEFAULT_PROPOSALS, null, null);
      completionProposals.add(testProposal);
    }
   
    return completionProposals.toArray(new ICompletionProposal[0]);
   
View Full Code Here


          displayString = getDisplayString(name);
          replaceMentString = getReplacementString(name, displayString);
        }
       
        if(displayString.toLowerCase().startsWith(currentWord)){
          CompletionProposal proposal = new  CompletionProposal(replaceMentString, offset, currentWord.length(), replaceMentString.length(), image, displayString, null, null);
          completionProposals.add(proposal);
        }
      }

    } catch (IllegalArgumentException e) {
View Full Code Here

   
    for(String s : userProposals){
     
     
      if(s.toLowerCase().startsWith(currentWord)){
        CompletionProposal proposal = new  CompletionProposal(s, offset, currentWord.length(), s.length(), image, s, null, null);
        completionProposals.add(proposal);
      }
    }
   
    return completionProposals;
View Full Code Here

        // convert code completion proposal into eclipse ICompletionProposal
        ICompletionProposal[] ret = new ICompletionProposal[proposals.length];
        for (int i = 0; i < proposals.length; i++) {
            CodeCompletionProposal prop = proposals[i];
            ret[i] = new CompletionProposal(prop.getReplacementString(), prop
                    .getReplacementOffset(), prop.getReplacementLength(), prop.getCursorPosition(),
                    null, prop.getDisplayString(), null, prop.getDoc());
        }

        return ret;
View Full Code Here

   * @param request
   */
  protected void addAttributeProposal(String text, ContentAssistRequest request) {
    text = "\""+ text + "\"";
   
    request.addProposal(new CompletionProposal(text,
        request.getReplacementBeginPosition(), request.getReplacementLength(),
        text.length()));
  }
View Full Code Here

      } else {
        endOffset = 0;
      }
    }
   
    request.addProposal(new CompletionProposal(text, startPos,
        endOffset, text.length()));
  }
View Full Code Here

      PropertyDescriptor[] pds = bi.getPropertyDescriptors();
      for (int i=0; i<pds.length; i++) {
        PropertyDescriptor pd = pds[i];
        String propertyName = pd.getName();
        if (!propertyName.equals("class") && propertyName.toUpperCase().startsWith(pUpper)) { //$NON-NLS-1$
          proposals.add(new CompletionProposal(
              propertyName,
              offset - subOffset + 1,
              getContent().length()-1,
              propertyName.length(),
              null, propertyName + " - " + pd.getReadMethod().getReturnType().getName(), null, null)); //$NON-NLS-1$
        }
      }
      for (int i=0; i<parentClass.getMethods().length; i++) {
        Method m = parentClass.getMethods()[i];
        String mName = m.getName();
        if (m.getParameterTypes().length > 0 && mName.startsWith("get") && mName.toUpperCase().startsWith(pUpper)) { //$NON-NLS-1$
          StringBuilder display = new StringBuilder();
          display.append(mName);
          display.append(LexicalConstants.LEFT_PARENTHESIS);
          for (int j=0; j<m.getParameterTypes().length; j++) {
            if (j > 0) display.append(", "); //$NON-NLS-1$
            display.append(m.getParameterTypes()[j].getName());
          }
          display.append(") - ").append(m.getReturnType().getName()); //$NON-NLS-1$
          String actual = mName + "()"; //$NON-NLS-1$
          int tLength = actual.length();
          if (m.getParameterTypes().length > 0) {
            tLength--;
          }
          proposals.add(new CompletionProposal(actual,
              offset - subOffset + 1, getContent().length()-1, tLength,
              null, display.toString(), null, null));
        }
      }
      return completionProposals(proposals);
View Full Code Here

      return getCompletionProposal(offset, subOffset-1,
          key, getContent());
    }
    else {
      String replacementString = key + "()"; //$NON-NLS-1$
      return new CompletionProposal (
          replacementString, offset-subOffset+1,
          getContent().length(), replacementString.length()-1);
    }
  }
View Full Code Here

    return l.toArray(new ICompletionProposal[l.size()]);
  }

  public ICompletionProposal getCompletionProposal (int offset, int subOffset,
      String replacementString, String replacingString) {
    return new CompletionProposal (
        replacementString, offset-subOffset,
        replacingString.length(), replacementString.length());
  }
View Full Code Here

    private ICompletionProposal[] buildProposal(String prefix, String[] strings) {
        if(strings != null) {
            ICompletionProposal[] result = new ICompletionProposal[strings.length];
            for (int i = 0; i < strings.length; i++) {
                String string = strings[i];
                result[i] = new CompletionProposal(string, 0, prefix.length(), string.length());
            }
            return result;
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.contentassist.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.