~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CActionFilter.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2011-10-06 21:15:04 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111006211504-8dutmljjih0zikfv
Tags: 8.0.1-1
* New upstream release.
* Split the JNI packages into a separate architecture dependent
  package and made eclipse-cdt architecture independent.
* Install JNI libraries into multiarch aware location
* Bumped Standards-Version to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (c) 2005, 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
 *     QNX Software System
 
11
 *     Sergey Prigogin (Google)
 
12
 *******************************************************************************/
 
13
package org.eclipse.cdt.internal.ui;
 
14
 
 
15
import org.eclipse.core.resources.IResource;
 
16
import org.eclipse.ui.IActionFilter;
 
17
 
 
18
import org.eclipse.cdt.core.model.ICElement;
 
19
 
 
20
/**
 
21
 * An implementation of the IWorkbenchAdapter for CElements.
 
22
 */
 
23
public class CActionFilter implements IActionFilter {
 
24
 
 
25
        public CActionFilter() {
 
26
        }
 
27
 
 
28
        public boolean testAttribute(Object target, String name, String value) {
 
29
                ICElement element = (ICElement) target;
 
30
                IResource resource = element.getResource();
 
31
                if (resource != null) {
 
32
                        IActionFilter filter = (IActionFilter) resource.getAdapter(IActionFilter.class);
 
33
                        if (filter != null) {
 
34
                                return filter.testAttribute(resource, name, value);
 
35
                        }
 
36
                }
 
37
                return false;
 
38
        }
 
39
}