fun create(status: IStatus): RefactoringStatus? { if (status.isOK()) return RefactoringStatus() return if (!status.isMultiStatus()) { when (status.getSeverity()) { IStatus.OK -> RefactoringStatus() IStatus.INFO -> RefactoringStatus.createWarningStatus(status.getMessage()) IStatus.WARNING -> RefactoringStatus.createErrorStatus(status.getMessage()) IStatus.ERROR -> RefactoringStatus.createFatalErrorStatus(status.getMessage()) IStatus.CANCEL -> RefactoringStatus.createFatalErrorStatus(status.getMessage()) else -> RefactoringStatus.createFatalErrorStatus(status.getMessage()) } } else { val children: Array<IStatus> = status.getChildren() val result = RefactoringStatus() for (i in children.indices) { result.merge(RefactoringStatus.create(children[i])) } Result } }
Creates a new < code > RefactoringStatus < /code > from the given < code > IStatus < /code > . An OK status is mapped to an OK refactoring status , an information status is mapped to a warning refactoring status , a warning status is mapped to an error refactoring status and an error or cancel status is mapped to a fatal refactoring status . An unknown status is converted into a fatal error status as well . If the status is a < code > MultiStatus < /code > then the first level of children of the status will be added as refactoring status entries to the created refactoring status .