01: /*******************************************************************************
02: * Copyright (c) 2000, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.wizards.imports;
11:
12: import org.eclipse.core.resources.IProject;
13: import org.eclipse.jdt.core.IJavaProject;
14: import org.eclipse.jface.viewers.Viewer;
15: import org.eclipse.jface.viewers.ViewerFilter;
16: import org.eclipse.pde.internal.core.WorkspaceModelManager;
17:
18: public class BinaryProjectFilter extends ViewerFilter {
19:
20: /**
21: * Returns <code>false</code> if the given element is a binary plug-in/feature project,
22: * and <code>true</code> otherwise.
23: *
24: * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
25: */
26: public boolean select(Viewer viewer, Object parentElement,
27: Object element) {
28: IProject project = null;
29:
30: if (element instanceof IJavaProject) {
31: project = ((IJavaProject) element).getProject();
32: } else if (element instanceof IProject) {
33: project = (IProject) element;
34: }
35: if (project != null) {
36: if (WorkspaceModelManager.isPluginProject(project)
37: || WorkspaceModelManager.isFeatureProject(project)) {
38: return !WorkspaceModelManager.isBinaryProject(project);
39: }
40: }
41: return true;
42: }
43:
44: }
|