0

Instead of closing my Eclipse RCP application when clicking on the close button [X] I'd like the application to be minimized. In the ExitAddon I've tried this:

@Override
public boolean close(MWindow window) {
  window.getTags().add(IPresentationEngine.MINIMIZED);
  return false;
}

But it doesn't do the trick.

Is that possible to do and how?

greg-449
  • 109,219
  • 232
  • 102
  • 145
Zibus69
  • 1
  • 2

2 Answers2

0

I assume by 'ExitAddon' you mean something implementing IWindowCloseHandler.

Setting the shell to minimized directly seems to work:

@Override
public boolean close(final MWindow window)
{
  IEclipseContext context = window.getContext();

  Shell shell = (Shell)context.get(IServiceConstants.ACTIVE_SHELL);

  shell.setMinimized(true);

  return false;
}
greg-449
  • 109,219
  • 232
  • 102
  • 145
0

With javaFX the solution was:

@Override
public boolean close(MWindow window) {
        IEclipseContext context = window.getContext();
        Stage stage = (Stage)context.get(IServiceConstants.ACTIVE_SHELL);
        stage.setIconified(true);

      return false;
    }
Zibus69
  • 1
  • 2