Package org.rstudio.studio.client.workbench.views.source.editors.text.ace

Examples of org.rstudio.studio.client.workbench.views.source.editors.text.ace.Range


         events_.fireEvent(new ConsoleExecutePendingInputEvent());
         return;
      }
     
     
      Range selectionRange = docDisplay_.getSelectionRange();
      boolean noSelection = selectionRange.isEmpty();
      if (noSelection)
      {
         int row = docDisplay_.getSelectionStart().getRow();
         selectionRange = Range.fromPoints(
               Position.create(row, 0),
View Full Code Here


                  @Override
                  public void execute()
                  {
                     Position cursorPos = docDisplay_.getCursorPosition();
                     Range anchorRange = anchor_.getRange();
                     if (cursorPos.isBeforeOrEqualTo(anchorRange.getStart()) ||
                         cursorPos.isAfterOrEqualTo(anchorRange.getEnd()))
                     {
                        hide();
                     }
                  }
               });
View Full Code Here

            // It's the easiest way to make sure getCurrentScope() returns
            // a Scope with an end.
            docDisplay_.getScopeTree();
           
            // see if there is a region of code in the current chunk to execute
            Range currentChunkRange = null;
            Scope currentScope = scopeHelper_.getCurrentSweaveChunk();
            if (currentScope != null)
            {
               // get end position (always execute the current line unless
               // the cursor is at the beginning of it)
View Full Code Here

   private void executeSweaveChunk(Scope chunk, boolean scrollNearTop)
   {
      if (chunk == null)
         return;

      Range range = scopeHelper_.getSweaveChunkInnerRange(chunk);
      if (scrollNearTop)
      {
         docDisplay_.navigateToPosition(
               SourcePosition.create(range.getStart().getRow(),
                                     range.getStart().getColumn()),
               true);
      }
      docDisplay_.setSelection(
            docDisplay_.createSelection(range.getStart(), range.getEnd()));
      if (!range.isEmpty())
      {
         codeExecution_.setLastExecuted(range.getStart(), range.getEnd());
         String code = scopeHelper_.getSweaveChunkText(chunk);
         events_.fireEvent(new SendToConsoleEvent(code, true));

         docDisplay_.collapseSelection(true);
      }
View Full Code Here

   @Handler
   void onFold()
   {
      if (useScopeTreeFolding())
      {
         Range range = Range.fromPoints(docDisplay_.getSelectionStart(),
                                        docDisplay_.getSelectionEnd());
         if (range.isEmpty())
         {
            // If no selection, fold the innermost non-anonymous scope
  
            ScopeList scopeList = new ScopeList(docDisplay_);
            scopeList.removeAll(ScopeList.ANON_BRACE);
View Full Code Here

   @Handler
   void onUnfold()
   {
      if (useScopeTreeFolding())
      {
         Range range = Range.fromPoints(docDisplay_.getSelectionStart(),
                                        docDisplay_.getSelectionEnd());
         if (range.isEmpty())
         {
            // If no selection, unfold the closest fold on the current row
  
            Position pos = range.getStart();
  
            AceFold startCandidate = null;
            AceFold endCandidate = null;
  
            for (AceFold f : JsUtil.asIterable(docDisplay_.getFolds()))
View Full Code Here

    
      // if we are searching in a selection then create a custom position
      // (based on the current selection) and range (based on the originally
      // saved selection range)
      Position position = null;
      Range range = null;
      if (display_.getInSelection().getValue() && (targetSelection_ != null))
      {      
         range = targetSelection_.getRange();
        
         if (findType == FindType.Forward)
         {
            Position selectionEnd = editor_.getSelectionEnd();
            if (selectionEnd.isBefore(range.getEnd()))
               position = selectionEnd;
         }
         else
         {
            Position selectionStart = editor_.getSelectionStart();
            if (selectionStart.isAfter(range.getStart()))
               position = selectionStart;
         }
      }
     
      // if this is an incremental search and we don't have a previous
      // incremental start position then set it, otherwise clear it
      if (incremental)
      {
         if (incrementalSearchPosition_ == null)
         {
            if (position != null)
               incrementalSearchPosition_ = position;
            else
               incrementalSearchPosition_ = defaultForward_ ?
                                          editor_.getSelectionStart() :
                                          editor_.getSelectionEnd();
         }
       
         // incremental searches always continue searching from the
         // original search position
         position = incrementalSearchPosition_;
      }
      else
      {
         incrementalSearchPosition_ = null;
      }
     
      // do the search
      Search search = Search.create(searchString,
                                    findType != FindType.Forward,
                                    wrap,
                                    !ignoreCase,
                                    wholeWord,
                                    position,
                                    range,
                                    regex);
  
      try
      {
         Range resultRange = search.find(editor_.getSession());
         if (resultRange == null)
         {
            if (!incremental)
            {
               globalDisplay_.showMessage(GlobalDisplay.MSG_INFO,
View Full Code Here

   private void replaceAll()
   {
      String code = null;
      if (targetSelection_ != null)
      {
         Range range = targetSelection_.getRange();
         code = editor_.getCode(range.getStart(), range.getEnd());
      }
      else
      {
         code = editor_.getCode();
      }
View Full Code Here

      }
     
      // see if we need to move any breakpoints around in response to
      // this change to the document's text
      String action = changeEvent.getAction();
      Range range = changeEvent.getRange();
      Position start = range.getStart();
      Position end = range.getEnd();
     
      // if the edit was all on one line or the action didn't change text
      // in a way that could change lines, we can't have moved anything
      if (start.getRow() == end.getRow() ||
          (!action.equals("insertText") &&
View Full Code Here

TOP

Related Classes of org.rstudio.studio.client.workbench.views.source.editors.text.ace.Range

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.