Package org.eclipse.ltk.core.refactoring

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


            monitor = new NullProgressMonitor();
          }
          monitor.beginTask(WizardMessages.NewTestCaseCreationWizard_create_progress, 4);
          try {
            Change change = fix.createChange(new SubProgressMonitor(monitor, 1));
            new PerformChangeOperation(change).run(new SubProgressMonitor(monitor, 1));

            runnable.run(new SubProgressMonitor(monitor, 2));
          } catch (OperationCanceledException e) {
            throw new InterruptedException();
          } catch (CoreException e) {
View Full Code Here


          }else{
            edits = new TextEdit[]{edit};
          }
        }

        PerformChangeOperation changeOperation = new PerformChangeOperation(change);
        changeOperation.setUndoManager(
            RefactoringCore.getUndoManager(), proposal.getName());
        changeOperation.run(monitor);

        if (edits.length > 0 &&
            change instanceof CompilationUnitChange &&
            src.equals(((CompilationUnitChange)change).getCompilationUnit()))
        {
View Full Code Here

      IWorkspace workspace = ResourcesPlugin.getWorkspace();
      ResourceChangeListener rcl = new ResourceChangeListener();
      workspace.addResourceChangeListener(rcl);
      try{
        PerformChangeOperation changeOperation = new PerformChangeOperation(change);
        // passing in refactor.name to the change op doesn't seem to do the
        // trick, so lets force our name on the change since the undo manager
        // will use the change's name if label is null (which it shouldn't be,
        // but is, hence this hack).
        if (change instanceof CompositeChange){
          try{
            Field fName = CompositeChange.class.getDeclaredField("fName");
            fName.setAccessible(true);
            fName.set(change, refactor.name);
          }catch(NoSuchFieldException nsfe){
            // change doesn't have the expected fName field.
          }
        }

        changeOperation.setUndoManager(
            RefactoringCore.getUndoManager(), change.getName());

        changeOperation.run(new SubProgressMonitor(monitor, 4));
        return rcl.getChangedFiles();
      }finally{
        workspace.removeResourceChangeListener(rcl);
      }
    }catch(RefactorException re){
View Full Code Here

        processor);
    CheckConditionsOperation checkOp = new CheckConditionsOperation(
        refactoring, CheckConditionsOperation.ALL_CONDITIONS);
    CreateChangeOperation operation = new CreateChangeOperation(checkOp,
        RefactoringStatus.WARNING);
    PerformChangeOperation perform = new PerformChangeOperation(operation);

    try {
      ResourcesPlugin.getWorkspace().run(perform,
          new NullProgressMonitor());
    } catch (CoreException e) {
      PHPCorePlugin.log(e.getStatus());
      return false;
    }

    RefactoringStatus status = perform.getValidationStatus();

    if (status == null) {
      RefactoringStatus refactoringStatus = checkOp.getStatus();

      if (refactoringStatus != null && !refactoringStatus.isOK()) {
View Full Code Here

      String jarPathString = FileLocator.resolve(rtLocation).getFile();
      newClassPath[oldClassPath.length] = JavaCore.newLibraryEntry(new Path(jarPathString), null, null, false);

      Change newClasspathChange =
                      ClasspathFixProposal.newClasspathChange(javaProject, newClassPath, javaProject.getOutputLocation());
      new PerformChangeOperation(newClasspathChange).run(null);
    } catch (IOException e) {
      CoopIIIActivator.getInstance().getLog().log(new Status(Status.ERROR, "lang.coopIII.ui", "Could not configure Co-op RT to project.", e));
    }
  }
View Full Code Here

      IClasspathEntry[] newClassPath = new IClasspathEntry[newClasspathAsList.size()];
      newClassPath = newClasspathAsList.toArray(newClassPath);
     
      Change newClasspathChange = ClasspathFixProposal.newClasspathChange(
          javaProject, newClassPath, javaProject.getOutputLocation());
      new PerformChangeOperation(newClasspathChange).run(null);
    }
  }
View Full Code Here

          .size()];
      newClassPathArray = newClassPath.toArray(newClassPathArray);
      Change newClasspathChange = ClasspathFixProposal
          .newClasspathChange(javaProject, newClassPathArray,
              javaProject.getOutputLocation());
      new PerformChangeOperation(newClasspathChange).run(null);
    }
  }
View Full Code Here

TOP

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

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.