| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2007, 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 | |
| 12 | package org.eclipse.ui.internal.views.markers; |
| 13 | |
| 14 | import org.eclipse.core.expressions.PropertyTester; |
| 15 | import org.eclipse.core.resources.IResource; |
| 16 | |
| 17 | /** |
| 18 | * FileMarkerPropertyTester is a property tester for a marker entry to see if it |
| 19 | * is a marker that has a file behind it. |
| 20 | * |
| 21 | * @since 3.4 |
| 22 | * |
| 23 | */ |
| 24 | public class FileMarkerPropertyTester extends PropertyTester { |
| 25 | |
| 26 | private static final Object FILE_MARKER = "fileMarker"; //$NON-NLS-1$ |
| 27 | |
| 28 | /** |
| 29 | * Create a new instance of the receiver. |
| 30 | */ |
| 31 | public FileMarkerPropertyTester() { |
| 32 | super(); |
| 33 | } |
| 34 | |
| 35 | /* (non-Javadoc) |
| 36 | * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object) |
| 37 | */ |
| 38 | public boolean test(Object receiver, String property, Object[] args, |
| 39 | Object expectedValue) { |
| 40 | if (property.equals(FILE_MARKER)) { |
| 41 | if (((MarkerEntry) receiver).getMarker().getResource().getType() == IResource.FILE) |
| 42 | return true; |
| 43 | } |
| 44 | return false; |
| 45 | } |
| 46 | |
| 47 | } |