Set custom CloseOperationHandler to a MultiView TopComponent

Paco Barrera <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <CAFS-qL=2ZB+WFiqEc22OwuvP1KOU3D=beXK_cHsuAJGQap+psg@mail.gmail.com>
Hi all,

I need to check some status of an object before closing a TopComponent that
has 3 MultiViewElements.

If I implement this check in the canCloseElement() of a MVE, I get the
standard  Dialog with 3 options buttons (Save, Discard, Cancel) for the
case of MultiViewFactory.createUnsafeCloseState is needed.
In other case I return the CloseOperationState.STATE_OK that any dialog is
showed.

If I want to handle my custom dialog, the option is to create my
implementation of CloseOperationHandler.

To do this is I need to create the MultiViewDescription for each MVE, and
then use the MultiViewFactory.createMultiView(dsc, dsc[0],
myCloseOpHandler) to create the TopComponent, but for this case, I cannot
pass the context to the MVEs.

For the other hand, if I create the TopComponent with
MultiViews.createMultiView(mime-type, context) I cannot set the custom
CloseOperationHandler.

How can achieve this feature?

Thanks in advance.


<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Libre
de virus. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.