Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.ISelectionProvider


    protected IAction getPropertiesAction() {
        if (propertiesAction == null) {
            final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
            final PropertyDialogAction tmp = new PropertyDialogAction(new SameShellProvider(shell),
                    new ISelectionProvider(){

                        public void addSelectionChangedListener( ISelectionChangedListener listener ) {
                        }

                        public ISelection getSelection() {
View Full Code Here


   * Returns the offset of the selected text in the given editor.
   * @param editor the given editor.
   * @return  the offset of the selected text in the given editor, or -1 if there is no valid text information.
   */
  public int selectionOffsetOf(IEditorPart editor) {
    ISelectionProvider selectionProvider = ((ITextEditor) editor).getSelectionProvider();
    ISelection selection = selectionProvider.getSelection();
    if (selection instanceof ITextSelection) {
      ITextSelection textSelection = (ITextSelection) selection;
      return textSelection.getOffset();
    }
    return -1;
View Full Code Here

   */
  QuickDiffRestoreAction(ResourceBundle bundle, String prefix, ITextEditor editor, boolean isRulerAction) {
    super(bundle, prefix, editor);
    fIsRulerAction= isRulerAction;

    ISelectionProvider selectionProvider= editor.getSelectionProvider();
    if (selectionProvider instanceof IPostSelectionProvider)
      ((IPostSelectionProvider)selectionProvider).addPostSelectionChangedListener(this);
  }
View Full Code Here

   * @return the editor's selection, or <code>null</code>
   */
  protected ITextSelection getSelection() {
    if (getTextEditor() == null)
      return null;
    ISelectionProvider sp= getTextEditor().getSelectionProvider();
    if (sp == null)
      return null;
    ISelection s= sp.getSelection();
    if (s instanceof ITextSelection)
      return (ITextSelection)s;
    return null;
  }
View Full Code Here

    for (int i= 0; i < actions.length; i++)
      Assert.isNotNull(actions[i]);

    System.arraycopy(actions, 0, fActions, 0, actions.length);
   
    ISelectionProvider selectionProvider= editor.getSelectionProvider();
    if (selectionProvider instanceof IPostSelectionProvider)
      ((IPostSelectionProvider)selectionProvider).addPostSelectionChangedListener(this);
   
    update();
  }
View Full Code Here

    text.addMouseListener(this);
    text.addFocusListener(this);
    fTextViewer.addTextListener(this);

    ISelectionProvider selectionProvider= fTextViewer.getSelectionProvider();
    if (selectionProvider != null)
      selectionProvider.addSelectionChangedListener(this);

    if (fTextViewer instanceof ITextViewerExtension)
      ((ITextViewerExtension) fTextViewer).prependVerifyKeyListener(this);
    else
      text.addVerifyKeyListener(this);
View Full Code Here

   */
  private void uninstall() {

    fTextViewer.removeTextListener(this);

    ISelectionProvider selectionProvider= fTextViewer.getSelectionProvider();
    if (selectionProvider != null)
      selectionProvider.removeSelectionChangedListener(this);

    StyledText text= fTextViewer.getTextWidget();
    if (text != null) {
      text.removeMouseListener(this);
      text.removeFocusListener(this);
View Full Code Here

   * @param editor the editor
   * @return the editor's selection
   */
  private static ITextSelection getSelection(ITextEditor editor) {

    ISelectionProvider selectionProvider= editor.getSelectionProvider();
    if (selectionProvider == null)
      return null;

    ISelection selection= selectionProvider.getSelection();
    if (!(selection instanceof ITextSelection))
      return null;

    return (ITextSelection) selection;
  }
View Full Code Here

      return true;

    if (fPosition.isDeleted)
      return false;

    ISelectionProvider provider= part.getSite().getSelectionProvider();
    ISelection selection= provider.getSelection();
    if (selection instanceof ITextSelection) {
      ITextSelection textSelection= (ITextSelection) selection;
      if (textSelection.getOffset() == fPosition.offset && textSelection.getLength() == fPosition.length) {
        String text= textSelection.getText();
        if (text != null) {
View Full Code Here

   * @param editor the editor
   * @return the editor's selection
   */
  private static ITextSelection getSelection(ITextEditor editor) {

    ISelectionProvider selectionProvider= editor.getSelectionProvider();
    if (selectionProvider == null)
      return null;

    ISelection selection= selectionProvider.getSelection();
    if (!(selection instanceof ITextSelection))
      return null;

    return (ITextSelection) selection;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.viewers.ISelectionProvider

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.