Examples of TextFileChange


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

      for (int i = 0; i < nodes.getLength(); i++) {
        createRenameBeanRefsTextEdit(nodes.item(i), descriptor, oldBeanId, newBeanId, multiEdit);
      }
     
      if (multiEdit.hasChildren()) {
        TextFileChange change = new TextFileChange("", file);
        change.setEdit(multiEdit);
        for (TextEdit e : multiEdit.getChildren()) {
          change.addTextEditGroup(new TextEditGroup("Rename " + descriptor.getType() + " reference", e));
        }
        return change;
      }
    }
    catch (IOException e) {
View Full Code Here

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

            recursiveCreateTextEdit(newNames[j], multiEdit, je, n);
          }
        }
      }
      if (multiEdit.hasChildren()) {
        TextFileChange change = new TextFileChange("", file);
        change.setEdit(multiEdit);
        for (TextEdit e : multiEdit.getChildren()) {
          change.addTextEditGroup(new TextEditGroup("Rename class name", e));
        }
        return change;
      }
    }
    catch (IOException e) {
View Full Code Here

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

      multiEdit.addChild(new ReplaceEdit(offset + changeCount * diff, oldLength, newName));
    }

    if (multiEdit.getChildrenSize() > 0) {
      TextFileChange change = new TextFileChange("", file);
      change.setEdit(multiEdit);
      return change;
    }
    else {
      return null;
    }
View Full Code Here

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

      TextSearchRequestor collector = new TextSearchRequestor() {
        @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() );
            changes.put( file, change );
          }
          ReplaceEdit edit = new ReplaceEdit( matchAccess.getMatchOffset(), matchAccess.getMatchLength(), RefactoringUtil.getNewFullyQualifiedName(
              renamedElement, getArguments().getNewName() ) );
          change.addEdit( edit );
          change.addTextEditGroup( new TextEditGroup( "Update type reference", edit ) ); //$NON-NLS-1$
          return true;
        }
      };
      TextSearchEngine.create().search( scope, collector, pattern, pm );
    }
View Full Code Here

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

      TextSearchRequestor collector = new TextSearchRequestor() {
        @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() );
            changes.put( file, change );
          }
          ReplaceEdit edit = new ReplaceEdit( matchAccess.getMatchOffset(), matchAccess.getMatchLength(), "" );
          change.addEdit( edit );
          change.addTextEditGroup( new TextEditGroup( "Remove type reference", edit ) ); //$NON-NLS-1$
          return true;
        }
      };
      TextSearchEngine.create().search( scope, collector, pattern, pm );
    }
View Full Code Here

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

      TextSearchRequestor collector = new TextSearchRequestor() {
        @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() );
            changes.put( file, change );
          }
          // TODO destination
          ReplaceEdit edit = new ReplaceEdit( matchAccess.getMatchOffset(), matchAccess.getMatchLength(), RefactoringUtil.getNewDestinationFullyQualifiedName(
              renamedElement, getArguments().getDestination().toString() ) );
          change.addEdit( edit );
          change.addTextEditGroup( new TextEditGroup( "Update type reference", edit ) ); //$NON-NLS-1$
          return true;
        }
      };
      TextSearchEngine.create().search( scope, collector, pattern, pm );
    }
View Full Code Here

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

      @Override
      public boolean acceptPatternMatch(
          final TextSearchMatchAccess matchAccess)
          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());
          changes.put(file, change);
        }
        ReplaceEdit edit = new ReplaceEdit(
            matchAccess.getMatchOffset(),
            matchAccess.getMatchLength(), newFullyQualifiedName);
        change.addEdit(edit);
        change.addTextEditGroup(new TextEditGroup(
            "Update type reference", edit)); //$NON-NLS-1$
        return true;
      }
    };
    TextSearchEngine.create().search(scope, collector, pattern, pm);
View Full Code Here

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

          e.printStackTrace();
        }
        if (found) {
          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());
            changes.put(file, change);
          }

          int index = content.indexOf("\"" + oldName + "\"");
          if (index >= 0) {
            ReplaceEdit edit = new ReplaceEdit(index + 1,
                oldName.length(), newName);
            change.addEdit(edit);
            change.addTextEditGroup(new TextEditGroup(
                "Update type reference", edit)); //$NON-NLS-1$
          }
        }
        return true;
      }
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.