]> git.argeo.org Git - gpl/argeo-slc.git/blob - legacy/argeo-commons/org.argeo.cms.ui.workbench/src/org/argeo/cms/ui/workbench/internal/useradmin/commands/SaveArgeoUser.java
Prepare next development cacle
[gpl/argeo-slc.git] / legacy / argeo-commons / org.argeo.cms.ui.workbench / src / org / argeo / cms / ui / workbench / internal / useradmin / commands / SaveArgeoUser.java
1 package org.argeo.cms.ui.workbench.internal.useradmin.commands;
2
3 import org.argeo.cms.ui.workbench.WorkbenchUiPlugin;
4 import org.eclipse.core.commands.AbstractHandler;
5 import org.eclipse.core.commands.ExecutionEvent;
6 import org.eclipse.core.commands.ExecutionException;
7 import org.eclipse.jface.dialogs.MessageDialog;
8 import org.eclipse.swt.widgets.Display;
9 import org.eclipse.ui.IEditorPart;
10 import org.eclipse.ui.IWorkbenchPart;
11 import org.eclipse.ui.handlers.HandlerUtil;
12
13 /** Save the currently edited Argeo user. */
14 public class SaveArgeoUser extends AbstractHandler {
15 public final static String ID = WorkbenchUiPlugin.PLUGIN_ID
16 + ".saveArgeoUser";
17
18 public Object execute(ExecutionEvent event) throws ExecutionException {
19 try {
20 IWorkbenchPart iwp = HandlerUtil.getActiveWorkbenchWindow(event)
21 .getActivePage().getActivePart();
22 if (!(iwp instanceof IEditorPart))
23 return null;
24 IEditorPart editor = (IEditorPart) iwp;
25 editor.doSave(null);
26 } catch (Exception e) {
27 MessageDialog.openError(Display.getDefault().getActiveShell(),
28 "Error", "Cannot save user: " + e.getMessage());
29 }
30 return null;
31 }
32 }