-/*
- * 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.cms.e4.users;
-import static org.argeo.cms.util.UserAdminUtils.getProperty;
+import static org.argeo.cms.auth.UserAdminUtils.getProperty;
import static org.argeo.naming.LdapAttrs.cn;
import static org.argeo.naming.LdapAttrs.givenName;
import static org.argeo.naming.LdapAttrs.mail;
import javax.inject.Inject;
-import org.argeo.cms.ArgeoNames;
+import org.argeo.api.NodeConstants;
import org.argeo.cms.auth.CurrentUser;
+import org.argeo.cms.auth.UserAdminUtils;
import org.argeo.cms.e4.users.providers.CommonNameLP;
import org.argeo.cms.e4.users.providers.DomainNameLP;
import org.argeo.cms.e4.users.providers.RoleIconLP;
import org.argeo.cms.e4.users.providers.UserFilter;
+import org.argeo.cms.swt.CmsSwtUtils;
import org.argeo.cms.ui.eclipse.forms.AbstractFormPart;
//import org.argeo.cms.ui.eclipse.forms.FormToolkit;
import org.argeo.cms.ui.eclipse.forms.IManagedForm;
-import org.argeo.cms.util.CmsUtils;
-import org.argeo.cms.util.UserAdminUtils;
import org.argeo.eclipse.ui.ColumnDefinition;
import org.argeo.eclipse.ui.EclipseUiUtils;
import org.argeo.eclipse.ui.parts.LdifUsersTable;
import org.argeo.naming.LdapAttrs;
-import org.argeo.node.NodeConstants;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.osgi.service.useradmin.UserAdminEvent;
/** Display/edit the properties of a given user */
-public class UserEditor extends AbstractRoleEditor implements ArgeoNames {
+public class UserEditor extends AbstractRoleEditor {
// final static String ID = "UserEditor.mainPage";
@Inject
@Override
protected void createUi(Composite body) {
-// Composite body = new Composite(parent, SWT.BORDER);
+ // Composite body = new Composite(parent, SWT.BORDER);
GridLayout mainLayout = new GridLayout();
// mainLayout.marginRight = 10;
body.setLayout(mainLayout);
-// body.getParent().setLayout(new GridLayout());
-// body.setLayoutData(CmsUtils.fillAll());
+ // body.getParent().setLayout(new GridLayout());
+ // body.setLayoutData(CmsUiUtils.fillAll());
User user = getDisplayedUser();
appendOverviewPart(body, user);
// Remove to ability to force the password for his own user. The user
// GridData gd = EclipseUiUtils.fillWidth();
// // gd.verticalAlignment = PRE_TITLE_INDENT;
// section.setLayoutData(gd);
- Composite body = new Composite(parent, SWT.BORDER);
+ Composite body = new Composite(parent, SWT.NONE);
body.setLayoutData(EclipseUiUtils.fillWidth());
// section.setClient(body);
// body.setLayout(new GridLayout(6, false));
// Section section = addSection(tk, parent, "Roles");
// Composite body = (Composite) section.getClient();
// Composite body= parent;
- Composite body = new Composite(parent, SWT.NONE);
- body.setLayout(EclipseUiUtils.noSpaceGridLayout());
- body.setLayoutData(CmsUtils.fillAll());
+ Composite body = new Composite(parent, SWT.BORDER);
+ body.setLayout(new GridLayout());
+ body.setLayoutData(CmsSwtUtils.fillAll());
// boolean isAdmin = CurrentUser.isInRole(NodeConstants.ROLE_ADMIN);
};
getManagedForm().addPart(part);
// addRemoveAbitily(body, userViewer, user);
+ // userViewerCmp.refresh();
+ String tooltip = "Remove " + UserAdminUtils.getUserLocalId(user.getName()) + " from the below selected groups";
+ Action action = new RemoveMembershipAction(userViewer, user, tooltip, SecurityAdminImages.ICON_REMOVE_DESC);
+ ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
+ ToolBar toolBar = toolBarManager.createControl(body);
+ toolBar.setLayoutData(CmsSwtUtils.fillWidth());
+ toolBarManager.add(action);
+ toolBarManager.update(true);
return userViewerCmp;
}
}
}
- private void addRemoveAbitily(Composite parent, TableViewer userViewer, User user) {
- // Section section = sectionPart.getSection();
- ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
- ToolBar toolbar = toolBarManager.createControl(parent);
- final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
- toolbar.setCursor(handCursor);
- toolbar.addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 3882131405820522925L;
-
- public void widgetDisposed(DisposeEvent e) {
- if ((handCursor != null) && (handCursor.isDisposed() == false)) {
- handCursor.dispose();
- }
- }
- });
-
- String tooltip = "Remove " + UserAdminUtils.getUserLocalId(user.getName()) + " from the below selected groups";
- Action action = new RemoveMembershipAction(userViewer, user, tooltip, SecurityAdminImages.ICON_REMOVE_DESC);
- toolBarManager.add(action);
- toolBarManager.update(true);
- // section.setTextClient(toolbar);
- }
+ // private void addRemoveAbility(Composite parent, TableViewer userViewer, User
+ // user) {
+ // // Section section = sectionPart.getSection();
+ // ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
+ // ToolBar toolbar = toolBarManager.createControl(parent);
+ // final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
+ // toolbar.setCursor(handCursor);
+ // toolbar.addDisposeListener(new DisposeListener() {
+ // private static final long serialVersionUID = 3882131405820522925L;
+ //
+ // public void widgetDisposed(DisposeEvent e) {
+ // if ((handCursor != null) && (handCursor.isDisposed() == false)) {
+ // handCursor.dispose();
+ // }
+ // }
+ // });
+ //
+ // String tooltip = "Remove " + UserAdminUtils.getUserLocalId(user.getName()) +
+ // " from the below selected groups";
+ // Action action = new RemoveMembershipAction(userViewer, user, tooltip,
+ // SecurityAdminImages.ICON_REMOVE_DESC);
+ // toolBarManager.add(action);
+ // toolBarManager.update(true);
+ // // section.setTextClient(toolbar);
+ // }
private class RemoveMembershipAction extends Action {
private static final long serialVersionUID = -1337713097184522588L;