Package org.mongodb.meclipse.views.objects

Source Code of org.mongodb.meclipse.views.objects.CollectionBase

package org.mongodb.meclipse.views.objects;

import java.util.Set;

import org.eclipse.ui.views.properties.IPropertySource;
import org.mongodb.meclipse.MeclipsePlugin;
import org.mongodb.meclipse.views.FilterPlacement;
import org.mongodb.meclipse.views.objects.properties.CollectionPropertySource;

import com.mongodb.DBCollection;
import com.mongodb.DBObject;

public abstract class CollectionBase extends TreeParent {

  public CollectionBase(String name) {
    super(name);
  }

  @Override
  public TreeObject[] getChildren() {
    Set<Filter> filters = MeclipsePlugin.getDefault().getFilters(
        new FilterPlacement(this));
    if (filters == null) {
      return new TreeObject[0];
    }
    return (TreeObject[]) filters.toArray(new TreeObject[filters.size()]);
  }

  public abstract DBObject getQuery();

  public abstract DBCollection getCollection();

  /**
   * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
   */
  @Override
  @SuppressWarnings("rawtypes")
  public Object getAdapter(Class adapter) {
    if (adapter == IPropertySource.class) {
      return new CollectionPropertySource(this);
    }
    return null;
  }
}
TOP

Related Classes of org.mongodb.meclipse.views.objects.CollectionBase

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.