1 11 package org.eclipse.pde.internal.core; 12 13 import org.eclipse.core.expressions.PropertyTester; 14 import org.eclipse.core.resources.IProject; 15 import org.eclipse.core.resources.IResource; 16 import org.eclipse.core.runtime.CoreException; 17 import org.eclipse.core.runtime.IAdaptable; 18 19 25 public class ResourceExtender extends PropertyTester { 26 27 private static final String PDE_NATURE = "PluginNature"; 29 35 public boolean test(Object receiver, String method, Object [] args, 36 Object expectedValue) { 37 IResource resource = (IResource) ((IAdaptable) receiver) 38 .getAdapter(IResource.class); 39 if (resource != null) { 40 if (PDE_NATURE.equals(method)) { 41 try { 42 IProject proj = resource.getProject(); 43 return proj.isAccessible() 44 && proj.hasNature("org.eclipse.pde.PluginNature"); } catch (CoreException e) { 46 return true; 47 } 48 } 49 } 50 return true; 51 } 52 53 } 54 | Popular Tags |