Search in sources :

Example 1 with IRefactoringRpcMessage

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

the class MergeForAllRefactoring 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 2 with IRefactoringRpcMessage

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

the class MoveFunctionRefactoring method checkFinalConditions.

@Override
public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) throws CoreException, OperationCanceledException {
    final IErlSelection sel = GlobalParameters.getWranglerSelection();
    IRefactoringRpcMessage message = run(sel);
    if (message.isSuccessful()) {
        changedFiles = message.getRefactoringChangeset();
        return new RefactoringStatus();
    } else if (message.getRefactoringState() == RefactoringState.QUESTION) {
        message = run2(sel);
        if (message.isSuccessful()) {
            changedFiles = message.getRefactoringChangeset();
            return new RefactoringStatus();
        }
        return RefactoringStatus.createFatalErrorStatus(message.getMessageString());
    } else {
        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 3 with IRefactoringRpcMessage

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

the class ProcessRelatedRefactoring method checkFinalConditions.

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

Example 4 with IRefactoringRpcMessage

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

the class ExtractFunctionRefactoring 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.WARNING) {
                final boolean answer = !ask("Warning", message.getMessageString());
                if (answer) {
                    message = runAlternative(sel);
                    if (message.getRefactoringState() == RefactoringState.OK) {
                        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 5 with IRefactoringRpcMessage

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

the class GeneraliseFunctionRefactoring method checkFinalConditions.

@Override
public RefactoringStatus checkFinalConditions(final IProgressMonitor pm) throws CoreException, OperationCanceledException {
    final IErlSelection sel = GlobalParameters.getWranglerSelection();
    final IRefactoringRpcMessage theMessage = run(sel);
    if (theMessage.isSuccessful()) {
        changedFiles = theMessage.getRefactoringChangeset();
        return new RefactoringStatus();
    }
    return RefactoringStatus.createFatalErrorStatus(theMessage.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