1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.team.ui;
14 import java.util.ArrayList;
15 import java.util.Collection;
16 import java.util.Iterator;
20 import org.eclipse.jface.action.GroupMarker;
21 import org.eclipse.jface.action.IMenuListener;
22 import org.eclipse.jface.action.IMenuManager;
23 import org.eclipse.jface.action.MenuManager;
24 import org.eclipse.jface.layout.GridDataFactory;
25 import org.eclipse.jface.layout.TreeColumnLayout;
26 import org.eclipse.jface.resource.JFaceResources;
27 import org.eclipse.jface.resource.LocalResourceManager;
28 import org.eclipse.jface.viewers.ColumnLabelProvider;
29 import org.eclipse.jface.viewers.ColumnWeightData;
30 import org.eclipse.jface.viewers.ITreeContentProvider;
31 import org.eclipse.jface.viewers.LabelProvider;
32 import org.eclipse.jface.viewers.TreeViewer;
33 import org.eclipse.jface.viewers.TreeViewerColumn;
34 import org.eclipse.jface.viewers.Viewer;
35 import org.eclipse.jface.viewers.ViewerCell;
36 import org.eclipse.swt.SWT;
37 import org.eclipse.swt.graphics.Image;
38 import org.eclipse.swt.widgets.Composite;
39 import org.eclipse.swt.widgets.Control;
40 import org.eclipse.swt.widgets.Menu;
41 import org.eclipse.swt.widgets.Shell;
42 import org.eclipse.ui.IMemento;
43 import org.eclipse.ui.IViewSite;
44 import org.eclipse.ui.IWorkbenchActionConstants;
45 import org.eclipse.ui.IWorkbenchPartSite;
46 import org.eclipse.ui.IWorkbenchSite;
47 import org.eclipse.ui.PartInitException;
48 import org.eclipse.ui.part.IPageSite;
49 import org.eclipse.ui.part.ViewPart;
50 import org.simantics.browsing.ui.GraphExplorer;
51 import org.simantics.browsing.ui.graph.impl.SessionContextInputSource;
52 import org.simantics.browsing.ui.swt.DefaultSelectionDataResolver;
53 import org.simantics.browsing.ui.swt.GraphExplorerFactory;
54 import org.simantics.browsing.ui.swt.ViewArgumentUtils;
55 import org.simantics.databoard.Bindings;
56 import org.simantics.db.ChangeSetIdentifier;
57 import org.simantics.db.ReadGraph;
58 import org.simantics.db.Resource;
59 import org.simantics.db.Session;
60 import org.simantics.db.exception.DatabaseException;
61 import org.simantics.db.management.ISessionContext;
62 import org.simantics.db.management.ISessionContextChangedListener;
63 import org.simantics.db.management.ISessionContextProvider;
64 import org.simantics.db.management.SessionContextChangedEvent;
65 import org.simantics.db.request.Read;
66 import org.simantics.layer0.Layer0;
67 import org.simantics.project.ProjectKeys;
68 import org.simantics.team.internal.Images;
69 import org.simantics.ui.SimanticsUI;
70 import org.simantics.utils.datastructures.disposable.DisposeState;
71 import org.simantics.utils.datastructures.hints.HintListenerAdapter;
72 import org.simantics.utils.datastructures.hints.HintTracker;
73 import org.simantics.utils.datastructures.hints.IHintContext.Key;
74 import org.simantics.utils.datastructures.hints.IHintListener;
75 import org.simantics.utils.datastructures.hints.IHintObservable;
76 import org.simantics.utils.datastructures.hints.IHintTracker;
77 import org.simantics.utils.ui.LayoutUtils;
80 * @author Kalle Kondelin
82 public class SynchroniseView extends ViewPart {
84 public SynchroniseView() {
87 public class SessionContextProjectTracker extends HintTracker {
88 public SessionContextProjectTracker() {
89 IHintListener activeProjectListener = new HintListenerAdapter() {
91 public void hintChanged(IHintObservable sender, Key key, Object oldValue, Object newValue) {
92 applySessionContext(getSessionContext());
95 addKeyHintListener(ProjectKeys.KEY_PROJECT, activeProjectListener);
99 protected LocalResourceManager resourceManager;
101 protected Composite parent;
103 protected TreeViewer treeViewer;
105 private Map<String, String> args;
107 private ISessionContextProvider contextProvider;
109 private ISessionContext sessionContext;
111 protected IMemento memento;
113 private IHintTracker sessionContextTracker = new SessionContextProjectTracker();
115 private DisposeState disposeState = DisposeState.Alive;
117 protected ISessionContextChangedListener contextChangeListener = new ISessionContextChangedListener() {
119 public void sessionContextChanged(SessionContextChangedEvent event) {
120 sessionContext = event.getNewValue();
121 sessionContextTracker.track(sessionContext);
125 protected void setSessionContextTracker(IHintTracker tracker) {
126 this.sessionContextTracker = tracker;
129 protected Map<String, String> getViewArguments() {
133 protected DisposeState getDisposeState() {
137 public ISessionContext getSessionContext() {
138 return sessionContext;
141 public ISessionContextProvider getSessionContextProvider() {
142 return contextProvider;
146 public void createPartControl(Composite parent) {
147 this.parent = parent;
148 this.treeViewer = new TreeViewer(parent, SWT.SINGLE | SWT.FULL_SELECTION);
149 this.resourceManager = new LocalResourceManager(JFaceResources.getResources(parent.getDisplay()), treeViewer.getTree());
150 Images.getInstance(JFaceResources.getResources());
151 TreeColumnLayout ad = new TreeColumnLayout();
152 parent.setLayout(ad);
153 treeViewer.getTree().setHeaderVisible(true);
154 //treeViewer.getTree().setLinesVisible(true);
155 //treeViewer.setUseHashlookup(true);
156 //treeViewer.setAutoExpandLevel(3);
158 TreeViewerColumn nameColumn = new TreeViewerColumn(treeViewer, SWT.LEFT);
159 TreeViewerColumn typeColumn = new TreeViewerColumn(treeViewer, SWT.LEFT);
160 // TreeViewerColumn idColumn = new TreeViewerColumn(treeViewer, SWT.LEFT);
161 // TreeViewerColumn lookupIdColumn = new TreeViewerColumn(treeViewer, SWT.LEFT);
162 // TreeViewerColumn zColumn = new TreeViewerColumn(treeViewer, SWT.LEFT);
164 nameColumn.setLabelProvider(new MyColumnLabelProvider());
165 typeColumn.setLabelProvider(new MyColumnLabelProvider());
166 // idColumn.setLabelProvider(new MyColumnLabelProvider());
167 // lookupIdColumn.setLabelProvider(new MyColumnLabelProvider());
168 // zColumn.setLabelProvider(new MyColumnLabelProvider());
170 nameColumn.getColumn().setText("Name");
171 nameColumn.getColumn().setWidth(20);
172 ad.setColumnData(nameColumn.getColumn(), new ColumnWeightData(80, 100));
173 typeColumn.getColumn().setText("Type");
174 typeColumn.getColumn().setWidth(20);
175 ad.setColumnData(typeColumn.getColumn(), new ColumnWeightData(20, 120));
176 // idColumn.getColumn().setText("ID");
177 // idColumn.getColumn().setWidth(20);
178 // ad.setColumnData(idColumn.getColumn(), new ColumnWeightData(10, 50));
179 // lookupIdColumn.getColumn().setText("Lookup ID");
180 // lookupIdColumn.getColumn().setWidth(20);
181 // ad.setColumnData(lookupIdColumn.getColumn(), new ColumnWeightData(50, 100));
182 // zColumn.getColumn().setText("Z");
183 // zColumn.getColumn().setWidth(70);
184 // ad.setColumnData(zColumn.getColumn(), new ColumnWeightData(10, 70));
186 createControls(parent);
192 * Invoked when this viewpart is disposed. Unhooks the view from its
193 * ISessionContextProvider. Overriding is allowed but super.dispose() must
196 * @see org.eclipse.ui.part.WorkbenchPart#dispose()
199 public void dispose() {
200 disposeState = DisposeState.Disposing;
202 if (contextProvider != null) {
203 contextProvider.removeContextChangedListener(contextChangeListener);
204 contextProvider = null;
206 sessionContextTracker.untrack();
207 resourceManager.dispose();
208 resourceManager = null;
210 sessionContext = null;
214 disposeState = DisposeState.Disposed;
219 public void setFocus() {
224 public void init(IViewSite site) throws PartInitException {
226 this.args = ViewArgumentUtils.parseViewArguments(this);
230 public void init(IViewSite site, IMemento memento) throws PartInitException {
231 super.init(site, memento);
232 this.args = ViewArgumentUtils.parseViewArguments(this);
233 this.memento = memento;
237 public void saveState(IMemento memento) {
238 if (this.memento != null) {
239 memento.putMemento(this.memento);
241 // if (explorer != null)
242 // explorer.saveState(memento);
245 protected final void attachToSession() {
246 // Track active ISessionContext changes
247 contextProvider = SimanticsUI.getSessionContextProvider(getViewSite().getWorkbenchWindow());
248 contextProvider.addContextChangedListener(contextChangeListener);
250 // Perform first-time initialization of the explorer and its input.
251 applySessionContext(contextProvider.getSessionContext());
254 // private abstract class NameAndDescriptionToolTip extends ToolTip {
255 // public NameAndDescriptionToolTip(Control control, int style) {
256 // super(control, style, false);
259 // protected abstract Object getModelElement(Event event);
262 // * Adds logic to only show a tooltip if a meaningful item is under the
265 // protected boolean shouldCreateToolTip(Event event) {
266 // if (!super.shouldCreateToolTip(event))
268 // Object tableElement = getModelElement(event);
269 // return tableElement != null && tableElement instanceof DisplayElement;
272 // protected Composite createToolTipContentArea(Event event,
273 // Composite parent) {
274 // Object modelElement = getModelElement(event);
276 // Image iconImage = null;
277 // String nameString = "no name";
279 // if (modelElement instanceof DisplayElement) {
281 // nameString = "name";
284 // // Create the content area
285 // Composite composite = new Composite(parent, SWT.NONE);
286 // composite.setBackground(parent.getDisplay().getSystemColor(
287 // SWT.COLOR_INFO_BACKGROUND));
288 // composite.setLayout(new GridLayout(2, false));
290 // // The title area with the icon (if there is one) and label.
291 // Label title = createEntry(composite, iconImage, nameString);
292 //// title.setFont(tooltipHeading);
293 // GridDataFactory.createFrom((GridData)title.getLayoutData())
294 // .hint(SWT.DEFAULT, SWT.DEFAULT)
295 //// .minSize(MIN_TOOLTIP_WIDTH, 1)
298 // // The description (if there is one)
299 //// String descriptionString = "description";
300 //// if (descriptionString != null)
301 //// createEntry(composite, null, descriptionString);
303 // // Other Content to add
304 // addContent(composite, modelElement);
310 // * Adds a line of information to <code>parent</code>. If
311 // * <code>icon</code> is not <code>null</code>, an icon is placed on the
312 // * left, and then a label with <code>text</code>.
315 // * the composite to add the entry to
317 // * the icon to place next to the text. <code>null</code> for
320 // * the text to display
321 // * @return the created label
323 // protected Label createEntry(Composite parent, Image icon, String text) {
324 // if (icon != null) {
325 // Label iconLabel = new Label(parent, SWT.NONE);
326 // iconLabel.setImage(icon);
327 // iconLabel.setBackground(parent.getDisplay().getSystemColor(
328 // SWT.COLOR_INFO_BACKGROUND));
329 // iconLabel.setData(new GridData());
332 // Label textLabel = new Label(parent, SWT.WRAP);
334 // if(icon == null) {
335 // GridDataFactory.generate(textLabel, 2, 1);
337 // GridDataFactory.generate(textLabel, 1, 1);
340 // textLabel.setText(text);
341 // textLabel.setBackground(parent.getDisplay().getSystemColor(
342 // SWT.COLOR_INFO_BACKGROUND));
347 // * Adds a line of information to <code>parent</code>. If
348 // * <code>icon</code> is not <code>null</code>, an icon is placed on the
349 // * left, and then a label with <code>text</code>, which supports using
350 // * anchor tags to creates links
353 // * the composite to add the entry to
355 // * the icon to place next to the text. <code>null</code> for
358 // * the text to display
359 // * @return the created link
361 // protected Text createEntryWithText(Composite parent, Image icon, String text) {
362 // if (icon != null) {
363 // Label iconLabel = new Label(parent, SWT.NONE);
364 // iconLabel.setImage(icon);
365 // iconLabel.setBackground(parent.getDisplay().getSystemColor(
366 // SWT.COLOR_INFO_BACKGROUND));
367 // iconLabel.setData(new GridData());
369 // Text texts = new Text(parent, SWT.READ_ONLY | SWT.MULTI | SWT.V_SCROLL);
370 // if(icon == null) {
371 // GridDataFactory.generate(texts, 2, 1);
373 // texts.setText(text);
374 // texts.setBackground(parent.getDisplay().getSystemColor(
375 // SWT.COLOR_INFO_BACKGROUND));
379 // protected void addContent(Composite destination, Object modelElement) {
383 private class ItemDetailToolTip extends NameAndDescriptionToolTip {
384 private final boolean DEBUG = false;
385 private TreeViewer viewer;
387 private ItemDetailToolTip(TreeViewer viewer, Tree tree, ViewerFilter filter) {
388 super(tree,NO_RECREATE);
390 this.viewer = viewer;
391 this.setHideOnMouseDown(false);
393 public Point getLocation(Point tipSize, Event event) {
394 // try to position the tooltip at the bottom of the cell
395 ViewerCell cell = viewer.getCell(new Point(event.x, event.y));
397 return tree.toDisplay(event.x,cell.getBounds().y+cell.getBounds().height);
398 return super.getLocation(tipSize, event);
400 protected Object getToolTipArea(Event event) {
401 // Ensure that the tooltip is hidden when the cell is left
402 return viewer.getCell(new Point(event.x, event.y));
404 protected void addContent(Composite destination, Object modelElement) {
405 final DisplayElement item = (DisplayElement)modelElement;
407 System.out.println("add content");
410 text = modelElement.toString();
411 createEntryWithText(destination, null, text.toString());
414 protected Object getModelElement(Event event) {
415 org.eclipse.swt.widgets.TreeItem treeItem = tree.getItem(new Point(event.x, event.y));
416 if (treeItem == null)
418 return treeItem.getData();
421 class MyColumnLabelProvider extends ColumnLabelProvider {
423 public void update(ViewerCell cell) {
424 //NodeProxy proxy = (NodeProxy) cell.getElement();
425 cell.setText("Kraa");
426 cell.setImage(Images.getInstance().OTHER_IMAGE);
429 protected void createControls(final Composite parent) {
430 parent.setLayout(LayoutUtils.createNoBorderGridLayout(1, false));
431 GridDataFactory.fillDefaults().grab(true, true).applyTo(treeViewer.getTree());
432 treeViewer.setContentProvider(new UndoContentProvider(SimanticsUI.getSession()));
433 treeViewer.setLabelProvider(new LabelProvider() {
435 public Image getImage(Object element) {
436 if (element instanceof ChangeSetElement)
437 return Images.getInstance().CHANGE_SET_IMAGE;
438 else if (element instanceof DisplayElement)
439 return Images.getInstance().DISPLAY_IMAGE;
440 else if (element instanceof ResourceElement)
441 return Images.getInstance().RESOURCE_IMAGE;
442 else if (element instanceof StringElement)
443 return Images.getInstance().STRING_IMAGE;
444 else if (element instanceof UndoCombinedElement)
445 return Images.getInstance().COMBINED_IMAGE;
446 else if (element instanceof RedoContextElement)
447 return Images.getInstance().REDO_IMAGE;
448 else if (element instanceof UndoContextElement)
449 return Images.getInstance().UNDO_IMAGE;
451 return Images.getInstance().OTHER_IMAGE;
454 public String getText(Object element) {
455 return element.toString();
458 //viewer.setSorter(new ViewerSorter());
459 treeViewer.setInput(this);
460 Control control = treeViewer.getControl();
461 // ISelectionProvider selectionProvider = new ISelectionProvider() {
463 // public void addSelectionChangedListener(ISelectionChangedListener listener) {
466 // public ISelection getSelection() {
470 // public void removeSelectionChangedListener(ISelectionChangedListener listener) {
473 // public void setSelection(ISelection selection) {
476 createContextMenu(control, getSite());
478 // ImageDescriptor desc = BundleUtils.getImageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_undo.png");
479 // getViewSite().getActionBars().getToolBarManager().add(new Action("GetUndoHistory", desc) {
481 // public void run() {
482 // treeViewer.setContentProvider(new UndoContentProvider(SimanticsUI.getSession()));
485 // getViewSite().getActionBars().getToolBarManager().add(new Action("DumpSelectedRevision", Activator.BIN_CLOSED_ICON) {
487 // public void run() {
488 // IStructuredSelection is = (IStructuredSelection)viewer.getSelection();
489 // Object o = is.getFirstElement();
490 // if (o instanceof ChangeSetElement) {
491 // ChangeSetElement ce = (ChangeSetElement)o;
492 // long csid = ce.getChangeSetIdentifier().getId();
493 // ManagementSupport ms = SimanticsUI.getSession().getService(ManagementSupport.class);
495 // ms.dumpRevision(csid);
496 // ShowMessage.showInformation("DumpSelectedRevision", "Operation was successful.");
497 // } catch (DatabaseException e) {
498 // ExceptionUtils.logAndShowError(e);
504 public IMenuManager createContextMenu(Control control, IWorkbenchSite site) {
505 final MenuManager mm = new MenuManager("#TeamViewPopup", "#TeamViewPopup");
506 mm.setRemoveAllWhenShown(true);
507 mm.addMenuListener(new IMenuListener() {
509 public void menuAboutToShow(IMenuManager manager) {
510 mm.add(new GroupMarker(IWorkbenchActionConstants.WB_START));
513 Menu menu = mm.createContextMenu(control);
514 control.setMenu(menu);
516 if (site instanceof IWorkbenchPartSite) {
517 ((IWorkbenchPartSite) site).registerContextMenu(mm.getId(), mm, site.getSelectionProvider());
518 } else if (site instanceof IPageSite) {
519 ((IPageSite) site).registerContextMenu(mm.getId(), mm, site.getSelectionProvider());
528 protected GraphExplorer createExplorerControl(Composite parent) {
529 return GraphExplorerFactory.getInstance().selectionDataResolver(new DefaultSelectionDataResolver()).create(parent);
532 // Needed for preventing unnecessary re-initialization of the explorer with the same input.
533 // private Object currentInput;
536 * Invoke this to reinitialize the explorer and reset its input. The input
537 * will be resolved from the specified ISessionContext based on the
538 * {@link SessionContextInputSource} that is currently in use. If the input
539 * is identical to the previous input, nothing will be done.
543 protected final boolean applySessionContext(ISessionContext context) {
544 // If control is not alive anymore, do nothing.
545 if (disposeState != DisposeState.Alive)
548 this.sessionContext = context;
550 // Start tracking the session context.
551 // This will cause IHintListeners of the sessionContextTracker to fire.
552 // For this we need the above input equality (identity) checking.
553 sessionContextTracker.track(sessionContext);
558 class IncomingContentProvider implements ITreeContentProvider {
559 class IncomingElement extends ChangeSetElement {
560 IncomingElement(Session session, ChangeSetIdentifier cs) {
564 IncomingElement[] changeSetIds;
565 IncomingContentProvider(Session session, Shell parent) {
566 //this.session = session;
567 // PublishSynchroniseSupport ps = session.getService(PublishSynchroniseSupport.class);
569 Collection<ChangeSetIdentifier> cids = new ArrayList<ChangeSetIdentifier>();
571 changeSetIds = new IncomingElement[0];
573 changeSetIds = new IncomingElement[cids.size()];
574 Iterator<ChangeSetIdentifier> it = cids.iterator();
576 while (it.hasNext()) {
577 changeSetIds[i++] = new IncomingElement(session, it.next());
579 assert(i == cids.size());
581 // } catch (DatabaseException e) {
582 // changeSetIds = new IncomingElement[0];
583 // ExceptionUtils.logAndShowError(e);
588 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
592 public void dispose() {
596 public Object[] getElements(Object inputElement) {
601 public boolean hasChildren(Object element) {
602 return changeSetIds.length > 0;
606 public Object getParent(Object element) {
611 public Object[] getChildren(Object parentElement) {
616 class OutgoingContentProvider implements ITreeContentProvider {
617 class OutgoingElement extends ChangeSetElement {
618 OutgoingElement(Session session, ChangeSetIdentifier cs) {
622 OutgoingElement[] changeSetIds;
623 OutgoingContentProvider(Session session) {
624 // PublishSynchroniseSupport ps = session.getService(PublishSynchroniseSupport.class);
626 Collection<ChangeSetIdentifier> cids = new ArrayList<ChangeSetIdentifier>();
628 changeSetIds = new OutgoingElement[0];
630 changeSetIds = new OutgoingElement[cids.size()];
631 Iterator<ChangeSetIdentifier> it = cids.iterator();
633 while (it.hasNext()) {
634 changeSetIds[i++] = new OutgoingElement(session, it.next());
636 assert(i == cids.size());
638 // } catch (DatabaseException e) {
639 // ExceptionUtils.logAndShowError(e);
640 // changeSetIds = new OutgoingElement[0];
645 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
649 public void dispose() {
653 public Object[] getElements(Object inputElement) {
658 public boolean hasChildren(Object element) {
659 if (element instanceof TreeElement)
660 return ((TreeElement)element).hasChildren();
665 public Object getParent(Object element) {
670 public Object[] getChildren(Object parentElement) {
671 if (parentElement instanceof TreeElement)
672 return ((TreeElement)parentElement).getChildren();
680 class ResourceElement extends TreeElement {
681 private Session session;
682 private String resourceUri;
683 private String resourceName;
684 private Resource resource;
685 ResourceElement(Session session, String resource) {
686 this.session = session;
687 this.resourceUri = resource;
689 ResourceElement(Session session, Resource resource) {
690 this.session = session;
691 this.resource = resource;
694 protected Image getIdImage() {
695 return Images.getInstance().RESOURCE_IMAGE;
698 protected String getIdText() {
699 String s = resource.toString();
700 return s.substring(0, Math.min(10, s.length()));
702 private String getNameByUri() {
704 String t = session.syncRequest(new Read<String>() {
706 public String perform(ReadGraph g) throws DatabaseException {
707 resource = g.getResource(resourceUri);
708 Layer0 l0 = Layer0.getInstance(g);
709 resourceName = g.getPossibleRelatedValue(resource, l0.HasName, Bindings.STRING);
710 if (null == resourceName) {
711 Set<Resource> types = g.getTypes(resource);
712 if (types.size() > 0) {
713 Iterator<Resource> i = types.iterator();
714 Resource r = i.next();
715 resourceName = g.getPossibleRelatedValue(r, l0.HasName, Bindings.STRING);
718 if (null == resourceName)
719 resourceName = resourceUri;
724 } catch (DatabaseException e) {
728 private String getName() {
730 String t = session.syncRequest(new Read<String>() {
732 public String perform(ReadGraph g) throws DatabaseException {
733 Layer0 l0 = Layer0.getInstance(g);
734 resourceName = g.getPossibleRelatedValue(resource, l0.HasName, Bindings.STRING);
735 if (null == resourceName) {
736 Set<Resource> types = g.getTypes(resource);
737 if (types.size() > 0) {
738 Iterator<Resource> i = types.iterator();
739 Resource r = i.next();
740 resourceName = g.getPossibleRelatedValue(r, l0.HasName, Bindings.STRING);
743 if (null == resourceName)
744 resourceName = resourceUri;
749 } catch (DatabaseException e) {
753 private Resource getParent() {
755 Resource parent = session.syncRequest(new Read<Resource>() {
757 public Resource perform(ReadGraph g) throws DatabaseException {
758 Layer0 l0 = Layer0.getInstance(g);
759 return g.getPossibleObject(resource, l0.PartOf);
764 } catch (DatabaseException e) {
768 public String toString() {
769 if (null == resourceName && null != resourceUri)
770 return getNameByUri();
771 else if (null != resource && null == resourceUri)
776 boolean hasChildren() {
777 Resource p = getParent();
784 Object[] getChildren() {
785 Resource p = getParent();
787 return new Object[0];
788 Object[] objects = new Object[1];
789 objects[0] = new ResourceElement(session, p);