Search in sources :

Example 1 with SelectionKind

use of org.erlide.wrangler.refactoring.selection.IErlSelection.SelectionKind in project erlide_eclipse by erlang.

the class TupleFunctionParametersRefactoring method checkInitialConditions.

@Override
public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) throws CoreException, OperationCanceledException {
    final IErlSelection sel = GlobalParameters.getWranglerSelection();
    if (sel instanceof IErlMemberSelection) {
        final SelectionKind kind = sel.getKind();
        if (kind == SelectionKind.FUNCTION_CLAUSE || kind == SelectionKind.FUNCTION) {
            final IErlMemberSelection s = (IErlMemberSelection) sel;
            numberOfTuplingParameters = calculateParametersNumber(WranglerUtils.getTextFromEditor(s.getSelectionRange(), s.getDocument()));
            if (numberOfTuplingParameters > 0) {
                return new RefactoringStatus();
            }
        }
    }
    return RefactoringStatus.createFatalErrorStatus("Please select function parameters!");
}
Also used : IErlMemberSelection(org.erlide.wrangler.refactoring.selection.IErlMemberSelection) RefactoringStatus(org.eclipse.ltk.core.refactoring.RefactoringStatus) IErlSelection(org.erlide.wrangler.refactoring.selection.IErlSelection) SelectionKind(org.erlide.wrangler.refactoring.selection.IErlSelection.SelectionKind)

Aggregations

RefactoringStatus (org.eclipse.ltk.core.refactoring.RefactoringStatus)1 IErlMemberSelection (org.erlide.wrangler.refactoring.selection.IErlMemberSelection)1 IErlSelection (org.erlide.wrangler.refactoring.selection.IErlSelection)1 SelectionKind (org.erlide.wrangler.refactoring.selection.IErlSelection.SelectionKind)1