0

I am building an application with E4 and SWT . For a button click, sometimes a new window(shell) is opened. The problem is when I open a new window, I am unable to use the other windows, in a sense, it's getting locked. Unless I close the latest window, cannot access the others. This makes debugging a little difficult. I am not sure if this is due to e4 model or SWT framework. Could you please tell me why this is and how to overcome this?

Thanks in advance.

christoph.keimel
  • 1,240
  • 10
  • 24
Lishus
  • 15
  • 7

2 Answers2

0

I have run into this issue before as I was creating a new window (MWindow) and adding it to a perpective (MPerspective). If this is what you are doing then you have two options:

  1. Add the new window to the application (MApplication) instead of the perspective

  2. Add the tag IPresentationEngine.WINDOW_TOP_LEVEL to the new window. (For more Information see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=441251)

Additional Information to (2): If you also want your window to be minimizable and to have an icon representation in the windows task bar you can use the following setting to configure the renderer

MWindow window = modelService.createModelElement(MTrimmedWindow.class);
window.getTags().add(IPresentationEngine.WINDOW_TOP_LEVEL);         
window.getPersistedState().put(IPresentationEngine.STYLE_OVERRIDE_KEY, "" + SWT.SHELL_TRIM);
christoph.keimel
  • 1,240
  • 10
  • 24
  • Hi ... I have created the main model , that is parts,for the UI using e4.xmiLike this - In the e4.xmi -> Windows -> TrimmedWindow-> Controls->PerspectiveStack->Perspective->Controls->PartSashContainer ->PartStack -> Part . This part has an associated class in which have a SWT shell and fill up the shell with different components. I have not used explicitly MWindow or MPerspective. – Lishus Mar 12 '15 at 09:09
  • Ok. In that case, your issue is probably unconnected to e4. You should add your comment to your question. Making your question clearer to others will increase your chance to get a good answer. Also, please show the code that includes the call to "new Shell(...)" etc. – christoph.keimel Mar 16 '15 at 10:37
  • Hi .. You were right. It was the shell creation which was wrong. Previously was creating shell using SWT.APPLICATION_MODAL, changed to SWT.PRIMARY_MODAL. Works fine now. Thanks for you help. – Lishus Mar 18 '15 at 07:43
0

I found what was wrong. The shell creation was wrong because I was using APPLICATION_MODAL bit:

shell = new Shell(Display.getCurrent(), SWT.TITLE | SWT.CLOSE | SWT.MAX | SWT.SHELL_TRIM | SWT.APPLICATION_MODAL | SWT.YES | SWT.NO);

It had to be PRIMARY_MODAL:

shell = new Shell(Display.getCurrent(), SWT.TITLE | SWT.CLOSE | SWT.MAX | SWT.SHELL_TRIM | SWT.PRIMARY_MODAL | SWT.YES | SWT.NO);

Thanks for all the help.

Lishus
  • 15
  • 7