Skip to content

Utility API for putting string on clipboard#3826

Open
georgweiss wants to merge 1 commit into
masterfrom
clipboard_api
Open

Utility API for putting string on clipboard#3826
georgweiss wants to merge 1 commit into
masterfrom
clipboard_api

Conversation

@georgweiss

Copy link
Copy Markdown
Collaborator

Follow up on #3821:

API to put a string on the system clipboard, e.g. from (embedded) script. For the sake of simplicity, no types besides java.lang.String are supported.

  • Testing:

    • The feature has automated tests
    • Tests were run
    • If not, explain how you tested your changes
  • Documentation:

    • The feature is documented
    • The documentation is up to date
    • Release notes:
      • Added an entry if the change is breaking or significant
      • Added an entry when adding a new feature

@georgweiss georgweiss requested a review from kasemir June 9, 2026 12:10
@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

@kasemir

kasemir commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

This adds a direct dependency from the ScriptUtil to javafx (Platform, ...).

Originally, we had a separation of display-model, display-runtime, display-representation.
The representation was designed as base classes/interfaces with two specializations: representation-swt and representation-jfx. The runtime or model had no idea about SWT, JavaFX, or whatever graphics lib we'll use in the future. You can still see evidence of that in ScriptUtil.showMessageDialog, which redirects to the abstract ToolkitRepresentation.getToolkit -> showMessageDialog:

    public static void showMessageDialog(final Widget widget, final String message)
    {
        try
        {
            ToolkitRepresentation.getToolkit(widget.getDisplayModel()).showMessageDialog(widget, message);

The toolkit-specific implementation is then in representation-jfx and representation-swt:

https://github.com/kasemir/org.csstudio.display.builder/blob/2a0ba03576cb76b1b6346ca35791354384fa75e9/org.csstudio.display.builder.representation.javafx/src/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java#L810
https://github.com/kasemir/org.csstudio.display.builder/blob/2a0ba03576cb76b1b6346ca35791354384fa75e9/org.csstudio.display.builder.representation.swt/src/org/csstudio/display/builder/representation/swt/SWTRepresentation.java#L135

Regrettably, I think we've burned enough bridges by now to sustain this approach. The display editor is tied at the hip to JFX, might as well directly call JFX from anywhere and then completely start over when JFX needs to be replaced.

@kasemir kasemir left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

See comment on import javafx.... dependencies unlikely worth fixing at this point in time.

@georgweiss

Copy link
Copy Markdown
Collaborator Author

Sure, I could add a method in ToolkitRepresentation...

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.

2 participants