Hello. I’m new here. I do realize the task I’m trying to solve is not a simple one, but I do have quite a lot of experience developing things, so hopefully there is a chance of success.
I was asked to create a plugin capable of loading (any) other plugin installed on a computer and displaying that other plugin’s editor. I have been able to make it almost work, but there is an issue: the other plugin’s editor only displays once. Let me explain what I mean.
After user selects the other plugin to work with, they click “Open editor” button. At that moment my plugin asks the other plugin for its editor (calling createEditorIfNeeded() method) and stores the returned pointer. It then creates a DocumentWindow instance and uses the stored pointer as a parameter to a setContentNonOwned(X, true) method of the new window – X stands for the pointer. The window opens and contains the other plugin’s editor.
But if the user closes this DocumentWindow and clicks the “Open editor” button again, they get a new window, which is black, the editor is not displayed. Clicking the “Open editor” button calls the same code, the only difference is that the code recognizes it already has the editor, so it doesn’t ask for it and uses the stored value. I did some checks and am pretty sure that
– the same pointer is used as when the editor was successfully displayed, it has not been reset to nullptr
– since I created both the plugin instance and the editor instance “manually”, I expect host has no means to interfere with the editor instance
– the editor instance thinks it is both visible and showing in both cases, though the user can actually see it only in the first one
(I am asking the other plugin for its editor only once, because otherwise I wasn’t able to make it not crash upon opening the editor repeatedly.)
Any ideas what I could be doing wrong (apart from accepting the task in the first place;-)? Or how is it even possible for a component to think it is displayed while it acutally isn’t (I tried repaint() as well as setVisible(false) and then setVisible(true), with the same results)? Thanks a lot and have a good time.