1 package org
.argeo
.security
.ui
.editors
;
3 import org
.apache
.commons
.logging
.Log
;
4 import org
.apache
.commons
.logging
.LogFactory
;
5 import org
.argeo
.ArgeoException
;
6 import org
.argeo
.security
.ArgeoSecurityService
;
7 import org
.argeo
.security
.ArgeoUser
;
8 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
9 import org
.eclipse
.ui
.IEditorInput
;
10 import org
.eclipse
.ui
.IEditorSite
;
11 import org
.eclipse
.ui
.PartInitException
;
12 import org
.eclipse
.ui
.forms
.editor
.FormEditor
;
14 /** Editor for an Argeo user. */
15 public class ArgeoUserEditor
extends FormEditor
{
16 private final static Log log
= LogFactory
.getLog(ArgeoUserEditor
.class);
18 public final static String ID
= "org.argeo.security.ui.argeoUserEditor";
20 private ArgeoUser user
;
21 private ArgeoSecurityService securityService
;
23 public void init(IEditorSite site
, IEditorInput input
)
24 throws PartInitException
{
25 super.init(site
, input
);
26 String username
= ((ArgeoUserEditorInput
) getEditorInput())
28 user
= securityService
.getSecurityDao().getUser(username
);
29 this.setPartProperty("name", username
);
30 setPartName(username
);
33 protected void addPages() {
35 addPage(new DefaultUserMainPage(this, securityService
, user
));
37 } catch (PartInitException e
) {
38 throw new ArgeoException("Not able to add page ", e
);
43 public void doSave(IProgressMonitor monitor
) {
44 if (log
.isDebugEnabled())
45 log
.debug("doSave called");
46 // for (int i = 0; i < getPageCount(); i++) {
47 // IEditorPart editor = getEditor(i);
48 // if (editor != null)
49 // editor.doSave(monitor);
51 findPage(DefaultUserMainPage
.ID
).doSave(monitor
);
53 securityService
.updateUser(user
);
54 firePropertyChange(PROP_DIRTY
);
58 public void doSaveAs() {
62 public boolean isSaveAsAllowed() {
66 public void setSecurityService(ArgeoSecurityService securityService
) {
67 this.securityService
= securityService
;