1 11 package org.eclipse.debug.internal.ui.views.breakpoints; 12 13 import java.util.ArrayList ; 14 import java.util.List ; 15 16 import org.eclipse.core.runtime.IAdaptable; 17 import org.eclipse.debug.core.model.IBreakpoint; 18 import org.eclipse.ui.IWorkingSet; 19 import org.eclipse.ui.IWorkingSetElementAdapter; 20 21 28 public class BreakpointWorkingSetElementAdapter implements IWorkingSetElementAdapter { 29 30 33 public IAdaptable[] adaptElements(IWorkingSet ws, IAdaptable[] elements) { 34 for (int i = 0; i < elements.length; i++) { 35 IAdaptable adaptable = elements[i]; 36 if (!(adaptable instanceof IBreakpoint)) { 37 return selectBreakpoints(elements); 38 } 39 } 40 return elements; 41 } 42 43 private IAdaptable[] selectBreakpoints(IAdaptable[] elements) { 44 List breakpoints = new ArrayList (elements.length); 45 for (int i = 0; i < elements.length; i++) { 46 IAdaptable adaptable = elements[i]; 47 if (adaptable instanceof IBreakpoint) { 48 breakpoints.add(adaptable); 49 } 50 } 51 return (IAdaptable[]) breakpoints.toArray(new IAdaptable[breakpoints.size()]); 52 } 53 54 57 public void dispose() { 58 } 59 60 } 61 | Popular Tags |