Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.IEditingSupportRegistry


      if (target != null)
        target.beginCompoundChange();

      if (fViewer instanceof IEditingSupportRegistry) {
        IEditingSupportRegistry registry= (IEditingSupportRegistry) fViewer;
        registry.register(helper);
      }


      if (p instanceof ICompletionProposalExtension2 && fViewer != null) {
        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) {
        fContentAssistSubjectControlAdapter.setSelectedRange(selection.x, selection.y);
        fContentAssistSubjectControlAdapter.revealRange(selection.x, selection.y);
      }

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

        int contextInformationOffset;
        if (p instanceof ICompletionProposalExtension) {
          ICompletionProposalExtension e= (ICompletionProposalExtension) p;
          contextInformationOffset= e.getContextInformationPosition();
        } else {
          if (selection == null)
            selection= fContentAssistSubjectControlAdapter.getSelectedRange();
          contextInformationOffset= selection.x + selection.y;
        }

        fContentAssistant.showContextInformation(info, contextInformationOffset);
      } else
        fContentAssistant.showContextInformation(null, -1);


    } finally {
      if (target != null)
        target.endCompoundChange();

      if (fViewer instanceof IEditingSupportRegistry) {
        IEditingSupportRegistry registry= (IEditingSupportRegistry) fViewer;
        registry.unregister(helper);
      }
      fInserting= false;
    }
  }
View Full Code Here


  public void hide() {

    unregister();

    if (fViewer instanceof IEditingSupportRegistry) {
      IEditingSupportRegistry registry= (IEditingSupportRegistry) fViewer;
      registry.unregister(fFocusHelper);
    }

    if (Helper.okToUse(fProposalShell)) {

      fContentAssistant.removeContentAssistListener(this, ContentAssistant.PROPOSAL_SELECTOR);
View Full Code Here

          }

        };
      }
      if (fViewer instanceof IEditingSupportRegistry) {
        IEditingSupportRegistry registry= (IEditingSupportRegistry) fViewer;
        registry.register(fFocusHelper);
      }


      /* https://bugs.eclipse.org/bugs/show_bug.cgi?id=52646
       * on GTK, setVisible and such may run the event loop
View Full Code Here

   */
  private void insertProposal(ICompletionProposal p, char trigger, int stateMask, final int offset) {

    fInserting= true;
    IRewriteTarget target= null;
    IEditingSupportRegistry registry= null;

    try {

      IDocument document= fViewer.getDocument();

      if (fViewer instanceof ITextViewerExtension) {
        ITextViewerExtension extension= (ITextViewerExtension) fViewer;
        target= extension.getRewriteTarget();
      }

      if (target != null)
        target.beginCompoundChange();

      if (fViewer instanceof IEditingSupportRegistry) {
        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;
        }

        fContentAssistant.showContextInformation(info, position);
      }

      fContentAssistant.fireProposalChosen(p);

    } finally {
      if (target != null)
        target.endCompoundChange();

      if (registry != null)
        registry.unregister(fModificationEditingSupport);

      fInserting= false;
    }
  }
View Full Code Here

  public void hide() {

    unregister();

    if (fViewer instanceof IEditingSupportRegistry) {
      IEditingSupportRegistry registry= (IEditingSupportRegistry) fViewer;
      registry.unregister(fFocusEditingSupport);
    }

    if (Helper2.okToUse(fProposalShell)) {
      fContentAssistant.removeContentAssistListener(this, ContentAssistant2.PROPOSAL_SELECTOR);
View Full Code Here

      if (document != null)
        document.addDocumentListener(fDocumentListener);


      if (fViewer instanceof IEditingSupportRegistry) {
        IEditingSupportRegistry registry= (IEditingSupportRegistry) fViewer;
        registry.register(fFocusEditingSupport);
      }

      fProposalShell.setVisible(true);
      // see bug 47511: setVisible may run the event loop on GTK
      // and trigger a rentrant call - have to check whether we are still
View Full Code Here

      if (target != null)
        target.beginCompoundChange();

      if (fViewer instanceof IEditingSupportRegistry) {
        IEditingSupportRegistry registry= (IEditingSupportRegistry) fViewer;
        registry.register(helper);
      }


      if (p instanceof ICompletionProposalExtension2 && fViewer != null) {
        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);
      }
      fireAppliedEvent(p);

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

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

        int contextInformationOffset;
        if (p instanceof ICompletionProposalExtension) {
          ICompletionProposalExtension e= (ICompletionProposalExtension) p;
          contextInformationOffset= e.getContextInformationPosition();
        } else {
          if (selection == null)
            selection= fContentAssistSubjectControlAdapter.getSelectedRange();
          contextInformationOffset= selection.x + selection.y;
        }

        fContentAssistant.showContextInformation(info, contextInformationOffset);
      } else
        fContentAssistant.showContextInformation(null, -1);


    } finally {
      if (target != null)
        target.endCompoundChange();

      if (fViewer instanceof IEditingSupportRegistry) {
        IEditingSupportRegistry registry= (IEditingSupportRegistry) fViewer;
        registry.unregister(helper);
      }
      fInserting= false;
    }
  }
View Full Code Here

  public void hide() {

    unregister();

    if (fViewer instanceof IEditingSupportRegistry) {
      IEditingSupportRegistry registry= (IEditingSupportRegistry) fViewer;
      registry.unregister(fFocusHelper);
    }

    if (Helper.okToUse(fProposalShell)) {

      fContentAssistant.removeContentAssistListener(this, ContentAssistant.PROPOSAL_SELECTOR);
View Full Code Here

          }

        };
      }
      if (fViewer instanceof IEditingSupportRegistry) {
        IEditingSupportRegistry registry= (IEditingSupportRegistry) fViewer;
        registry.register(fFocusHelper);
      }


      /* https://bugs.eclipse.org/bugs/show_bug.cgi?id=52646
       * on GTK, setVisible and such may run the event loop
View Full Code Here

   */
  private void insertProposal(ICompletionProposal p, char trigger, int stateMask, final int offset) {

    fInserting= true;
    IRewriteTarget target= null;
    IEditingSupportRegistry registry= null;

    try {

      IDocument document= fViewer.getDocument();

      if (fViewer instanceof ITextViewerExtension) {
        ITextViewerExtension extension= (ITextViewerExtension) fViewer;
        target= extension.getRewriteTarget();
      }

      if (target != null)
        target.beginCompoundChange();

      if (fViewer instanceof IEditingSupportRegistry) {
        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;
        }

        fContentAssistant.showContextInformation(info, position);
      }

      fContentAssistant.fireProposalChosen(p);

    } finally {
      if (target != null)
        target.endCompoundChange();

      if (registry != null)
        registry.unregister(fModificationEditingSupport);

      fInserting= false;
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.IEditingSupportRegistry

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.