| /******************************************************************************* |
| * Copyright (c) 2000, 2017 IBM Corporation and others. |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0. |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| *******************************************************************************/ |
| package org.eclipse.dltk.internal.ui.filters; |
| |
| |
| import org.eclipse.core.resources.IResource; |
| import org.eclipse.dltk.core.IModelElement; |
| import org.eclipse.jface.viewers.Viewer; |
| import org.eclipse.jface.viewers.ViewerFilter; |
| |
| |
| /** |
| * Filters closed projects |
| */ |
| public class ClosedProjectFilter extends ViewerFilter { |
| |
| @Override |
| public boolean select(Viewer viewer, Object parent, Object element) { |
| if (element instanceof IModelElement) |
| return ((IModelElement)element).getScriptProject().getProject().isOpen(); |
| if (element instanceof IResource) |
| return ((IResource)element).getProject().isOpen(); |
| return true; |
| } |
| } |