Package org.eclipse.jface.text.contentassist

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


        List<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>();
        for ( int k = 0; k < possibleAttributeTypes.length; k++ )
        {
            if ( possibleAttributeTypes[k].toUpperCase().startsWith( attribute.toUpperCase() ) )
            {
                ICompletionProposal proposal = new CompletionProposal( possibleAttributeTypes[k] + ", ", start,
                    documentOffset - start, possibleAttributeTypes[k].length() + 2, null, possibleAttributeTypes[k],
                    null, null );
                proposalList.add( proposal );
            }
        }
View Full Code Here


                    }
                }

                for ( int k = 0; k < this.possibleAttributeTypes.length; k++ )
                {
                    ICompletionProposal proposal = new CompletionProposal( this.possibleAttributeTypes[k], offset, 0,
                        this.possibleAttributeTypes[k].length() );
                    proposalList.add( proposal );
                }
            }
            else if ( filter.getFilterComponent() instanceof LdapFilterItemComponent
                && filter.getFilterComponent().getStartToken().getOffset() <= offset
                && offset <= filter.getFilterComponent().getStartToken().getOffset()
                    + filter.getFilterComponent().getStartToken().getLength() )
            {
                // show matching attribute types
                LdapFilterItemComponent fc = ( LdapFilterItemComponent ) filter.getFilterComponent();
                for ( int k = 0; k < this.possibleAttributeTypes.length; k++ )
                {
                    if ( this.possibleAttributeTypes[k].startsWith( fc.getAttributeToken().getValue() ) )
                    {
                        ICompletionProposal proposal = new CompletionProposal( this.possibleAttributeTypes[k], fc
                            .getAttributeToken().getOffset(), fc.getAttributeToken().getLength(),
                            this.possibleAttributeTypes[k].length() );
                        proposalList.add( proposal );
                    }
                }
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.getNumericOid() + ")";
                    }
                    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

            for ( String possibleFilterType : copy.keySet() )
            {
                String replacementString = possibleFilterType;
                String displayString = copy.get( possibleFilterType );

                ICompletionProposal proposal = new CompletionProposal( replacementString, offset, filterType.length(),
                    possibleFilterType.length(), getFilterTypeImage(), displayString, null, null );
                proposalList.add( proposal );
            }
        }
    }
View Full Code Here

                    else
                    {
                        displayString += " (" + description.getNumericOid() + ")";
                    }

                    ICompletionProposal proposal = new CompletionProposal( replacementString, offset, objectClass
                        .length(), replacementString.length(), getObjectClassImage(), displayString, null, SchemaUtils
                        .getLdifLine( schema.getObjectClassDescription( possibleObjectClass ) ) );
                    proposalList.add( proposal );
                }
            }
View Full Code Here

                    else
                    {
                        displayString += " (" + description.getNumericOid() + ")";
                    }
                    String info = SchemaUtils.getLdifLine( description );
                    ICompletionProposal proposal = new CompletionProposal( replacementString, offset, matchingRule
                        .length(), replacementString.length(), getMatchingRuleImage(), displayString, null, info );
                    proposalList.add( proposal );
                }
            }
        }
View Full Code Here

    {
        if ( "dn".toUpperCase().startsWith( dnAttr.toUpperCase() ) )
        {
            String replacementString = "dn:";
            String displayString = "dn: ()";
            ICompletionProposal proposal = new CompletionProposal( replacementString, offset, dnAttr.length(),
                replacementString.length(), null, displayString, null, null );
            proposalList.add( proposal );
        }
    }
View Full Code Here

    if (contentAssistRequest.getNode().getOwnerDocument().getDocumentElement() != null) {
      rootname = contentAssistRequest.getNode().getOwnerDocument().getDocumentElement().getNodeName();
    }

    String proposedText = "<!DOCTYPE " + rootname + " PUBLIC \"//UNKNOWN/\" \"unknown.dtd\">"; //$NON-NLS-1$ //$NON-NLS-2$
    ICompletionProposal proposal = new CustomCompletionProposal(proposedText, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), 10, XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_DOCTYPE), "<!DOCTYPE ... >", //$NON-NLS-1$
          null, null, XMLRelevanceConstants.R_DOCTYPE);
    // TODO provide special documentation on doc type
    contentAssistRequest.addProposal(proposal);
  }
View Full Code Here

          selectionLength += fTextViewer.getSelectedRange().y;
        }
        // create a new proposal for entity string...
        replacementText = "&" + entityName + ";"; //$NON-NLS-1$ //$NON-NLS-2$
        displayString = "&" + entityName + "; (" + entityValue + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        ICompletionProposal cp = new CustomCompletionProposal(replacementText, sdRegion.getStartOffset(completionRegion), selectionLength, replacementText.length(), entityIcon, displayString, null, null, XMLRelevanceConstants.R_ENTITY);
        if (cp != null) {
          proposals.add(cp);
        }
      }
    }
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.