Package org.eclipse.ltk.core.refactoring

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


                /*
                 * get the previous change for this file if it exists, or otherwise create a new change for it, but do
                 * not store it yet: wait until we know if there are actually changes in the file
                 */
                TextChange fileChange = getTextChange(resource);
                final boolean fileChangeIsNew = (fileChange == null);
                if (fileChange == null) {
                    fileChange = new TextFileChange(proxy.getName(), resource);
                    fileChange.setEdit(new MultiTextEdit());
                }
                TextEdit rootEdit = fileChange.getEdit();

                /* loop over all renames to perform */
                for (Map.Entry<IPackageFragment,RenameArguments> entry : pkgFragments.entrySet()) {
                    IPackageFragment pkgFragment = entry.getKey();
                    RenameArguments arguments = entry.getValue();
View Full Code Here


      @Override
      public boolean acceptPatternMatch(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

      @Override
      public boolean acceptPatternMatch(final TextSearchMatchAccess matchAccess) throws CoreException {
        final IFile file = matchAccess.getFile();
        TextFileChange change = changes.get(file);
        if (change == null) {
          final TextChange textChange = getTextChange(file);
          if (textChange != null) {
            return false;
          }
          change = new TextFileChange(file.getName(), file);
          change.setEdit(new MultiTextEdit());
View Full Code Here

      @Override
      public boolean acceptPatternMatch(final TextSearchMatchAccess matchAccess) throws CoreException {
        final IFile file = matchAccess.getFile();
        TextFileChange change = changes.get(file);
        if (change == null) {
          final TextChange textChange = getTextChange(file);
          if (textChange != null) {
            return false;
          }
          change = new TextFileChange(file.getName(), file);
          change.setEdit(new MultiTextEdit());
View Full Code Here

   * {@link #createChange(IProgressMonitor)}.</p>
   *
   * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#getTextChange(java.lang.Object)
   */
  public TextChange getTextChange(Object element) {
    TextChange existingChange = (TextChange)fLocalTextChanges.get(element);
    if(existingChange == null) {
      existingChange = super.getTextChange(element);
    }
   
    return existingChange;
View Full Code Here

   * {@link #createChange(IProgressMonitor)}.</p>
   *
   * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#getTextChange(java.lang.Object)
   */
  public TextChange getTextChange(Object element) {
    TextChange existingChange = (TextChange)fLocalTextChanges.get(element);
    if(existingChange == null) {
      existingChange = super.getTextChange(element);
    }
   
    return existingChange;
View Full Code Here

   */
  private Change createChange(JavaSearchDocumentDelegate searchDoc, TextEdit edit, RefactoringParticipant participant) {
    IDocument doc = searchDoc.getJspTranslation().getJspDocument();
    String description = getDescription();
   
    TextChange existingChange = participant.getTextChange(searchDoc.getFile());
    TextChange change = null;
    if(existingChange != null) {
      try {
        existingChange.addEdit(edit);
      }catch (MalformedTreeException e) {
        Logger.logException("MalformedTreeException while adding edit " + //$NON-NLS-1$
            edit + " to existing change " + change, e); //$NON-NLS-1$
      }
     
      TextEditGroup group = new TextEditGroup(description, edit);
      existingChange.addTextEditGroup(group);
    } else {
      change = new JSPRenameChange(searchDoc.getFile(), doc, edit, searchDoc.getFile().getName());
      TextEditGroup group = new TextEditGroup(description, edit);
      change.addTextEditGroup(group);
    }
   
    return change;
  }
View Full Code Here

   * {@link #createChange(IProgressMonitor)}.</p>
   *
   * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#getTextChange(java.lang.Object)
   */
  public TextChange getTextChange(Object element) {
    TextChange existingChange = (TextChange)fLocalTextChanges.get(element);
    if(existingChange == null) {
      existingChange = super.getTextChange(element);
    }
   
    return existingChange;
View Full Code Here

   * {@link #createChange(IProgressMonitor)}.</p>
   *
   * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#getTextChange(java.lang.Object)
   */
  public TextChange getTextChange(Object element) {
    TextChange existingChange = (TextChange)fLocalTextChanges.get(element);
    if(existingChange == null) {
      existingChange = super.getTextChange(element);
    }
   
    return existingChange;
View Full Code Here

      astTextEdit = serviceUnit.rewrite(document, serviceType.getJavaProject().getOptions(true));
    }
    // merge AST edit with existing edit for service type file
    {
      IFile serviceTypeFile = (IFile) serviceType.getUnderlyingResource();
      TextChange existingTextChange = getTextChange(serviceTypeFile);
      if (existingTextChange != null) {
        existingTextChange.addEdit(astTextEdit);
        return null;
      } else {
        CompilationUnitChange serviceUnitChange =
            new CompilationUnitChange(serviceType.getFullyQualifiedName(), serviceCompilationUnit);
        serviceUnitChange.setEdit(astTextEdit);
View Full Code Here

TOP

Related Classes of org.eclipse.ltk.core.refactoring.TextChange

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.