Package org.eclipse.jface.text.contentassist

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


        registry= (IEditingSupportRegistry) fViewer;
        registry.register(fModificationEditingSupport);
      }

      if (p instanceof ICompletionProposalExtension2) {
        ICompletionProposalExtension2 e= (ICompletionProposalExtension2) p;
        e.apply(fViewer, trigger, stateMask, offset);
      } else if (p instanceof ICompletionProposalExtension) {
        ICompletionProposalExtension e= (ICompletionProposalExtension) p;
        e.apply(document, trigger, offset);
      } else {
        p.apply(document);
      }

      Point selection= p.getSelection(document);
      if (selection != null) {
        fViewer.setSelectedRange(selection.x, selection.y);
        fViewer.revealRange(selection.x, selection.y);
      }

      IContextInformation info= p.getContextInformation();
      if (info != null) {

        int position;
        if (p instanceof ICompletionProposalExtension) {
          ICompletionProposalExtension e= (ICompletionProposalExtension) p;
          position= e.getContextInformationPosition();
        } else {
          if (selection == null)
            selection= fViewer.getSelectedRange();
          position= selection.x + selection.y;
        }
View Full Code Here


    if (fKeyListener != null && styledText != null && !styledText.isDisposed())
      styledText.removeKeyListener(fKeyListener);

    if (fLastProposal != null) {
      if (fLastProposal instanceof ICompletionProposalExtension2) {
        ICompletionProposalExtension2 extension= (ICompletionProposalExtension2) fLastProposal;
        extension.unselected(fViewer);
      }

      fLastProposal= null;
    }
View Full Code Here

  }

  private boolean validateProposal(IDocument document, ICompletionProposal p, int offset, DocumentEvent event) {
    // detect selected
    if (p instanceof ICompletionProposalExtension2) {
      ICompletionProposalExtension2 e= (ICompletionProposalExtension2) p;
      if (e.validate(document, offset, event))
        return true;
    } else if (p instanceof ICompletionProposalExtension) {
      ICompletionProposalExtension e= (ICompletionProposalExtension) p;
      if (e.isValidFor(document, offset))
        return true;
    }
    return false;
  }
View Full Code Here

    List filtered= new ArrayList(length);
    for (int i= 0; i < length; i++) {

      if (proposals[i] instanceof ICompletionProposalExtension2) {

        ICompletionProposalExtension2 p= (ICompletionProposalExtension2) proposals[i];
        if (p.validate(document, offset, event))
          filtered.add(p);

      } else if (proposals[i] instanceof ICompletionProposalExtension) {

        ICompletionProposalExtension p= (ICompletionProposalExtension) proposals[i];
        if (p.isValidFor(document, offset))
          filtered.add(p);

      } else {
        // restore original behavior
        fInvocationOffset= offset;
View Full Code Here

                            dialog.setTitle("Choose import");
                            dialog.setMessage("Which import should be added?");
                            dialog.setElements(props.toArray());
                            int returnCode = dialog.open();
                            if (returnCode == Window.OK) {
                                ICompletionProposalExtension2 firstResult = (ICompletionProposalExtension2) dialog
                                        .getFirstResult();

                                completionsToApply.add(firstResult);
                            } else if (returnCode == Window.CANCEL) {
                                keepGoing[0] = false;
View Full Code Here

        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());
                }
            }
View Full Code Here

        registry= (IEditingSupportRegistry) fViewer;
        registry.register(fModificationEditingSupport);
      }

      if (p instanceof ICompletionProposalExtension2) {
        ICompletionProposalExtension2 e= (ICompletionProposalExtension2) p;
        e.apply(fViewer, trigger, stateMask, offset);
      } else if (p instanceof ICompletionProposalExtension) {
        ICompletionProposalExtension e= (ICompletionProposalExtension) p;
        e.apply(document, trigger, offset);
      } else {
        p.apply(document);
      }

      Point selection= p.getSelection(document);
      if (selection != null) {
        fViewer.setSelectedRange(selection.x, selection.y);
        fViewer.revealRange(selection.x, selection.y);
      }

      IContextInformation info= p.getContextInformation();
      if (info != null) {

        int position;
        if (p instanceof ICompletionProposalExtension) {
          ICompletionProposalExtension e= (ICompletionProposalExtension) p;
          position= e.getContextInformationPosition();
        } else {
          if (selection == null)
            selection= fViewer.getSelectedRange();
          position= selection.x + selection.y;
        }
View Full Code Here

    if (fKeyListener != null && styledText != null && !styledText.isDisposed())
      styledText.removeKeyListener(fKeyListener);

    if (fLastProposal != null) {
      if (fLastProposal instanceof ICompletionProposalExtension2) {
        ICompletionProposalExtension2 extension= (ICompletionProposalExtension2) fLastProposal;
        extension.unselected(fViewer);
      }

      fLastProposal= null;
    }
View Full Code Here

  }

  private boolean validateProposal(IDocument document, ICompletionProposal p, int offset, DocumentEvent event) {
    // detect selected
    if (p instanceof ICompletionProposalExtension2) {
      ICompletionProposalExtension2 e= (ICompletionProposalExtension2) p;
      if (e.validate(document, offset, event))
        return true;
    } else if (p instanceof ICompletionProposalExtension) {
      ICompletionProposalExtension e= (ICompletionProposalExtension) p;
      if (e.isValidFor(document, offset))
        return true;
    }
    return false;
  }
View Full Code Here

    List filtered= new ArrayList(length);
    for (int i= 0; i < length; i++) {

      if (proposals[i] instanceof ICompletionProposalExtension2) {

        ICompletionProposalExtension2 p= (ICompletionProposalExtension2) proposals[i];
        if (p.validate(document, offset, event))
          filtered.add(p);

      } else if (proposals[i] instanceof ICompletionProposalExtension) {

        ICompletionProposalExtension p= (ICompletionProposalExtension) proposals[i];
        if (p.isValidFor(document, offset))
          filtered.add(p);

      } else {
        // restore original behavior
        fInvocationOffset= offset;
View Full Code Here

TOP

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

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.