Skip to content

Conversation

@danialahmad-ucl
Copy link
Contributor

Description

This PR closes #136 by adding a Paste button to the Java Input pane.

The Paste button allows users to quickly paste and overwrite the Java source input from clipboard without having to manually click into the text editor, select all, and paste. This improves the user experience when quickly testing different Java code snippets.

Changes Made

Backend Changes

  • ITextClipboard.cs: Added GetTextAsync() method to read text from clipboard
  • TextClipboard.cs: Implemented GetTextAsync() method that retrieves clipboard content
  • MainWindowViewModel.cs: Added PasteInput command that:
    • Reads text from clipboard
    • Overwrites the Java source input with clipboard content
    • Shows a confirmation message: "Pasted Java code from clipboard!"

UI Changes

  • MainWindow.axaml: Added Paste button in the Java Input pane
    • Positioned in the same row as File Path textbox and Open File button
    • Uses Font Awesome paste icon (fa-paste)
    • Includes proper tooltip ("Paste from Clipboard") and accessibility properties
    • Grid layout updated from 3 columns to 4 columns to accommodate the new button

UI Layout

The Paste button is now positioned in the file controls row.

Usage

  1. Copy Java code to the clipboard
  2. Click the Paste button in the Java Input pane
  3. The Java source input is replaced with the clipboard content
  4. A confirmation message appears briefly at the bottom

Screenshots/Demo

Before - No Paste button:

image

After - With Paste button:

Java Input pane with Paste button

Demo:
Paste functionality in action

Related Issues

Closes #136

@danialahmad-ucl danialahmad-ucl changed the title Issue/136 Add Paste button to Java Input pane (#136) Nov 18, 2025
@paulirwin paulirwin requested a review from Copilot December 9, 2025 03:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a Paste button to the Java Input pane, allowing users to quickly paste Java code from the clipboard without manually selecting and pasting in the text editor. This improves the user experience when testing different code snippets.

  • Added GetTextAsync() method to the ITextClipboard interface and its implementation
  • Implemented PasteInput command in MainWindowViewModel with clipboard reading and user feedback
  • Added Paste button to the UI with proper accessibility attributes and FontAwesome icon

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
JavaToCSharpGui/Infrastructure/ITextClipboard.cs Added GetTextAsync() method to clipboard interface for reading clipboard text
JavaToCSharpGui/Infrastructure/TextClipboard.cs Implemented GetTextAsync() to retrieve clipboard content with null check
JavaToCSharpGui/ViewModels/MainWindowViewModel.cs Added PasteInput command to handle paste functionality with user feedback message
JavaToCSharpGui/Views/MainWindow.axaml Added Paste button to Java Input pane with proper grid layout, tooltip, and accessibility properties

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Owner

@paulirwin paulirwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@paulirwin paulirwin merged commit ef6865d into paulirwin:master Dec 9, 2025
2 checks passed
paulirwin added a commit to Lancelotbronner/java2csharp that referenced this pull request Dec 11, 2025
* GUI: Add Paste button to Java Input pane, paulirwin#136

* GUI: Fix Paste button positioning in file controls row, paulirwin#136

* Update JavaToCSharpGui/Infrastructure/TextClipboard.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Danial Ahmad <108906119+iamdanialahmad@users.noreply.github.com>
Co-authored-by: Paul Irwin <paulirwin@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Paste button to Java Input pane

3 participants