Search in sources :

Example 1 with IDeepLinks

use of org.eclipse.scout.rt.client.deeplink.IDeepLinks in project scout.rt by eclipse.

the class AbstractDesktop method handleDeepLink.

/**
 * Checks whether the given path is a valid deep-link. If that is the case the deep-link is handled. When an error
 * occurs while handling the deep-link a {@link DeepLinkException} is thrown, usually this exception is thrown when
 * the business-logic failed to find the resource addressed by the deep-link (similar to the 404 HTTP error status).
 *
 * @param deepLinkPath
 * @return
 * @throws DeepLinkException
 *           when deep-link could not be executed
 */
protected boolean handleDeepLink(String deepLinkPath) throws DeepLinkException {
    if (hasApplicationModalElement()) {
        LOG.debug("Could not handle deep-link because modal element prevents changes on UI state. deepLinkPath={}", deepLinkPath);
        return false;
    }
    if (StringUtility.isNullOrEmpty(deepLinkPath)) {
        return false;
    }
    boolean handled = false;
    IDeepLinks deepLinks = BEANS.get(IDeepLinks.class);
    if (deepLinks.canHandleDeepLink(deepLinkPath)) {
        handled = deepLinks.handleDeepLink(deepLinkPath);
    } else {
        // non empty deepLinkPath provided but no handler found, throw exception to let user know
        throw new DeepLinkException("No deep-link handler found. deepLinkPath={" + deepLinkPath + " }");
    }
    return handled;
}
Also used : DeepLinkException(org.eclipse.scout.rt.client.deeplink.DeepLinkException) IDeepLinks(org.eclipse.scout.rt.client.deeplink.IDeepLinks)

Aggregations

DeepLinkException (org.eclipse.scout.rt.client.deeplink.DeepLinkException)1 IDeepLinks (org.eclipse.scout.rt.client.deeplink.IDeepLinks)1