]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/Fetch.java
Clean, update comments
[gpl/argeo-slc.git] / plugins / org.argeo.slc.client.ui.dist / src / main / java / org / argeo / slc / client / ui / dist / commands / Fetch.java
index 819e30d26d6443a7ba058b593318ed2e2e279746..b6537d832fc83679ae99a4894b7d8ebb8cbb911e 100644 (file)
@@ -17,17 +17,23 @@ import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.ui.handlers.HandlerUtil;
 
-/** Wraps a {@link RepoSync} as an Eclipse command. */
+/**
+ * Wrap a {@link RepoSync} as an Eclipse command. Open a wizard that enable
+ * definition of the fetch process parameters
+ */
 public class Fetch extends AbstractHandler {
        // private final static Log log = LogFactory.getLog(Fetch.class);
 
        public final static String ID = DistPlugin.ID + ".fetch";
-       public final static String PARAM_TARGET_REPO = "targetRepoPath";
        public final static String DEFAULT_LABEL = "Fetch...";
-       public final static String DEFAULT_ICON_PATH = "icons/fetchRepo.png";
+       public final static ImageDescriptor DEFAULT_ICON = DistPlugin
+                       .getImageDescriptor("icons/fetchRepo.png");
+
+       public final static String PARAM_TARGET_REPO_PATH = "targetRepoPath";
 
        // DEPENDENCY INJECTION
        private Keyring keyring;
@@ -35,10 +41,11 @@ public class Fetch extends AbstractHandler {
        private Repository nodeRepository;
 
        public Object execute(ExecutionEvent event) throws ExecutionException {
+
                Session currSession = null;
                try {
                        // Target Repository
-                       String targetRepoPath = event.getParameter(PARAM_TARGET_REPO);
+                       String targetRepoPath = event.getParameter(PARAM_TARGET_REPO_PATH);
                        currSession = nodeRepository.login();
                        Node targetRepoNode = currSession.getNode(targetRepoPath);
 
@@ -53,7 +60,7 @@ public class Fetch extends AbstractHandler {
                                CommandHelpers.callCommand(RefreshDistributionsView.ID);
                        return null;
                } catch (RepositoryException e) {
-                       throw new SlcException("Unexpected error while fetching data", e);
+                       throw new SlcException("Unable te retrieve repo node from path", e);
                } finally {
                        JcrUtils.logoutQuietly(currSession);
                }