Search in sources :

Example 1 with InvalidPreferenceScopeException

use of org.uberfire.preferences.shared.impl.exception.InvalidPreferenceScopeException in project kie-wb-common by kiegroup.

the class WorkbenchPreferenceScopeResolver method getScopeFromOrder.

private PreferenceScope getScopeFromOrder(final String... scopeTypes) {
    for (PreferenceScope scope : order) {
        boolean match = true;
        PreferenceScope currentScope = scope;
        for (int i = 0; i < scopeTypes.length; i++) {
            if (currentScope == null || !currentScope.type().equals(scopeTypes[i])) {
                match = false;
                break;
            }
            currentScope = currentScope.childScope();
        }
        if (match && currentScope == null) {
            return scope;
        }
    }
    throw new InvalidPreferenceScopeException("The passed scope types are invalid.");
}
Also used : InvalidPreferenceScopeException(org.uberfire.preferences.shared.impl.exception.InvalidPreferenceScopeException) PreferenceScope(org.uberfire.preferences.shared.PreferenceScope)

Aggregations

PreferenceScope (org.uberfire.preferences.shared.PreferenceScope)1 InvalidPreferenceScopeException (org.uberfire.preferences.shared.impl.exception.InvalidPreferenceScopeException)1