Package org.eclipse.ltk.core.refactoring

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


        return new RefactoringStatus();
    }

    @Override
    public CompositeChange createChange(IProgressMonitor pm) {
        CompositeChange result = new CompositeChange(getName());
        for (Presentation classPresentation : cache) {
            try {
                List<Change> changes = classPresentation.getChanges();
                result.addAll(changes.toArray(new Change[changes.size()]));
            } catch (Exception e) {
                DesignerLogger.logErrorWithoutDialog(e.getMessage(), e);
            }
        }
        return result;
View Full Code Here


    if (changes.isEmpty()) {
      return null;
    }

    final CompositeChange result = new CompositeChange("QWickie renamings");
    for (final Iterator<TextFileChange> iter = changes.values().iterator(); iter.hasNext();) {
      result.add(iter.next());
    }
    return result;
  }
View Full Code Here

            if (monitor != null)
            {
                monitor.beginTask("Searching targets...", 1);
            }
           
            compositeChange = new CompositeChange(changeName);
       
            searchTargets();
            if (monitor != null)
            {
                monitor.beginTask("Creating changes...", 70);
View Full Code Here

   */
  public Change createChange(IProgressMonitor pm) throws CoreException {
    this.getTextChange(""); //$NON-NLS-1$
   
    //create one multi change to contain all new created changes
    CompositeChange multiChange = new CompositeChange(JSPUIMessages.JSP_changes);
   
    //for each element get the changes for it and add it to the multi change
    Iterator iter = fElementAndArgumentPairs.values().iterator();
    while(iter.hasNext()) {
      ElementAndArgumentsPair elemArgsPair = (ElementAndArgumentsPair)iter.next();
     
      Object dest = elemArgsPair.fArgs.getDestination();
     
      if(dest instanceof IPackageFragment) { 
        Change[] changes = createChangesFor(elemArgsPair.fElement, ((IPackageFragment)dest).getElementName());
       
        /* add all new text changes to the local list of text changes so that
         * future iterations through the while loop will be aware of already
         * existing changes
         */
        for(int i = 0; i < changes.length; ++i) {
          if(changes[i] instanceof TextChange) {
            fLocalTextChanges.put(((TextChange)changes[i]).getModifiedElement(), changes[i]);
          }
        }
       
        if(changes.length > 0) {
          multiChange.addAll(changes);
        }
      }
    }

    //unless there are actually new changes return null
    Change result = null;
    if(multiChange.getChildren().length > 0) {
      result = multiChange;
    }
   
    return result;
  }
View Full Code Here

   */
  public Change createChange(IProgressMonitor pm) throws CoreException {
    this.getTextChange(""); //$NON-NLS-1$
   
    //create one multi change to contain all new created changes
    CompositeChange multiChange = new CompositeChange(JSPUIMessages.JSP_changes);
   
    //for each element get the changes for it and add it to the multi change
    Iterator iter = fElementAndArgumentPairs.values().iterator();
    while(iter.hasNext()) {
      ElementAndArgumentsPair elemArgsPair = (ElementAndArgumentsPair)iter.next();
      Change[] changes = createChangesFor(elemArgsPair.fElement, elemArgsPair.fArgs.getNewName());
     
      /* add all new text changes to the local list of text changes so that
       * future iterations through the while loop will be aware of already
       * existing changes
       */
      for(int i = 0; i < changes.length; ++i) {
        if(changes[i] instanceof TextChange) {
          fLocalTextChanges.put(((TextChange)changes[i]).getModifiedElement(), changes[i]);
        }
      }
     
      if(changes.length > 0) {
        multiChange.addAll(changes);
      }
    }

    //unless there are actually new changes return null
    Change result = null;
    if(multiChange.getChildren().length > 0) {
      result = multiChange;
    }
   
    return result;
  }
View Full Code Here

   */
  public Change createChange(IProgressMonitor pm) throws CoreException {
    this.getTextChange(""); //$NON-NLS-1$
   
    //create one multi change to contain all new created changes
    CompositeChange multiChange = new CompositeChange(JSPUIMessages.JSP_changes);
   
    //for each element get the changes for it and add it to the multi change
    Iterator iter = fElementAndArgumentPairs.values().iterator();
    while(iter.hasNext()) {
      ElementAndArgumentsPair elemArgsPair = (ElementAndArgumentsPair)iter.next();
     
      Object dest = elemArgsPair.fArgs.getDestination();
     
      if(dest instanceof IPackageFragment) { 
        Change[] changes = createChangesFor(elemArgsPair.fElement, ((IPackageFragment)dest).getElementName(), pm);
       
        /* add all new text changes to the local list of text changes so that
         * future iterations through the while loop will be aware of already
         * existing changes
         */
        for(int i = 0; i < changes.length; ++i) {
          if(changes[i] instanceof TextChange) {
            fLocalTextChanges.put(((TextChange)changes[i]).getModifiedElement(), changes[i]);
          }
        }
       
        if(changes.length > 0) {
          multiChange.addAll(changes);
        }
      }
    }

    //unless there are actually new changes return null
    Change result = null;
    if(multiChange.getChildren().length > 0) {
      result = multiChange;
    }
   
    return result;
  }
View Full Code Here

   */
  public Change createChange(IProgressMonitor pm) throws CoreException {
    this.getTextChange(""); //$NON-NLS-1$
   
    //create one multi change to contain all new created changes
    CompositeChange multiChange = new CompositeChange(JSPUIMessages.JSP_changes);
   
    //for each element get the changes for it and add it to the multi change
    Iterator iter = fElementAndArgumentPairs.values().iterator();
    while(iter.hasNext()) {
      ElementAndArgumentsPair elemArgsPair = (ElementAndArgumentsPair)iter.next();
      Change[] changes = createChangesFor(elemArgsPair.fElement, elemArgsPair.fArgs.getNewName(), pm);
     
      /* add all new text changes to the local list of text changes so that
       * future iterations through the while loop will be aware of already
       * existing changes
       */
      for(int i = 0; i < changes.length; ++i) {
        if(changes[i] instanceof TextChange) {
          fLocalTextChanges.put(((TextChange)changes[i]).getModifiedElement(), changes[i]);
        }
      }
     
      if(changes.length > 0) {
        multiChange.addAll(changes);
      }
    }

    //unless there are actually new changes return null
    Change result = null;
    if(multiChange.getChildren().length > 0) {
      result = multiChange;
    }
   
    return result;
  }
View Full Code Here

   
    return null;
  }

  public Change getChange() {
    CompositeChange compositeChange = new CompositeChange(Messages.getString("org.apache.openejb.helper.annotation.compositChangeString")); //$NON-NLS-1$

    Iterator<CompilationUnit> iterator = cache.values().iterator();
    while (iterator.hasNext()) {
      try {
        CompilationUnit cu = iterator.next();
        ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
        IPath path = cu.getJavaElement().getPath();
        bufferManager.connect(path, null);

        ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(path);
        IDocument document = textFileBuffer.getDocument();

        TextEdit edit = cu.rewrite(document, javaProject.getOptions(true));
        TextFileChange dc = new TextFileChange(path.toString(), (IFile) cu.getJavaElement().getResource());
        dc.setTextType("java"); //$NON-NLS-1$
        dc.setEdit(edit);
        dc.setSaveMode(TextFileChange.FORCE_SAVE);

        compositeChange.add(dc);
      } catch (CoreException e) {
      }
    }

    return compositeChange;
View Full Code Here

  }

  @Override
  public Change createChange(IProgressMonitor pm) throws CoreException,
      OperationCanceledException {
    CompositeChange rootChange = new CompositeChange("CompositeChange");
    try {
      pm.beginTask( CoreTexts.reformatProductionRefactor_collectingChanges, 100 );
     
      IFile file = getFile(info.getAtgEditor());
      TextFileChange textFileChange = new TextFileChange( file.getName(), file );
      rootChange.add(textFileChange);
     
      //a file change contains a tree of edits, first add the root of them
      final MultiTextEdit fileChangeRootEdit = new MultiTextEdit();
      textFileChange.setEdit(fileChangeRootEdit);   
     
View Full Code Here

  }

  @Override
  public Change createChange(IProgressMonitor pm) throws CoreException,
      OperationCanceledException {
    CompositeChange rootChange = new CompositeChange("CompositeChange");
    try {
      pm.beginTask( CoreTexts.renameRefactor_collectingChanges, 100 );
     
      IFile file = getFile(info.getAtgEditor());
      TextFileChange textFileChange = new TextFileChange( file.getName(), file );
      rootChange.add(textFileChange);
     
      //a file change contains a tree of edits, first add the root of them
      final MultiTextEdit fileChangeRootEdit = new MultiTextEdit();
      textFileChange.setEdit(fileChangeRootEdit);   
     
View Full Code Here

TOP

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

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.