Search in sources :

Example 1 with TreeParent

use of org.mongodb.meclipse.views.objects.TreeParent in project meclipse by flaper87.

the class FilterWizard method addFilter.

public void addFilter(ISelection selection, Filter filter) {
    if (selection == null)
        throw new IllegalStateException(getCaption("filterWizard.error.nullSelection"));
    if (!(selection instanceof ITreeSelection))
        throw new IllegalStateException(selection.getClass().getSimpleName() + getCaption("filterWizard.error.noITreeSelection"));
    ITreeSelection treeSelection = (ITreeSelection) selection;
    Object obj = treeSelection.getFirstElement();
    if (!(obj instanceof Collection) && !(obj instanceof Filter))
        throw new IllegalStateException(obj.getClass().getSimpleName() + getCaption("filterWizard.error.noCollection"));
    TreeParent parent = (TreeParent) obj;
    filter.setParent(parent);
    MeclipsePlugin.getDefault().addFilter(new FilterPlacement(parent), filter);
}
Also used : ITreeSelection(org.eclipse.jface.viewers.ITreeSelection) Filter(org.mongodb.meclipse.views.objects.Filter) TreeParent(org.mongodb.meclipse.views.objects.TreeParent) FilterPlacement(org.mongodb.meclipse.views.FilterPlacement) Collection(org.mongodb.meclipse.views.objects.Collection)

Aggregations

ITreeSelection (org.eclipse.jface.viewers.ITreeSelection)1 FilterPlacement (org.mongodb.meclipse.views.FilterPlacement)1 Collection (org.mongodb.meclipse.views.objects.Collection)1 Filter (org.mongodb.meclipse.views.objects.Filter)1 TreeParent (org.mongodb.meclipse.views.objects.TreeParent)1