Search in sources :

Example 6 with IRefactoringRpcMessage

use of org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage in project erlide_eclipse by erlang.

the class SimpleOneStepWranglerRefactoring method checkFinalConditions.

/**
 * If the refactoring returns with a warning message, wrangler should know
 * that the user asked to continue. It is done by calling a function.
 *
 * @return a refactoring message
 */
// public abstract IRefactoringRpcMessage runAfterWarning(IErlSelection
// sel);
@Override
public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) throws CoreException, OperationCanceledException {
    final IErlSelection sel = GlobalParameters.getWranglerSelection();
    final IRefactoringRpcMessage message = run(sel);
    if (message.isSuccessful()) {
        changedFiles = message.getRefactoringChangeset();
        return new RefactoringStatus();
    // } else if (message.getRefactoringState() ==
    // RefactoringState.WARNING) {
    // return RefactoringStatus.createWarningStatus(message
    // .getMessageString());
    }
    return RefactoringStatus.createFatalErrorStatus(message.getMessageString());
}
Also used : IRefactoringRpcMessage(org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage) RefactoringStatus(org.eclipse.ltk.core.refactoring.RefactoringStatus) IErlSelection(org.erlide.wrangler.refactoring.selection.IErlSelection)

Example 7 with IRefactoringRpcMessage

use of org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage in project erlide_eclipse by erlang.

the class RenameModuleRefactoring method getWorkflowController.

@Override
public RefactoringWorkflowController getWorkflowController(final Shell shell) {
    return new RefactoringWorkflowController(shell) {

        @Override
        public void doRefactoring() {
            final IErlSelection sel = GlobalParameters.getWranglerSelection();
            IRefactoringRpcMessage message = run(sel);
            if (message.isSuccessful()) {
                changedFiles = message.getRefactoringChangeset();
                status = new RefactoringStatus();
            } else if (message.getRefactoringState() == RefactoringState.QUESTION) {
                renameTestMod = ask("Question", message.getMessageString());
                message = runAlternative(sel);
                if (message.getRefactoringState() == RefactoringState.OK) {
                    changedFiles = message.getRefactoringChangeset();
                    status = new RefactoringStatus();
                } else {
                    status = RefactoringStatus.createFatalErrorStatus(message.getMessageString());
                }
            } else if (message.getRefactoringState() == RefactoringState.WARNING) {
                renameTestMod = !ask("Warning", message.getMessageString());
                if (!renameTestMod) {
                    message = runAlternative(sel);
                    if (message.getRefactoringState() == RefactoringState.OK) {
                        changedFiles = message.getRefactoringChangeset();
                        status = new RefactoringStatus();
                    } else {
                        status = RefactoringStatus.createFatalErrorStatus(message.getMessageString());
                    }
                } else {
                    stop();
                }
            } else {
                status = RefactoringStatus.createFatalErrorStatus(message.getMessageString());
            }
        }
    };
}
Also used : IRefactoringRpcMessage(org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage) RefactoringWorkflowController(org.erlide.wrangler.refactoring.core.RefactoringWorkflowController) RefactoringStatus(org.eclipse.ltk.core.refactoring.RefactoringStatus) IErlSelection(org.erlide.wrangler.refactoring.selection.IErlSelection)

Example 8 with IRefactoringRpcMessage

use of org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage in project erlide_eclipse by erlang.

the class UserRefactoring method getWorkflowController.

/**
 * Defines workflow of the refactoring, sets changed files and status
 *
 * @param shell
 * @return
 */
public RefactoringWorkflowController getWorkflowController(final Shell shell) {
    return new RefactoringWorkflowController(shell) {

        @Override
        public void doRefactoring() {
            final IErlSelection sel = GlobalParameters.getWranglerSelection();
            final IRefactoringRpcMessage message = run(sel);
            if (message.isSuccessful()) {
                changedFiles = message.getRefactoringChangeset();
                status = new RefactoringStatus();
            } else {
                status = RefactoringStatus.createFatalErrorStatus(message.getMessageString());
            }
        }
    };
}
Also used : IRefactoringRpcMessage(org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage) RefactoringWorkflowController(org.erlide.wrangler.refactoring.core.RefactoringWorkflowController) RefactoringStatus(org.eclipse.ltk.core.refactoring.RefactoringStatus) IErlSelection(org.erlide.wrangler.refactoring.selection.IErlSelection)

Example 9 with IRefactoringRpcMessage

use of org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage in project erlide_eclipse by erlang.

the class FoldAgainstMacro method checkFinalConditions.

@Override
public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) throws CoreException, OperationCanceledException {
    final IErlSelection sel = GlobalParameters.getWranglerSelection();
    final IRefactoringRpcMessage message = run(sel);
    if (message.isSuccessful()) {
        changedFiles = message.getRefactoringChangeset();
        return new RefactoringStatus();
    }
    return RefactoringStatus.createFatalErrorStatus(message.getMessageString());
}
Also used : IRefactoringRpcMessage(org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage) RefactoringStatus(org.eclipse.ltk.core.refactoring.RefactoringStatus) IErlSelection(org.erlide.wrangler.refactoring.selection.IErlSelection)

Example 10 with IRefactoringRpcMessage

use of org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage in project erlide_eclipse by erlang.

the class FoldLocalExpressionRefactoring method checkFinalConditions.

@Override
public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) throws CoreException, OperationCanceledException {
    final IErlSelection sel = GlobalParameters.getWranglerSelection();
    final IRefactoringRpcMessage message = run(sel);
    if (message.isSuccessful()) {
        changedFiles = message.getRefactoringChangeset();
        return new RefactoringStatus();
    }
    return RefactoringStatus.createFatalErrorStatus(message.getMessageString());
}
Also used : IRefactoringRpcMessage(org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage) RefactoringStatus(org.eclipse.ltk.core.refactoring.RefactoringStatus) IErlSelection(org.erlide.wrangler.refactoring.selection.IErlSelection)

Aggregations

RefactoringStatus (org.eclipse.ltk.core.refactoring.RefactoringStatus)13 IRefactoringRpcMessage (org.erlide.wrangler.refactoring.backend.IRefactoringRpcMessage)13 IErlSelection (org.erlide.wrangler.refactoring.selection.IErlSelection)13 RefactoringWorkflowController (org.erlide.wrangler.refactoring.core.RefactoringWorkflowController)4 ProcessRpcMessage (org.erlide.wrangler.refactoring.backend.internal.ProcessRpcMessage)1