]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - security/plugins/org.argeo.security.ui.admin/src/main/java/org/argeo/security/ui/admin/editors/ArgeoUserEditorInput.java
1 package org
.argeo
.security
.ui
.admin
.editors
;
4 import javax
.jcr
.PathNotFoundException
;
5 import javax
.jcr
.RepositoryException
;
6 import javax
.jcr
.ValueFormatException
;
8 import org
.argeo
.ArgeoException
;
9 import org
.argeo
.jcr
.ArgeoNames
;
10 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
11 import org
.eclipse
.ui
.IEditorInput
;
12 import org
.eclipse
.ui
.IPersistableElement
;
14 /** Editor input for an Argeo user. */
15 public class ArgeoUserEditorInput
implements IEditorInput
{
16 private final String username
;
17 private final Node userHome
;
20 public ArgeoUserEditorInput(String username
) {
21 this.username
= username
;
25 public ArgeoUserEditorInput(Node userHome
) {
27 this.username
= userHome
.getProperty(ArgeoNames
.ARGEO_USER_ID
)
29 this.userHome
= userHome
;
30 } catch (RepositoryException e
) {
31 throw new ArgeoException("Cannot initialize editor input for "
36 public Object
getAdapter(@SuppressWarnings("rawtypes") Class adapter
) {
40 public boolean exists() {
41 return username
!= null;
44 public ImageDescriptor
getImageDescriptor() {
48 public String
getName() {
49 return username
!= null ? username
: "<new user>";
52 public IPersistableElement
getPersistable() {
56 public String
getToolTipText() {
57 return username
!= null ? username
: "<new user>";
60 public boolean equals(Object obj
) {
61 if (!(obj
instanceof ArgeoUserEditorInput
))
63 if (((ArgeoUserEditorInput
) obj
).getUsername() == null)
65 return ((ArgeoUserEditorInput
) obj
).getUsername().equals(username
);
68 public String
getUsername() {
72 public Node
getUserHome() {