1 11 package org.eclipse.jdt.internal.debug.ui.actions; 12 13 14 import java.util.Iterator ; 15 16 import org.eclipse.core.runtime.CoreException; 17 import org.eclipse.debug.core.model.IBreakpoint; 18 import org.eclipse.jdt.core.Signature; 19 import org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint; 20 import org.eclipse.jdt.debug.core.IJavaStackFrame; 21 import org.eclipse.jdt.debug.core.IJavaThread; 22 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; 23 import org.eclipse.jface.action.IAction; 24 import org.eclipse.jface.viewers.IStructuredSelection; 25 26 public class ExcludeExceptionLocationAction extends ObjectActionDelegate { 27 28 31 public void run(IAction action) { 32 IStructuredSelection selection= getCurrentSelection(); 33 if (selection == null) { 34 return; 35 } 36 Iterator itr= selection.iterator(); 37 38 while (itr.hasNext()) { 39 IJavaThread thread= (IJavaThread)itr.next(); 40 try { 41 IBreakpoint[] breakpoints= thread.getBreakpoints(); 42 IJavaStackFrame frame= (IJavaStackFrame)thread.getTopStackFrame(); 43 String newFilter= frame.getDeclaringTypeName(); 44 int index = newFilter.indexOf(Signature.C_GENERIC_START); 45 if (index > 0) { 46 newFilter = newFilter.substring(0, index); 47 } 48 for (int i = 0; i < breakpoints.length; i++) { 49 IBreakpoint breakpoint = breakpoints[i]; 50 if (breakpoint instanceof IJavaExceptionBreakpoint) { 51 IJavaExceptionBreakpoint exBreakpoint= (IJavaExceptionBreakpoint)breakpoint; 52 String [] current= exBreakpoint.getExclusionFilters(); 53 String [] newFilters= new String [current.length+1]; 54 System.arraycopy(current, 0, newFilters, 0, current.length); 55 newFilters[current.length]= newFilter; 56 exBreakpoint.setExclusionFilters(newFilters); 57 action.setEnabled(false); 58 } 59 } 60 } catch (CoreException de) { 61 JDIDebugUIPlugin.log(de); 62 } 63 } 64 } 65 } 66 | Popular Tags |