1 11 package org.eclipse.debug.internal.ui.views.breakpoints; 12 13 import org.eclipse.core.resources.IMarker; 14 import org.eclipse.core.resources.IResource; 15 import org.eclipse.debug.core.model.IBreakpoint; 16 import org.eclipse.ui.IMemento; 17 import org.eclipse.ui.IPersistableElement; 18 19 22 public class BreakpointPersistableElementAdapter implements IPersistableElement { 23 24 private IBreakpoint fBreakpoint; 25 26 public static final String TAG_MARKER_ID = "TAG_MARKER_ID"; public static final String TAG_RESOURCE_FACTORY_ID = "TAG_RESOURCE_FACTORY_ID"; 29 34 public BreakpointPersistableElementAdapter(IBreakpoint breakpoint) { 35 fBreakpoint = breakpoint; 36 } 37 38 41 public String getFactoryId() { 42 return "org.eclipse.debug.ui.elementFactory.breakpoints"; } 44 45 48 public void saveState(IMemento memento) { 49 IMarker marker = fBreakpoint.getMarker(); 50 if (marker != null) { 51 IResource resource = marker.getResource(); 52 IPersistableElement pe = (IPersistableElement) resource.getAdapter(IPersistableElement.class); 53 if (pe != null) { 54 long id = marker.getId(); 55 String longString = Long.toString(id); 56 memento.putString(TAG_MARKER_ID, longString); 57 memento.putString(TAG_RESOURCE_FACTORY_ID, pe.getFactoryId()); 58 pe.saveState(memento); 59 } 60 } 61 } 62 63 } 64 | Popular Tags |