Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Inactivity timeout Login screen
Inactivity timeout Login screen [message #1722760] Mon, 08 February 2016 21:32 Go to next message
Michael Dedina is currently offline Michael DedinaFriend
Messages: 6
Registered: January 2016
Junior Member
Our RCP 3.8 application currently presents a login dialog at startup. But we have a user requirement to add an inactivity timeout. When the timeout occurs, we need to obscure the workbench completely and present the login dialog again.

Any suggestions on how to approach this? The timeout doesn't seem difficult, but how to obscure the application? Perhaps programmatically switch to a perspective that contains just a single view?

Michael
Re: Inactivity timeout Login screen [message #1722764 is a reply to message #1722760] Mon, 08 February 2016 22:36 Go to previous messageGo to next message
Jim Klo is currently offline Jim KloFriend
Messages: 49
Registered: September 2012
Member
Michael Dedina wrote on Mon, 08 February 2016 16:32
Our RCP 3.8 application currently presents a login dialog at startup. But we have a user requirement to add an inactivity timeout. When the timeout occurs, we need to obscure the workbench completely and present the login dialog again.

Any suggestions on how to approach this? The timeout doesn't seem difficult, but how to obscure the application? Perhaps programmatically switch to a perspective that contains just a single view?

Michael


Does it matter if you set some flag and restart the workbench and use a custom org.eclipse.ui.splashHandler extension point? I have a similar "EULA Agreement" license check that works as a custom splashHandler. If you set a timeout to just save all work and restart the workbench the splashHandler could prompt for login and automatically prevent access to the workbench.

I'm not sure that there is an "easy" way to obscure the application in a pre-4.0 application, other than making a modal window that is the same size as the display. Even then with 4.0+ not all apps are built with FX where you could add some kind of global "blur" to the CSS. Maybe you can dynamically modify the theme... using SWT CSS - I've done this before but not sure if those kind of "advanced" CSS features would be supported.

[Updated on: Mon, 08 February 2016 22:41]

Report message to a moderator

Re: Inactivity timeout Login screen [message #1722850 is a reply to message #1722764] Tue, 09 February 2016 15:57 Go to previous messageGo to next message
Michael Dedina is currently offline Michael DedinaFriend
Messages: 6
Registered: January 2016
Junior Member
Thanks for the reply Jim. Restarting is a possibility, especially if I can get the splashHandler login to prevent the workbench from showing until the user has logged in. But we currently can't completely restore the state of the workbench, so it's not ideal.

I'm wondering if this would work: switch to a new perspective which just has a single "blank" view. Hide the perspective bar and all menus. Then put up the login dialog. I'm going to investigate this approach but if you know of any reason that this isn't possible please let me know and save me some frustration Smile
Re: Inactivity timeout Login screen [message #1724004 is a reply to message #1722760] Fri, 19 February 2016 16:35 Go to previous messageGo to next message
Michael Dedina is currently offline Michael DedinaFriend
Messages: 6
Registered: January 2016
Junior Member
The way I ended up doing this was simply to open a Shell as a child of the workbench shell, with the same size/position as the workbench shell, and then present a modal login dialog in front of that. The user cannot see the workbench until the dialog is dismissed. It works pretty well.
Re: Inactivity timeout Login screen [message #1752196 is a reply to message #1722760] Thu, 19 January 2017 17:56 Go to previous message
Michael Dedina is currently offline Michael DedinaFriend
Messages: 6
Registered: January 2016
Junior Member
In response to my statement that "the timeout doesn't seem difficult" I received an offline question about how to do it:

To display the lock screen when a activity timeout occurs, I added this code to our WorkbenchAdvisor:

	
	@Override
	public void eventLoopIdle(Display display) {

		if (SessionManager.getSessionManager().isActivityTimeOut()) {
			AccessControl.getAccessControl().timeoutScreen();
		}

		super.eventLoopIdle(display);
	}


To reset the timeout when activity occurs, I used a SWT Listener to detect mouse and keyboard events:

	Listener uiListener = new Listener() {
		public void handleEvent (Event event) {
			sessionManager.resetActivityTimeOut();
		}
	};

	Display display = PlatformUI.createDisplay();
	display.addFilter(SWT.KeyUp, uiListener);
	display.addFilter(SWT.MouseUp, uiListener);
	display.addFilter(SWT.Activate, uiListener);


Here are the relevant methods from our class called SessionManager:

	private long timeStampLastMs;
	private long timeOutTimeMs = CMD_TIME_OUT_MS;

	public synchronized boolean isActivityTimeOut() {

		boolean timeout = false;
		if (accessControl) {
		
			long now = System.currentTimeMillis();
	
			if (timeOutTimeMs < (now - timeStampLastMs)) {
				timeout = true;
			}
		}
		
		return timeout;
	}
	public synchronized void resetActivityTimeOut() {
		timeStampLastMs =  System.currentTimeMillis();
	}

Previous Topic:How to add the Project Explorer view to an Eclipse RCP application
Next Topic:Preferences - Properties in non UI plugin and UI plugin
Goto Forum:
  


Current Time: Fri Apr 26 10:20:00 GMT 2024

Powered by FUDForum. Page generated in 0.03128 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top