Package org.eclipse.jface.text.contentassist

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


   *
   * @param stateMask the state mask
   * @since 2.1
   */
  private void selectProposalWithMask(int stateMask) {
    ICompletionProposal p= getSelectedProposal();
    hide();
    if (p != null)
      insertProposal(p, (char) 0, stateMask, fViewer.getSelectedRange().x);
  }
View Full Code Here


   * @param proposals the proposals
   */
  private void setProposals(ICompletionProposal[] proposals) {
    if (Helper2.okToUse(fProposalTable)) {

      ICompletionProposal oldProposal= getSelectedProposal();
      if (oldProposal instanceof ICompletionProposalExtension2)
        ((ICompletionProposalExtension2) oldProposal).unselected(fViewer);

      fFilteredProposals= proposals;

      fProposalTable.setRedraw(false);
      fProposalTable.removeAll();

      Point selection= fViewer.getSelectedRange();
      int endOffset;
      endOffset= selection.x + selection.y;
      IDocument document= fViewer.getDocument();
      boolean validate= false;
      if (selection.y != 0 && document != null) validate= true;
      int selectionIndex= 0;

      TableItem item;
      ICompletionProposal p;
      for (int i= 0; i < proposals.length; i++) {
        p= proposals[i];
        item= new TableItem(fProposalTable, SWT.NULL);
        if (p.getImage() != null)
          item.setImage(p.getImage());
       
        String displayString;
        StyleRange[] styleRanges= null;
        if (fIsColoredLabelsSupportEnabled && p instanceof ICompletionProposalExtension6) {
          StyledString styledString= ((ICompletionProposalExtension6)p).getStyledDisplayString();
          displayString= styledString.getString();
          styleRanges= styledString.getStyleRanges();
        } else
          displayString= p.getDisplayString();

        item.setText(displayString);
        if (fIsColoredLabelsSupportEnabled)
          TableOwnerDrawSupport.storeStyleRanges(item, 0, styleRanges);
       
View Full Code Here

        case '\t':
//          hide();
          break;

        default:
          ICompletionProposal p= getSelectedProposal();
        if (p instanceof ICompletionProposalExtension) {
          ICompletionProposalExtension t= (ICompletionProposalExtension) p;
          char[] triggers= t.getTriggerCharacters();
          if (contains(triggers, key)) {
            hide();
View Full Code Here

   * @param smartToggle <code>true</code> if the smart toogle key has been pressed
   * @since 2.1
   */
  private void selectProposal(int index, boolean smartToggle) {

    ICompletionProposal oldProposal= getSelectedProposal();
    if (oldProposal instanceof ICompletionProposalExtension2)
      ((ICompletionProposalExtension2) oldProposal).unselected(fViewer);

    ICompletionProposal proposal= fFilteredProposals[index];
    if (proposal instanceof ICompletionProposalExtension2)
      ((ICompletionProposalExtension2) proposal).selected(fViewer, smartToggle);

    fLastProposal= proposal;

View Full Code Here

        RuleCompletionProcessor.addAllNewProposals( proposals,
                                                    newProposals );

        assertTrue( proposals.size() == 2 );

        ICompletionProposal prop = (ICompletionProposal) proposals.get( 1 );
        assertEquals( "getNoName() Object - MyObject",
                      prop.getDisplayString() );
    }
View Full Code Here

    }

    public static void addAllNewProposals(final Collection proposals,
                                          final Collection newProposals) {
        for ( Iterator iter = newProposals.iterator(); iter.hasNext(); ) {
            ICompletionProposal newProp = (ICompletionProposal) iter.next();
            String displayString = newProp.getDisplayString();

            //JBRULES-1134 do not add completions if they already exist
            if ( !containsProposal( proposals,
                                    displayString ) ) {
                proposals.add( newProp );
View Full Code Here

     * The match is based on the first token based on a space split
     */
    public static boolean containsProposal(final Collection proposals,
                                           String newProposal) {
        for ( Iterator iter = proposals.iterator(); iter.hasNext(); ) {
            ICompletionProposal prop = (ICompletionProposal) iter.next();
            String displayString = prop.getDisplayString();
            String[] existings = displayString.split( " " );
            if ( existings.length == 0 ) {
                continue;
            }

View Full Code Here

        List<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>();
        for ( String string : proposals )
        {
            if ( string.toUpperCase().startsWith( attribute.toUpperCase() ) )
            {
                ICompletionProposal proposal = new CompletionProposal( string + ", ", start, //$NON-NLS-1$
                    documentOffset - start, string.length() + 2, null, string, null, null );
                proposalList.add( proposal );
            }
        }
        return proposalList.toArray( new ICompletionProposal[proposalList.size()] );
View Full Code Here

        ICompletionProposal[] oldProposals = computeCompletionProposals( position );
        IContentProposal[] proposals = new IContentProposal[oldProposals.length];
        for ( int i = 0; i < oldProposals.length; i++ )
        {
            final ICompletionProposal oldProposal = oldProposals[i];
            final Document document = new Document( contents );
            oldProposal.apply( document );

            proposals[i] = new IContentProposal()
            {
                public String getContent()
                {
                    return document.get();
                }


                public int getCursorPosition()
                {
                    return oldProposal.getSelection( document ).x;
                }


                public String getDescription()
                {
                    return oldProposal.getAdditionalProposalInfo();
                }


                public String getLabel()
                {
                    return oldProposal.getDisplayString();
                }


                public String toString()
                {
View Full Code Here

                    else
                    {
                        displayString += " (" + description.getOid() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
                    }
                    String info = SchemaUtils.getLdifLine( description );
                    ICompletionProposal proposal = new CompletionProposal( replacementString, offset, attributeType
                        .length(), replacementString.length(), getAttributeTypeImage(), displayString, null, info );
                    proposalList.add( proposal );
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.contentassist.ICompletionProposal

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.