-/*
- * 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;
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;
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) {
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;