Any way to find wheter a dialog is visible

Is there any way to find a dialog is visible from shell

Is there any way to find a dialog is visible from shell

@Panneerselvam-D I do not believe the application-shell can track the visibility of dialogs in the framework.
You might be able to achieve the use-case by querying the dom if the dialog is currently displayed.

The DialogOverlayService from @theia/core is keeping track of the current dialog. Although the currentDialog property is protected. Maybe it can be useful for your use case.

Thank you @Hanksha @vince-fugnitto
I will try it out

it used for adding dialogs only, I can’t get any data about dialogs

@Panneerselvam-D I’m not sure if that’s your use case but I tested it like this:

@inject("Factory<MyCustomDialog>")
private readonly myCustomDialogFactory: () => MyCustomDialog;    

@inject(DialogOverlayService)
private readonly dialogOverlayService: DialogOverlayService;

registerCommands(commands: CommandRegistry): void {
    commands.registerCommand(MyCustomCommand, {
        execute: () => this.myCustomDialogFactory().open(),
        isEnabled: () => {
            const currentDialog = (this.dialogOverlayService as any).currentDialog;
            return !(currentDialog instanceof MyCustomDialog);
        }
    });
}

This for example will prefer from executing the MyCustomCommand is the current dialog is still MyCustomDialog. But like I’ve said the “currentDialog” property is protected so it’s internal API.