package net.sourceforge.phpeclipse.xdebug.ui.php.launching; import net.sourceforge.phpeclipse.xdebug.php.model.XDebugLineBreakpoint; import net.sourceforge.phpeclipse.xdebug.php.model.XDebugStackFrame; import net.sourceforge.phpeclipse.xdebug.php.model.XDebugTarget; import net.sourceforge.phpeclipse.xdebug.php.model.XDebugThread; import net.sourceforge.phpeclipse.xdebug.php.model.XDebugValue; import net.sourceforge.phpeclipse.xdebug.php.model.XDebugVariable; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; import org.eclipse.debug.core.model.ILineBreakpoint; import org.eclipse.debug.core.model.IValue; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.IDebugModelPresentation; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IValueDetailListener; import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.IEditorDescriptor; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorRegistry; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.part.FileEditorInput; public class PHPDebugModelPresentation implements IDebugModelPresentation { public void setAttribute(String attribute, Object value) { // TODO Auto-generated method stub } /** * @see IDebugModelPresentation#getImage(Object) */ public Image getImage(Object element) { if (element instanceof XDebugLineBreakpoint) { return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT); } else if (element instanceof IMarker) { return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT); } else if (element instanceof XDebugStackFrame || element instanceof XDebugThread || element instanceof XDebugTarget) { return null; } else if (element instanceof XDebugVariable) { return getVariableImage((XDebugVariable)element); } else if (element instanceof XDebugValue) { return getValueImage((XDebugValue)element); } return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT); } private Image getVariableImage(XDebugVariable phpVar) { /* if (phpVar != null) { if (phpVar.isLocal()) return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); if (phpVar.isHashValue()) return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); } */ return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); } private Image getValueImage(XDebugValue phpVar) { if (phpVar != null) { return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); } return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); } public String getText(Object element) { // TODO Auto-generated method stub return null; } public void computeDetail(IValue value, IValueDetailListener listener) { // TODO Auto-generated method stub } public void addListener(ILabelProviderListener listener) { // TODO Auto-generated method stub } public void dispose() { // TODO Auto-generated method stub } public boolean isLabelProperty(Object element, String property) { // TODO Auto-generated method stub return false; } public void removeListener(ILabelProviderListener listener) { // TODO Auto-generated method stub } public IEditorInput getEditorInput(Object element) { if (element instanceof IFile) { return new FileEditorInput((IFile)element); } if (element instanceof ILineBreakpoint) { return new FileEditorInput((IFile)((ILineBreakpoint)element).getMarker().getResource()); } return null; } public String getEditorId(IEditorInput input, Object element) { IEditorRegistry registry= PlatformUI.getWorkbench().getEditorRegistry(); IEditorDescriptor descriptor= registry.getDefaultEditor(input.getName()); if (descriptor != null) return descriptor.getId(); return null; } }