Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.TextSelection


  {
    if (isel instanceof TextSelection)
    {
      try
      {
        TextSelection   selection = (TextSelection)isel;
        ISourceRange   sourceRange = element.getSourceRange();
       
        if (sourceRange == null)
          return false;
       
        if ((sourceRange.getOffset() <= selection.getOffset()) &&
          (sourceRange.getOffset() + sourceRange.getLength() >= selection.getOffset() + selection.getLength()))
        {
          return true;
        }
      }
      catch (JavaModelException e)
View Full Code Here


    return fSite.getShell();
  }
 
  @Override
  public void run() {
    TextSelection sel = EditorUtils.getSelection(deeEditor);
    final int offset = sel.getOffset();
   
    new FindReferencesOperation(offset).executeAndHandle();
   
  }
View Full Code Here

  public void run(IAction action) {
    IDocumentProvider dp = editor.getDocumentProvider();
    IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
    TextSelectionNavigationLocation navloc = (TextSelectionNavigationLocation) editor.createNavigationLocation();
    TextSelection selection=(TextSelection) editor.getSelectionProvider().getSelection();
    int line=selection.getStartLine();
    try {
      String text=document.get(document.getLineOffset(line),document.getLineLength(line));
      org.jbehave.plugin.eclipse.model.StoryLine storyLine = StoryLine.parseLine(text);
      if (storyLine!=null){
        findAndOpenClass(storyLine);
View Full Code Here

    if (delim != null && document.getLineLength(endLine) == delim.length())
      fAddDelimiter= true;
    else
      fAddDelimiter= false;

    return new TextSelection(document, low, high - low);
  }
View Full Code Here

      return null;
    try {
      if (fCopy && skippedLineN == -1)
        skippedLineN= 0;
      IRegion line= document.getLineInformation(skippedLineN);
      return new TextSelection(document, line.getOffset(), line.getLength());
    } catch (BadLocationException e) {
      // only happens on concurrent modifications
      return null;
    }
  }
View Full Code Here

    // get selection
    Point p= viewer.getSelectedRange();
    if (p == null)
      return;

    ITextSelection sel= new TextSelection(document, p.x, p.y);

    ITextSelection skippedLine= getSkippedLine(document, sel);
    if (skippedLine == null)
      return;
View Full Code Here

      ISelectionProvider provider= editor.getEditorSite().getSelectionProvider();
      if (provider == null)
        return;

      provider.setSelection(new TextSelection(pos.offset, pos.length));
    }
  }
View Full Code Here

   
    Integer length= memento.getInteger(TAG_SELECTION_LENGTH);
    if (length == null)
      return;
   
    doSetSelection(new TextSelection(offset.intValue(), length.intValue()));
   
    // XXX: https://bugs.eclipse.org/bugs/show_bug.cgi?id=168524
    Integer horizontalPixel= memento.getInteger(TAG_SELECTION_HPIXEL);
    if (horizontalPixel == null)
      return;
View Full Code Here

    super(parentShell);
    this.selection = selection;
    this.project = project;
   
    if (this.selection != null && this.selection instanceof TextSelection){
      TextSelection ts = (TextSelection)this.selection;
      this.setTypeName(ts.getText());
     
    } else if (this.selection != null && this.selection instanceof TreeSelection){
      TreeSelection ts = (TreeSelection)this.selection;
      Object element = ts.getFirstElement();
      if (element instanceof ToolAttribute){
        this.setTypeName(((ToolAttribute)element).getType());
      } else if (element instanceof ToolVirtualAttribute){
        this.setTypeName(((ToolAttribute)element).getType());
      } else {
        this.setTypeName(ts.getFirstElement().toString());
      }
    }
  }
View Full Code Here

            return null;
        }
       
        ISelection selection = HandlerUtil.getCurrentSelection(event);
        if ((selection != null) && (selection instanceof TextSelection)) {
            TextSelection docSelection = (TextSelection)selection;
            try {
                int lineStart = docSelection.getStartLine();
                int lineEnd = docSelection.getEndLine();
                boolean shouldComment = shouldComment(lineStart, lineEnd, doc);
                for (int i = lineStart; i <= lineEnd; i++) {
                    if (shouldComment)
                        doc.replace(doc.getLineOffset(i), 0, "#");
                    else
View Full Code Here

TOP

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

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.