Package org.eclipse.jface.text.contentassist

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


        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

        List<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>();
        for ( String string : proposals )
        {
            if ( string.toUpperCase().startsWith( attribute.toUpperCase() ) )
            {
                ICompletionProposal proposal = new CompletionProposal( string + ", ", start,
                    documentOffset - start, string.length() + 2, null, string,
                    null, null );
                proposalList.add( proposal );
            }
        }
View Full Code Here

        int len = pythonAndTemplateProposals.size();
        for (int i = 0; i < len; i++) {
            Object o = pythonAndTemplateProposals.get(i);
            if (o instanceof ICompletionProposal) {
                ICompletionProposal proposal = (ICompletionProposal) o;

                String displayString;
                if (proposal instanceof IPyCompletionProposal2) {
                    IPyCompletionProposal2 pyCompletionProposal = (IPyCompletionProposal2) proposal;
                    displayString = pyCompletionProposal.getInternalDisplayStringRepresentation();

                } else {
                    displayString = proposal.getDisplayString();
                }

                if (onlyForCalltips) {
                    if (displayString.equals(qualifier)) {
                        addProposal(returnProposals, proposal, displayString);

                    } else if (displayString.length() > qualifier.length() && displayString.startsWith(qualifier)) {
                        if (displayString.charAt(qualifier.length()) == '(') {
                            addProposal(returnProposals, proposal, displayString);
                        }
                    }
                } else if (displayString.toLowerCase().startsWith(lowerCaseQualifier)) {
                    List<ICompletionProposal> existing = returnProposals.get(displayString);
                    if (existing != null) {
                        //a proposal with the same string is already there...
                        boolean addIt = true;
                        if (proposal instanceof PyCompletionProposal) {
                            PyCompletionProposal propP = (PyCompletionProposal) proposal;

                            OUT: for (Iterator<ICompletionProposal> it = existing.iterator(); it.hasNext();) {
                                ICompletionProposal curr = it.next();
                                int overrideBehavior = propP.getOverrideBehavior(curr);

                                switch (overrideBehavior) {
                                    case PyCompletionProposal.BEHAVIOR_COEXISTS:
                                        //just go on (it will be added later)
View Full Code Here

     * When executed it'll create a proposal and apply it.
     */
    /*default*/void execute(RefactoringInfo refactoringInfo, String actTok, List<String> parametersAfterCall,
            int locationStrategy) {
        try {
            ICompletionProposal proposal = createProposal(refactoringInfo, actTok, locationStrategy,
                    parametersAfterCall);
            if (proposal != null) {
                if (proposal instanceof ICompletionProposalExtension2) {
                    ICompletionProposalExtension2 extension2 = (ICompletionProposalExtension2) proposal;
                    extension2.apply(targetEditor.getPySourceViewer(), '\n', 0, 0);
                } else {
                    proposal.apply(refactoringInfo.getDocument());
                }
            }

        } catch (Exception e) {
            Log.log(e);
View Full Code Here

        String sel = PyAction.getLineWithoutComments(ps);

        assertEquals(true, assist.isValid(ps, sel, null, d.length()));
        List<ICompletionProposal> props = assist.getProps(ps, null, null, null, null, d.length());
        assertEquals(2, props.size());
        ICompletionProposal prop0 = assertContains("Assign to local (new_method)", props);
        ICompletionProposal prop1 = assertContains("Assign to field (self._new_method)", props);

        prop0.apply(doc);

        String expected = "" +
                "from testAssist import assist\n" +
                "new_method = assist._NewMethod(a = 1, b = 2)";

        assertEquals(expected, doc.get());

        doc = new Document(d);
        prop1.apply(doc);

        expected = "" +
                "from testAssist import assist\n" +
                "self._new_method = assist._NewMethod(a = 1, b = 2)";
        assertEquals(expected, doc.get());
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.