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;
*/
public class GenericJcrBrowser extends AbstractJcrBrowser {
public final static String ID = JcrExplorerPlugin.ID + ".browserView";
- private boolean sortChildNodes = false;
+ private boolean sortChildNodes = true;
/* DEPENDENCY INJECTION */
private Keyring keyring;
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());
return nodesViewer;
}
+ /**
+ * Resets the tree content provider
+ *
+ * @param sortChildNodes
+ * if true the content provider will use a comparer to sort nodes
+ * that might slow down the display
+ * */
+ public void setSortChildNodes(boolean sortChildNodes) {
+ this.sortChildNodes = sortChildNodes;
+ ((NodeContentProvider) nodesViewer.getContentProvider())
+ .setSortChildren(sortChildNodes);
+ nodesViewer.setInput(getViewSite());
+ }
+
/** Notifies the current view that a node has been added */
public void nodeAdded(TreeParent parentNode) {
// insure that Ui objects have been correctly created:
getNodeViewer().expandToLevel(parentNode, 1);
}
- /** Notifies the current view that a node has been added */
+ /** Notifies the current view that a node has been removed */
public void nodeRemoved(TreeParent parentNode) {
IStructuredSelection newSel = new StructuredSelection(parentNode);
getNodeViewer().setSelection(newSel, true);
}
- public void setSortChildNodes(boolean sortChildNodes) {
- this.sortChildNodes = sortChildNodes;
- }
-
public boolean getSortChildNodes() {
return sortChildNodes;
}