@Override
 public IRefactoringRpcMessage run(IErlSelection selection) {
   IErlMemberSelection sel = (IErlMemberSelection) selection;
   return WranglerBackendManager.getRefactoringBackend()
       .call(
           "fold_expr_1_eclipse",
           "sxxxi",
           sel.getFilePath(),
           syntaxTree,
           getSelectedPos(),
           sel.getSearchPath(),
           GlobalParameters.getTabWidth());
 }
Пример #2
0
 @Override
 public IRefactoringRpcMessage runAlternative(final IErlSelection selection) {
   IErlMemberSelection sel = (IErlMemberSelection) selection;
   return WranglerBackendManager.getRefactoringBackend()
       .call(
           "new_let_1_eclipse",
           "ssxxxi",
           sel.getFilePath(),
           userInput,
           expr,
           parentExpr,
           sel.getSearchPath(),
           GlobalParameters.getTabWidth());
 }
Пример #3
0
 @Override
 public IRefactoringRpcMessage run(final IErlSelection selection) {
   IErlMemberSelection sel = (IErlMemberSelection) selection;
   return WranglerBackendManager.getRefactoringBackend()
       .call(
           "new_let_eclipse",
           "sxxsxi",
           sel.getFilePath(),
           sel.getSelectionRange().getStartPos(),
           sel.getSelectionRange().getEndPos(),
           userInput,
           sel.getSearchPath(),
           GlobalParameters.getTabWidth());
 }
  @Override
  public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
      throws CoreException, OperationCanceledException {
    if (functionClause == null) {
      return RefactoringStatus.createFatalErrorStatus("No function clause was given!");
    } else {

      ExpressionPosRpcMessage m = new ExpressionPosRpcMessage();
      String path = selection.getFilePath();
      String moduleName = functionClause.getModule().getModuleName();
      String functionName = functionClause.getFunctionName();
      int arity = functionClause.getArity();

      int clauseIndex = 1;
      if (!(functionClause instanceof IErlFunction))
        // FIXME: avoid hacking!!!
        clauseIndex = Integer.valueOf(functionClause.getName().substring(1));

      m =
          (ExpressionPosRpcMessage)
              WranglerBackendManager.getRefactoringBackend()
                  .callWithParser(
                      m,
                      "fold_expr_by_name_eclipse",
                      "sssiixi",
                      path,
                      moduleName,
                      functionName,
                      arity,
                      clauseIndex,
                      selection.getSearchPath(),
                      GlobalParameters.getTabWidth());

      if (m.isSuccessful()) {
        syntaxTree = m.getSyntaxTree();
        // TODO: store positions, selectedpositions
        positions = m.getPositionDefinitions(selection.getDocument());
        selectedPositions = new ArrayList<IErlRange>();
      } else {
        return RefactoringStatus.createFatalErrorStatus(m.getMessageString());
      }
    }

    return new RefactoringStatus();
  }