1 11 package org.eclipse.debug.internal.ui.launchConfigurations; 12 13 import org.eclipse.core.resources.IProject; 14 import org.eclipse.core.resources.IResource; 15 import org.eclipse.core.runtime.CoreException; 16 import org.eclipse.debug.core.ILaunchConfiguration; 17 import org.eclipse.debug.core.ILaunchConfigurationType; 18 import org.eclipse.jface.viewers.Viewer; 19 import org.eclipse.jface.viewers.ViewerFilter; 20 21 29 public class DeletedProjectFilter extends ViewerFilter { 30 31 34 public DeletedProjectFilter() { 35 super(); 36 } 37 38 41 public boolean select(Viewer viewer, Object parentElement, Object element) { 42 if (element instanceof ILaunchConfigurationType) { 44 return true; 45 } 46 if(element instanceof ILaunchConfiguration) { 47 try { 48 ILaunchConfiguration config = (ILaunchConfiguration)element; 49 IResource[] resources = config.getMappedResources(); 50 if(resources == null) { 51 return true; 52 } 53 for(int i = 0; i < resources.length; i++) { 54 IProject project= resources[i].getProject(); 55 if(project != null && project.exists()) { 56 return true; 57 } 58 } 59 } 60 catch(CoreException e) {} 61 } 62 return false; 63 } 64 65 } 66 | Popular Tags |