Refactor JCR explorer model
authorMathieu Baudier <mbaudier@argeo.org>
Mon, 10 Dec 2012 10:33:25 +0000 (10:33 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Mon, 10 Dec 2012 10:33:25 +0000 (10:33 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@5940 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

25 files changed:
server/plugins/org.argeo.jcr.ui.explorer/plugin.xml
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/browser/NodeContentProvider.java
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/browser/NodeLabelProvider.java
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/commands/AddFolderNode.java
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/commands/AddPrivileges.java
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/commands/CreateWorkspace.java
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/commands/DeleteNodes.java
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/commands/GetNodeSize.java
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/commands/ImportFileSystem.java
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/commands/RemoveRemoteRepository.java
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/MaintainedRepositoryElem.java [new file with mode: 0644]
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RemoteRepositoryElem.java [new file with mode: 0644]
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RemoteRepositoryNode.java [deleted file]
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RepositoriesElem.java [new file with mode: 0644]
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RepositoriesNode.java [deleted file]
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RepositoryElem.java [new file with mode: 0644]
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RepositoryNode.java [deleted file]
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/SingleJcrNode.java [deleted file]
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/SingleJcrNodeElem.java [new file with mode: 0644]
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/UiNode.java [deleted file]
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/WorkspaceElem.java [new file with mode: 0644]
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/WorkspaceNode.java [deleted file]
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/utils/GenericNodeDoubleClickListener.java
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/utils/JcrUiUtils.java
server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/views/GenericJcrBrowser.java

index 9428cbe9805fbec27ce8cec8975098ce7d285ce9..1df9981dcdb486dc90102c2a832aa287479986a9 100644 (file)
                                      <and>
                                         <or>
                                            <instanceof
-                                                 value="org.argeo.jcr.ui.explorer.model.SingleJcrNode">
+                                                 value="org.argeo.jcr.ui.explorer.model.SingleJcrNodeElem">
                                            </instanceof>
                                            <instanceof
-                                                 value="org.argeo.jcr.ui.explorer.model.WorkspaceNode">
+                                                 value="org.argeo.jcr.ui.explorer.model.WorkspaceElem">
                                            </instanceof>
                                         </or>
                                <with variable="activeMenuSelection"><count value="1"/></with>
                                      <and>
                                         <or>
                                            <instanceof
-                                                 value="org.argeo.jcr.ui.explorer.model.SingleJcrNode">
+                                                 value="org.argeo.jcr.ui.explorer.model.SingleJcrNodeElem">
                                            </instanceof>
                                            <instanceof
-                                                 value="org.argeo.jcr.ui.explorer.model.WorkspaceNode">
+                                                 value="org.argeo.jcr.ui.explorer.model.WorkspaceElem">
                                            </instanceof>
                                         </or>
                                <with variable="activeMenuSelection"><count value="1"/></with>
                              <and>
                                 <or>
                                    <instanceof
-                                         value="org.argeo.jcr.ui.explorer.model.RepositoryNode">
+                                         value="org.argeo.jcr.ui.explorer.model.RepositoryElem">
                                    </instanceof>
                                 </or>
                        <with variable="activeMenuSelection"><count value="1"/></with>
            <iterate>
               <or>
                  <instanceof
-                       value="org.argeo.jcr.ui.explorer.model.SingleJcrNode">
+                       value="org.argeo.jcr.ui.explorer.model.SingleJcrNodeElem">
                  </instanceof>
                  <instanceof
-                       value="org.argeo.jcr.ui.explorer.model.WorkspaceNode">
+                       value="org.argeo.jcr.ui.explorer.model.WorkspaceElem">
                  </instanceof>
               </or>
            </iterate>
               <and>
                  <or>
                     <instanceof
-                          value="org.argeo.jcr.ui.explorer.model.SingleJcrNode">
+                          value="org.argeo.jcr.ui.explorer.model.SingleJcrNodeElem">
                     </instanceof>
                     <instanceof
-                          value="org.argeo.jcr.ui.explorer.model.WorkspaceNode">
+                          value="org.argeo.jcr.ui.explorer.model.WorkspaceElem">
                     </instanceof>
                  </or>
                  <with variable="activeMenuSelection"><count value="1"/></with>
            <iterate> 
                                <or>
                        <instanceof
-                       value="org.argeo.jcr.ui.explorer.model.RepositoriesNode">
+                       value="org.argeo.jcr.ui.explorer.model.RepositoriesElem">
                                        </instanceof>
                                        <instanceof
-                                               value="org.argeo.jcr.ui.explorer.model.RepositoryNode">
+                                               value="org.argeo.jcr.ui.explorer.model.RepositoryElem">
                                        </instanceof>
                                </or> 
            </iterate>
            <iterate> 
                                <or>
                                        <instanceof
-                                               value="org.argeo.jcr.ui.explorer.model.RemoteRepositoryNode">
+                                               value="org.argeo.jcr.ui.explorer.model.RemoteRepositoryElem">
                                        </instanceof>
                                </or> 
            </iterate>
            <iterate>
               <or>
                  <instanceof
-                       value="org.argeo.jcr.ui.explorer.model.SingleJcrNode">
+                       value="org.argeo.jcr.ui.explorer.model.SingleJcrNodeElem">
                  </instanceof>
                  <instanceof
-                       value="org.argeo.jcr.ui.explorer.model.WorkspaceNode">
+                       value="org.argeo.jcr.ui.explorer.model.WorkspaceElem">
                  </instanceof>
               </or>
            </iterate>
index 3834865db12231f4e97257e6f7fe3374c3ca1834..c2de694dd8d5051f3b905ecd03f9475440cc72a6 100644 (file)
@@ -27,8 +27,8 @@ import org.argeo.eclipse.ui.TreeParent;
 import org.argeo.jcr.ArgeoJcrConstants;
 import org.argeo.jcr.RepositoryRegister;
 import org.argeo.jcr.UserJcrUtils;
-import org.argeo.jcr.ui.explorer.model.RepositoriesNode;
-import org.argeo.jcr.ui.explorer.model.SingleJcrNode;
+import org.argeo.jcr.ui.explorer.model.RepositoriesElem;
+import org.argeo.jcr.ui.explorer.model.SingleJcrNodeElem;
 import org.argeo.jcr.ui.explorer.utils.TreeObjectsComparator;
 import org.argeo.util.security.Keyring;
 import org.eclipse.jface.viewers.ITreeContentProvider;
@@ -51,8 +51,8 @@ public class NodeContentProvider implements ITreeContentProvider {
        final private boolean sortChildren;
 
        // reference for cleaning
-       private SingleJcrNode homeNode = null;
-       private RepositoriesNode repositoriesNode = null;
+       private SingleJcrNodeElem homeNode = null;
+       private RepositoriesElem repositoriesNode = null;
 
        // Utils
        private TreeObjectsComparator itemComparator = new TreeObjectsComparator();
@@ -77,14 +77,14 @@ public class NodeContentProvider implements ITreeContentProvider {
                                // TODO : find a way to dynamically get alias for the node
                                if (homeNode != null)
                                        homeNode.dispose();
-                               homeNode = new SingleJcrNode(null, userHome,
+                               homeNode = new SingleJcrNodeElem(null, userHome,
                                                userSession.getUserID(), ArgeoJcrConstants.ALIAS_NODE);
                        }
                }
                if (repositoryRegister != null) {
                        if (repositoriesNode != null)
                                repositoriesNode.dispose();
-                       repositoriesNode = new RepositoriesNode("Repositories",
+                       repositoriesNode = new RepositoriesElem("Repositories",
                                        repositoryRegister, repositoryFactory, null, userSession,
                                        keyring);
                }
@@ -132,8 +132,8 @@ public class NodeContentProvider implements ITreeContentProvider {
        }
 
        public boolean hasChildren(Object element) {
-               if (element instanceof RepositoriesNode) {
-                       RepositoryRegister rr = ((RepositoriesNode) element)
+               if (element instanceof RepositoriesElem) {
+                       RepositoryRegister rr = ((RepositoriesElem) element)
                                        .getRepositoryRegister();
                        return rr.getRepositories().size() > 0;
                } else if (element instanceof TreeParent) {
index 2a3dc4e9ef5ac19a6c140e884b39d4d1dd842e67..d6d593ce824421626325a8f70865e53e3d0761a9 100644 (file)
@@ -22,11 +22,11 @@ import javax.jcr.nodetype.NodeType;
 import org.argeo.ArgeoException;
 import org.argeo.eclipse.ui.jcr.DefaultNodeLabelProvider;
 import org.argeo.eclipse.ui.jcr.JcrImages;
-import org.argeo.jcr.ui.explorer.model.RemoteRepositoryNode;
-import org.argeo.jcr.ui.explorer.model.RepositoriesNode;
-import org.argeo.jcr.ui.explorer.model.RepositoryNode;
-import org.argeo.jcr.ui.explorer.model.SingleJcrNode;
-import org.argeo.jcr.ui.explorer.model.WorkspaceNode;
+import org.argeo.jcr.ui.explorer.model.RemoteRepositoryElem;
+import org.argeo.jcr.ui.explorer.model.RepositoriesElem;
+import org.argeo.jcr.ui.explorer.model.RepositoryElem;
+import org.argeo.jcr.ui.explorer.model.SingleJcrNodeElem;
+import org.argeo.jcr.ui.explorer.model.WorkspaceElem;
 import org.eclipse.swt.graphics.Image;
 
 public class NodeLabelProvider extends DefaultNodeLabelProvider {
@@ -34,8 +34,8 @@ public class NodeLabelProvider extends DefaultNodeLabelProvider {
 
        public String getText(Object element) {
                try {
-                       if (element instanceof SingleJcrNode) {
-                               SingleJcrNode sjn = (SingleJcrNode) element;
+                       if (element instanceof SingleJcrNodeElem) {
+                               SingleJcrNodeElem sjn = (SingleJcrNodeElem) element;
                                return getText(sjn.getNode());
                        } else
                                return super.getText(element);
@@ -57,26 +57,26 @@ public class NodeLabelProvider extends DefaultNodeLabelProvider {
 
        @Override
        public Image getImage(Object element) {
-               if (element instanceof RemoteRepositoryNode) {
-                       if (((RemoteRepositoryNode) element).isConnected())
+               if (element instanceof RemoteRepositoryElem) {
+                       if (((RemoteRepositoryElem) element).isConnected())
                                return JcrImages.REMOTE_CONNECTED;
                        else
                                return JcrImages.REMOTE_DISCONNECTED;
-               } else if (element instanceof RepositoryNode) {
-                       if (((RepositoryNode) element).isConnected())
+               } else if (element instanceof RepositoryElem) {
+                       if (((RepositoryElem) element).isConnected())
                                return JcrImages.REPOSITORY_CONNECTED;
                        else
                                return JcrImages.REPOSITORY_DISCONNECTED;
-               } else if (element instanceof WorkspaceNode) {
-                       if (((WorkspaceNode) element).isConnected())
+               } else if (element instanceof WorkspaceElem) {
+                       if (((WorkspaceElem) element).isConnected())
                                return JcrImages.WORKSPACE_CONNECTED;
                        else
                                return JcrImages.WORKSPACE_DISCONNECTED;
-               } else if (element instanceof RepositoriesNode) {
+               } else if (element instanceof RepositoriesElem) {
                        return JcrImages.REPOSITORIES;
-               } else if (element instanceof SingleJcrNode)
+               } else if (element instanceof SingleJcrNodeElem)
                        try {
-                               return super.getImage(((SingleJcrNode) element).getNode());
+                               return super.getImage(((SingleJcrNodeElem) element).getNode());
                        } catch (RepositoryException e) {
                                return null;
                        }
index d5e6a685cf192ed2147813959f6d7f4bc418d01f..0389aeec05f7e0ef86a21c1f1155680ad9261628 100644 (file)
@@ -24,8 +24,8 @@ import org.argeo.eclipse.ui.TreeParent;
 import org.argeo.eclipse.ui.dialogs.SingleValue;
 import org.argeo.eclipse.ui.jcr.JcrUiPlugin;
 import org.argeo.jcr.ui.explorer.JcrExplorerPlugin;
-import org.argeo.jcr.ui.explorer.model.SingleJcrNode;
-import org.argeo.jcr.ui.explorer.model.WorkspaceNode;
+import org.argeo.jcr.ui.explorer.model.SingleJcrNodeElem;
+import org.argeo.jcr.ui.explorer.model.WorkspaceElem;
 import org.argeo.jcr.ui.explorer.views.GenericJcrBrowser;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
@@ -35,8 +35,8 @@ import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.handlers.HandlerUtil;
 
 /**
- * Adds a node of type nt:folder, only on {@link SingleJcrNode} and
- * {@link WorkspaceNode} TreeObject types.
+ * Adds a node of type nt:folder, only on {@link SingleJcrNodeElem} and
+ * {@link WorkspaceElem} TreeObject types.
  * 
  * 
  * This handler assumes that a selection provider is available and picks only
@@ -71,12 +71,12 @@ public class AddFolderNode extends AbstractHandler {
                        TreeParent treeParentNode = null;
                        Node jcrParentNode = null;
 
-                       if (obj instanceof SingleJcrNode) {
+                       if (obj instanceof SingleJcrNodeElem) {
                                treeParentNode = (TreeParent) obj;
-                               jcrParentNode = ((SingleJcrNode) treeParentNode).getNode();
-                       } else if (obj instanceof WorkspaceNode) {
+                               jcrParentNode = ((SingleJcrNodeElem) treeParentNode).getNode();
+                       } else if (obj instanceof WorkspaceElem) {
                                treeParentNode = (TreeParent) obj;
-                               jcrParentNode = ((WorkspaceNode) treeParentNode).getRootNode();
+                               jcrParentNode = ((WorkspaceElem) treeParentNode).getRootNode();
                        } else
                                return null;
 
index c0873eb78d8e8e8ae319cdea721e90d29f1a341b..829290ebe29fd18b11f63dc524de6ba24d600f53 100644 (file)
@@ -22,8 +22,8 @@ import org.argeo.ArgeoException;
 import org.argeo.eclipse.ui.ErrorFeedback;
 import org.argeo.eclipse.ui.TreeParent;
 import org.argeo.jcr.ui.explorer.JcrExplorerPlugin;
-import org.argeo.jcr.ui.explorer.model.SingleJcrNode;
-import org.argeo.jcr.ui.explorer.model.WorkspaceNode;
+import org.argeo.jcr.ui.explorer.model.SingleJcrNodeElem;
+import org.argeo.jcr.ui.explorer.model.WorkspaceElem;
 import org.argeo.jcr.ui.explorer.wizards.ChangeRightsWizard;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
@@ -50,12 +50,12 @@ public class AddPrivileges extends AbstractHandler {
                        TreeParent treeParentNode = null;
                        Node jcrParentNode = null;
 
-                       if (obj instanceof SingleJcrNode) {
+                       if (obj instanceof SingleJcrNodeElem) {
                                treeParentNode = (TreeParent) obj;
-                               jcrParentNode = ((SingleJcrNode) treeParentNode).getNode();
-                       } else if (obj instanceof WorkspaceNode) {
+                               jcrParentNode = ((SingleJcrNodeElem) treeParentNode).getNode();
+                       } else if (obj instanceof WorkspaceElem) {
                                treeParentNode = (TreeParent) obj;
-                               jcrParentNode = ((WorkspaceNode) treeParentNode).getRootNode();
+                               jcrParentNode = ((WorkspaceElem) treeParentNode).getRootNode();
                        } else
                                return null;
 
index f5679263d91163533bfa1d621a9de4d5430732db..e579630ce8b8bda48788a73078e6dc790683a827 100644 (file)
@@ -20,7 +20,7 @@ import java.util.Arrays;
 import org.argeo.eclipse.ui.ErrorFeedback;
 import org.argeo.eclipse.ui.dialogs.SingleValue;
 import org.argeo.jcr.ui.explorer.JcrExplorerPlugin;
-import org.argeo.jcr.ui.explorer.model.RepositoryNode;
+import org.argeo.jcr.ui.explorer.model.RepositoryElem;
 import org.argeo.jcr.ui.explorer.views.GenericJcrBrowser;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
@@ -46,10 +46,10 @@ public class CreateWorkspace extends AbstractHandler {
                if (selection != null && !selection.isEmpty()
                                && selection instanceof IStructuredSelection) {
                        Object obj = ((IStructuredSelection) selection).getFirstElement();
-                       if (!(obj instanceof RepositoryNode))
+                       if (!(obj instanceof RepositoryElem))
                                return null;
 
-                       RepositoryNode repositoryNode = (RepositoryNode) obj;
+                       RepositoryElem repositoryNode = (RepositoryElem) obj;
                        String workspaceName = SingleValue.ask("Workspace name",
                                        "Enter workspace name");
                        if (workspaceName != null) {
index 29760a2bf89e4e2fcf924293ecc47c9d1f8f1ef5..26d4cdd4323f85ed7f58df47cf952f96d9169d97 100644 (file)
@@ -23,8 +23,8 @@ import javax.jcr.RepositoryException;
 import org.argeo.ArgeoException;
 import org.argeo.eclipse.ui.ErrorFeedback;
 import org.argeo.eclipse.ui.TreeParent;
-import org.argeo.jcr.ui.explorer.model.SingleJcrNode;
-import org.argeo.jcr.ui.explorer.model.WorkspaceNode;
+import org.argeo.jcr.ui.explorer.model.SingleJcrNodeElem;
+import org.argeo.jcr.ui.explorer.model.WorkspaceElem;
 import org.argeo.jcr.ui.explorer.views.GenericJcrBrowser;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
@@ -58,7 +58,7 @@ public class DeleteNodes extends AbstractHandler {
                StringBuffer buf = new StringBuffer("");
                Iterator<?> lst = ((IStructuredSelection) selection).iterator();
                while (lst.hasNext()) {
-                       SingleJcrNode sjn = ((SingleJcrNode) lst.next());
+                       SingleJcrNodeElem sjn = ((SingleJcrNodeElem) lst.next());
                        buf.append(sjn.getName()).append(' ');
                }
                Boolean ok = MessageDialog.openConfirm(
@@ -69,14 +69,14 @@ public class DeleteNodes extends AbstractHandler {
                if (ok) {
                        Iterator<?> it = ((IStructuredSelection) selection).iterator();
                        Object obj = null;
-                       SingleJcrNode ancestor = null;
-                       WorkspaceNode rootAncestor = null;
+                       SingleJcrNodeElem ancestor = null;
+                       WorkspaceElem rootAncestor = null;
                        try {
                                while (it.hasNext()) {
                                        obj = it.next();
-                                       if (obj instanceof SingleJcrNode) {
+                                       if (obj instanceof SingleJcrNodeElem) {
                                                // Cache objects
-                                               SingleJcrNode sjn = (SingleJcrNode) obj;
+                                               SingleJcrNodeElem sjn = (SingleJcrNodeElem) obj;
                                                TreeParent tp = (TreeParent) sjn.getParent();
                                                Node node = sjn.getNode();
 
@@ -87,10 +87,10 @@ public class DeleteNodes extends AbstractHandler {
                                                tp.removeChild(sjn);
 
                                                // Check if the parent is the root node
-                                               if (tp instanceof WorkspaceNode)
-                                                       rootAncestor = (WorkspaceNode) tp;
+                                               if (tp instanceof WorkspaceElem)
+                                                       rootAncestor = (WorkspaceElem) tp;
                                                else
-                                                       ancestor = getOlder(ancestor, (SingleJcrNode) tp);
+                                                       ancestor = getOlder(ancestor, (SingleJcrNodeElem) tp);
                                        }
                                }
                                if (rootAncestor != null)
@@ -104,7 +104,7 @@ public class DeleteNodes extends AbstractHandler {
                return null;
        }
 
-       private SingleJcrNode getOlder(SingleJcrNode A, SingleJcrNode B) {
+       private SingleJcrNodeElem getOlder(SingleJcrNodeElem A, SingleJcrNodeElem B) {
                try {
                        if (A == null)
                                return B == null ? null : B;
index 372013781fb8b209110c955ea8312bb5b75cb58a..cfcac1354b50dbb024b88e60bd0e8bd4f078b14d 100644 (file)
@@ -24,8 +24,8 @@ import javax.jcr.Node;
 import org.argeo.eclipse.ui.ErrorFeedback;
 import org.argeo.jcr.JcrUtils;
 import org.argeo.jcr.ui.explorer.JcrExplorerPlugin;
-import org.argeo.jcr.ui.explorer.model.SingleJcrNode;
-import org.argeo.jcr.ui.explorer.model.WorkspaceNode;
+import org.argeo.jcr.ui.explorer.model.SingleJcrNodeElem;
+import org.argeo.jcr.ui.explorer.model.WorkspaceElem;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
@@ -75,12 +75,12 @@ public class GetNodeSize extends AbstractHandler {
                                        Object obj = it.next();
                                        String curPath;
                                        Node node;
-                                       if (obj instanceof SingleJcrNode) {
-                                               node = ((SingleJcrNode) obj).getNode();
+                                       if (obj instanceof SingleJcrNodeElem) {
+                                               node = ((SingleJcrNodeElem) obj).getNode();
                                                curPath = node.getSession().getWorkspace().getName();
                                                curPath += "/" + node.getPath();
-                                       } else if (obj instanceof WorkspaceNode) {
-                                               node = ((WorkspaceNode) obj).getRootNode();
+                                       } else if (obj instanceof WorkspaceElem) {
+                                               node = ((WorkspaceElem) obj).getRootNode();
                                                curPath = node.getSession().getWorkspace().getName();
                                        } else
                                                // unvalid object type
index b90b88d4b18c1f9fcb4b6c565b7b191baaeabf69..5c4bf7e6bcce76e81dfe383652af10d18ec22fdf 100644 (file)
@@ -20,8 +20,8 @@ import javax.jcr.Node;
 import org.argeo.eclipse.ui.ErrorFeedback;
 import org.argeo.eclipse.ui.TreeParent;
 import org.argeo.jcr.ui.explorer.JcrExplorerPlugin;
-import org.argeo.jcr.ui.explorer.model.SingleJcrNode;
-import org.argeo.jcr.ui.explorer.model.WorkspaceNode;
+import org.argeo.jcr.ui.explorer.model.SingleJcrNodeElem;
+import org.argeo.jcr.ui.explorer.model.WorkspaceElem;
 import org.argeo.jcr.ui.explorer.views.GenericJcrBrowser;
 import org.argeo.jcr.ui.explorer.wizards.ImportFileSystemWizard;
 import org.eclipse.core.commands.AbstractHandler;
@@ -45,10 +45,10 @@ public class ImportFileSystem extends AbstractHandler {
                        Object obj = ((IStructuredSelection) selection).getFirstElement();
                        try {
                                Node folder = null;
-                               if (obj instanceof SingleJcrNode) {
-                                       folder = ((SingleJcrNode) obj).getNode();
-                               } else if (obj instanceof WorkspaceNode) {
-                                       folder = ((WorkspaceNode) obj).getRootNode();
+                               if (obj instanceof SingleJcrNodeElem) {
+                                       folder = ((SingleJcrNodeElem) obj).getNode();
+                               } else if (obj instanceof WorkspaceElem) {
+                                       folder = ((WorkspaceElem) obj).getRootNode();
                                } else {
                                        ErrorFeedback.show(JcrExplorerPlugin
                                                        .getMessage("warningInvalidNodeToImport"));
index 86fca20978d03664a2ea541f7ac804dde653d19f..ec23dd08c35cc842213aff1d092da66b52ab489e 100644 (file)
@@ -15,7 +15,7 @@
  */
 package org.argeo.jcr.ui.explorer.commands;
 
-import org.argeo.jcr.ui.explorer.model.RemoteRepositoryNode;
+import org.argeo.jcr.ui.explorer.model.RemoteRepositoryElem;
 import org.argeo.jcr.ui.explorer.views.GenericJcrBrowser;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
@@ -40,8 +40,8 @@ public class RemoveRemoteRepository extends AbstractHandler {
                                && selection instanceof IStructuredSelection) {
                        Object obj = ((IStructuredSelection) selection).getFirstElement();
 
-                       if (obj instanceof RemoteRepositoryNode) {
-                               ((RemoteRepositoryNode) obj).remove();
+                       if (obj instanceof RemoteRepositoryElem) {
+                               ((RemoteRepositoryElem) obj).remove();
                                view.refresh(null);
                        }
                }
diff --git a/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/MaintainedRepositoryElem.java b/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/MaintainedRepositoryElem.java
new file mode 100644 (file)
index 0000000..abb97a9
--- /dev/null
@@ -0,0 +1,24 @@
+package org.argeo.jcr.ui.explorer.model;
+
+import javax.jcr.Repository;
+
+import org.argeo.ArgeoException;
+import org.argeo.eclipse.ui.TreeParent;
+import org.argeo.jcr.MaintainedRepository;
+
+/** Wraps a {@link MaintainedRepository} */
+public class MaintainedRepositoryElem extends RepositoryElem {
+
+       public MaintainedRepositoryElem(String alias, Repository repository,
+                       TreeParent parent) {
+               super(alias, repository, parent);
+               if (!(repository instanceof MaintainedRepository)) {
+                       throw new ArgeoException("Repository " + alias
+                                       + " is not amiantained repository");
+               }
+       }
+
+       protected MaintainedRepository getMaintainedRepository() {
+               return (MaintainedRepository) getRepository();
+       }
+}
diff --git a/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RemoteRepositoryElem.java b/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RemoteRepositoryElem.java
new file mode 100644 (file)
index 0000000..0be6978
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * 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.jcr.ui.explorer.model;
+
+import java.util.Arrays;
+
+import javax.jcr.Node;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.RepositoryFactory;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+import org.argeo.ArgeoException;
+import org.argeo.eclipse.ui.TreeParent;
+import org.argeo.jcr.ArgeoJcrUtils;
+import org.argeo.jcr.ArgeoNames;
+import org.argeo.util.security.Keyring;
+
+/** Root of a remote repository */
+public class RemoteRepositoryElem extends RepositoryElem {
+       private final Keyring keyring;
+       /**
+        * A session of the logged in user on the default workspace of the node
+        * repository.
+        */
+       private final Session userSession;
+       private final String remoteNodePath;
+
+       private final RepositoryFactory repositoryFactory;
+       private final String uri;
+
+       public RemoteRepositoryElem(String alias,
+                       RepositoryFactory repositoryFactory, String uri, TreeParent parent,
+                       Session userSession, Keyring keyring, String remoteNodePath) {
+               super(alias, null, parent);
+               this.repositoryFactory = repositoryFactory;
+               this.uri = uri;
+               this.keyring = keyring;
+               this.userSession = userSession;
+               this.remoteNodePath = remoteNodePath;
+       }
+
+       @Override
+       protected Session repositoryLogin(String workspaceName)
+                       throws RepositoryException {
+               Node remoteRepository = userSession.getNode(remoteNodePath);
+               String userID = remoteRepository.getProperty(ArgeoNames.ARGEO_USER_ID)
+                               .getString();
+               String pwdPath = remoteRepository.getPath() + '/'
+                               + ArgeoNames.ARGEO_PASSWORD;
+               char[] password = keyring.getAsChars(pwdPath);
+
+               try {
+                       SimpleCredentials credentials = new SimpleCredentials(userID,
+                                       password);
+                       return getRepository().login(credentials, workspaceName);
+               } finally {
+                       Arrays.fill(password, 0, password.length, ' ');
+               }
+       }
+
+       @Override
+       public Repository getRepository() {
+               if (repository == null)
+                       repository = ArgeoJcrUtils.getRepositoryByUri(repositoryFactory,
+                                       uri);
+               return super.getRepository();
+       }
+
+       public void remove() {
+               try {
+                       Node remoteNode = userSession.getNode(remoteNodePath);
+                       remoteNode.remove();
+                       remoteNode.getSession().save();
+               } catch (RepositoryException e) {
+                       throw new ArgeoException("Cannot remove " + remoteNodePath, e);
+               }
+       }
+
+}
diff --git a/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RemoteRepositoryNode.java b/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RemoteRepositoryNode.java
deleted file mode 100644 (file)
index 217a90e..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.jcr.ui.explorer.model;
-
-import java.util.Arrays;
-
-import javax.jcr.Node;
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.RepositoryFactory;
-import javax.jcr.Session;
-import javax.jcr.SimpleCredentials;
-
-import org.argeo.ArgeoException;
-import org.argeo.eclipse.ui.TreeParent;
-import org.argeo.jcr.ArgeoJcrUtils;
-import org.argeo.jcr.ArgeoNames;
-import org.argeo.util.security.Keyring;
-
-/** Root of a remote repository */
-public class RemoteRepositoryNode extends RepositoryNode {
-       private final Keyring keyring;
-       /**
-        * A session of the logged in user on the default workspace of the node
-        * repository.
-        */
-       private final Session userSession;
-       private final String remoteNodePath;
-
-       private final RepositoryFactory repositoryFactory;
-       private final String uri;
-
-       public RemoteRepositoryNode(String alias,
-                       RepositoryFactory repositoryFactory, String uri, TreeParent parent,
-                       Session userSession, Keyring keyring, String remoteNodePath) {
-               super(alias, null, parent);
-               this.repositoryFactory = repositoryFactory;
-               this.uri = uri;
-               this.keyring = keyring;
-               this.userSession = userSession;
-               this.remoteNodePath = remoteNodePath;
-       }
-
-       @Override
-       protected Session repositoryLogin(String workspaceName)
-                       throws RepositoryException {
-               Node remoteRepository = userSession.getNode(remoteNodePath);
-               String userID = remoteRepository.getProperty(ArgeoNames.ARGEO_USER_ID)
-                               .getString();
-               String pwdPath = remoteRepository.getPath() + '/'
-                               + ArgeoNames.ARGEO_PASSWORD;
-               char[] password = keyring.getAsChars(pwdPath);
-
-               try {
-                       SimpleCredentials credentials = new SimpleCredentials(userID,
-                                       password);
-                       return getRepository().login(credentials, workspaceName);
-               } finally {
-                       Arrays.fill(password, 0, password.length, ' ');
-               }
-       }
-
-       @Override
-       public Repository getRepository() {
-               if (repository == null)
-                       repository = ArgeoJcrUtils.getRepositoryByUri(repositoryFactory,
-                                       uri);
-               return super.getRepository();
-       }
-
-       public void remove() {
-               try {
-                       Node remoteNode = userSession.getNode(remoteNodePath);
-                       remoteNode.remove();
-                       remoteNode.getSession().save();
-               } catch (RepositoryException e) {
-                       throw new ArgeoException("Cannot remove " + remoteNodePath, e);
-               }
-       }
-
-}
diff --git a/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RepositoriesElem.java b/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RepositoriesElem.java
new file mode 100644 (file)
index 0000000..b123727
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * 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.jcr.ui.explorer.model;
+
+import java.util.Map;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.RepositoryFactory;
+import javax.jcr.Session;
+
+import org.argeo.ArgeoException;
+import org.argeo.eclipse.ui.ErrorFeedback;
+import org.argeo.eclipse.ui.TreeParent;
+import org.argeo.jcr.ArgeoNames;
+import org.argeo.jcr.MaintainedRepository;
+import org.argeo.jcr.RepositoryRegister;
+import org.argeo.jcr.UserJcrUtils;
+import org.argeo.util.security.Keyring;
+
+/**
+ * UI Tree component. Implements the Argeo abstraction of a
+ * {@link RepositoryFactory} that enable a user to "mount" various repositories
+ * in a single Tree like View. It is usually meant to be at the root of the UI
+ * Tree and thus {@link getParent()} method will return null.
+ * 
+ * The {@link RepositoryFactory} is injected at instantiation time and must be
+ * use get or register new {@link Repository} objects upon which a reference is
+ * kept here.
+ */
+
+public class RepositoriesElem extends TreeParent implements ArgeoNames {
+       private final RepositoryRegister repositoryRegister;
+       private final RepositoryFactory repositoryFactory;
+
+       /**
+        * A session of the logged in user on the default workspace of the node
+        * repository.
+        */
+       private final Session userSession;
+       private final Keyring keyring;
+
+       public RepositoriesElem(String name, RepositoryRegister repositoryRegister,
+                       RepositoryFactory repositoryFactory, TreeParent parent,
+                       Session userSession, Keyring keyring) {
+               super(name);
+               this.repositoryRegister = repositoryRegister;
+               this.repositoryFactory = repositoryFactory;
+               this.userSession = userSession;
+               this.keyring = keyring;
+       }
+
+       /**
+        * Override normal behavior to initialize the various repositories only at
+        * request time
+        */
+       @Override
+       public synchronized Object[] getChildren() {
+               if (isLoaded()) {
+                       return super.getChildren();
+               } else {
+                       // initialize current object
+                       Map<String, Repository> refRepos = repositoryRegister
+                                       .getRepositories();
+                       for (String name : refRepos.keySet()) {
+                               Repository repository = refRepos.get(name);
+                               if (repository instanceof MaintainedRepository)
+                                       super.addChild(new MaintainedRepositoryElem(name,
+                                                       repository, this));
+                               else
+                                       super.addChild(new RepositoryElem(name, repository, this));
+                       }
+
+                       // remote
+                       if (keyring != null) {
+                               try {
+                                       addRemoteRepositories(keyring);
+                               } catch (RepositoryException e) {
+                                       throw new ArgeoException(
+                                                       "Cannot browse remote repositories", e);
+                               }
+                       }
+                       return super.getChildren();
+               }
+       }
+
+       protected void addRemoteRepositories(Keyring jcrKeyring)
+                       throws RepositoryException {
+               Node userHome = UserJcrUtils.getUserHome(userSession);
+               if (userHome != null && userHome.hasNode(ARGEO_REMOTE)) {
+                       NodeIterator it = userHome.getNode(ARGEO_REMOTE).getNodes();
+                       while (it.hasNext()) {
+                               Node remoteNode = it.nextNode();
+                               String uri = remoteNode.getProperty(ARGEO_URI).getString();
+                               try {
+                                       RemoteRepositoryElem remoteRepositoryNode = new RemoteRepositoryElem(
+                                                       remoteNode.getName(), repositoryFactory, uri, this,
+                                                       userSession, jcrKeyring, remoteNode.getPath());
+                                       super.addChild(remoteRepositoryNode);
+                               } catch (Exception e) {
+                                       ErrorFeedback.show("Cannot add remote repository "
+                                                       + remoteNode, e);
+                               }
+                       }
+               }
+       }
+
+       public void registerNewRepository(String alias, Repository repository) {
+               // TODO: implement this
+               // Create a new RepositoryNode Object
+               // add it
+               // super.addChild(new RepositoriesNode(...));
+       }
+
+       /** Returns the {@link RepositoryRegister} wrapped by this object. */
+       public RepositoryRegister getRepositoryRegister() {
+               return repositoryRegister;
+       }
+}
diff --git a/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RepositoriesNode.java b/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RepositoriesNode.java
deleted file mode 100644 (file)
index df9d5b9..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.jcr.ui.explorer.model;
-
-import java.util.Map;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.RepositoryFactory;
-import javax.jcr.Session;
-
-import org.argeo.ArgeoException;
-import org.argeo.eclipse.ui.ErrorFeedback;
-import org.argeo.eclipse.ui.TreeParent;
-import org.argeo.jcr.ArgeoNames;
-import org.argeo.jcr.RepositoryRegister;
-import org.argeo.jcr.UserJcrUtils;
-import org.argeo.util.security.Keyring;
-
-/**
- * UI Tree component. Implements the Argeo abstraction of a
- * {@link RepositoryFactory} that enable a user to "mount" various repositories
- * in a single Tree like View. It is usually meant to be at the root of the UI
- * Tree and thus {@link getParent()} method will return null.
- * 
- * The {@link RepositoryFactory} is injected at instantiation time and must be
- * use get or register new {@link Repository} objects upon which a reference is
- * kept here.
- */
-
-public class RepositoriesNode extends TreeParent implements ArgeoNames {
-       private final RepositoryRegister repositoryRegister;
-       private final RepositoryFactory repositoryFactory;
-
-       /**
-        * A session of the logged in user on the default workspace of the node
-        * repository.
-        */
-       private final Session userSession;
-       private final Keyring keyring;
-
-       public RepositoriesNode(String name, RepositoryRegister repositoryRegister,
-                       RepositoryFactory repositoryFactory, TreeParent parent,
-                       Session userSession, Keyring keyring) {
-               super(name);
-               this.repositoryRegister = repositoryRegister;
-               this.repositoryFactory = repositoryFactory;
-               this.userSession = userSession;
-               this.keyring = keyring;
-       }
-
-       /**
-        * Override normal behavior to initialize the various repositories only at
-        * request time
-        */
-       @Override
-       public synchronized Object[] getChildren() {
-               if (isLoaded()) {
-                       return super.getChildren();
-               } else {
-                       // initialize current object
-                       Map<String, Repository> refRepos = repositoryRegister
-                                       .getRepositories();
-                       for (String name : refRepos.keySet()) {
-                               super.addChild(new RepositoryNode(name, refRepos.get(name),
-                                               this));
-                       }
-
-                       // remote
-                       if (keyring != null) {
-                               try {
-                                       addRemoteRepositories(keyring);
-                               } catch (RepositoryException e) {
-                                       throw new ArgeoException(
-                                                       "Cannot browse remote repositories", e);
-                               }
-                       }
-                       return super.getChildren();
-               }
-       }
-
-       protected void addRemoteRepositories(Keyring jcrKeyring)
-                       throws RepositoryException {
-               Node userHome = UserJcrUtils.getUserHome(userSession);
-               if (userHome != null && userHome.hasNode(ARGEO_REMOTE)) {
-                       NodeIterator it = userHome.getNode(ARGEO_REMOTE).getNodes();
-                       while (it.hasNext()) {
-                               Node remoteNode = it.nextNode();
-                               String uri = remoteNode.getProperty(ARGEO_URI).getString();
-                               try {
-                                       RemoteRepositoryNode remoteRepositoryNode = new RemoteRepositoryNode(
-                                                       remoteNode.getName(), repositoryFactory, uri, this,
-                                                       userSession, jcrKeyring, remoteNode.getPath());
-                                       super.addChild(remoteRepositoryNode);
-                               } catch (Exception e) {
-                                       ErrorFeedback.show("Cannot add remote repository "
-                                                       + remoteNode, e);
-                               }
-                       }
-               }
-       }
-
-       public void registerNewRepository(String alias, Repository repository) {
-               // TODO: implement this
-               // Create a new RepositoryNode Object
-               // add it
-               // super.addChild(new RepositoriesNode(...));
-       }
-
-       /** Returns the {@link RepositoryRegister} wrapped by this object. */
-       public RepositoryRegister getRepositoryRegister() {
-               return repositoryRegister;
-       }
-}
diff --git a/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RepositoryElem.java b/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RepositoryElem.java
new file mode 100644 (file)
index 0000000..935bac1
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * 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.jcr.ui.explorer.model;
+
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.argeo.ArgeoException;
+import org.argeo.eclipse.ui.TreeParent;
+
+/**
+ * UI Tree component. Wraps a JCR {@link Repository}. It also keeps a reference
+ * to its parent Tree Ui component; typically the unique {@link Repositories}
+ * object of the current view to enable bi-directionnal browsing in the tree.
+ */
+
+public class RepositoryElem extends TreeParent {
+       private String alias;
+       protected Repository repository;
+       private Session defaultSession = null;
+
+       /** Create a new repository with distinct name & alias */
+       public RepositoryElem(String alias, Repository repository, TreeParent parent) {
+               super(alias);
+               this.repository = repository;
+               setParent(parent);
+               this.alias = alias;
+       }
+
+       public void login() {
+               try {
+                       defaultSession = repositoryLogin(null);
+                       String[] wkpNames = defaultSession.getWorkspace()
+                                       .getAccessibleWorkspaceNames();
+                       for (String wkpName : wkpNames) {
+                               if (wkpName.equals(defaultSession.getWorkspace().getName()))
+                                       addChild(new WorkspaceElem(this, wkpName, defaultSession));
+                               else
+                                       addChild(new WorkspaceElem(this, wkpName));
+                       }
+               } catch (RepositoryException e) {
+                       throw new ArgeoException("Cannot connect to repository " + alias, e);
+               }
+       }
+
+       /**
+        * Actual call to the
+        * {@link Repository#login(javax.jcr.Credentials, String)} method. To be
+        * overridden.
+        */
+       protected Session repositoryLogin(String workspaceName)
+                       throws RepositoryException {
+               return repository.login(workspaceName);
+       }
+
+       public String[] getAccessibleWorkspaceNames() {
+               try {
+                       return defaultSession.getWorkspace().getAccessibleWorkspaceNames();
+               } catch (RepositoryException e) {
+                       throw new ArgeoException("Cannot retrieve workspace names", e);
+               }
+       }
+
+       public void createWorkspace(String workspaceName) {
+               if (!isConnected())
+                       login();
+               try {
+                       defaultSession.getWorkspace().createWorkspace(workspaceName);
+               } catch (RepositoryException e) {
+                       throw new ArgeoException("Cannot create workspace", e);
+               }
+       }
+
+       /** returns the {@link Repository} referenced by the current UI Node */
+       public Repository getRepository() {
+               return repository;
+       }
+
+       public String getAlias() {
+               return alias;
+       }
+
+       public Boolean isConnected() {
+               if (defaultSession != null && defaultSession.isLive())
+                       return true;
+               else
+                       return false;
+       }
+}
diff --git a/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RepositoryNode.java b/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/RepositoryNode.java
deleted file mode 100644 (file)
index a8b64af..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.jcr.ui.explorer.model;
-
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-
-import org.argeo.ArgeoException;
-import org.argeo.eclipse.ui.TreeParent;
-
-/**
- * UI Tree component. Wraps a JCR {@link Repository}. It also keeps a reference
- * to its parent Tree Ui component; typically the unique {@link Repositories}
- * object of the current view to enable bi-directionnal browsing in the tree.
- */
-
-public class RepositoryNode extends TreeParent implements UiNode {
-       private String alias;
-       protected Repository repository;
-       private Session defaultSession = null;
-
-       /** Create a new repository with alias = name */
-       public RepositoryNode(String alias, Repository repository, TreeParent parent) {
-               this(alias, alias, repository, parent);
-       }
-
-       /** Create a new repository with distinct name & alias */
-       public RepositoryNode(String alias, String name, Repository repository,
-                       TreeParent parent) {
-               super(name);
-               this.repository = repository;
-               setParent(parent);
-               this.alias = alias;
-       }
-
-       public void login() {
-               try {
-                       defaultSession = repositoryLogin(null);
-                       String[] wkpNames = defaultSession.getWorkspace()
-                                       .getAccessibleWorkspaceNames();
-                       for (String wkpName : wkpNames) {
-                               if (wkpName.equals(defaultSession.getWorkspace().getName()))
-                                       addChild(new WorkspaceNode(this, wkpName, defaultSession));
-                               else
-                                       addChild(new WorkspaceNode(this, wkpName));
-                       }
-               } catch (RepositoryException e) {
-                       throw new ArgeoException("Cannot connect to repository " + alias, e);
-               }
-       }
-
-       /**
-        * Actual call to the
-        * {@link Repository#login(javax.jcr.Credentials, String)} method. To be
-        * overridden.
-        */
-       protected Session repositoryLogin(String workspaceName)
-                       throws RepositoryException {
-               return repository.login(workspaceName);
-       }
-
-       public String[] getAccessibleWorkspaceNames() {
-               try {
-                       return defaultSession.getWorkspace().getAccessibleWorkspaceNames();
-               } catch (RepositoryException e) {
-                       throw new ArgeoException("Cannot retrieve workspace names", e);
-               }
-       }
-
-       public void createWorkspace(String workspaceName) {
-               if (!isConnected())
-                       login();
-               try {
-                       defaultSession.getWorkspace().createWorkspace(workspaceName);
-               } catch (RepositoryException e) {
-                       throw new ArgeoException("Cannot create workspace", e);
-               }
-       }
-
-       /** returns the {@link Repository} referenced by the current UI Node */
-       public Repository getRepository() {
-               return repository;
-       }
-
-       public String getAlias() {
-               return alias;
-       }
-
-       public Boolean isConnected() {
-               if (defaultSession != null && defaultSession.isLive())
-                       return true;
-               else
-                       return false;
-       }
-}
diff --git a/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/SingleJcrNode.java b/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/SingleJcrNode.java
deleted file mode 100644 (file)
index fa20f96..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.jcr.ui.explorer.model;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.Workspace;
-
-import org.argeo.ArgeoException;
-import org.argeo.eclipse.ui.TreeParent;
-
-/**
- * UI Tree component. Wraps a node of a JCR {@link Workspace}. It also keeps a
- * reference to its parent node that can either be a {@link WorkspaceNode}, a
- * {@link SingleJcrNode} or null if the node is "mounted" as the root of the UI
- * tree.
- */
-
-public class SingleJcrNode extends TreeParent implements UiNode {
-
-       private final Node node;
-       private String alias = null;
-
-       // keeps a local reference to the node's name to avoid exception when the
-       // session is lost
-       // private final String name;
-
-       /** Creates a new UiNode in the UI Tree */
-       public SingleJcrNode(TreeParent parent, Node node, String name) {
-               super(name);
-               setParent(parent);
-               this.node = node;
-       }
-
-       /**
-        * Creates a new UiNode in the UI Tree, keeping a reference to the alias of
-        * the corresponding repository in the current UI environment. It is useful
-        * to be able to mount nodes as roots of the UI tree.
-        */
-       public SingleJcrNode(TreeParent parent, Node node, String name, String alias) {
-               super(name);
-               setParent(parent);
-               this.node = node;
-               this.alias = alias;
-       }
-
-       /** returns the node wrapped by the current Ui object */
-       public Node getNode() {
-               return node;
-       }
-
-       /**
-        * Returns the alias corresponding to the repository abstraction that
-        * contains current node. If the current object is mounted as root of the UI
-        * tree, the alias is stored in the object. Otherwise, we must browse the
-        * tree backward to the RepositoryNode.
-        * 
-        * Alias is then cached in the current object so that next time it will be
-        * here.
-        */
-       public String getAlias() {
-               if (alias == null) {
-                       alias = ((UiNode) getParent()).getAlias();
-               }
-               return alias;
-       }
-
-       /**
-        * Override normal behavior to initialize children only when first
-        * requested
-        */
-       @Override
-       public synchronized Object[] getChildren() {
-               if (isLoaded()) {
-                       return super.getChildren();
-               } else {
-                       // initialize current object
-                       try {
-                               NodeIterator ni = node.getNodes();
-                               while (ni.hasNext()) {
-                                       Node curNode = ni.nextNode();
-                                       addChild(new SingleJcrNode(this, curNode, curNode.getName()));
-                               }
-                               return super.getChildren();
-                       } catch (RepositoryException re) {
-                               throw new ArgeoException(
-                                               "Unexcpected error while initializing children SingleJcrNode",
-                                               re);
-                       }
-               }
-       }
-
-       @Override
-       public boolean hasChildren() {
-               try {
-                       if (node.getSession().isLive())
-                               return node.hasNodes();
-                       else
-                               return false;
-               } catch (RepositoryException re) {
-                       throw new ArgeoException(
-                                       "Unexpected error while checking children node existence",
-                                       re);
-               }
-       }
-
-}
diff --git a/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/SingleJcrNodeElem.java b/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/SingleJcrNodeElem.java
new file mode 100644 (file)
index 0000000..7b588f8
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * 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.jcr.ui.explorer.model;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+import javax.jcr.Workspace;
+
+import org.argeo.ArgeoException;
+import org.argeo.eclipse.ui.TreeParent;
+
+/**
+ * UI Tree component. Wraps a node of a JCR {@link Workspace}. It also keeps a
+ * reference to its parent node that can either be a {@link WorkspaceElem}, a
+ * {@link SingleJcrNodeElem} or null if the node is "mounted" as the root of the UI
+ * tree.
+ */
+
+public class SingleJcrNodeElem extends TreeParent {
+
+       private final Node node;
+       private String alias = null;
+
+       // keeps a local reference to the node's name to avoid exception when the
+       // session is lost
+       // private final String name;
+
+       /** Creates a new UiNode in the UI Tree */
+       public SingleJcrNodeElem(TreeParent parent, Node node, String name) {
+               super(name);
+               setParent(parent);
+               this.node = node;
+       }
+
+       /**
+        * Creates a new UiNode in the UI Tree, keeping a reference to the alias of
+        * the corresponding repository in the current UI environment. It is useful
+        * to be able to mount nodes as roots of the UI tree.
+        */
+       public SingleJcrNodeElem(TreeParent parent, Node node, String name, String alias) {
+               super(name);
+               setParent(parent);
+               this.node = node;
+               this.alias = alias;
+       }
+
+       /** returns the node wrapped by the current Ui object */
+       public Node getNode() {
+               return node;
+       }
+
+       protected String getRepositoryAlias() {
+               return alias;
+       }
+
+       /**
+        * Override normal behavior to initialize children only when first requested
+        */
+       @Override
+       public synchronized Object[] getChildren() {
+               if (isLoaded()) {
+                       return super.getChildren();
+               } else {
+                       // initialize current object
+                       try {
+                               NodeIterator ni = node.getNodes();
+                               while (ni.hasNext()) {
+                                       Node curNode = ni.nextNode();
+                                       addChild(new SingleJcrNodeElem(this, curNode, curNode.getName()));
+                               }
+                               return super.getChildren();
+                       } catch (RepositoryException re) {
+                               throw new ArgeoException(
+                                               "Unexcpected error while initializing children SingleJcrNode",
+                                               re);
+                       }
+               }
+       }
+
+       @Override
+       public boolean hasChildren() {
+               try {
+                       if (node.getSession().isLive())
+                               return node.hasNodes();
+                       else
+                               return false;
+               } catch (RepositoryException re) {
+                       throw new ArgeoException(
+                                       "Unexpected error while checking children node existence",
+                                       re);
+               }
+       }
+
+}
diff --git a/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/UiNode.java b/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/UiNode.java
deleted file mode 100644 (file)
index 5023a84..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.jcr.ui.explorer.model;
-
-/**
- * insure presence of the useful specific methods used in the building a UI Tree
- * based on JCR repositories
- */
-public interface UiNode {
-
-       public String getAlias();
-}
diff --git a/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/WorkspaceElem.java b/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/WorkspaceElem.java
new file mode 100644 (file)
index 0000000..bb9b69c
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * 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.jcr.ui.explorer.model;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Workspace;
+
+import org.argeo.ArgeoException;
+import org.argeo.eclipse.ui.TreeParent;
+import org.argeo.jcr.JcrUtils;
+
+/**
+ * UI Tree component. Wraps the root node of a JCR {@link Workspace}. It also
+ * keeps a reference to its parent {@link RepositoryElem}, to be able to
+ * retrieve alias of the current used repository
+ */
+public class WorkspaceElem extends TreeParent {
+       private Session session = null;
+
+       public WorkspaceElem(RepositoryElem parent, String name) {
+               this(parent, name, null);
+       }
+
+       public WorkspaceElem(RepositoryElem parent, String name, Session session) {
+               super(name);
+               this.session = session;
+               setParent(parent);
+       }
+
+       public Session getSession() {
+               return session;
+       }
+
+       public Node getRootNode() {
+               try {
+                       if (session != null)
+                               return session.getRootNode();
+                       else
+                               return null;
+               } catch (RepositoryException e) {
+                       throw new ArgeoException("Cannot get root node of workspace "
+                                       + getName(), e);
+               }
+       }
+
+       public void login() {
+               try {
+                       session = ((RepositoryElem) getParent()).repositoryLogin(getName());
+               } catch (RepositoryException e) {
+                       throw new ArgeoException("Cannot connect to repository "
+                                       + getName(), e);
+               }
+       }
+
+       public Boolean isConnected() {
+               if (session != null && session.isLive())
+                       return true;
+               else
+                       return false;
+       }
+
+       @Override
+       public synchronized void dispose() {
+               logout();
+               super.dispose();
+       }
+
+       /** Logouts the session, does not nothing if there is no live session. */
+       public void logout() {
+               clearChildren();
+               JcrUtils.logoutQuietly(session);
+       }
+
+       @Override
+       public boolean hasChildren() {
+               try {
+                       if (isConnected())
+                               return session.getRootNode().hasNodes();
+                       else
+                               return false;
+               } catch (RepositoryException re) {
+                       throw new ArgeoException(
+                                       "Unexpected error while checking children node existence",
+                                       re);
+               }
+       }
+
+       /** Override normal behaviour to initialize display of the workspace */
+       @Override
+       public synchronized Object[] getChildren() {
+               if (isLoaded()) {
+                       return super.getChildren();
+               } else {
+                       // initialize current object
+                       try {
+                               Node rootNode;
+                               if (session == null)
+                                       return null;
+                               else
+                                       rootNode = session.getRootNode();
+                               NodeIterator ni = rootNode.getNodes();
+                               while (ni.hasNext()) {
+                                       Node node = ni.nextNode();
+                                       addChild(new SingleJcrNodeElem(this, node, node.getName()));
+                               }
+                               return super.getChildren();
+                       } catch (RepositoryException e) {
+                               throw new ArgeoException(
+                                               "Cannot initialize WorkspaceNode UI object."
+                                                               + getName(), e);
+                       }
+               }
+       }
+}
diff --git a/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/WorkspaceNode.java b/server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/model/WorkspaceNode.java
deleted file mode 100644 (file)
index 22a7731..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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.jcr.ui.explorer.model;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.Workspace;
-
-import org.argeo.ArgeoException;
-import org.argeo.eclipse.ui.TreeParent;
-import org.argeo.jcr.JcrUtils;
-
-/**
- * UI Tree component. Wraps the root node of a JCR {@link Workspace}. It also
- * keeps a reference to its parent {@link RepositoryNode}, to be able to
- * retrieve alias of the current used repository
- */
-public class WorkspaceNode extends TreeParent implements UiNode {
-       private Session session = null;
-
-       public WorkspaceNode(RepositoryNode parent, String name) {
-               this(parent, name, null);
-       }
-
-       public WorkspaceNode(RepositoryNode parent, String name, Session session) {
-               super(name);
-               this.session = session;
-               setParent(parent);
-       }
-
-       public Session getSession() {
-               return session;
-       }
-
-       public Node getRootNode() {
-               try {
-                       if (session != null)
-                               return session.getRootNode();
-                       else
-                               return null;
-               } catch (RepositoryException e) {
-                       throw new ArgeoException("Cannot get root node of workspace "
-                                       + getName(), e);
-               }
-       }
-
-       public void login() {
-               try {
-                       session = ((RepositoryNode) getParent()).repositoryLogin(getName());
-               } catch (RepositoryException e) {
-                       throw new ArgeoException("Cannot connect to repository "
-                                       + getName(), e);
-               }
-       }
-
-       public Boolean isConnected() {
-               if (session != null && session.isLive())
-                       return true;
-               else
-                       return false;
-       }
-
-       @Override
-       public synchronized void dispose() {
-               logout();
-               super.dispose();
-       }
-
-       /** Logouts the session, does not nothing if there is no live session. */
-       public void logout() {
-               clearChildren();
-               JcrUtils.logoutQuietly(session);
-       }
-
-       /** Returns the alias of the parent Repository */
-       public String getAlias() {
-               return ((UiNode) getParent()).getAlias();
-       }
-
-       @Override
-       public boolean hasChildren() {
-               try {
-                       if (isConnected())
-                               return session.getRootNode().hasNodes();
-                       else
-                               return false;
-               } catch (RepositoryException re) {
-                       throw new ArgeoException(
-                                       "Unexpected error while checking children node existence",
-                                       re);
-               }
-       }
-
-       /** Override normal behaviour to initialize display of the workspace */
-       @Override
-       public synchronized Object[] getChildren() {
-               if (isLoaded()) {
-                       return super.getChildren();
-               } else {
-                       // initialize current object
-                       try {
-                               Node rootNode;
-                               if (session == null)
-                                       return null;
-                               else
-                                       rootNode = session.getRootNode();
-                               NodeIterator ni = rootNode.getNodes();
-                               while (ni.hasNext()) {
-                                       Node node = ni.nextNode();
-                                       addChild(new SingleJcrNode(this, node, node.getName()));
-                               }
-                               return super.getChildren();
-                       } catch (RepositoryException e) {
-                               throw new ArgeoException(
-                                               "Cannot initialize WorkspaceNode UI object."
-                                                               + getName(), e);
-                       }
-               }
-       }
-}
index 4dff3b435768d17aded326756b21ae03ade7d170..eaa5475e0af1ed10cb41267eeca35197b25949bf 100644 (file)
@@ -25,9 +25,9 @@ import org.argeo.eclipse.ui.specific.FileHandler;
 import org.argeo.jcr.ui.explorer.JcrExplorerPlugin;
 import org.argeo.jcr.ui.explorer.editors.GenericNodeEditor;
 import org.argeo.jcr.ui.explorer.editors.GenericNodeEditorInput;
-import org.argeo.jcr.ui.explorer.model.RepositoryNode;
-import org.argeo.jcr.ui.explorer.model.SingleJcrNode;
-import org.argeo.jcr.ui.explorer.model.WorkspaceNode;
+import org.argeo.jcr.ui.explorer.model.RepositoryElem;
+import org.argeo.jcr.ui.explorer.model.SingleJcrNodeElem;
+import org.argeo.jcr.ui.explorer.model.WorkspaceElem;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
 import org.eclipse.jface.viewers.IStructuredSelection;
@@ -57,22 +57,22 @@ public class GenericNodeDoubleClickListener implements IDoubleClickListener {
                        return;
                Object obj = ((IStructuredSelection) event.getSelection())
                                .getFirstElement();
-               if (obj instanceof RepositoryNode) {
-                       RepositoryNode rpNode = (RepositoryNode) obj;
+               if (obj instanceof RepositoryElem) {
+                       RepositoryElem rpNode = (RepositoryElem) obj;
                        if (!rpNode.isConnected()) {
                                rpNode.login();
                                nodeViewer.refresh(obj);
                        }
                        // else do nothing
-               } else if (obj instanceof WorkspaceNode) {
-                       WorkspaceNode wn = (WorkspaceNode) obj;
+               } else if (obj instanceof WorkspaceElem) {
+                       WorkspaceElem wn = (WorkspaceElem) obj;
                        if (wn.isConnected())
                                wn.logout();
                        else
                                wn.login();
                        nodeViewer.refresh(obj);
-               } else if (obj instanceof SingleJcrNode) {
-                       SingleJcrNode sjn = (SingleJcrNode) obj;
+               } else if (obj instanceof SingleJcrNodeElem) {
+                       SingleJcrNodeElem sjn = (SingleJcrNodeElem) obj;
                        Node node = sjn.getNode();
                        try {
                                if (node.isNodeType(NodeType.NT_FILE)) {
index cee62f2fa4bb81c00cd12df40ee6310b993553fa..ad327f09853feb07773be9bb27c76dfde6aed4f8 100644 (file)
@@ -20,10 +20,10 @@ import javax.jcr.RepositoryException;
 
 import org.argeo.ArgeoException;
 import org.argeo.eclipse.ui.TreeParent;
-import org.argeo.jcr.ui.explorer.model.RepositoriesNode;
-import org.argeo.jcr.ui.explorer.model.RepositoryNode;
-import org.argeo.jcr.ui.explorer.model.SingleJcrNode;
-import org.argeo.jcr.ui.explorer.model.WorkspaceNode;
+import org.argeo.jcr.ui.explorer.model.RepositoriesElem;
+import org.argeo.jcr.ui.explorer.model.RepositoryElem;
+import org.argeo.jcr.ui.explorer.model.SingleJcrNodeElem;
+import org.argeo.jcr.ui.explorer.model.WorkspaceElem;
 
 /** Centralizes some useful methods to build UIs with JCR */
 public class JcrUiUtils {
@@ -35,25 +35,25 @@ public class JcrUiUtils {
                boolean doRefresh = false;
 
                try {
-                       if (element instanceof SingleJcrNode) {
-                               curNode = ((SingleJcrNode) element).getNode();
-                       } else if (element instanceof WorkspaceNode) {
-                               curNode = ((WorkspaceNode) element).getRootNode();
+                       if (element instanceof SingleJcrNodeElem) {
+                               curNode = ((SingleJcrNodeElem) element).getNode();
+                       } else if (element instanceof WorkspaceElem) {
+                               curNode = ((WorkspaceElem) element).getRootNode();
                        }
 
                        if (curNode != null
                                        && element.getChildren().length != curNode.getNodes()
                                                        .getSize())
                                doRefresh = true;
-                       else if (element instanceof RepositoryNode) {
-                               RepositoryNode rn = (RepositoryNode) element;
+                       else if (element instanceof RepositoryElem) {
+                               RepositoryElem rn = (RepositoryElem) element;
                                if (rn.isConnected()) {
                                        String[] wkpNames = rn.getAccessibleWorkspaceNames();
                                        if (element.getChildren().length != wkpNames.length)
                                                doRefresh = true;
                                }
-                       } else if (element instanceof RepositoriesNode) {
-                               RepositoriesNode rn = (RepositoriesNode) element;
+                       } else if (element instanceof RepositoriesElem) {
+                               RepositoriesElem rn = (RepositoriesElem) element;
                                if (element.getChildren().length != rn.getRepositoryRegister()
                                                .getRepositories().size())
                                        doRefresh = true;
index 1b62582b08232d1fd52c704399fe8046f42675a6..f000ba385fa0f4964611657dac8325bcf4c04634 100644 (file)
@@ -38,7 +38,7 @@ import org.argeo.jcr.ui.explorer.JcrExplorerPlugin;
 import org.argeo.jcr.ui.explorer.browser.NodeContentProvider;
 import org.argeo.jcr.ui.explorer.browser.NodeLabelProvider;
 import org.argeo.jcr.ui.explorer.browser.PropertiesContentProvider;
-import org.argeo.jcr.ui.explorer.model.SingleJcrNode;
+import org.argeo.jcr.ui.explorer.model.SingleJcrNodeElem;
 import org.argeo.jcr.ui.explorer.utils.GenericNodeDoubleClickListener;
 import org.argeo.jcr.ui.explorer.utils.JcrUiUtils;
 import org.argeo.util.security.Keyring;
@@ -153,9 +153,9 @@ public class GenericJcrBrowser extends AbstractJcrBrowser {
                                                        IStructuredSelection sel = (IStructuredSelection) event
                                                                        .getSelection();
                                                        Object firstItem = sel.getFirstElement();
-                                                       if (firstItem instanceof SingleJcrNode)
+                                                       if (firstItem instanceof SingleJcrNodeElem)
                                                                propertiesViewer
-                                                                               .setInput(((SingleJcrNode) firstItem)
+                                                                               .setInput(((SingleJcrNodeElem) firstItem)
                                                                                                .getNode());
                                                } else {
                                                        propertiesViewer.setInput(getViewSite());