1 package org
.argeo
.cms
.ui
.workbench
.rap
.commands
;
3 import org
.argeo
.cms
.ui
.workbench
.UserHomePerspective
;
4 import org
.argeo
.cms
.ui
.workbench
.util
.CommandUtils
;
5 import org
.argeo
.eclipse
.ui
.dialogs
.ErrorFeedback
;
6 import org
.eclipse
.core
.commands
.AbstractHandler
;
7 import org
.eclipse
.core
.commands
.ExecutionEvent
;
8 import org
.eclipse
.core
.commands
.ExecutionException
;
9 import org
.eclipse
.ui
.WorkbenchException
;
10 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
12 /** Default action of the user menu */
13 public class OpenHome
extends AbstractHandler
{
14 private final static String PROP_OPEN_HOME_CMD_ID
= "org.argeo.ui.openHomeCommandId";
16 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
18 String defaultCmdId
= System
.getProperty(PROP_OPEN_HOME_CMD_ID
, "");
19 if (!"".equals(defaultCmdId
.trim()))
20 CommandUtils
.callCommand(defaultCmdId
);
23 String defaultPerspective
= HandlerUtil
.getActiveWorkbenchWindow(event
).getWorkbench()
24 .getPerspectiveRegistry().getDefaultPerspective();
25 HandlerUtil
.getActiveSite(event
).getWorkbenchWindow()
26 .openPage(defaultPerspective
!= null ? defaultPerspective
: UserHomePerspective
.ID
, null);
27 } catch (WorkbenchException e
) {
28 ErrorFeedback
.show("Cannot open home perspective", e
);