]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Small UI improvements and documentation
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 31 Oct 2012 14:20:49 +0000 (14:20 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 31 Oct 2012 14:20:49 +0000 (14:20 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@5683 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/DistributionPerspective.java
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/RunInOsgi.java
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/views/DistributionsView.java

index 5b185a89aeb50639751cd427ce852f660663f1ff..954f54e6d1368b7c1865c95c02d7def8a202529e 100644 (file)
  */
 package org.argeo.slc.client.ui.dist;
 
-import org.argeo.slc.client.ui.dist.views.ArtifactsBrowser;
 import org.argeo.slc.client.ui.dist.views.DistributionsView;
-import org.argeo.slc.client.ui.dist.views.QueryArtifactsForm;
-import org.argeo.slc.client.ui.dist.views.QueryArtifactsText;
-import org.argeo.slc.client.ui.dist.views.QueryBundlesForm;
 import org.eclipse.ui.IFolderLayout;
 import org.eclipse.ui.IPageLayout;
 import org.eclipse.ui.IPerspectiveFactory;
@@ -36,10 +32,10 @@ public class DistributionPerspective implements IPerspectiveFactory {
                IFolderLayout main = layout.createFolder("main", IPageLayout.LEFT,
                                0.5f, editorArea);
                main.addView(DistributionsView.ID);
-               main.addView(ArtifactsBrowser.ID);
-               main.addView(QueryArtifactsForm.ID);
-               main.addView(QueryBundlesForm.ID);
-               main.addView(QueryArtifactsText.ID);
+//             main.addView(ArtifactsBrowser.ID);
+//             main.addView(QueryArtifactsForm.ID);
+//             main.addView(QueryBundlesForm.ID);
+//             main.addView(QueryArtifactsText.ID);
                main.addView("org.eclipse.ui.views.ProgressView");
        }
 }
index f274b4b13227500f999fc6fff8fc37e73ea0acad..f89a9b0443bd5934fd4aa81e34e4fed55a35a7a0 100644 (file)
@@ -48,6 +48,7 @@ import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 
+/** <b>UNDER DEVELOPMENT</b>. Download and prepare an OSGi runtime*/
 public class RunInOsgi extends AbstractHandler implements SlcNames {
        private final static Log log = LogFactory.getLog(RunInOsgi.class);
 
index acb50335028f4f70f81ed5dc8d7a6962045b44b2..25e67382a7c264f27f3bd6069c864d2d7f1053ac 100644 (file)
@@ -374,10 +374,15 @@ public class DistributionsView extends ViewPart implements SlcNames, ArgeoNames
                                String[] workspaceNames = session.getWorkspace()
                                                .getAccessibleWorkspaceNames();
                                List<DistributionElem> distributionElems = new ArrayList<DistributionElem>();
-                               for (String workspace : workspaceNames)
-                                       distributionElems.add(new DistributionElem(this, workspace,
-                                                       credentials));
-                               // FIXME remove deleted workspaces
+                               for (String workspaceName : workspaceNames) {
+                                       Node workspaceNode = repoNode.hasNode(workspaceName) ? repoNode
+                                                       .getNode(workspaceName) : repoNode
+                                                       .addNode(workspaceName);
+                                       repoNode.getSession().save();
+                                       distributionElems.add(new DistributionElem(this,
+                                                       workspaceNode));
+                                       // FIXME remove deleted workspaces
+                               }
                                return distributionElems.toArray();
                        } catch (RepositoryException e) {
                                throw new SlcException(
@@ -406,32 +411,22 @@ public class DistributionsView extends ViewPart implements SlcNames, ArgeoNames
                        connect();
                        return repository;
                }
+
+               public Credentials getCredentials() {
+                       return credentials;
+               }
+
        }
 
        /** Abstracts a distribution, that is a workspace */
        private static class DistributionElem extends TreeParent {
                private final RepoElem repoElem;
                private final Node workspaceNode;
-               private final String workspaceName;
-               private final Credentials credentials;
 
-               public DistributionElem(RepoElem repoElem, String workspaceName,
-                               Credentials credentials) {
-                       super(workspaceName);
+               public DistributionElem(RepoElem repoElem, Node workspaceNode) {
+                       super(JcrUtils.getNameQuietly(workspaceNode));
                        this.repoElem = repoElem;
-                       try {
-                               // TODO move it to repo elem
-                               this.workspaceNode = repoElem.getRepoNode().hasNode(
-                                               workspaceName) ? repoElem.getRepoNode().getNode(
-                                               workspaceName) : repoElem.getRepoNode().addNode(
-                                               workspaceName);
-                               repoElem.getRepoNode().getSession().save();
-                       } catch (RepositoryException e) {
-                               throw new SlcException("Cannot get or add workspace node "
-                                               + workspaceName, e);
-                       }
-                       this.workspaceName = workspaceName;
-                       this.credentials = credentials;
+                       this.workspaceNode = workspaceNode;
                }
 
                public Node getWorkspaceNode() {
@@ -439,7 +434,7 @@ public class DistributionsView extends ViewPart implements SlcNames, ArgeoNames
                }
 
                public String getWorkspaceName() {
-                       return workspaceName;
+                       return JcrUtils.getNameQuietly(workspaceNode);
                }
 
                public String getWorkspacePath() {
@@ -447,7 +442,7 @@ public class DistributionsView extends ViewPart implements SlcNames, ArgeoNames
                                return workspaceNode.getPath();
                        } catch (RepositoryException e) {
                                throw new SlcException("Cannot get or add workspace path "
-                                               + workspaceName, e);
+                                               + getWorkspaceName(), e);
                        }
                }
 
@@ -456,7 +451,7 @@ public class DistributionsView extends ViewPart implements SlcNames, ArgeoNames
                                return workspaceNode.getParent().getPath();
                        } catch (RepositoryException e) {
                                throw new SlcException("Cannot get or add workspace path "
-                                               + workspaceName, e);
+                                               + getWorkspaceName(), e);
                        }
                }
 
@@ -465,7 +460,7 @@ public class DistributionsView extends ViewPart implements SlcNames, ArgeoNames
                }
 
                public Credentials getCredentials() {
-                       return credentials;
+                       return repoElem.getCredentials();
                }
        }
 
@@ -593,8 +588,8 @@ public class DistributionsView extends ViewPart implements SlcNames, ArgeoNames
                                // QueryResult result = countQuery.execute();
                                // Long expectedCount = result.getNodes().getSize();
 
-                                Long expectedCount = JcrUtils.countFiles(sourceSession
-                                .getRootNode());
+                               Long expectedCount = JcrUtils.countFiles(sourceSession
+                                               .getRootNode());
                                if (log.isDebugEnabled())
                                        log.debug("Will copy " + expectedCount + " files...");