3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.operations
;
13 import org
.eclipse
.core
.commands
.ExecutionException
;
14 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
15 import org
.eclipse
.core
.runtime
.IAdaptable
;
16 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
17 import org
.eclipse
.core
.runtime
.IStatus
;
19 import eu
.etaxonomy
.cdm
.api
.conversation
.IConversationEnabled
;
20 import eu
.etaxonomy
.cdm
.model
.common
.User
;
21 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
24 * <p>ToggleUserEnablementOperation class.</p>
30 public class ToggleUserEnablementOperation
extends AbstractPersistentPostOperation
{
35 * <p>Constructor for ToggleUserEnablementOperation.</p>
37 * @param label a {@link java.lang.String} object.
38 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
39 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operations.IPostOperationEnabled} object.
40 * @param user a {@link eu.etaxonomy.cdm.model.common.User} object.
41 * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
43 public ToggleUserEnablementOperation(String label
, IUndoContext undoContext
,
44 User user
, IPostOperationEnabled postOperationEnabled
, IConversationEnabled conversationEnabled
) {
45 super(label
, undoContext
, postOperationEnabled
, conversationEnabled
);
50 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
54 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
55 throws ExecutionException
{
60 user
.setEnabled(! user
.isEnabled());
62 CdmStore
.getUserService().saveOrUpdate(user
);
65 return postExecute(null);
69 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
73 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
74 throws ExecutionException
{
75 return execute(monitor
, info
);
79 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
83 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
84 throws ExecutionException
{
86 CdmStore
.getUserService().createUser(user
);
87 return postExecute(null);