Written by Rena Li, Western University Student
Western University is an Academic member of Open Mainframe Project, which offered a winter mentorship to students. Three students joined the Zowe Mentorship led by Uladzislau Kalesnikau. These students share their experience and key learnings in the blogs.
As part of a continued effort to improve Zowe Explorer for IntelliJ IDEA, I contributed two features that significantly improve how users work with mainframe files: a new “Compare with…” action for file comparison, and an enhanced conflict resolution workflow that introduces a “Compare And Decide” option. These features provide more visibility, control, and efficiency for developers working with datasets, PDS members, and USS files.
The Problem
Prior to these enhancements, Zowe Explorer for IntelliJ IDEA lacked a native way to compare two mainframe files. Users had no built-in method for determining differences between datasets or resolving remote conflicts visually within the IDE. This made it difficult to track changes or verify sync conflicts, particularly in environments where mainframe resources don’t follow traditional file structures.
Additionally, when a remote conflict occurred (i.e., the content of a file differed locally and remotely), users were limited to choosing between overwriting the mainframe or accepting the remote version — without the ability to view and assess the differences side-by-side.
Feature #1: Implementing “Compare with…” in Zowe Explorer
To address the need for intuitive file comparison, I implemented a new “Compare with…” functionality in Zowe Explorer for IntelliJ IDEA. This action allows users to right-click any compatible mainframe file and compare it with others—streamlining workflows for debugging and change tracking.
How it Works
When a user right-clicks a mainframe file and selects “Compare with…”, the plugin smartly gathers candidate files by:
1. Collecting candidate files from two main sources:
-
- Files from other selected nodes in the explorer view
- Currently open files in the editor 2
2. Filtering files for compatibility:
- Excluding the source file
- Removing directories
- Only allowing mainframe virtual files (MFVirtualFile instances)
Determining Compatibility
I implemented a type-checking function to ensure comparisons only occur between matching file types:
This ensures logical comparisons like:
- Dataset ↔ Dataset
- PDS Member ↔ PDS Member
- USS File ↔ USS File
Smart History Tracking
To improve efficiency, I built a comparison history system using:
- In-memory caching for the current session
- Persistent storage via PropertiesComponent for history across sessions
The result was a quicker, smarter file selection popup that remembers your frequent comparisons.
Friendly Display
To make things clear for users, file entries appear in recognizable formats:
- DATASET
- DATASET(MEMBER)
- /full/path/to/ussfile
The goal was clarity at a glance, with no need to guess what you’re clicking.
Implementation Overview
To bring this to life, I made changes across the codebase:
- New Action Class: CompareWithAction.kt handles action logic and diff display
- plugin.xml Registration: Integrated the new action into context menus with compatibility constraints
- File Selection Popup: Showed sorted, compatible files based on recent usage
- Comparison Logic: Ensured only compatible files can be compared
- Diff Viewer Integration: Leveraged IntelliJ’s built-in diff viewer for a native experience
- Error Handling: User-friendly messages and smart defaults when no compatible files are found
Feature #2: Compare & Resolve Remote Conflicts
In real-world usage, file conflicts between local and remote versions are inevitable. Previously, users could only choose between overwriting content on the mainframe (keep local changes) and accepting the remote version (discard local changes).
I improved the user experience by adding a new “Compare And Decide” button in the Remote Conflicts dialog, which opens a side-by-side diff viewer showing both versions of the file.
How it Works
To resolve this, I updated the conflict resolution dialog within SaveStrategy.kt to present a new default option: Compare And Decide.
When this button is selected, the system:
- Retrieves the local version of the file directly from the filesystem.
- Uses the ContentSynchronizer to get the remote version.
- Opens a side-by-side diff viewer using IntelliJ’s built-in diff tool.
Here’s the relevant snippet from SaveStrategy.kt:
This block ensures that the comparison is only shown if both local and remote content are available. Otherwise, it fails gracefully with an appropriate error message.
The Diff Viewer
The actual comparison is performed using IntelliJ’s built-in diff viewer, which provides a familiar interface for most users. I wrote a helper function showFileComparison to handle this:
This function constructs a diff view with:
- Side-by-side layout
- Clear labels for local and remote content
- Highlighted differences for easy scanning
Default Behavior + Compatibility
After viewing the diff, if the user closes the window without choosing to accept the remote version, the system assumes they want to keep local changes — maintaining consistency with the previous overwrite behavior.
All changes were carefully scoped to SaveStrategy.kt to preserve compatibility with existing logic and minimize disruptions.
Open Mainframe Project is currently accepting applications for the 2025 Summer Mentorship. Applications are due by May 9. Learn more here or watch mentee presentations on the Mentorship playlist here.
Keep up to date with Open Mainframe Project:
- Connect with our LinkedIn page
- Subscribe to our Youtube Channel
- Bookmark our Flickr channel
- Follow us on X at @Openmfproject
- Sign up to get our quarterly newsletter