1 package org
.argeo
.slc
.client
.ui
.dist
.commands
;
4 import javax
.jcr
.Property
;
5 import javax
.jcr
.Repository
;
6 import javax
.jcr
.RepositoryException
;
7 import javax
.jcr
.Session
;
9 import org
.argeo
.cms
.ArgeoTypes
;
10 import org
.argeo
.cms
.ui
.workbench
.util
.CommandUtils
;
11 import org
.argeo
.jcr
.JcrUtils
;
12 import org
.argeo
.slc
.SlcException
;
13 import org
.argeo
.slc
.client
.ui
.dist
.DistPlugin
;
14 import org
.eclipse
.core
.commands
.AbstractHandler
;
15 import org
.eclipse
.core
.commands
.ExecutionEvent
;
16 import org
.eclipse
.core
.commands
.ExecutionException
;
17 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
18 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
21 * Un-register a remote repository by deleting the corresponding RepoNode from
22 * the node Repository. It does not affect the repository instance
24 public class UnregisterRemoteRepo
extends AbstractHandler
{
25 // private static final Log log = LogFactory
26 // .getLog(UnregisterRemoteRepo.class);
28 public final static String ID
= DistPlugin
.PLUGIN_ID
+ ".unregisterRemoteRepo";
29 public final static String DEFAULT_LABEL
= "Unregister";
30 public final static ImageDescriptor DEFAULT_ICON
= DistPlugin
31 .getImageDescriptor("icons/removeItem.gif");
33 public final static String PARAM_REPO_PATH
= DistPlugin
.PLUGIN_ID
37 private Repository nodeRepository
;
39 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
40 Session session
= null;
41 String repoPath
= event
.getParameter(PARAM_REPO_PATH
);
46 session
= nodeRepository
.login();
47 Node rNode
= session
.getNode(repoPath
);
48 if (rNode
.isNodeType(ArgeoTypes
.ARGEO_REMOTE_REPOSITORY
)) {
50 String alias
= rNode
.getProperty(Property
.JCR_TITLE
)
52 String msg
= "Your are about to unregister remote repository: "
53 + alias
+ "\n" + "Are you sure you want to proceed ?";
55 boolean result
= MessageDialog
.openConfirm(DistPlugin
56 .getDefault().getWorkbench().getDisplay()
57 .getActiveShell(), "Confirm Delete", msg
);
63 CommandUtils
.callCommand(RefreshDistributionsView
.ID
);
65 } catch (RepositoryException e
) {
66 throw new SlcException(
67 "Unexpected error while unregistering remote repository.",
70 JcrUtils
.logoutQuietly(session
);
76 public void setNodeRepository(Repository nodeRepository
) {
77 this.nodeRepository
= nodeRepository
;