Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Re: Associate Title Bar Close Button [X] to my IHandler
Re: Associate Title Bar Close Button [X] to my IHandler [message #479141] Sun, 09 August 2009 18:44 Go to next message
Vuk  is currently offline Vuk Friend
Messages: 5
Registered: July 2009
Junior Member
Thanks for the reply Christian.
I do have a follow up question for you.


I can see in WorkbenchWindowAdvisor that I can override
preWindowShellClose(). Here I have added a logging event and returned
false, which essentially disables the [X] close button (I did this just
for testing). I attempted the following in the overrided method:


ExitHandler myeh = new ExitHandler();
myeh.execute(event);

However I do not have an event to pass.

-----------------------------------------------

My ExitHandler is:


public class ExitHandler extends AbstractHandler implements IHandler {

private static final Logger LOG =
Logger.getLogger("dtv.xts.rcp.handler.ExitHandler");

public Object execute(ExecutionEvent event) throws ExecutionException {
LOG.log(TracerLevel.GUI, "[Closing Workbench...]");
HandlerUtil.getActiveWorkbenchWindow(event).close();
return null;
}
}


------------------------------------------------


I think I'm approaching this the wrong way. Any other insights from the
community?
Re: Associate Title Bar Close Button [X] to my IHandler [message #479233 is a reply to message #479141] Mon, 10 August 2009 11:34 Go to previous message
Christian is currently offline ChristianFriend
Messages: 72
Registered: July 2009
Member
Vuk schrieb:
> Thanks for the reply Christian.
> I do have a follow up question for you.
>
>
> I can see in WorkbenchWindowAdvisor that I can override
> preWindowShellClose(). Here I have added a logging event and returned
> false, which essentially disables the [X] close button (I did this just
> for testing). I attempted the following in the overrided method:
>
>
> ExitHandler myeh = new ExitHandler();
> myeh.execute(event);
>
> However I do not have an event to pass.
>
> -----------------------------------------------
>
> My ExitHandler is:
>
>
> public class ExitHandler extends AbstractHandler implements IHandler {
>
> private static final Logger LOG =
> Logger.getLogger("dtv.xts.rcp.handler.ExitHandler");
>
> public Object execute(ExecutionEvent event) throws ExecutionException {
> LOG.log(TracerLevel.GUI, "[Closing Workbench...]");
> HandlerUtil.getActiveWorkbenchWindow(event).close();
> return null;
> }
> }
>
>
> ------------------------------------------------
>
>
> I think I'm approaching this the wrong way. Any other insights from the
> community?
>
>


I think best is to call that handler by the ID of the command that
handler is for
IHandlerService commandService = (IHandlerService) activeWorkbenchWindow
.getService(IHandlerService.class);
commandService.executeCommand(commandId, null);
Previous Topic:RCP Customization
Next Topic:Re: Building tables made easy: TableViewerBuilder
Goto Forum:
  


Current Time: Wed Feb 05 13:02:13 GMT 2025

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

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

Back to the top