use of com.intellij.openapi.diff.DiffNavigationContext in project intellij-community by JetBrains.
the class MigrateToNewDiffUtil method convertRequestFair.
@Nullable
private static DiffRequest convertRequestFair(@NotNull com.intellij.openapi.diff.DiffRequest oldRequest) {
if (oldRequest.getOnOkRunnable() != null)
return null;
//if (oldRequest.getBottomComponent() != null) return null; // TODO: we need EDT to make this check. Let's ignore bottom component.
// TODO: migrate layers
com.intellij.openapi.diff.DiffContent[] contents = oldRequest.getContents();
String[] titles = oldRequest.getContentTitles();
List<DiffContent> newContents = new ArrayList<>(contents.length);
for (int i = 0; i < contents.length; i++) {
DiffContent convertedContent = convertContent(oldRequest.getProject(), contents[i]);
if (convertedContent == null)
return null;
newContents.add(convertedContent);
}
SimpleDiffRequest newRequest = new SimpleDiffRequest(oldRequest.getWindowTitle(), newContents, Arrays.asList(titles));
DiffNavigationContext navigationContext = (DiffNavigationContext) oldRequest.getGenericData().get(DiffTool.SCROLL_TO_LINE.getName());
if (navigationContext != null) {
newRequest.putUserData(DiffUserDataKeysEx.NAVIGATION_CONTEXT, navigationContext);
}
return newRequest;
}
Aggregations