Examples of replaceString()


Examples of com.intellij.openapi.editor.Document.replaceString()

      if (!lastChild.getNode().getElementType().equals(RIGHT_BRACKET)) {
        PsiElement prevSibling = lastChild.getPrevSibling();
        if (prevSibling != null) {
          final int textOffset = prevSibling.getTextOffset();
          if (prevSibling.getNode().getElementType() == COMMA) {
            doc.replaceString(textOffset, textOffset + 1, "]");
          } else {
            doc.insertString(textOffset + prevSibling.getTextLength(), "]");
          }
        }
        return;
View Full Code Here

Examples of com.intellij.openapi.editor.Document.replaceString()

                } else {
                    end += rightWhites;
                }
                boolean isEndOfLine = document.getLineEndOffset(line) == end;
                int endOffset = isEndOfLine ? end + document.getLineSeparatorLength(line) : end;
                document.replaceString(start, endOffset, "");
            }
        };
    }

    private static int getWhites(Pattern whitespacePattern, String importLine) {
View Full Code Here

Examples of com.intellij.openapi.editor.Document.replaceString()

            final Document document = editor.getDocument();

            CommandProcessor.getInstance().executeCommand(editor.getProject(), new Runnable() {
              public void run() {
                document.replaceString(0, document.getTextLength(), stringPropertyConverter.mergeComments(newDocumentContent, fileText));
              }
            }, "Property Sorter Plugin", null, UndoConfirmationPolicy.DO_NOT_REQUEST_CONFIRMATION);
          }
        });
        messageWindowComponent.say("Properties were sorted.");
View Full Code Here

Examples of com.intellij.openapi.editor.Document.replaceString()

    HbPath path = PsiTreeUtil.findChildOfType(targetBlockMustache, HbPath.class);
    final Document document = PsiDocumentManager.getInstance(project).getDocument(file);
    if (path != null && document != null) {
      final TextRange textRange = path.getTextRange();
      document.replaceString(textRange.getStartOffset(), textRange.getEndOffset(), myCorrectedName);
    }
  }

  @Override
  public boolean startInWriteAction() {
View Full Code Here

Examples of com.intellij.openapi.editor.Document.replaceString()

    public NginxDirectiveValue handleContentChange(NginxDirectiveValue element, TextRange range, String newContent) throws IncorrectOperationException {

        String oldText = element.getText();
        String newText = oldText.substring(0, range.getStartOffset()) + newContent + oldText.substring(range.getEndOffset());
        Document document = FileDocumentManager.getInstance().getDocument(element.getContainingFile().getVirtualFile());
        document.replaceString(element.getTextRange().getStartOffset(), element.getTextRange().getEndOffset(), newText);
        PsiDocumentManager.getInstance(element.getProject()).commitDocument(document);

        NginxServersConfiguration nginxServersConfiguration = ApplicationManager.getApplication().getComponent(NginxServersConfiguration.class);
        nginxServersConfiguration.rebuildFilepaths();
View Full Code Here

Examples of com.intellij.openapi.editor.Document.replaceString()

              continue;
            }
            String selectedText = document.getText(TextRange.create(blockStart, blockEnd));
            String newTextPart = transform(selectedText);

            document.replaceString(blockStart + plusOffset, blockEnd + plusOffset, newTextPart);

            int realOldTextLength = blockEnd - blockStart;
            plusOffset += newTextPart.length() - realOldTextLength;
          }
        } else {
View Full Code Here

Examples of com.intellij.openapi.editor.Document.replaceString()

          if (selectedText == null) {
            return;
          }
 
          document.replaceString(selectionStart,
              selectionEnd, transform(selectedText));
        }
      }
    });
  }
View Full Code Here

Examples of com.intellij.openapi.editor.Document.replaceString()

      if (start < 1 || end > document.getTextLength() - 1) return;
      CharSequence sequence = document.getCharsSequence();
      boolean left = sequence.charAt(start - 1) == sequence.charAt(start);
      boolean right = sequence.charAt(end - 1) == sequence.charAt(end);
      if (left || right) {
        document.replaceString(start, end, sequence.subSequence(left ? start + 1 : start, right ? end - 1 : end));
        if (right) {
          context.getEditor().getCaretModel().moveCaretRelatively(1, 0, false, false, true);
        }
      }
    }
View Full Code Here

Examples of com.intellij.openapi.editor.Document.replaceString()

      int formattingStart;
      int formattingEnd;

      if (inline) {
        document.replaceString(start, end, tag);
        formattingStart = start;
        formattingEnd = start + tag.length();
      }
      else {
        document.replaceString(start, end, "${" + var + "}");
View Full Code Here

Examples of com.intellij.openapi.editor.Document.replaceString()

        document.replaceString(start, end, tag);
        formattingStart = start;
        formattingEnd = start + tag.length();
      }
      else {
        document.replaceString(start, end, "${" + var + "}");
        XmlTag containingTag = PsiTreeUtil.getParentOfType(value, XmlTag.class, false);
        assert containingTag != null;
        int startOffset = containingTag.getTextRange().getStartOffset();
        document.insertString(startOffset, "\n");
        document.insertString(startOffset, tag);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.