3
votes

My question is: I want to find the name of currently opened dialog(being displayed on top of all views) and finally reload it. Can anyone guide me for this ?

1
Thank you Baz for the comment. Indeed, I used the code org.eclipse.swt.widgets.Display.getCurrent().getActiveShell().getText() and equivalently org.eclipse.ui.PlatformUI.getWorkbench().getDisplay().getActiveShell().getText() too. But both of these codes produced same output i.e. the name of dialog. - yayayokoho3
never mind! Baz. You are always welcome to do so.Thank you. - yayayokoho3

1 Answers

3
votes

If the dialog is focused, you can access its Shell via:

Shell active = Display.getCurrent().getActiveShell();
String title = active.getText();

If you are using Eclipse RCP, you can do the same by using:

Shell active = PlatformUI.getWorkbench().getDisplay().getActiveShell();
String title = active.getText();