Skip to content

Added file drag-n-drop for opening them - #3731

Draft
RobertoRoos wants to merge 2 commits into
ControlSystemStudio:masterfrom
RobertoRoos:feature/file-drag-drop
Draft

RobertoRoos wants to merge 2 commits into
ControlSystemStudio:masterfrom
RobertoRoos:feature/file-drag-drop

Conversation

@RobertoRoos

Copy link
Copy Markdown

Added feature to allow drag-and-drop of files to open them.

Resolves #3730

Checklist

  • 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

@RobertoRoos

Copy link
Copy Markdown
Author

I am completely new to Java and Phoebus, so I just started somewhere. The current version is extremely rough.

Comment thread core/ui/src/main/java/org/phoebus/ui/application/PhoebusApplication.java Outdated
toolbar = createToolbar();
createTopResourcesMenu();

menuBar.setOnDragOver(e -> {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

What would be a good location to put this event method? Because the event-handler should be shared, as I would like it to be called from other panels too.

@RobertoRoos RobertoRoos changed the title First coarse version of a file drag-n-drop Added file drag-n-drop for opening them Mar 9, 2026
@RobertoRoos

RobertoRoos commented Mar 9, 2026 •

Copy link
Copy Markdown
Author

Question: to which objects should we add an event listener for these two spaces:
imageimage

I think they might be the best candidates for opening files.

EDIT: Oh, looks like it's DockPane. Pushing a new commit.

@sonarqubecloud

sonarqubecloud Bot commented Mar 9, 2026

Copy link
Copy Markdown

@georgweiss

Copy link
Copy Markdown
Collaborator

@RobertoRoos, could you please resolve merge conflicts as advertised by Github?

@RobertoRoos
RobertoRoos force-pushed the feature/file-drag-drop branch from 41c0f64 to 21c82e6 Compare October 23, 2026 09:17
@RobertoRoos

RobertoRoos commented Oct 23, 2026 •

Copy link
Copy Markdown
Author

@RobertoRoos, could you please resolve merge conflicts as advertised by Github?

I couldn't get the merge done, as I don't understand the codebase.

But I just started from scratch, copying some changes. I backed-up the original branch here: https://github.com/RobertoRoos/phoebus/tree/archive/feature/file-drag-drop-before-rebase

  • Got the menu drop working, looking at dropping on top of a dock-item now

Comment on lines +783 to +786
if (event.getDragboard().hasContent(DockItem.DOCK_ITEM))
result = handleDropDockItem(event);
// else if (event.getDragboard().hasFiles())
// result = handleDropFile(event);

@RobertoRoos RobertoRoos Oct 23, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@georgweiss this would override the option of dragging a .bob file into an editor to embed it. How could I prioritize the embedding behavior over opening the file?

EDIT: I see this 'embed' d-n-d is done from WidgetTransfer.addDropSupport(), not from a DockPane subclass or something, that's a little tricky.
Can we find from this whether the dock contains an editor?

@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

[Feature] Drag and drop files from explorer into Phoebus to open them

3 participants