package hiro.yoshioka.ast.sql.view;

import hiro.yoshioka.ast.sql.AbsSimpleNode;

import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

public class ASTTreeContentProvider implements ITreeContentProvider {

  public Object[] getChildren(Object element) {
    AbsSimpleNode node = (AbsSimpleNode) element;

    return node.getChildren();
  }

  public Object[] getElements(Object element) {
    return getChildren(element);
  }

  public boolean hasChildren(Object element) {
    return getChildren(element).length > 0;
  }

  public Object getParent(Object element) {
    return ((AbsSimpleNode) element).getParent();
  }

  public void dispose() {
  }

  public void inputChanged(Viewer viewer, Object old_input, Object new_input) {
  }
}