upload tizen1.0 source
[sdk/ide/product.git] / org.eclipse.cdt.ui / src / org / eclipse / cdt / internal / ui / filters / ExecutableFilter.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2008 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package org.eclipse.cdt.internal.ui.filters;
12
13 import org.eclipse.cdt.core.model.IBinary;
14 import org.eclipse.cdt.core.model.IBinaryContainer;
15
16 import org.eclipse.jface.viewers.Viewer;
17 import org.eclipse.jface.viewers.ViewerFilter;
18
19
20
21 /**
22  * The ExecutableFilter is a filter used to determine whether
23  * an executable is shown
24  */
25 public class ExecutableFilter extends ViewerFilter {
26         
27         /* (non-Javadoc)
28          * Method declared on ViewerFilter.
29          */
30         @Override
31         public boolean select(Viewer viewer, Object parentElement, Object element) {
32                 if (element instanceof IBinary) {
33                         IBinary bin = (IBinary)element;
34                         if (! (parentElement instanceof IBinaryContainer)) {
35                                 if (bin.isExecutable()) {
36                                         return false;
37                                 }
38                         }
39                 }
40                 return true;
41         }
42 }