<persistedState key="styleOverride" value="8"/>
<tags>shellMaximized</tags>
<children xsi:type="advanced:PerspectiveStack" xmi:id="_jXVqsCk4Eein5vuhpK-Dew" elementId="org.argeo.cms.e4.perspectivestack.0">
- <children xsi:type="advanced:Perspective" xmi:id="_jvjWYCk4Eein5vuhpK-Dew" elementId="org.argeo.cms.e4.perspective.0">
+ <children xsi:type="advanced:Perspective" xmi:id="_jvjWYCk4Eein5vuhpK-Dew" elementId="org.argeo.cms.e4.perspective.data" label="Data" iconURI="platform:/plugin/org.argeo.cms.ui.theme/icons/nodes.gif">
<children xsi:type="basic:PartSashContainer" xmi:id="_h3tvMCkxEein5vuhpK-Dew" elementId="org.argeo.cms.e4.partsashcontainer.0" selectedElement="_0B9SECkxEein5vuhpK-Dew" horizontal="true">
<children xsi:type="basic:PartStack" xmi:id="_0B9SECkxEein5vuhpK-Dew" elementId="org.argeo.cms.e4.partstack.0" containerData="4000" selectedElement="_WAjPkCkTEein5vuhpK-Dew">
<children xsi:type="basic:Part" xmi:id="_WAjPkCkTEein5vuhpK-Dew" elementId="org.argeo.cms.e4.jcrbrowser" containerData="" contributionURI="bundleclass://org.argeo.cms.e4/org.argeo.cms.e4.jcr.JcrBrowserView" label="JCR" iconURI="platform:/plugin/org.argeo.cms.ui.theme/icons/browser.gif">
</menus>
</children>
</children>
- <children xsi:type="basic:PartStack" xmi:id="_mHrEUCk4Eein5vuhpK-Dew" elementId="org.argeo.cms.e4.partstack.1" containerData="6000"/>
+ <children xsi:type="basic:PartStack" xmi:id="_mHrEUCk4Eein5vuhpK-Dew" elementId="org.argeo.cms.e4.partstack.1" containerData="6000">
+ <tags>dataExplorer</tags>
+ </children>
</children>
</children>
</children>
<handlers xmi:id="_jbnNwCqYEeidr6NYQH6GbQ" elementId="org.argeo.cms.e4.handler.1" contributionURI="bundleclass://org.argeo.cms.e4/org.argeo.cms.e4.jcr.commands.DeleteNodes" command="_ChJ-4CqYEeidr6NYQH6GbQ"/>
<handlers xmi:id="_loxB0CqYEeidr6NYQH6GbQ" elementId="org.argeo.cms.e4.handler.2" contributionURI="bundleclass://org.argeo.cms.e4/org.argeo.cms.e4.jcr.commands.Refresh" command="_TOKHsCqYEeidr6NYQH6GbQ"/>
<handlers xmi:id="_omPfkCqYEeidr6NYQH6GbQ" elementId="org.argeo.cms.e4.handler.3" contributionURI="bundleclass://org.argeo.cms.e4/org.argeo.cms.e4.jcr.commands.RenameNode" command="_ZrcUMCqYEeidr6NYQH6GbQ"/>
+ <descriptors xmi:id="_XzfoMCqlEeidr6NYQH6GbQ" elementId="org.argeo.cms.e4.partdescriptor.nodeEditor" label="Node Editor" iconURI="platform:/plugin/org.argeo.cms.ui.theme/icons/node.gif" allowMultiple="true" category="dataExplorer" closeable="true" contributionURI="bundleclass://org.argeo.cms.e4/org.argeo.cms.e4.jcr.JcrNodeEditor"/>
<commands xmi:id="_RgE5cCqREeidr6NYQH6GbQ" elementId="org.argeo.cms.e4.command.addFolderNode" commandName="Add folder node" category="_MDkwUCqYEeidr6NYQH6GbQ"/>
<commands xmi:id="_ChJ-4CqYEeidr6NYQH6GbQ" elementId="org.argeo.cms.e4.command.deleteNodes" commandName="Delete nodes" category="_MDkwUCqYEeidr6NYQH6GbQ"/>
<commands xmi:id="_TOKHsCqYEeidr6NYQH6GbQ" elementId="org.argeo.cms.e4.command.refreshNodes" commandName="Refresh nodes" category="_MDkwUCqYEeidr6NYQH6GbQ"/>
--- /dev/null
+/*
+ * 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.e4.jcr;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
+import javax.jcr.RepositoryException;
+
+import org.argeo.cms.ui.jcr.PropertyLabelProvider;
+import org.argeo.eclipse.ui.EclipseUiException;
+import org.eclipse.jface.layout.TreeColumnLayout;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+
+/**
+ * Generic editor property page. Lists all properties of current node as a
+ * complex tree. TODO: enable editing
+ */
+public class GenericPropertyPage {
+
+ // Main business Objects
+ private Node currentNode;
+
+ public GenericPropertyPage(Node currentNode) {
+ this.currentNode = currentNode;
+ }
+
+ protected void createFormContent(Composite parent) {
+ Composite innerBox = new Composite(parent, SWT.NONE);
+ // Composite innerBox = new Composite(body, SWT.NO_FOCUS);
+ FillLayout layout = new FillLayout();
+ layout.marginHeight = 5;
+ layout.marginWidth = 5;
+ innerBox.setLayout(layout);
+ createComplexTree(innerBox);
+ // TODO TreeColumnLayout triggers a scroll issue with the form:
+ // The inside body is always to big and a scroll bar is shown
+ // Composite tableCmp = new Composite(body, SWT.NO_FOCUS);
+ // createComplexTree(tableCmp);
+ }
+
+ private TreeViewer createComplexTree(Composite parent) {
+ int style = SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION;
+ Tree tree = new Tree(parent, style);
+ TreeColumnLayout tableColumnLayout = new TreeColumnLayout();
+
+ createColumn(tree, tableColumnLayout, "Property", SWT.LEFT, 200, 30);
+ createColumn(tree, tableColumnLayout, "Value(s)", SWT.LEFT, 300, 60);
+ createColumn(tree, tableColumnLayout, "Type", SWT.LEFT, 75, 10);
+ createColumn(tree, tableColumnLayout, "Attributes", SWT.LEFT, 75, 0);
+ // Do not apply the treeColumnLayout it does not work yet
+ // parent.setLayout(tableColumnLayout);
+
+ tree.setLinesVisible(true);
+ tree.setHeaderVisible(true);
+
+ TreeViewer treeViewer = new TreeViewer(tree);
+ treeViewer.setContentProvider(new TreeContentProvider());
+ treeViewer.setLabelProvider((IBaseLabelProvider) new PropertyLabelProvider());
+ treeViewer.setInput(currentNode);
+ treeViewer.expandAll();
+ return treeViewer;
+ }
+
+ private static TreeColumn createColumn(Tree parent, TreeColumnLayout tableColumnLayout, String name, int style,
+ int width, int weight) {
+ TreeColumn column = new TreeColumn(parent, style);
+ column.setText(name);
+ column.setWidth(width);
+ column.setMoveable(true);
+ column.setResizable(true);
+ tableColumnLayout.setColumnData(column, new ColumnWeightData(weight, width, true));
+ return column;
+ }
+
+ private class TreeContentProvider implements ITreeContentProvider {
+ private static final long serialVersionUID = -6162736530019406214L;
+
+ public Object[] getElements(Object parent) {
+ Object[] props = null;
+ try {
+
+ if (parent instanceof Node) {
+ Node node = (Node) parent;
+ PropertyIterator pi;
+ pi = node.getProperties();
+ List<Property> propList = new ArrayList<Property>();
+ while (pi.hasNext()) {
+ propList.add(pi.nextProperty());
+ }
+ props = propList.toArray();
+ }
+ } catch (RepositoryException e) {
+ throw new EclipseUiException("Unexpected exception while listing node properties", e);
+ }
+ return props;
+ }
+
+ public Object getParent(Object child) {
+ return null;
+ }
+
+ public Object[] getChildren(Object parent) {
+ if (parent instanceof Property) {
+ Property prop = (Property) parent;
+ try {
+ if (prop.isMultiple())
+ return prop.getValues();
+ } catch (RepositoryException e) {
+ throw new EclipseUiException("Cannot get multi-prop values on " + prop, e);
+ }
+ }
+ return null;
+ }
+
+ public boolean hasChildren(Object parent) {
+ try {
+ return (parent instanceof Property && ((Property) parent).isMultiple());
+ } catch (RepositoryException e) {
+ throw new EclipseUiException("Cannot check if property is multiple for " + parent, e);
+ }
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public void dispose() {
+ }
+ }
+}
import org.argeo.cms.CmsException;
import org.argeo.cms.ui.jcr.JcrBrowserUtils;
-import org.argeo.cms.ui.jcr.JcrDClickListener;
import org.argeo.cms.ui.jcr.NodeContentProvider;
import org.argeo.cms.ui.jcr.NodeLabelProvider;
import org.argeo.cms.ui.jcr.OsgiRepositoryRegister;
import org.argeo.eclipse.ui.jcr.AsyncUiEventListener;
import org.argeo.eclipse.ui.jcr.utils.NodeViewerComparer;
import org.argeo.node.security.CryptoKeyring;
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.IBaseLabelProvider;
@Inject
private Repository nodeRepository;
- // Current user session on the "Argeo node" default workspace
+ // Current user session on the home repository default workspace
private Session userSession;
private OsgiRepositoryRegister repositoryRegister = new OsgiRepositoryRegister();
private EventListener resultsObserver;
@PostConstruct
- public void createPartControl(Composite parent, ESelectionService selectionService, EMenuService menuService) {
+ public void createPartControl(Composite parent, IEclipseContext context, EPartService partService,
+ ESelectionService selectionService, EMenuService menuService) {
repositoryRegister.init();
parent.setLayout(new FillLayout());
selectionService.setSelection(selection.toList());
}
});
+ nodesViewer.addDoubleClickListener(new JcrE4DClickListener(nodesViewer, partService));
menuService.registerContextMenu(nodesViewer.getControl(), NODE_VIEWER_POPUP_MENU_ID);
// getSite().registerContextMenu(menuManager, nodesViewer);
// getSite().setSelectionProvider(nodesViewer);
throw new EclipseUiException("Cannot register listeners", e);
}
- tmpNodeViewer.addDoubleClickListener(new JcrDClickListener(tmpNodeViewer));
+ // tmpNodeViewer.addDoubleClickListener(new JcrDClickListener(tmpNodeViewer));
return tmpNodeViewer;
}
--- /dev/null
+package org.argeo.cms.e4.jcr;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+
+import org.argeo.cms.CmsException;
+import org.argeo.cms.ui.jcr.JcrDClickListener;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import org.eclipse.jface.viewers.TreeViewer;
+
+public class JcrE4DClickListener extends JcrDClickListener {
+ EPartService partService;
+
+ public JcrE4DClickListener(TreeViewer nodeViewer, EPartService partService) {
+ super(nodeViewer);
+ this.partService = partService;
+ }
+
+ @Override
+ protected void openNode(Node node) {
+ MPart part = partService.createPart(JcrNodeEditor.DESCRIPTOR_ID);
+ try {
+ part.setLabel(node.getName());
+ part.getPersistedState().put("nodeWorkspace", node.getSession().getWorkspace().getName());
+ part.getPersistedState().put("nodePath", node.getPath());
+ } catch (RepositoryException e) {
+ throw new CmsException("Cannot open " + node, e);
+ }
+
+ // the provided part is be shown
+ partService.showPart(part, PartState.ACTIVATE);
+ }
+
+}