X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=security%2Fplugins%2Forg.argeo.security.ui.rap%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fsecurity%2Fui%2Frap%2FRapActionBarAdvisor.java;h=074b798c7ee42179a36fc68e9e0a7eb1b806d812;hb=3a3d316af102ba410d1d9e6de349d0c8f7ac044f;hp=68176dad2940ffb4057f807760ee730079a4d195;hpb=041234a54c1b98bcba16e359c4c4905c4eed1768;p=lgpl%2Fargeo-commons.git diff --git a/security/plugins/org.argeo.security.ui.rap/src/main/java/org/argeo/security/ui/rap/RapActionBarAdvisor.java b/security/plugins/org.argeo.security.ui.rap/src/main/java/org/argeo/security/ui/rap/RapActionBarAdvisor.java index 68176dad2..074b798c7 100644 --- a/security/plugins/org.argeo.security.ui.rap/src/main/java/org/argeo/security/ui/rap/RapActionBarAdvisor.java +++ b/security/plugins/org.argeo.security.ui.rap/src/main/java/org/argeo/security/ui/rap/RapActionBarAdvisor.java @@ -1,6 +1,21 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.argeo.security.ui.rap; -import org.argeo.security.ui.rap.commands.UserMenu; +import org.argeo.security.ui.commands.OpenHomePerspective; import org.eclipse.core.commands.Category; import org.eclipse.core.commands.Command; import org.eclipse.jface.action.ICoolBarManager; @@ -9,6 +24,8 @@ import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.ToolBarManager; import org.eclipse.swt.SWT; import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; import org.eclipse.ui.application.ActionBarAdvisor; import org.eclipse.ui.application.IActionBarConfigurer; import org.eclipse.ui.commands.ICommandService; @@ -22,13 +39,14 @@ public class RapActionBarAdvisor extends ActionBarAdvisor { /** Null means anonymous */ private String username = null; -// private IAction logoutAction; -// private IWorkbenchAction openPerspectiveDialogAction; -// private IWorkbenchAction showViewMenuAction; -// private IWorkbenchAction preferences; -// private IWorkbenchAction saveAction; -// private IWorkbenchAction saveAllAction; -// private IWorkbenchAction closeAllAction; + // private IAction logoutAction; + // private IWorkbenchAction openPerspectiveDialogAction; + // private IWorkbenchAction showViewMenuAction; + // private IWorkbenchAction preferences; + private IWorkbenchAction saveAction; + private IWorkbenchAction saveAllAction; + + // private IWorkbenchAction closeAllAction; public RapActionBarAdvisor(IActionBarConfigurer configurer, String username) { super(configurer); @@ -36,57 +54,58 @@ public class RapActionBarAdvisor extends ActionBarAdvisor { } protected void makeActions(IWorkbenchWindow window) { -// preferences = ActionFactory.PREFERENCES.create(window); -// register(preferences); -// openPerspectiveDialogAction = ActionFactory.OPEN_PERSPECTIVE_DIALOG -// .create(window); -// register(openPerspectiveDialogAction); -// showViewMenuAction = ActionFactory.SHOW_VIEW_MENU.create(window); -// register(showViewMenuAction); -// -// // logout -// logoutAction = ActionFactory.QUIT.create(window); -// // logoutAction = createLogoutAction(); -// register(logoutAction); -// -// // Save semantics -// saveAction = ActionFactory.SAVE.create(window); -// register(saveAction); -// saveAllAction = ActionFactory.SAVE_ALL.create(window); -// register(saveAllAction); -// closeAllAction = ActionFactory.CLOSE_ALL.create(window); -// register(closeAllAction); + // preferences = ActionFactory.PREFERENCES.create(window); + // register(preferences); + // openPerspectiveDialogAction = ActionFactory.OPEN_PERSPECTIVE_DIALOG + // .create(window); + // register(openPerspectiveDialogAction); + // showViewMenuAction = ActionFactory.SHOW_VIEW_MENU.create(window); + // register(showViewMenuAction); + // + // // logout + // logoutAction = ActionFactory.QUIT.create(window); + // // logoutAction = createLogoutAction(); + // register(logoutAction); + // + // Save semantics + saveAction = ActionFactory.SAVE.create(window); + register(saveAction); + saveAllAction = ActionFactory.SAVE_ALL.create(window); + register(saveAllAction); + // closeAllAction = ActionFactory.CLOSE_ALL.create(window); + // register(closeAllAction); } protected void fillMenuBar(IMenuManager menuBar) { -// MenuManager fileMenu = new MenuManager("&File", -// IWorkbenchActionConstants.M_FILE); -// MenuManager editMenu = new MenuManager("&Edit", -// IWorkbenchActionConstants.M_EDIT); -// MenuManager windowMenu = new MenuManager("&Window", -// IWorkbenchActionConstants.M_WINDOW); -// -// menuBar.add(fileMenu); -// menuBar.add(editMenu); -// menuBar.add(windowMenu); -// // Add a group marker indicating where action set menus will appear. -// menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); -// -// // File -// fileMenu.add(saveAction); -// fileMenu.add(saveAllAction); -// fileMenu.add(closeAllAction); -// fileMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); -// fileMenu.add(new Separator()); -// fileMenu.add(logoutAction); -// -// // Edit -// editMenu.add(preferences); -// -// // Window -// windowMenu.add(openPerspectiveDialogAction); -// windowMenu.add(showViewMenuAction); + // MenuManager fileMenu = new MenuManager("&File", + // IWorkbenchActionConstants.M_FILE); + // MenuManager editMenu = new MenuManager("&Edit", + // IWorkbenchActionConstants.M_EDIT); + // MenuManager windowMenu = new MenuManager("&Window", + // IWorkbenchActionConstants.M_WINDOW); + // + // menuBar.add(fileMenu); + // menuBar.add(editMenu); + // menuBar.add(windowMenu); + // // Add a group marker indicating where action set menus will appear. + // menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + // + // // File + // fileMenu.add(saveAction); + // fileMenu.add(saveAllAction); + // fileMenu.add(closeAllAction); + // fileMenu.add(new + // GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + // fileMenu.add(new Separator()); + // fileMenu.add(logoutAction); + // + // // Edit + // editMenu.add(preferences); + // + // // Window + // windowMenu.add(openPerspectiveDialogAction); + // windowMenu.add(showViewMenuAction); } @Override @@ -104,14 +123,14 @@ public class RapActionBarAdvisor extends ActionBarAdvisor { if (userMenu.isDefined()) userMenu.undefine(); userMenu.define(username, "User menu actions", userMenus); - userMenu.setHandler(new UserMenu()); + userMenu.setHandler(new OpenHomePerspective()); // userToolbar.add(new UserMenuAction()); // coolBar.add(userToolbar); } else {// anonymous IToolBarManager userToolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT); - //userToolbar.add(logoutAction); + // userToolbar.add(logoutAction); coolBar.add(userToolbar); } // IToolBarManager saveToolbar = new ToolBarManager(SWT.FLAT |