DISABLE ADBLOCK

ADBlock is blocking some content on the site

ADBlock errore

Eclipse RCP, SWT, JFace: How to create a dialog that is modal only to a view (not the entire shell)?

StackOverflow https://stackoverflow.com/questions/800321

Question

Is there anyway to create a dialog that is modal to a view and not the entire shell (application)? So if say, I have one view called A that is overlaying another view called B, I want to open a dialog that is only modal to view A, so when I switch to view B, the dialog and the view A will be covered by view B. Is there anyway I can do this, even if it is not the normal practice to do?

Thanks!

Solution

I think it won't be so easy to implement. One possibility is that instead of using a modal dialog in View A, you use a TabFolder. Then, you can open the contents of the dialog in a new Tab instead and force this tab to stay on top until you dismiss it. This is a similar behavior to the one you need.

This will also allow you to drag and drop something from View B into View A.

OTHER TIPS

The whole idea of workbench restore is to put the workbench back into the state it was in before. It does not have to restore every little detail but if you don't want to leave the view blank then you should restore it to its original state. That means view B should be restored with the same input that it had when you closed the workbench. If view B and its input continue to exist after view A is closed then view B and its input can be restored, regardless of whether view A exists or not. You certainly should not be opening dialog boxes during workbench restore. That would not be good UI design. Eclipse provides a very easy to use memento framework that can save a view's input. Use it.

If you are not familiar with mementos, see for example http://wiki.eclipse.org/FAQ_How_does_a_view_persist_its_state_between_sessions%3F.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow