From: cperkonig Date: Tue, 4 Oct 2005 11:06:10 +0000 (+0000) Subject: Not in Use in new Version X-Git-Url: http://git.phpeclipse.com Not in Use in new Version --- diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/CorePlugin.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/CorePlugin.java deleted file mode 100644 index 7ce333d..0000000 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/CorePlugin.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.sourceforge.phpeclipse.xdebug.core; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; -import java.util.*; - -/** - * The main plugin class to be used in the desktop. - */ -public class CorePlugin extends Plugin { - //The shared instance. - private static CorePlugin plugin; - //Resource bundle. - private ResourceBundle resourceBundle; - - /** - * The constructor. - */ - public CorePlugin() { - super(); - plugin = this; - try { - resourceBundle = ResourceBundle.getBundle("net.sourceforge.phpeclipse.xdebug.core.CorePluginResources"); - } catch (MissingResourceException x) { - resourceBundle = null; - } - } - - /** - * This method is called upon plug-in activation - */ - public void start(BundleContext context) throws Exception { - super.start(context); - } - - /** - * This method is called when the plug-in is stopped - */ - public void stop(BundleContext context) throws Exception { - super.stop(context); - } - - /** - * Returns the shared instance. - */ - public static CorePlugin getDefault() { - return plugin; - } - - /** - * Returns the string from the plugin's resource bundle, - * or 'key' if not found. - */ - public static String getResourceString(String key) { - ResourceBundle bundle = CorePlugin.getDefault().getResourceBundle(); - try { - return (bundle != null) ? bundle.getString(key) : key; - } catch (MissingResourceException e) { - return key; - } - } - - /** - * Returns the plugin's resource bundle, - */ - public ResourceBundle getResourceBundle() { - return resourceBundle; - } -} diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/IXDebugConstants.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/IXDebugConstants.java deleted file mode 100644 index fdabf98..0000000 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/IXDebugConstants.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Created on 23.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.core; - -/** - * @author Axel - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public interface IXDebugConstants { - - /** - * Unique identifier for the PDA debug model (value - * org.eclipse.debug.examples.pda). - */ - public static final String ID_XDEBUG_DEBUG_MODEL = "net.sourceforge.phpeclipse.xdebug.core"; - - /** - * Name of the string substitution variable that resolves to the - * location of a local Perl executable (value perlExecutable). - */ - public static final String ID_PERL_EXECUTABLE = "perlExecutable"; - /** - * Launch configuration key. Value is a path to a perl - * program. The path is a string representing a full path - * to a perl program in the workspace. - */ - public static final String ATTR_XDEBUG_PROGRAM = ID_XDEBUG_DEBUG_MODEL + ".ATTR_XDEBUG_PROGRAM"; -} diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugElement.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugElement.java deleted file mode 100644 index dc1958a..0000000 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugElement.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Created on 23.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.core; - -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.core.model.IDebugTarget; - -/** - * @author Axel - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public abstract class XDebugElement extends PlatformObject implements IDebugElement { - - // containing target - protected XDebugTarget fTarget; - - /** - * Constructs a new debug element contained in the given - * debug target. - * - * @param target debug target (PDA VM) - */ - public XDebugElement(XDebugTarget target) { - fTarget = target; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier() - */ - public String getModelIdentifier() { -// return IPDAConstants.ID_PDA_DEBUG_MODEL; - return null; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget() - */ - public IDebugTarget getDebugTarget() { - return fTarget; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDebugElement#getLaunch() - */ - public ILaunch getLaunch() { - return getDebugTarget().getLaunch(); - } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class adapter) { - if (adapter == IDebugElement.class) { - return this; - } - return super.getAdapter(adapter); - } - - protected void abort(String message, Throwable e) throws DebugException { -/* Axel auskommentiert - throw new DebugException(new Status(IStatus.ERROR, DebugExamplesPlugin.getDefault().getDescriptor().getUniqueIdentifier(), - DebugPlugin.INTERNAL_ERROR, message, e)); -*/ - } - - /** - * Fires a debug event - * - * @param event the event to be fired - */ - protected void fireEvent(DebugEvent event) { - DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {event}); - } - - /** - * Fires a CREATE event for this element. - */ - protected void fireCreationEvent() { - fireEvent(new DebugEvent(this, DebugEvent.CREATE)); - } - - /** - * Fires a RESUME event for this element with - * the given detail. - * - * @param detail event detail code - */ - public void fireResumeEvent(int detail) { - fireEvent(new DebugEvent(this, DebugEvent.RESUME, detail)); - } - - /** - * Fires a SUSPEND event for this element with - * the given detail. - * - * @param detail event detail code - */ - public void fireSuspendEvent(int detail) { - fireEvent(new DebugEvent(this, DebugEvent.SUSPEND, detail)); - } - - /** - * Fires a TERMINATE event for this element. - */ - protected void fireTerminateEvent() { - fireEvent(new DebugEvent(this, DebugEvent.TERMINATE)); - } -} diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugLineBreakpoint.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugLineBreakpoint.java deleted file mode 100644 index 135d4bc..0000000 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugLineBreakpoint.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.core; - -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.core.model.LineBreakpoint; -import net.sourceforge.phpeclipse.xdebug.core.IXDebugConstants; - -/** - * @author Axel - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class XDebugLineBreakpoint extends LineBreakpoint { - - /** - * Default constructor is required for the breakpoint manager - * to re-create persisted breakpoints. After instantiating a breakpoint, - * the setMarker(...) method is called to restore - * this breakpoint's attributes. - */ - public XDebugLineBreakpoint() { - } - - /** - * Constructs a line breakpoint on the given resource at the given - * line number. The line number is 1-based (i.e. the first line of a - * file is line number 1). The PDA VM uses 0-based line numbers, - * so this line number translation is done at breakpoint install time. - * - * @param resource file on which to set the breakpoint - * @param lineNumber 1-based line number of the breakpoint - * @throws CoreException if unable to create the breakpoint - */ - public XDebugLineBreakpoint(IResource resource, int lineNumber) throws CoreException { - IMarker marker = resource.createMarker("org.eclipse.debug.examples.core.pda.lineBreakpoint.marker"); - setMarker(marker); - setEnabled(true); - ensureMarker().setAttribute(IMarker.LINE_NUMBER, lineNumber); - ensureMarker().setAttribute(IBreakpoint.ID, IXDebugConstants.ID_XDEBUG_DEBUG_MODEL); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IBreakpoint#getModelIdentifier() - */ - public String getModelIdentifier() { - return IXDebugConstants.ID_XDEBUG_DEBUG_MODEL; - } -} diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugStackFrame.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugStackFrame.java deleted file mode 100644 index 8dfffb0..0000000 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugStackFrame.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Created on 23.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.core; - -import org.eclipse.core.runtime.Path; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IRegisterGroup; -import org.eclipse.debug.core.model.IStackFrame; -import org.eclipse.debug.core.model.IThread; -import org.eclipse.debug.core.model.IVariable; - -/** - * @author Axel - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class XDebugStackFrame extends XDebugElement implements IStackFrame { - - private XDebugThread fThread; - private String fName; - private int fPC; - private String fFileName; - private int fId; - private IVariable[] fVariables; - - /** - * Constructs a stack frame in the given thread with the given - * frame data. - * - * @param thread - * @param data frame data - * @param id stack frame id (0 is the bottom of the stack) - */ - public XDebugStackFrame(XDebugThread thread, String data, int id) { - super((XDebugTarget) thread.getDebugTarget()); - fId = id; - fThread = thread; - init(data); - } - - /** - * Initializes this frame based on its data - * - * @param data - */ - private void init(String data) { - String[] strings = data.split("\\|"); - String fileName = strings[0]; - fFileName = (new Path(fileName)).lastSegment(); - String pc = strings[1]; - fPC = Integer.parseInt(pc) + 1; - fName = strings[2]; - int numVars = strings.length - 3; - fVariables = new IVariable[numVars]; - for (int i = 0; i < numVars; i++) { - fVariables[i] = new XDebugVariable(this, strings[i + 3]); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#getThread() - */ - public IThread getThread() { - return fThread; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#getVariables() - */ - public IVariable[] getVariables() throws DebugException { - return fVariables; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#hasVariables() - */ - public boolean hasVariables() throws DebugException { - return fVariables.length > 0; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#getLineNumber() - */ - public int getLineNumber() throws DebugException { - return fPC; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#getCharStart() - */ - public int getCharStart() throws DebugException { - return -1; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#getCharEnd() - */ - public int getCharEnd() throws DebugException { - return -1; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#getName() - */ - public String getName() throws DebugException { - return fName; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#getRegisterGroups() - */ - public IRegisterGroup[] getRegisterGroups() throws DebugException { - return null; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStackFrame#hasRegisterGroups() - */ - public boolean hasRegisterGroups() throws DebugException { - return false; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#canStepInto() - */ - public boolean canStepInto() { - return getThread().canStepInto(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#canStepOver() - */ - public boolean canStepOver() { - return getThread().canStepOver(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#canStepReturn() - */ - public boolean canStepReturn() { - return getThread().canStepReturn(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#isStepping() - */ - public boolean isStepping() { - return getThread().isStepping(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#stepInto() - */ - public void stepInto() throws DebugException { - getThread().stepInto(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#stepOver() - */ - public void stepOver() throws DebugException { - getThread().stepOver(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#stepReturn() - */ - public void stepReturn() throws DebugException { - getThread().stepReturn(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#canResume() - */ - public boolean canResume() { - return getThread().canResume(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() - */ - public boolean canSuspend() { - return getThread().canSuspend(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() - */ - public boolean isSuspended() { - return getThread().isSuspended(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#resume() - */ - public void resume() throws DebugException { - getThread().resume(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#suspend() - */ - public void suspend() throws DebugException { - getThread().suspend(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#canTerminate() - */ - public boolean canTerminate() { - return getThread().canTerminate(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#isTerminated() - */ - public boolean isTerminated() { - return getThread().isTerminated(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#terminate() - */ - public void terminate() throws DebugException { - getThread().terminate(); - } - - /** - * Returns the name of the source file this stack frame is associated - * with. - * - * @return the name of the source file this stack frame is associated - * with - */ - public String getSourceName() { - return fFileName; - } - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - if (obj instanceof XDebugStackFrame) { - XDebugStackFrame sf = (XDebugStackFrame)obj; - try { - return sf.getSourceName().equals(getSourceName()) && - sf.getLineNumber() == getLineNumber() && - sf.fId == fId; - } catch (DebugException e) { - } - } - return false; - } - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return getSourceName().hashCode() + fId; - } - - /** - * Returns this stack frame's unique identifier within its thread - * - * @return this stack frame's unique identifier within its thread - */ - protected int getIdentifier() { - return fId; - } -} diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugTarget.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugTarget.java deleted file mode 100644 index 995df98..0000000 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugTarget.java +++ /dev/null @@ -1,597 +0,0 @@ -/* - * Created on 23.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.core; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.Socket; -import java.net.ServerSocket; -import java.net.UnknownHostException; -import java.text.MessageFormat; -import org.w3c.dom.*; -import javax.xml.parsers.*; -import javax.xml.parsers.DocumentBuilder; -import org.xml.sax.SAXException; -import java.io.StringBufferInputStream; -import java.io.OutputStreamWriter; - -import org.eclipse.core.resources.IMarkerDelta; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.ILineBreakpoint; -import org.eclipse.debug.core.model.IMemoryBlock; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.debug.core.model.IStackFrame; -import org.eclipse.debug.core.model.IThread; -import org.eclipse.debug.core.model.IValue; -import net.sourceforge.phpdt.internal.debug.core.PHPDebugCorePlugin; - -/** - * @author Axel - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class XDebugTarget extends XDebugElement implements IDebugTarget { - - // associated system process (VM) - private IProcess fProcess; - - // containing launch object - private ILaunch fLaunch; - - // program name - private String fName; - - // sockets to communicate with XDebug - private ServerSocket fDebugServerSocket; - private Socket fDebugSocket; - private OutputStreamWriter fDebugWriter; - private BufferedReader fDebugReader; - - // suspend state - private boolean fSuspended = true; - - // terminated state - private boolean fTerminated = false; - - // threads - private XDebugThread fThread; - private IThread[] fThreads; - - // event dispatch job - private EventDispatchJob fEventDispatch; - - // Settings for Debug Process - private String transaction_id = ""; - private String fileuri = ""; - - /** - * Listens to events from the XDebug and fires corresponding - * debug events. - */ - class EventDispatchJob extends Job { - - public EventDispatchJob() { - super("XDebug Event Dispatch"); - setSystem(true); - } - - public String getAttributeValue (Node CurrentNode, String AttributeName) { - String strValue = ""; - if (CurrentNode.hasAttributes()) { - NamedNodeMap listAttribute = CurrentNode.getAttributes(); - Node nodeTransactionID = listAttribute.getNamedItem(AttributeName); - strValue = nodeTransactionID.getNodeValue(); - } - return strValue; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) - */ - protected IStatus run(IProgressMonitor monitor) { - String event = ""; - int CurrentByte; - boolean ZeroByteFound; - int BytesToRead = 0; - String InputXML; - while (!isTerminated() && event != null) { - try { - ZeroByteFound = false; - event = ""; - while (!ZeroByteFound){ - CurrentByte = fDebugReader.read(); - if (CurrentByte == 0) { - ZeroByteFound = true; - try { - BytesToRead = Integer.parseInt(event); - } catch (NumberFormatException e) { - BytesToRead = 0; - } - } else { - event = event + (char)CurrentByte; - } - } - if (BytesToRead > 0) { - InputXML = ""; - for (int i = 0; i < BytesToRead; i++) { - CurrentByte = fDebugReader.read(); - InputXML = InputXML + (char)CurrentByte; - } - CurrentByte = fDebugReader.read(); // Das Null Byte nach dem String lesen. - try { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = factory.newDocumentBuilder(); - StringBufferInputStream InputXMLStream = new StringBufferInputStream(InputXML); - Document doc = builder.parse(InputXMLStream); - Node myNode = doc.getFirstChild(); - if (myNode.getNodeName() == "init") { - transaction_id = getAttributeValue(myNode, "appid"); - fileuri = getAttributeValue(myNode, "fileuri"); - fThread.setBreakpoints(null); - fThread.setStepping(false); - started(); - } else if (myNode.getNodeName() == "response") { - - } - - } catch (ParserConfigurationException e) { - - } catch (SAXException e) { - - } - } -/* - event = fDebugReader.readLine(); - if (event != null) { - fThread.setBreakpoints(null); - fThread.setStepping(false); - if (event.equals("started")) { - - } else if (event.equals("terminated")) { - terminated(); - } else if (event.startsWith("resumed")) { - if (event.endsWith("step")) { - fThread.setStepping(true); - resumed(DebugEvent.STEP_OVER); - } else if (event.endsWith("client")) { - resumed(DebugEvent.CLIENT_REQUEST); - } - } else if (event.startsWith("suspended")) { - if (event.endsWith("client")) { - suspended(DebugEvent.CLIENT_REQUEST); - } else if (event.endsWith("step")) { - suspended(DebugEvent.STEP_END); - } else if (event.indexOf("breakpoint") >= 0) { - breakpointHit(event); - } - } - } -*/ - } catch (IOException e) { - terminated(); - } - } - return Status.OK_STATUS; - } - - } - - /** - * Constructs a new debug target in the given launch for the - * associated PDA VM process. - * - * @param launch containing launch - * @param debugPort port to read events from - * @exception CoreException if unable to connect to host - */ - public XDebugTarget(ILaunch launch, int debugPort) throws CoreException { - super(null); - fLaunch = launch; - fTarget = this; - try { - fDebugServerSocket = new ServerSocket(debugPort); - fDebugSocket = fDebugServerSocket.accept(); - fDebugWriter = new OutputStreamWriter(fDebugSocket.getOutputStream(), "UTF8"); - fDebugReader = new BufferedReader(new InputStreamReader(fDebugSocket.getInputStream())); - - } catch (UnknownHostException e) { - abort("Unable to connect to PDA VM", e); - } catch (IOException e) { - abort("Unable to connect to PDA VM", e); - } - fThread = new XDebugThread(this); - fThreads = new IThread[] {fThread}; - fEventDispatch = new EventDispatchJob(); - fEventDispatch.schedule(); - DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDebugTarget#getProcess() - */ - public IProcess getProcess() { - return fProcess; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDebugTarget#getThreads() - */ - public IThread[] getThreads() throws DebugException { - return fThreads; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDebugTarget#hasThreads() - */ - public boolean hasThreads() throws DebugException { - return false; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDebugTarget#getName() - */ - public String getName() throws DebugException { - if (fName == null) { - fName = "XDebug Core"; - try { - fName = getLaunch().getLaunchConfiguration().getAttribute(IXDebugConstants.ATTR_XDEBUG_PROGRAM, "PDA VM"); - } catch (CoreException e) { - } - } - return fName; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDebugTarget#supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint) - */ - public boolean supportsBreakpoint(IBreakpoint breakpoint) { - if (breakpoint.getModelIdentifier().equals(PHPDebugCorePlugin.PLUGIN_ID)) { - /* Axel: Weiß nicht ob das wichtig ist. - try { - String program = getLaunch().getLaunchConfiguration().getAttribute(IXDebugConstants.ATTR_XDEBUG_PROGRAM, (String)null); - if (program != null) { - IMarker marker = breakpoint.getMarker(); - if (marker != null) { - IPath p = new Path(program); - return marker.getResource().getFullPath().equals(p); - } - } - } catch (CoreException e) { - } -*/ - return true; - } - return false; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget() - */ - public IDebugTarget getDebugTarget() { - return this; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDebugElement#getLaunch() - */ - public ILaunch getLaunch() { - return fLaunch; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#canTerminate() - */ - public boolean canTerminate() { -// return getProcess().canTerminate(); - return false; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#isTerminated() - */ - public boolean isTerminated() { -// return getProcess().isTerminated(); - return false; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#terminate() - */ - public void terminate() throws DebugException { - sendRequest ("stop -i " + transaction_id); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#canResume() - */ - public boolean canResume() { - return !isTerminated() && isSuspended(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() - */ - public boolean canSuspend() { - return !isTerminated() && !isSuspended(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() - */ - public boolean isSuspended() { - return fSuspended; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#resume() - */ - public void resume() throws DebugException { - sendRequest("run -i " + transaction_id); - } - - /** - * Notification the target has resumed for the given reason - * - * @param detail reason for the resume - */ - private void resumed(int detail) { - fSuspended = false; - fThread.fireResumeEvent(detail); - } - - /** - * Notification the target has suspended for the given reason - * - * @param detail reason for the suspend - */ - private void suspended(int detail) { - fSuspended = true; - fThread.fireSuspendEvent(detail); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#suspend() - */ - public void suspend() throws DebugException { - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.IBreakpointListener#breakpointAdded(org.eclipse.debug.core.model.IBreakpoint) - */ - public void breakpointAdded(IBreakpoint breakpoint) { - if (supportsBreakpoint(breakpoint)) { - try { - if (breakpoint.isEnabled()) { - try { - sendRequest("breakpoint_set -i " + transaction_id +" -t line -n " + (((ILineBreakpoint)breakpoint).getLineNumber() - 1)); - } catch (CoreException e) { - } - } - } catch (CoreException e) { - } - } - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.IBreakpointListener#breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta) - */ - public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) { - if (supportsBreakpoint(breakpoint)) { - try { - sendRequest("clear " + ((ILineBreakpoint)breakpoint).getLineNumber()); - } catch (CoreException e) { - } - } - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta) - */ - public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) { - if (supportsBreakpoint(breakpoint)) { - try { - if (breakpoint.isEnabled()) { - breakpointAdded(breakpoint); - } else { - breakpointRemoved(breakpoint, null); - } - } catch (CoreException e) { - } - } - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDisconnect#canDisconnect() - */ - public boolean canDisconnect() { - return false; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDisconnect#disconnect() - */ - public void disconnect() throws DebugException { - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IDisconnect#isDisconnected() - */ - public boolean isDisconnected() { - return false; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#supportsStorageRetrieval() - */ - public boolean supportsStorageRetrieval() { - return false; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long) - */ - public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException { - return null; - } - - /** - * Notification we have connected to the VM and it has started. - * Resume the VM. - */ - private void started() { - fireCreationEvent(); - installDeferredBreakpoints(); - try { - resume(); - } catch (DebugException e) { - } - } - - /** - * Install breakpoints that are already registered with the breakpoint - * manager. - */ - private void installDeferredBreakpoints() { - IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(PHPDebugCorePlugin.PLUGIN_ID); - for (int i = 0; i < breakpoints.length; i++) { - breakpointAdded(breakpoints[i]); - } - } - - /** - * Called when this debug target terminates. - */ - private void terminated() { - fTerminated = true; - fSuspended = false; - DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this); - fireTerminateEvent(); - } - - /** - * Returns the current stack frames in the target. - * - * @return the current stack frames in the target - * @throws DebugException if unable to perform the request - */ - protected IStackFrame[] getStackFrames() throws DebugException { - synchronized (fDebugSocket) { - sendRequest("stack -i " + transaction_id); - try { - String framesData = fDebugReader.readLine(); - if (framesData != null) { - String[] frames = framesData.split("#"); - IStackFrame[] theFrames = new IStackFrame[frames.length]; - for (int i = 0; i < frames.length; i++) { - String data = frames[i]; - theFrames[frames.length - i - 1] = new XDebugStackFrame(fThread, data, i); - } - return theFrames; - } - } catch (IOException e) { - abort("Unable to retrieve stack frames", e); - } - } - return new IStackFrame[0]; - } - - /** - * Single step the interpreter. - * - * @throws DebugException if the request fails - */ - protected void step() throws DebugException { - sendRequest("step_into -i " + transaction_id); - } - - /** - * Returns the current value of the given variable. - * - * @param variable - * @return variable value - * @throws DebugException if the request fails - */ - protected IValue getVariableValue(XDebugVariable variable) throws DebugException { - synchronized (fDebugSocket) { - sendRequest("var " + variable.getStackFrame().getIdentifier() + " " + variable.getName()); - try { - String value = fDebugReader.readLine(); - return new XDebugValue(this, value); - } catch (IOException e) { - abort(MessageFormat.format("Unable to retrieve value for variable {0}", new String[]{variable.getName()}), e); - } - } - return null; - } - - /** - * Returns the values on the data stack (top down) - * - * @return the values on the data stack (top down) - */ - public IValue[] getDataStack() throws DebugException { - synchronized (fDebugSocket) { - sendRequest ("data"); - try { - String valueString = fDebugReader.readLine(); - if (valueString != null && valueString.length() > 0) { - String[] values = valueString.split("\\|"); - IValue[] theValues = new IValue[values.length]; - for (int i = 0; i < values.length; i++) { - String value = values[values.length - i - 1]; - theValues[i] = new XDebugValue(this, value); - } - return theValues; - } - } catch (IOException e) { - abort("Unable to retrieve data stack", e); - } - } - return new IValue[0]; - } - - /** - * Sends a request to the PDA VM and waits for an OK. - * - * @param request debug command - * @throws DebugException if the request fails - */ - private void sendRequest(String request) throws DebugException { - synchronized (fDebugSocket) { - try { - fDebugWriter.write(request); - fDebugWriter.write(0); - fDebugWriter.flush(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - /** - * Notification a breakpoint was encountered. Determine - * which breakpoint was hit and fire a suspend event. - * - * @param event debug event - */ - private void breakpointHit(String event) { - // determine which breakpoint was hit, and set the thread's breakpoint - int lastSpace = event.lastIndexOf(' '); - if (lastSpace > 0) { - String line = event.substring(lastSpace + 1); - int lineNumber = Integer.parseInt(line); - IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(PHPDebugCorePlugin.PLUGIN_ID); - for (int i = 0; i < breakpoints.length; i++) { - IBreakpoint breakpoint = breakpoints[i]; - if (supportsBreakpoint(breakpoint)) { - if (breakpoint instanceof ILineBreakpoint) { - ILineBreakpoint lineBreakpoint = (ILineBreakpoint) breakpoint; - try { - if (lineBreakpoint.getLineNumber() == lineNumber) { - fThread.setBreakpoints(new IBreakpoint[]{breakpoint}); - break; - } - } catch (CoreException e) { - } - } - } - } - } - suspended(DebugEvent.BREAKPOINT); - } -} - diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugThread.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugThread.java deleted file mode 100644 index 6e5c4d9..0000000 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugThread.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Created on 23.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.core; - -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.core.model.IStackFrame; -import org.eclipse.debug.core.model.IThread; - -/** - * @author Axel - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class XDebugThread extends XDebugElement implements IThread { - - /** - * Breakpoints this thread is suspended at or null - * if none. - */ - private IBreakpoint[] fBreakpoints; - - /** - * Whether this thread is stepping - */ - private boolean fStepping = false; - - /** - * Constructs a new thread for the given target - * - * @param target VM - */ - public XDebugThread(XDebugTarget target) { - super(target); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IThread#getStackFrames() - */ - public IStackFrame[] getStackFrames() throws DebugException { - if (isSuspended()) { - return ((XDebugTarget)getDebugTarget()).getStackFrames(); - } else { - return new IStackFrame[0]; - } - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IThread#hasStackFrames() - */ - public boolean hasStackFrames() throws DebugException { - return isSuspended(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IThread#getPriority() - */ - public int getPriority() throws DebugException { - return 0; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IThread#getTopStackFrame() - */ - public IStackFrame getTopStackFrame() throws DebugException { - IStackFrame[] frames = getStackFrames(); - if (frames.length > 0) { - return frames[0]; - } - return null; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IThread#getName() - */ - public String getName() throws DebugException { - return "Thread[1]"; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IThread#getBreakpoints() - */ - public IBreakpoint[] getBreakpoints() { - if (fBreakpoints == null) { - return new IBreakpoint[0]; - } - return fBreakpoints; - } - /** - * Sets the breakpoints this thread is suspended at, or null - * if none. - * - * @param breakpoints the breakpoints this thread is suspended at, or null - * if none - */ - protected void setBreakpoints(IBreakpoint[] breakpoints) { - fBreakpoints = breakpoints; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#canResume() - */ - public boolean canResume() { - return isSuspended(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() - */ - public boolean canSuspend() { - return !isSuspended(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() - */ - public boolean isSuspended() { - return getDebugTarget().isSuspended(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#resume() - */ - public void resume() throws DebugException { - getDebugTarget().resume(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ISuspendResume#suspend() - */ - public void suspend() throws DebugException { - getDebugTarget().suspend(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#canStepInto() - */ - public boolean canStepInto() { - return false; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#canStepOver() - */ - public boolean canStepOver() { - return isSuspended(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#canStepReturn() - */ - public boolean canStepReturn() { - return false; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#isStepping() - */ - public boolean isStepping() { - return fStepping; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#stepInto() - */ - public void stepInto() throws DebugException { - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#stepOver() - */ - public void stepOver() throws DebugException { - ((XDebugTarget)getDebugTarget()).step(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IStep#stepReturn() - */ - public void stepReturn() throws DebugException { - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#canTerminate() - */ - public boolean canTerminate() { - return !isTerminated(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#isTerminated() - */ - public boolean isTerminated() { - return getDebugTarget().isTerminated(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.ITerminate#terminate() - */ - public void terminate() throws DebugException { - getDebugTarget().terminate(); - } - - /** - * Sets whether this thread is stepping - * - * @param stepping whether stepping - */ - protected void setStepping(boolean stepping) { - fStepping = stepping; - } -} diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugValue.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugValue.java deleted file mode 100644 index a7ea108..0000000 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugValue.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Created on 23.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.core; - -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IValue; -import org.eclipse.debug.core.model.IVariable; - -/** - * @author Axel - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class XDebugValue extends XDebugElement implements IValue { - - private String fValue; - - public XDebugValue(XDebugTarget target, String value) { - super(target); - fValue = value; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName() - */ - public String getReferenceTypeName() throws DebugException { - try { - Integer.parseInt(fValue); - } catch (NumberFormatException e) { - return "text"; - } - return "integer"; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValue#getValueString() - */ - public String getValueString() throws DebugException { - return fValue; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValue#isAllocated() - */ - public boolean isAllocated() throws DebugException { - return true; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValue#getVariables() - */ - public IVariable[] getVariables() throws DebugException { - return new IVariable[0]; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValue#hasVariables() - */ - public boolean hasVariables() throws DebugException { - return false; - } -} diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugVariable.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugVariable.java deleted file mode 100644 index 03d7dd0..0000000 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugVariable.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Created on 23.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.core; - -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IValue; -import org.eclipse.debug.core.model.IVariable; - -/** - * @author Axel - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class XDebugVariable extends XDebugElement implements IVariable { - - // name & stack frmae - private String fName; - private XDebugStackFrame fFrame; - - /** - * Constructs a variable contained in the given stack frame - * with the given name. - * - * @param frame owning stack frame - * @param name variable name - */ - public XDebugVariable(XDebugStackFrame frame, String name) { - super((XDebugTarget) frame.getDebugTarget()); - fFrame = frame; - fName = name; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IVariable#getValue() - */ - public IValue getValue() throws DebugException { - return ((XDebugTarget)getDebugTarget()).getVariableValue(this); - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IVariable#getName() - */ - public String getName() throws DebugException { - return fName; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName() - */ - public String getReferenceTypeName() throws DebugException { - // TODO Auto-generated method stub - return "Thing"; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IVariable#hasValueChanged() - */ - public boolean hasValueChanged() throws DebugException { - // TODO Auto-generated method stub - return false; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String) - */ - public void setValue(String expression) throws DebugException { - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue) - */ - public void setValue(IValue value) throws DebugException { - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValueModification#supportsValueModification() - */ - public boolean supportsValueModification() { - return false; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String) - */ - public boolean verifyValue(String expression) throws DebugException { - return false; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue) - */ - public boolean verifyValue(IValue value) throws DebugException { - return false; - } - - /** - * Returns the stack frame owning this variable. - * - * @return the stack frame owning this variable - */ - protected XDebugStackFrame getStackFrame() { - return fFrame; - } - -} diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugBreakpointAdapterFactory.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugBreakpointAdapterFactory.java deleted file mode 100644 index 1086ec5..0000000 --- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugBreakpointAdapterFactory.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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}; - } -} diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugLineBreakpointAdapter.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugLineBreakpointAdapter.java deleted file mode 100644 index 1bdcba0..0000000 --- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugLineBreakpointAdapter.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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 null if none. - * - * @param part workbench part - * @return the editor being used to edit a PDA file, associated with the - * given part, or null 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; - } -} diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugMainTab.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugMainTab.java deleted file mode 100644 index 66852a3..0000000 --- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugMainTab.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * 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); - } -} diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugModelPresentation.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugModelPresentation.java deleted file mode 100644 index ea5f50f..0000000 --- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugModelPresentation.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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; - } -} diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugTabGroup.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugTabGroup.java deleted file mode 100644 index f3c10b6..0000000 --- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugTabGroup.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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() - }); - } -}