--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>net.sourceforge.phpeclipse.xdebug.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+source.xdebugui.jar = src/
+output.xdebugui.jar = bin/
+bin.includes = plugin.xml,\
+ xdebugui.jar
--- /dev/null
+
+Plugin.name=PHPEclipse XDebug UI
+
+LaunchShortcut.PHP.label=PHP Application
+
+PreferencePage.PHPBase.name=PHP
+PreferencePage.PHPInterpreter.name=Installed Interpreters
+
+DebugActionSet.label=PHP XDebug
+RunMenu.label=&Run
+
+BreakpoingActionSet.label=PHP Breakpoints
+# GlobalManageBreakpointAction.label=Toggle Line Breakpoint (PHP)
+AddBreakpoint.label=Toggle PHP &Breakpoint
+
+Context.Debugging.name=xDebugging PHP
+Context.Debugging.description=xDebugging PHP-Scripts
+DebugHover.description=Shows the value of the selected variable.
+DebugHover.label=debug variable hover
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+ id="net.sourceforge.phpeclipse.xdebug.ui"
+ name="XDebug Ui Plugin"
+ version="1.0.0"
+ provider-name="phpeclipse.de">
+
+ <runtime>
+ <library name="xdebugui.jar">
+ <export name="*"/>
+ </library>
+ </runtime>
+ <requires>
+ <import plugin="org.eclipse.debug.core"/>
+ <import plugin="org.eclipse.debug.ui"/>
+ <import plugin="net.sourceforge.phpeclipse"/>
+ <import plugin="net.sourceforge.phpeclipse.xdebug.core"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.ui.workbench.texteditor"/>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.ui.editors"/>
+ <import plugin="org.eclipse.jface.text"/>
+ <import plugin="org.eclipse.ui.ide"/>
+ </requires>
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ type="net.sourceforge.phpeclipse.xdebug.core.launchConfigurationType.pda"
+ description="Run or debug a Push Down Automata program"
+ class="net.sourceforge.phpeclipse.xdebug.ui.XDebugTabGroup"
+ id="net.sourceforge.phpeclipse.xdebug.ui.launchConfigurationTabGroup.pda">
+ </launchConfigurationTabGroup>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.debugModelPresentations">
+ <debugModelPresentation
+ class="net.sourceforge.phpeclipse.xdebug.ui.XDebugModelPresentation"
+ id="net.sourceforge.phpeclipse.xdebug">
+ </debugModelPresentation>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ class="net.sourceforge.phpeclipse.xdebug.ui.XDebugBreakpointAdapterFactory"
+ adaptableType="org.eclipse.ui.texteditor.ITextEditor">
+ <adapter
+ type="org.eclipse.debug.ui.actions.IToggleBreakpointsTarget">
+ </adapter>
+ </factory>
+ </extension>
+</plugin>
--- /dev/null
+/*
+ * Created on 25.11.2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package net.sourceforge.phpeclipse.xdebug.ui;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * @author Axel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class XDebugBreakpointAdapterFactory implements IAdapterFactory {
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof ITextEditor) {
+ ITextEditor editorPart = (ITextEditor) adaptableObject;
+ IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class);
+ if (resource != null) {
+ String extension = resource.getFileExtension();
+ if (extension != null && extension.equals("pda")) {
+ return new XDebugLineBreakpointAdapter();
+ }
+ }
+ }
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ return new Class[]{IToggleBreakpointsTarget.class};
+ }
+}
--- /dev/null
+/*
+ * Created on 25.11.2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package net.sourceforge.phpeclipse.xdebug.ui;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.ILineBreakpoint;
+import net.sourceforge.phpeclipse.xdebug.core.IXDebugConstants;
+import net.sourceforge.phpeclipse.xdebug.core.XDebugLineBreakpoint;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * @author Axel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class XDebugLineBreakpointAdapter implements IToggleBreakpointsTarget {
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
+ ITextEditor textEditor = getEditor(part);
+ if (textEditor != null) {
+ IResource resource = (IResource) textEditor.getEditorInput().getAdapter(IResource.class);
+ ITextSelection textSelection = (ITextSelection) selection;
+ int lineNumber = textSelection.getStartLine();
+ IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(IXDebugConstants.ID_XDEBUG_DEBUG_MODEL);
+ for (int i = 0; i < breakpoints.length; i++) {
+ IBreakpoint breakpoint = breakpoints[i];
+ if (resource.equals(breakpoint.getMarker().getResource())) {
+ if (((ILineBreakpoint)breakpoint).getLineNumber() == (lineNumber + 1)) {
+ // remove
+ breakpoint.delete();
+ return;
+ }
+ }
+ }
+ // create line breakpoint (doc line numbers start at 0)
+ XDebugLineBreakpoint lineBreakpoint = new XDebugLineBreakpoint(resource, lineNumber + 1);
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint);
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection) {
+ return getEditor(part) != null;
+ }
+
+ /**
+ * Returns the editor being used to edit a PDA file, associated with the
+ * given part, or <code>null</code> if none.
+ *
+ * @param part workbench part
+ * @return the editor being used to edit a PDA file, associated with the
+ * given part, or <code>null</code> if none
+ */
+ private ITextEditor getEditor(IWorkbenchPart part) {
+ if (part instanceof ITextEditor) {
+ ITextEditor editorPart = (ITextEditor) part;
+ IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class);
+ if (resource != null) {
+ String extension = resource.getFileExtension();
+ if (extension != null && extension.equals("pda")) {
+ return editorPart;
+ }
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public void toggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public boolean canToggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) {
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
+ return false;
+ }
+}
--- /dev/null
+/*
+ * Created on 25.11.2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package net.sourceforge.phpeclipse.xdebug.ui;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import net.sourceforge.phpeclipse.xdebug.core.IXDebugConstants;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+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.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.ResourceListSelectionDialog;
+
+/**
+ * @author Axel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class XDebugMainTab extends AbstractLaunchConfigurationTab {
+
+ private Text fProgramText;
+ private Button fProgramButton;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Font font = parent.getFont();
+
+ Composite comp = new Composite(parent, SWT.NONE);
+ setControl(comp);
+ GridLayout topLayout = new GridLayout();
+ topLayout.verticalSpacing = 0;
+ topLayout.numColumns = 3;
+ comp.setLayout(topLayout);
+ comp.setFont(font);
+
+ createVerticalSpacer(comp, 3);
+
+ Label programLabel = new Label(comp, SWT.NONE);
+ programLabel.setText("&Program:");
+ GridData gd = new GridData(GridData.BEGINNING);
+ programLabel.setLayoutData(gd);
+ programLabel.setFont(font);
+
+ fProgramText = new Text(comp, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fProgramText.setLayoutData(gd);
+ fProgramText.setFont(font);
+ fProgramText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ fProgramButton = createPushButton(comp, "&Browse...", null); //$NON-NLS-1$
+ fProgramButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ browsePDAFiles();
+ }
+ });
+ }
+
+ /**
+ * Open a resource chooser to select a PDA program
+ */
+ protected void browsePDAFiles() {
+ ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE);
+ dialog.setTitle("PDA Program");
+ dialog.setMessage("Select PDA Program");
+ // TODO: single select
+ if (dialog.open() == Window.OK) {
+ Object[] files = dialog.getResult();
+ IFile file = (IFile) files[0];
+ fProgramText.setText(file.getFullPath().toString());
+ }
+
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ try {
+ String program = configuration.getAttribute(IXDebugConstants.ATTR_XDEBUG_PROGRAM, (String)null);
+ if (program != null) {
+ fProgramText.setText(program);
+ }
+ } catch (CoreException e) {
+ setErrorMessage(e.getMessage());
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ String program = fProgramText.getText().trim();
+ if (program.length() == 0) {
+ program = null;
+ }
+ configuration.setAttribute(IXDebugConstants.ATTR_XDEBUG_PROGRAM, program);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+ */
+ public String getName() {
+ return "Main";
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public boolean isValid(ILaunchConfiguration launchConfig) {
+ String text = fProgramText.getText();
+ if (text.length() > 0) {
+ IPath path = new Path(text);
+ if (ResourcesPlugin.getWorkspace().getRoot().findMember(path) == null) {
+ setErrorMessage("Specified program does not exist");
+ return false;
+ }
+ } else {
+ setMessage("Specify a program");
+ }
+ return super.isValid(launchConfig);
+ }
+}
--- /dev/null
+/*
+ * Created on 25.11.2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package net.sourceforge.phpeclipse.xdebug.ui;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.ILineBreakpoint;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.IValueDetailListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @author Axel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class XDebugModelPresentation extends LabelProvider implements IDebugModelPresentation {
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDebugModelPresentation#setAttribute(java.lang.String, java.lang.Object)
+ */
+ public void setAttribute(String attribute, Object value) {
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ */
+ public Image getImage(Object element) {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ public String getText(Object element) {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDebugModelPresentation#computeDetail(org.eclipse.debug.core.model.IValue, org.eclipse.debug.ui.IValueDetailListener)
+ */
+ public void computeDetail(IValue value, IValueDetailListener listener) {
+ String detail = "";
+ try {
+ detail = value.getValueString();
+ } catch (DebugException e) {
+ }
+ listener.detailComputed(value, detail);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ISourcePresentation#getEditorInput(java.lang.Object)
+ */
+ 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;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ISourcePresentation#getEditorId(org.eclipse.ui.IEditorInput, java.lang.Object)
+ */
+ public String getEditorId(IEditorInput input, Object element) {
+ if (element instanceof IFile || element instanceof ILineBreakpoint) {
+ return "org.eclipse.ui.DefaultTextEditor";
+ }
+ return null;
+ }
+}
--- /dev/null
+/*
+ * Created on 25.11.2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package net.sourceforge.phpeclipse.xdebug.ui;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+
+/**
+ * @author Axel
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class XDebugTabGroup extends AbstractLaunchConfigurationTabGroup {
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ */
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ setTabs(new ILaunchConfigurationTab[] {
+ new XDebugMainTab(),
+ new SourceLookupTab(),
+ new CommonTab()
+ });
+ }
+}