Search in sources :

Example 1 with DiffViewerWrapper

use of com.intellij.diff.impl.DiffViewerWrapper in project intellij-community by JetBrains.

the class ChangeDiffRequestProducer method loadCurrentContents.

@NotNull
protected DiffRequest loadCurrentContents(@NotNull UserDataHolder context, @NotNull ProgressIndicator indicator) throws DiffRequestProducerException {
    DiffRequestProducerException wrapperException = null;
    DiffRequestProducerException requestException = null;
    DiffViewerWrapper wrapper = null;
    try {
        for (ChangeDiffViewerWrapperProvider provider : ChangeDiffViewerWrapperProvider.EP_NAME.getExtensions()) {
            if (provider.canCreate(myProject, myChange)) {
                wrapper = provider.process(this, context, indicator);
                break;
            }
        }
    } catch (DiffRequestProducerException e) {
        wrapperException = e;
    }
    DiffRequest request = null;
    try {
        for (ChangeDiffRequestProvider provider : ChangeDiffRequestProvider.EP_NAME.getExtensions()) {
            if (provider.canCreate(myProject, myChange)) {
                request = provider.process(this, context, indicator);
                break;
            }
        }
        if (request == null)
            request = createRequest(myProject, myChange, context, indicator);
    } catch (DiffRequestProducerException e) {
        requestException = e;
    }
    if (requestException != null && wrapperException != null) {
        String message = requestException.getMessage() + "\n\n" + wrapperException.getMessage();
        throw new DiffRequestProducerException(message);
    }
    if (requestException != null) {
        request = new ErrorDiffRequest(getRequestTitle(myChange), requestException);
        LOG.info("Request: " + requestException.getMessage());
    }
    if (wrapperException != null) {
        LOG.info("Wrapper: " + wrapperException.getMessage());
    }
    request.putUserData(CHANGE_KEY, myChange);
    request.putUserData(DiffViewerWrapper.KEY, wrapper);
    for (Map.Entry<Key, Object> entry : myChangeContext.entrySet()) {
        request.putUserData(entry.getKey(), entry.getValue());
    }
    DiffUtil.putDataKey(request, VcsDataKeys.CURRENT_CHANGE, myChange);
    return request;
}
Also used : DiffRequestProducerException(com.intellij.diff.chains.DiffRequestProducerException) ErrorDiffRequest(com.intellij.diff.requests.ErrorDiffRequest) DiffViewerWrapper(com.intellij.diff.impl.DiffViewerWrapper) ErrorDiffRequest(com.intellij.diff.requests.ErrorDiffRequest) DiffRequest(com.intellij.diff.requests.DiffRequest) SimpleDiffRequest(com.intellij.diff.requests.SimpleDiffRequest) Map(java.util.Map) Key(com.intellij.openapi.util.Key) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

DiffRequestProducerException (com.intellij.diff.chains.DiffRequestProducerException)1 DiffViewerWrapper (com.intellij.diff.impl.DiffViewerWrapper)1 DiffRequest (com.intellij.diff.requests.DiffRequest)1 ErrorDiffRequest (com.intellij.diff.requests.ErrorDiffRequest)1 SimpleDiffRequest (com.intellij.diff.requests.SimpleDiffRequest)1 Key (com.intellij.openapi.util.Key)1 Map (java.util.Map)1 NotNull (org.jetbrains.annotations.NotNull)1