From: <ed...@ed...> - 2008-10-04 23:53:43
|
Author: incastrix Date: 2008-10-04 18:48:59 -0500 (Sat, 04 Oct 2008) New Revision: 1616 Modified: branches/1.3.x/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPDebugModelPresentation.java branches/1.3.x/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPRemoteDebug.java Log: Merge from trunk. Modified: branches/1.3.x/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPDebugModelPresentation.java =================================================================== --- branches/1.3.x/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPDebugModelPresentation.java 2008-10-03 17:58:12 UTC (rev 1615) +++ branches/1.3.x/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPDebugModelPresentation.java 2008-10-04 23:48:59 UTC (rev 1616) @@ -1,23 +1,42 @@ +/********************************************************************** + Copyright (c) 2000, 2002 IBM Corp. and others. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Common Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/cpl-v10.html + + Contributors: + IBM Corporation - Initial implementation + Vicente Fernando - www.alfersoft.com.ar + **********************************************************************/ package net.sourceforge.phpeclipse.xdebug.ui.php.launching; import java.io.File; +import java.util.HashMap; -//import net.sourceforge.phpdt.internal.ui.PHPUiImages; 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.XDebugStackFrame; +import net.sourceforge.phpeclipse.xdebug.php.model.XDebugVariable; import net.sourceforge.phpeclipse.xdebug.php.model.XDebugValue; -import net.sourceforge.phpeclipse.xdebug.php.model.XDebugVariable; import net.sourceforge.phpeclipse.xdebug.ui.XDebugUIPluginImages; +//import net.sourceforge.phpeclipse.xdebug.ui.XDebugUIPlugin; +//import net.sourceforge.phpeclipse.xdebug.ui.php.launching.CopyOfPHPDebugModelPresentation.StorageEditorInput; -//import org.eclipse.core.internal.resources.Marker; +//import net.sourceforge.phpdt.internal.debug.core.model.IPHPDebugTarget; + +//import net.sourceforge.phpdt.internal.debug.core.model.PHPThread; +//import net.sourceforge.phpdt.internal.debug.core.model.PHPValue; +//import net.sourceforge.phpdt.internal.debug.core.model.PHPVariable; + import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IStorage; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.PlatformObject; -//import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.ILineBreakpoint; import org.eclipse.debug.core.model.IValue; @@ -27,7 +46,7 @@ import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IValueDetailListener; import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.IEditorDescriptor; import org.eclipse.ui.IEditorInput; @@ -37,92 +56,90 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.ui.part.FileEditorInput; -public class PHPDebugModelPresentation implements IDebugModelPresentation { - - class StorageEditorInput extends PlatformObject implements - IStorageEditorInput { - private File fFile; +/** + * @see IDebugModelPresentation + */ +public class PHPDebugModelPresentation extends LabelProvider implements + IDebugModelPresentation { - private IStorage fStorage; + protected HashMap fAttributes = new HashMap(3); - public StorageEditorInput(IStorage storage, File file) { - super(); - fStorage = storage; - fFile = file; - } + public PHPDebugModelPresentation() { + super(); + } - public IStorage getStorage() { - return fStorage; - } + /** + * @see IDebugModelPresentation#getEditorId(IEditorInput, Object) + */ + public String getEditorId(IEditorInput input, Object inputObject) { + IEditorRegistry registry = PlatformUI.getWorkbench() + .getEditorRegistry(); + IEditorDescriptor descriptor = registry.getDefaultEditor(input + .getName()); + if (descriptor != null) + return descriptor.getId(); - public ImageDescriptor getImageDescriptor() { - return null; - } + return null; + } - public String getName() { - return getStorage().getName(); + /** + * @see IDebugModelPresentation#setAttribute(String, Object) + */ + public void setAttribute(String id, Object value) { + if (value == null) { + return; } + fAttributes.put(id, value); + } - public IPersistableElement getPersistable() { - return null; - } + /** + * @see IDebugModelPresentation#getEditorInput(Object) + */ + public IEditorInput getEditorInput(Object element) { - public String getToolTipText() { - return getStorage().getFullPath().toOSString(); + if (element instanceof IFile) { + return new FileEditorInput((IFile)element); } - - public boolean equals(Object object) { - return object instanceof StorageEditorInput - && getStorage().equals( - ((StorageEditorInput) object).getStorage()); + if( element instanceof LocalFileStorage) { + LocalFileStorage lfc= (LocalFileStorage)element; + return new StorageEditorInput(lfc,lfc.getFile()); } - - public int hashCode() { - return getStorage().hashCode(); + if (element instanceof ILineBreakpoint) { + return new FileEditorInput((IFile)((ILineBreakpoint)element).getMarker().getResource()); } - - public boolean exists() { - return fFile.exists(); - } + return null; } - - - 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) { - boolean breakpointEnable = true; - try { - breakpointEnable = ((XDebugLineBreakpoint) element).isEnabled(); - } catch (CoreException e) { - } - if (breakpointEnable) { - return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT); - } else { - return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT_DISABLED); - } + return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT); } else if (element instanceof IMarker) { - boolean enabled = ((IMarker)element).getAttribute(IBreakpoint.ENABLED, true); - if (enabled) { - return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT); - } else { - return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT_DISABLED); - } - } else if (element instanceof XDebugStackFrame || element instanceof XDebugThread || element instanceof XDebugTarget) { - return null; + return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT); + } else if (element instanceof XDebugStackFrame + || element instanceof XDebugThread + || element instanceof XDebugTarget) { + return getDebugElementImage(element); } else if (element instanceof XDebugVariable) { - return getVariableImage((XDebugVariable)element); + return getVariableImage((XDebugVariable) element); } else if (element instanceof XDebugValue) { - return getValueImage((XDebugValue)element); + 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 getVariableImage(XDebugVariable phpVar) { if (phpVar.getVisibility().equals("protected")) { return XDebugUIPluginImages.get(XDebugUIPluginImages.IMG_FIELD_PROTECTED); @@ -132,7 +149,6 @@ return XDebugUIPluginImages.get(XDebugUIPluginImages.IMG_FIELD_PUBLIC); } - private Image getValueImage(XDebugValue phpVar) { if (phpVar != null) { return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); @@ -140,59 +156,147 @@ return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); } - + /** + * @see IDebugModelPresentation#getText(Object) + */ public String getText(Object element) { - // TODO Auto-generated method stub + try { + if (element instanceof XDebugLineBreakpoint) { + return getBreakpointText((IBreakpoint) element); + } else if (element instanceof XDebugVariable) { + XDebugVariable phpVar = (XDebugVariable) element; + return phpVar.toString(); + } + } catch (CoreException e) { + //return PHPDebugUiMessages + // .getString("PHPDebugModelPresentation.<not responding>"); //$NON-NLS-1$ + } return null; } + /** + * @see IDebugModelPresentation#computeDetail(IValue, IValueDetailListener) + */ public void computeDetail(IValue value, IValueDetailListener listener) { - // TODO Auto-generated method stub + return; + } + protected IBreakpoint getBreakpoint(IMarker marker) { + return DebugPlugin.getDefault().getBreakpointManager().getBreakpoint( + marker); } - public void addListener(ILabelProviderListener listener) { - // TODO Auto-generated method stub - + protected String getBreakpointText(IBreakpoint breakpoint) + throws CoreException { + if (breakpoint instanceof XDebugLineBreakpoint) { + return getLineBreakpointText((XDebugLineBreakpoint) breakpoint); + } + return ""; //$NON-NLS-1$ } - public void dispose() { - // TODO Auto-generated method stub + protected String getLineBreakpointText(XDebugLineBreakpoint breakpoint) + throws CoreException { + StringBuffer label = new StringBuffer(); - } + label.append(breakpoint.getMarker().getResource().getFullPath()); + label.append(" ["); //$NON-NLS-1$ + //label.append(PHPDebugUiMessages + // .getString("PHPDebugModelPresentation.line")); //$NON-NLS-1$ + label.append(' '); + label.append(breakpoint.getLineNumber()); + label.append(']'); - public boolean isLabelProperty(Object element, String property) { - // TODO Auto-generated method stub - return false; - } + /*if (breakpoint.getHitCount() > 0) { + label.append(" [skip count "); + label.append(breakpoint.getHitCount()); + label.append(']'); + }*/ - public void removeListener(ILabelProviderListener listener) { - // TODO Auto-generated method stub + /*if (breakpoint.isConditionEnabled()) { + label.append(" [conditional]"); + }*/ + return label.toString(); } - public IEditorInput getEditorInput(Object element) { - - if (element instanceof IFile) { - return new FileEditorInput((IFile)element); + /** + * Returns the image associated with the given element or <code>null</code> + * if none is defined. + */ + protected Image getDebugElementImage(Object element) { + Image image = null; + if (element instanceof XDebugThread) { + XDebugThread thread = (XDebugThread) element; + if (thread.isSuspended()) { + image = DebugUITools + .getImage(IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED); + } else if (thread.isTerminated()) { + image = DebugUITools + .getImage(IDebugUIConstants.IMG_OBJS_THREAD_TERMINATED); + } else { + image = DebugUITools + .getImage(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING); + } + } else if (element instanceof XDebugStackFrame) { + image = DebugUITools + .getImage(IDebugUIConstants.IMG_OBJS_STACKFRAME); + } else if (element instanceof XDebugTarget) { + XDebugTarget debugTarget = (XDebugTarget) element; + if (debugTarget.isTerminated()) { + image = DebugUITools + .getImage(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET_TERMINATED); + } else { + image = DebugUITools + .getImage(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET); + } } - if( element instanceof LocalFileStorage) { - LocalFileStorage lfc= (LocalFileStorage)element; - return new StorageEditorInput(lfc,lfc.getFile()); - } - if (element instanceof ILineBreakpoint) { - return new FileEditorInput((IFile)((ILineBreakpoint)element).getMarker().getResource()); - } - return null; + return image; } - 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; - } + class StorageEditorInput extends PlatformObject implements + IStorageEditorInput { +private File fFile; +private IStorage fStorage; + +public StorageEditorInput(IStorage storage, File file) { + super(); + fStorage = storage; + fFile = file; } + +public IStorage getStorage() { + return fStorage; +} + +public ImageDescriptor getImageDescriptor() { + return null; +} + +public String getName() { + return getStorage().getName(); +} + +public IPersistableElement getPersistable() { + return null; +} + +public String getToolTipText() { + return getStorage().getFullPath().toOSString(); +} + +public boolean equals(Object object) { + return object instanceof StorageEditorInput + && getStorage().equals( + ((StorageEditorInput) object).getStorage()); +} + +public int hashCode() { + return getStorage().hashCode(); +} + +public boolean exists() { + return fFile.exists(); +} +} +} \ No newline at end of file Modified: branches/1.3.x/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPRemoteDebug.java =================================================================== --- branches/1.3.x/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPRemoteDebug.java 2008-10-03 17:58:12 UTC (rev 1615) +++ branches/1.3.x/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPRemoteDebug.java 2008-10-04 23:48:59 UTC (rev 1616) @@ -2,9 +2,7 @@ import net.sourceforge.phpdt.internal.ui.PHPUiImages; import net.sourceforge.phpdt.internal.ui.util.PHPProjectSelector; -//import net.sourceforge.phpeclipse.xdebug.core.XDebugCorePlugin; import net.sourceforge.phpeclipse.xdebug.php.launching.IXDebugConstants; -//import net.sourceforge.phpeclipse.xdebug.ui.EditPathMapDialog; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; @@ -13,29 +11,17 @@ import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -//import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; -//import org.eclipse.jface.viewers.TableLayout; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; -//import org.eclipse.swt.events.MouseAdapter; -//import org.eclipse.swt.events.MouseEvent; -//import org.eclipse.swt.events.SelectionAdapter; -//import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; -//import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; -//import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -//import org.eclipse.swt.widgets.Table; -//import org.eclipse.swt.widgets.TableColumn; -//import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; @@ -46,14 +32,12 @@ private PHPProjectSelector projectSelector; private Text fIdeIDText; - private Text fRemoteLocationText; public void createControl(Composite parent) { Font font = parent.getFont(); Composite comp = new Composite(parent, SWT.NONE); setControl(comp); -// PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_MAIN_TAB); GridLayout topLayout = new GridLayout(); topLayout.verticalSpacing = 0; comp.setLayout(topLayout); @@ -90,18 +74,7 @@ } }); - Label remoteLabel= new Label(group,SWT.NONE); - remoteLabel.setText("Remote Location:"); - - fRemoteLocationText = new Text(group,SWT.SINGLE | SWT.BORDER); gd= new GridData(GridData.FILL_HORIZONTAL); - fRemoteLocationText.setLayoutData(gd); - fRemoteLocationText.setFont(font); - fRemoteLocationText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent evt) { - updateLaunchConfigurationDialog(); - } - }); } private void createIdeIDEditor(Composite parent) { @@ -133,7 +106,6 @@ protected IProject getContext() { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - //IWorkbenchPage page= XDebugCorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); if (page != null) { ISelection selection = page.getSelection(); if (selection instanceof IStructuredSelection) { @@ -170,10 +142,6 @@ } String ideID = configuration.getAttribute(IXDebugConstants.ATTR_PHP_IDE_ID, "testID"); fIdeIDText.setText(ideID); - - String remoteLocation=configuration.getAttribute(IXDebugConstants.ATTR_PHP_REMOTE_LOCATION, ""); - fRemoteLocationText.setText(remoteLocation); - } catch (CoreException e) { setErrorMessage(e.getMessage()); } @@ -187,8 +155,6 @@ configuration.setAttribute(IXDebugConstants.ATTR_PHP_PROJECT, project); String ideID = fIdeIDText.getText().trim(); configuration.setAttribute(IXDebugConstants.ATTR_PHP_IDE_ID, ideID); - String remoteLocation = fRemoteLocationText.getText().trim(); - configuration.setAttribute(IXDebugConstants.ATTR_PHP_REMOTE_LOCATION, remoteLocation); } /* (non-Javadoc) |