Bug 201545 - Workbench restart is not implemented
Summary: Workbench restart is not implemented
Status: ASSIGNED
Alias: None
Product: RAP
Classification: RT
Component: Workbench (show other bugs)
Version: 1.0   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: Future   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 432649 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-08-29 05:48 EDT by Benedikt Arnold CLA
Modified: 2014-04-12 04:40 EDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benedikt Arnold CLA 2007-08-29 05:48:56 EDT
Steps To Reproduce:
IWorkbench.restart closes the workbench but does not open a new workbench window. After closing only the gradient html background is shown.

More information:
RAP 1.0 CVS
Comment 1 Ivan Furnadjiev CLA 2008-05-21 01:03:20 EDT
public class TestRestartWorkbench extends ViewPart {

  public void createPartControl( Composite parent ) {    
    Button btn = new Button( parent, SWT.NONE );
    btn.setText( "Restart Workbench" );
    btn.addSelectionListener( new SelectionListener() {

      public void widgetSelected( SelectionEvent e ) {
        PlatformUI.getWorkbench().restart();
      };

      public void widgetDefaultSelected( SelectionEvent e ) {
      };
    } );    
  }
}
Comment 2 Frank Gerhardt CLA 2008-07-12 19:37:59 EDT
I need to support the use case where the user logs in using a dialog, opens the workbench, logs out & closes the workbench. Then he can can login again with the login dialog. 

The idea has been posted by Frank Appel:

display creation
while( !exit )
  loginShell
  createWorkbench

If the restart, or workbench.close + createAndRunWorkbench is not supported, is there a workaround?
Comment 3 Cristian Malinescu CLA 2008-11-03 17:09:07 EST
We have the same problem. We need to restart the workbench and it doesn't work:
/*
 * WorkbenchUtils.java
 */
...
public static IWorkbench getWorkbench() {
  return PlatformUI.getWorkbench();
}

public static Display getDisplay() {
  Display display;

  display = getWorkbench().getDisplay();

  if ( null == display )
    display = Display.getCurrent();

  if ( null == display )
     display = Display.getDefault();

  return display;
}  

public static restart() {
  getDisplay().asyncExec(new Runnable() {
    public void run() {
      getWorkbench().restart();
    }
  });
} 
...
Comment 4 Thomas Haskes CLA 2009-07-29 08:00:09 EDT
One could create a browser widget that redirects to the entrypoint url after the workbench is closed. But using that solution would be nice if it was possible to find out the url of the entryPoint that is currently used (including) port, so that one has not to hardcode the link to the browserwidget. Is there a way to find out the currently used url?
Comment 5 Ivan Furnadjiev CLA 2014-04-12 03:41:52 EDT
*** Bug 432649 has been marked as a duplicate of this bug. ***
Comment 6 Barys Dubauski CLA 2014-04-12 03:50:19 EDT
Are there any plans to fix this? It has been over 7 years since it was open. Did RAP users find a workaround or just gave up on it?
Comment 7 Ivan Furnadjiev CLA 2014-04-12 04:04:59 EDT
It's currently not in our plans. The workaround is to trigger page reload with JavaScriptExecutor - see [1]

[1] http://www.eclipse.org/forums/index.php/mv/msg/29465/1259896/#msg_1259896
Comment 8 Barys Dubauski CLA 2014-04-12 04:14:46 EDT
(In reply to Ivan Furnadjiev from comment #7)
> It's currently not in our plans. The workaround is to trigger page reload
> with JavaScriptExecutor - see [1]
> 
> [1] http://www.eclipse.org/forums/index.php/mv/msg/29465/1259896/#msg_1259896

Unfortunately, the workaround is of no help for us at all. I just posted reply to on the forums but will duplicate it here:

This workaround only stops current UISession and creates a new one within the same JVM process. It doesn't help if one is trying to have Eclipse workbench restarted in order to have a new VM process allocated upon restart. In our case we need the server (Eclipse with embedded Jetty) to be truly restarted and the lack of Workbench.restart() implementation is blocking us from doing that.
Comment 9 Ivan Furnadjiev CLA 2014-04-12 04:20:20 EDT
(In reply to Barys Dubauski from comment #8)
> Unfortunately, the workaround is of no help for us at all. I just posted
> reply to on the forums but will duplicate it here:
> 
> This workaround only stops current UISession and creates a new one within
> the same JVM process. It doesn't help if one is trying to have Eclipse
> workbench restarted in order to have a new VM process allocated upon
> restart. In our case we need the server (Eclipse with embedded Jetty) to be
> truly restarted and the lack of Workbench.restart() implementation is
> blocking us from doing that.

As I explained in the newsgroup, Workbench restart *can't* be implemented in a way to restart the servlet container (VM process). It's not a responsibility of a single web application to restart the servlet container. What will happen with other web applications in the same servlet container than!?
Comment 10 Barys Dubauski CLA 2014-04-12 04:32:03 EDT
(In reply to Ivan Furnadjiev from comment #9)
> (In reply to Barys Dubauski from comment #8)
> > Unfortunately, the workaround is of no help for us at all. I just posted
> > reply to on the forums but will duplicate it here:
> > 
> > This workaround only stops current UISession and creates a new one within
> > the same JVM process. It doesn't help if one is trying to have Eclipse
> > workbench restarted in order to have a new VM process allocated upon
> > restart. In our case we need the server (Eclipse with embedded Jetty) to be
> > truly restarted and the lack of Workbench.restart() implementation is
> > blocking us from doing that.
> 
> As I explained in the newsgroup, Workbench restart *can't* be implemented in
> a way to restart the servlet container (VM process). It's not a
> responsibility of a single web application to restart the servlet container.
> What will happen with other web applications in the same servlet container
> than!?
:
 Perhaps, I'm missing something so please forgive my ignorance here. But since RAP substitutes Eclipse's Workbench implementation with RAP version, that doesn't leave any choices for doing the servlet container restart by any means (not just from within a web application). In our specific case there aren't any other web applications in our setup to worry about. We relied on RAP to perform the port of our SWT RCP application to web (hence there aren't any other applications in the picture).

 If the Workbench.restart() implementation was functional but was disabled in the org.eclipse.rap.ui.workbench bundle based on this considerations wouldn't be a better choice to leave it there but update the javadoc with a warning to exercise caution when invoking it when there are multiple web applications running?
Comment 11 Ivan Furnadjiev CLA 2014-04-12 04:40:34 EDT
(In reply to Barys Dubauski from comment #10)
>  If the Workbench.restart() implementation was functional but was disabled
> in the org.eclipse.rap.ui.workbench bundle based on this considerations
> wouldn't be a better choice to leave it there but update the javadoc with a
> warning to exercise caution when invoking it when there are multiple web
> applications running?

Do you think it's possible to restart multiple (how many???) servlet containers like Tomcat, JBoss, WebLogic and others with a single implementation? I doubt. And once again, I don't think that the correct Workbench#restart implementation includes servlet container restart.