Esempio n. 1
0
  /**
   * @param pyEdit the editor that will have this action
   * @return the action (with the pyedit attached to it)
   */
  public static PyRefactorAction getRefactorAction(PyEdit pyEdit) {
    PyRefactorAction pyRefactorAction =
        new PyRefactorAction() {

          @Override
          protected String perform(IAction action, IProgressMonitor monitor) throws Exception {
            throw new RuntimeException("Perform should not be called in this case.");
          }
        };
    pyRefactorAction.setEditor(pyEdit);
    return pyRefactorAction;
  }
Esempio n. 2
0
 /**
  * @param pyEdit the editor where we should look for the occurrences
  * @param pyRefactorAction the action that will return the initial refactoring request
  * @param ps the pyselection used (if null it will be created in this method)
  * @return a refactoring request suitable for finding the locals in the file
  * @throws BadLocationException
  * @throws MisconfigurationException
  */
 public static RefactoringRequest getRefactoringRequest(
     final PyEdit pyEdit, PyRefactorAction pyRefactorAction, PySelection ps)
     throws BadLocationException, MisconfigurationException {
   final RefactoringRequest req = pyRefactorAction.getRefactoringRequest();
   req.ps = ps;
   req.fillInitialNameAndOffset();
   req.inputName = "foo";
   req.setAdditionalInfo(RefactoringRequest.FIND_DEFINITION_IN_ADDITIONAL_INFO, false);
   req.setAdditionalInfo(RefactoringRequest.FIND_REFERENCES_ONLY_IN_LOCAL_SCOPE, true);
   return req;
 }