Examples of TextChange


Examples of org.eclipse.ltk.core.refactoring.TextChange

                Map.Entry entry = (Map.Entry) iterator.next();
                IFile file = (IFile) entry.getKey();
                Collection bucket = (Collection) entry.getValue();
                if (!bucket.isEmpty()) {
                    try {
                        TextChange change = createFileChange(file, pattern, bucket, resultingStatus, matchGroups);
                        if (change != null) {
                            compositeChange.add(change);
                            hasChanges = true;
                        }
                    } catch (CoreException e) {
View Full Code Here

Examples of org.eclipse.ltk.core.refactoring.TextChange

  }

  protected TextChange createTextChange() throws CoreException {
    ICompilationUnit cu = m_cu;
    String name = "TestNG";
    TextChange change = null;
//    if (!cu.getResource().exists()) {
//      String source;
//      try {
//        source= cu.getSource();
//      } catch (JavaModelException e) {
//        JavaPlugin.log(e);
//        source= new String(); // empty
//      }
//    }
    Document document= new Document(cu.getSource());
    document.setInitialLineDelimiter(StubUtility.getLineDelimiterUsed(cu));
    change= new DocumentChange(name, document);
//    } else {
//      Document doc = new Document(m_cu.getSource());
//      CompilationUnitChange cuChange = new CompilationUnitChange(name, cu);
//      cuChange.setSaveMode(TextFileChange.LEAVE_DIRTY);
//      change= cuChange;
//    }
    TextEdit rootEdit= new MultiTextEdit();
    change.setEdit(rootEdit);

    // initialize text change
//    IDocument document= change.getCurrentDocument(new NullProgressMonitor());
    addEdits(change.getCurrentDocument(new NullProgressMonitor()), rootEdit);
    return change;
  }
View Full Code Here

Examples of org.eclipse.ltk.core.refactoring.TextChange

   */
  private String getHtml() {
    final StringBuffer buf= new StringBuffer();

    try {
      final TextChange change= getTextChange();

      change.setKeepPreviewEdits(true);
      final IDocument previewContent= change.getPreviewDocument(new NullProgressMonitor());
      final TextEdit rootEdit= change.getPreviewEdit(change.getEdit());

      class EditAnnotator extends TextEditVisitor {
        private int m_writtenToPos = 0;

        public void unchangedUntil(int pos) {
View Full Code Here

Examples of org.eclipse.ltk.core.refactoring.TextChange

    // need to look at already refactored positions to make sure offsets are
    // correct
    List<Integer> refactoredPositions = new ArrayList<Integer>();
    ProcessorBasedRefactoring refactoring = getProcessor().getRefactoring();
    if (refactoring != null) {
      TextChange textChange = refactoring.getTextChange(file);
      if (textChange != null) {
        TextEdit edit = textChange.getEdit();
        getPositions(edit, refactoredPositions);
      }
    }

    int changeCount = 0;
View Full Code Here

Examples of org.eclipse.ltk.core.refactoring.TextChange

        @Override
        public boolean acceptPatternMatch( final TextSearchMatchAccess matchAccess ) throws CoreException {
          IFile file = matchAccess.getFile();
          TextFileChange change = (TextFileChange) changes.get( file );
          if ( change == null ) {
            TextChange textChange = getTextChange( file ); // an other participant already modified that file?
            if ( textChange != null ) {
              return false; // don't try to merge changes
            }
            change = new TextFileChange( file.getName(), file );
            change.setEdit( new MultiTextEdit() );
View Full Code Here

Examples of org.eclipse.ltk.core.refactoring.TextChange

        @Override
        public boolean acceptPatternMatch( final TextSearchMatchAccess matchAccess ) throws CoreException {
          IFile file = matchAccess.getFile();
          TextFileChange change = (TextFileChange) changes.get( file );
          if ( change == null ) {
            TextChange textChange = getTextChange( file ); // an other participant already modified that file?
            if ( textChange != null ) {
              return false; // don't try to merge changes
            }
            change = new TextFileChange( file.getName(), file );
            change.setEdit( new MultiTextEdit() );
View Full Code Here

Examples of org.eclipse.ltk.core.refactoring.TextChange

        @Override
        public boolean acceptPatternMatch( final TextSearchMatchAccess matchAccess ) throws CoreException {
          IFile file = matchAccess.getFile();
          TextFileChange change = (TextFileChange) changes.get( file );
          if ( change == null ) {
            TextChange textChange = getTextChange( file ); // an other participant already modified that file?
            if ( textChange != null ) {
              return false; // don't try to merge changes
            }
            change = new TextFileChange( file.getName(), file );
            change.setEdit( new MultiTextEdit() );
View Full Code Here

Examples of org.eclipse.ltk.core.refactoring.TextChange

          throws CoreException {
        IFile file = matchAccess.getFile();
        TextFileChange change = (TextFileChange) changes.get(file);
        if (change == null) {
          // an other participant already modified that file?
          TextChange textChange = getTextChange(file);
          if (textChange != null) {
            return false; // don't try to merge changes
          }
          change = new TextFileChange(file.getName(), file);
          change.setEdit(new MultiTextEdit());
View Full Code Here

Examples of org.eclipse.ltk.core.refactoring.TextChange

          String content = matchAccess.getFileContent(0,
              matchAccess.getFileContentLength());
          TextFileChange change = (TextFileChange) changes.get(file);
          if (change == null) {
            // an other participant already modified that file?
            TextChange textChange = getTextChange(file);
            if (textChange != null) {
              return false; // don't try to merge changes
            }
            change = new TextFileChange(file.getName(), file);
            change.setEdit(new MultiTextEdit());
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.