/******************************************************************************* * Copyright (c) 2004, 2007 Boeing. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Boeing - initial API and implementation *******************************************************************************/ package org.eclipse.osee.framework.ui.skynet; import java.sql.SQLException; import java.util.Collections; import java.util.List; import java.util.logging.Level; import org.eclipse.jface.viewers.IContentProvider; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.Viewer; import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.relation.RelationLink; import org.eclipse.osee.framework.skynet.core.relation.RelationSide; import org.eclipse.osee.framework.skynet.core.relation.RelationType; import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager; import org.eclipse.osee.framework.skynet.core.relation.RelationTypeSide; /** * The basis for the comments in this class can be found at * http://www.eclipse.org/articles/treeviewer-cg/TreeViewerArticle.htm * * @author Ryan D. Brooks */ public class RelationContentProvider implements ITreeContentProvider { private static Object[] EMPTY_ARRAY = new Object[0]; private Artifact artifact; public RelationContentProvider(RelationsComposite relComp) { } /* * @see IContentProvider#dispose() */ public void dispose() { } /** * Notifies this content provider that the given viewer's input has been switched to a different element. *
* A typical use for this method is registering the content provider as a listener to changes on the new input (using * model-specific means), and deregistering the viewer from the old input. In response to these change notifications, * the content provider propagates the changes to the viewer. *
* * @param viewer the viewer * @param oldInput the old input element, ornull
if the viewer did not previously have an input
* @param newInput the new input element, or null
if the viewer does not have an input
* @see IContentProvider#inputChanged(Viewer, Object, Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
this.artifact = (Artifact) newInput;
}
/**
* The tree viewer calls its content provider’s getChildren method when it needs to create or display the child
* elements of the domain object, parent . This method should answer an array of domain objects that represent
* the unfiltered children of parent
*
* @see ITreeContentProvider#getChildren(Object)
*/
public Object[] getChildren(Object parentElement) {
try {
if (parentElement instanceof Artifact) {
Artifact artifact = (Artifact) parentElement;
List