Remove old license headers
[lgpl/argeo-commons.git] / org.argeo.cms.ui / src / org / argeo / cms / ui / jcr / JcrTreeContentProvider.java
index f45e876f0d4aba7faa6358b867a05e54fdb5b276..cc8479f78680fc60b8705a1a49471b88f66b3079 100644 (file)
@@ -1,18 +1,3 @@
-/*
- * 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.cms.ui.jcr;
 
 import java.util.ArrayList;
@@ -24,7 +9,7 @@ import javax.jcr.NodeIterator;
 import javax.jcr.RepositoryException;
 
 import org.argeo.eclipse.ui.EclipseUiException;
-import org.argeo.eclipse.ui.jcr.utils.JcrItemsComparator;
+import org.argeo.eclipse.ui.jcr.util.JcrItemsComparator;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.Viewer;
 
@@ -38,20 +23,12 @@ public class JcrTreeContentProvider implements ITreeContentProvider {
        private JcrItemsComparator itemComparator = new JcrItemsComparator();
 
        /**
-        * Sends back the first level of the Tree. input element must be a single
-        * node object
+        * Sends back the first level of the Tree. input element must be a single node
+        * object
         */
        public Object[] getElements(Object inputElement) {
-               try {
-                       Node rootNode = (Node) inputElement;
-                       List<Node> result = new ArrayList<Node>();
-                       NodeIterator ni = rootNode.getNodes();
-                       while (ni.hasNext())
-                               result.add(ni.nextNode());
-                       return result.toArray();
-               } catch (RepositoryException re) {
-                       throw new EclipseUiException("Unable to retrieve elements for " + inputElement, re);
-               }
+               Node rootNode = (Node) inputElement;
+               return childrenNodes(rootNode);
        }
 
        public Object[] getChildren(Object parentElement) {
@@ -82,8 +59,13 @@ public class JcrTreeContentProvider implements ITreeContentProvider {
                try {
                        List<Node> children = new ArrayList<Node>();
                        NodeIterator nit = parentNode.getNodes();
-                       while (nit.hasNext())
-                               children.add(nit.nextNode());
+                       while (nit.hasNext()) {
+                               Node node = nit.nextNode();
+//                             if (node.getName().startsWith("rep:") || node.getName().startsWith("jcr:")
+//                                             || node.getName().startsWith("nt:"))
+//                                     continue nodes;
+                               children.add(node);
+                       }
                        Node[] arr = children.toArray(new Node[0]);
                        Arrays.sort(arr, itemComparator);
                        return arr;