add sourceLocaterProvider extension point
diff --git a/plugins/org.eclipse.datatools.sqltools.debugger.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.datatools.sqltools.debugger.core/META-INF/MANIFEST.MF
index 6c3ec0b..effabab 100644
--- a/plugins/org.eclipse.datatools.sqltools.debugger.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.datatools.sqltools.debugger.core/META-INF/MANIFEST.MF
@@ -23,5 +23,7 @@
  org.eclipse.datatools.sqltools.debugger.breakpoint,
  org.eclipse.datatools.sqltools.debugger.core,
  org.eclipse.datatools.sqltools.debugger.core.internal,
+ org.eclipse.datatools.sqltools.debugger.debug,
+ org.eclipse.datatools.sqltools.debugger.editorext,
  org.eclipse.datatools.sqltools.debugger.model
 Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/plugins/org.eclipse.datatools.sqltools.debugger.core/plugin.xml b/plugins/org.eclipse.datatools.sqltools.debugger.core/plugin.xml
index 8a73864..e018473 100644
--- a/plugins/org.eclipse.datatools.sqltools.debugger.core/plugin.xml
+++ b/plugins/org.eclipse.datatools.sqltools.debugger.core/plugin.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?eclipse version="3.0"?>
 <plugin>
+   <extension-point id="sourceLocatorProvider" name="Routine Source Locator Provider" schema="schema/sourceLocatorProvider.exsd"/>
 
    <extension
          id="org.eclipse.datatools.sqltools.deugger.editorext.SQLDebuggerDocumentProvider"
diff --git a/plugins/org.eclipse.datatools.sqltools.debugger.core/schema/sourceLocatorProvider.exsd b/plugins/org.eclipse.datatools.sqltools.debugger.core/schema/sourceLocatorProvider.exsd
new file mode 100644
index 0000000..56efa37
--- /dev/null
+++ b/plugins/org.eclipse.datatools.sqltools.debugger.core/schema/sourceLocatorProvider.exsd
@@ -0,0 +1,129 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.datatools.sqltools.debugger.core">
+<annotation>
+      <appInfo>
+         <meta.schema plugin="org.eclipse.datatools.sqltools.debugger.core" id="sourceLocatorProvider" name="Routine Source Locator Provider"/>
+      </appInfo>
+      <documentation>
+          This extension point gives the extender an opportunity to change the default source locator used by the sql debugger framework. e.g. clients may contribute a specific source locator and model presentation to open a multipage form editor instead of the standalone sql editor.
+
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <complexType>
+         <sequence>
+            <element ref="sourceLocator" minOccurs="0" maxOccurs="unbounded"/>
+         </sequence>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  a fully qualified identifier of the target extension point
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  an optional identifier of the extension instance
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  an optional name of the extension instance
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="sourceLocator">
+      <annotation>
+         <appInfo>
+            <meta.element labelAttribute="name"/>
+         </appInfo>
+      </annotation>
+      <complexType>
+         <attribute name="id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  specifies a unique identifier for this source locator provider.
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="class" type="string" use="required">
+            <annotation>
+               <documentation>
+                  specifies the fully qualified name of the Java class that implements &lt;code&gt;ISourceLocatorProvider&lt;/code&gt;.
+               </documentation>
+               <appInfo>
+                  <meta.attribute kind="java" basedOn="org.eclipse.datatools.sqltools.debugger.debug.ISourceLocatorProvider"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string" use="required">
+            <annotation>
+               <documentation>
+                  a human-readable name, describing the type of this source locator provider.
+               </documentation>
+               <appInfo>
+                  <meta.attribute translatable="true"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="examples"/>
+      </appInfo>
+      <documentation>
+         The following is an example of a source locator extension point:
+
+&lt;p&gt;
+&lt;pre&gt;
+ &lt;extension point=&quot;com.sybase.stf.dmp.sybcomponents.sourceLocatorProvider&quot;&gt;
+  &lt;sourceLocatorProvider
+   id=&quot;com.example.ExampleIdentifier&quot;
+   class=&quot;com.example.ExampleSourceLocatorProvider&quot;
+   name=&quot;Example Source Locator Provider&quot;&gt;
+  &lt;/sourceLocatorProvider&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+&lt;/p&gt;
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="apiInfo"/>
+      </appInfo>
+      <documentation>
+         Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;ISourceLocatorProvider&lt;/b&gt;.
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="copyright"/>
+      </appInfo>
+      <documentation>
+         /*******************************************************************************
+ * Copyright (c) 2004, 2005 Sybase, Inc. and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Sybase, Inc. - initial API and implementation
+ *******************************************************************************/
+      </documentation>
+   </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/core/internal/DebuggerCorePlugin.java b/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/core/internal/DebuggerCorePlugin.java
index 5543641..008be46 100644
--- a/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/core/internal/DebuggerCorePlugin.java
+++ b/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/core/internal/DebuggerCorePlugin.java
@@ -31,6 +31,8 @@
 
     private static final int INTERNAL_ERROR = 0;
     public static String PLUGIN_ID="org.eclipse.datatools.sqltools.debugger.core";
+    public static final String EXTENSION_POINT_SOURCE_LOCATORS= "sourceLocatorProvider";    //$NON-NLS-1$
+    
 	//The shared instance.
 	private static DebuggerCorePlugin plugin;
     private IDebugHandlerManager      _debugHandlerManager;
@@ -54,9 +56,9 @@
 	}
 
 	public void stop(BundleContext context) throws Exception {
-		super.stop(context);
 		plugin = null;
 		_debugHandlerManager.dispose();
+		super.stop(context);
 	}
 	/**
 	 * Returns the shared instance.
diff --git a/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/core/internal/DebuggerMessages.java b/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/core/internal/DebuggerMessages.java
index a98448d..9d45ad5 100644
--- a/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/core/internal/DebuggerMessages.java
+++ b/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/core/internal/DebuggerMessages.java
@@ -69,6 +69,7 @@
 	public static String SPLaunchConfigurationDelegate_AttachingConn;
 	public static String SPLaunchConfigurationDelegate_NoPermission;
 	public static String SPLaunchConfigurationDelegate_CreatingDebugger;
+	public static String SPLaunchConfigurationDelegate_Invalid_locator;
 	public static String perspective_DebuggerPerspective_activeWinNull1;
 	public static String perspective_DebuggerPerspective_activeWinNull2;
 	public static String perspective_DebuggerPerspective_changePerspectiveException;
diff --git a/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/core/internal/messages.properties b/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/core/internal/messages.properties
index d26ec73..c4a7cd6 100644
--- a/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/core/internal/messages.properties
+++ b/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/core/internal/messages.properties
@@ -49,6 +49,7 @@
 SPLaunchConfigurationDelegate_AttachingConn=Attaching to connection
 SPLaunchConfigurationDelegate_NoPermission=Cannot debug. Maybe you do not have enough permission.
 SPLaunchConfigurationDelegate_CreatingDebugger=Creating debugger
+SPLaunchConfigurationDelegate_Invalid_locator=Invalid source locator extension defined by plug-in \"{0}\": \"id\" not specified.
 
 
 perspective_DebuggerPerspective_activeWinNull1=Failed to change perspective, as the active window could not be retrieved
diff --git a/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/debug/ISourceLocatorProvider.java b/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/debug/ISourceLocatorProvider.java
new file mode 100644
index 0000000..0c60510
--- /dev/null
+++ b/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/debug/ISourceLocatorProvider.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005 Sybase, Inc. and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Sybase, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.datatools.sqltools.debugger.debug;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.IPersistableSourceLocator;
+
+/**
+ * This interface gives the extender an opportunity to change the default source locator used
+ * by the sql debugger framework. e.g. clients may contribute a specific source locator and
+ * model presentation to open a multipage form editor instead of the standalone sql editor.
+ * @author Hui Cao
+ * 
+ */
+public interface ISourceLocatorProvider
+{
+
+    /**
+     * Returns an <code>ISourceLocator</code> object based on the configuration. Returns null if the configuration is
+     * not supported. To open the source in a particular editor, let the source locator object implement
+     * ISourcePresentation as well.
+     * 
+     * @param configuration
+     * @return
+     */
+    public IPersistableSourceLocator getSourceLocator(ILaunchConfiguration configuration);
+}
diff --git a/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/model/SPDebugModelUtil.java b/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/model/SPDebugModelUtil.java
index f70089c..d3badba 100644
--- a/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/model/SPDebugModelUtil.java
+++ b/plugins/org.eclipse.datatools.sqltools.debugger.core/src/org/eclipse/datatools/sqltools/debugger/model/SPDebugModelUtil.java
@@ -18,16 +18,18 @@
 import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.resources.IMarkerDelta;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.datatools.connectivity.sqm.core.definition.DatabaseDefinition;
 import org.eclipse.datatools.sqltools.core.ProcIdentifier;
 import org.eclipse.datatools.sqltools.core.ProcIdentifierImpl;
-import org.eclipse.datatools.sqltools.core.profile.ProfileUtil;
 import org.eclipse.datatools.sqltools.debugger.breakpoint.SPLineBreakpoint;
 import org.eclipse.datatools.sqltools.debugger.core.internal.DebuggerCorePlugin;
 import org.eclipse.datatools.sqltools.routineeditor.RoutineAnnotationModel;
+import org.eclipse.debug.core.DebugException;
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.IBreakpointManager;
+import org.eclipse.debug.core.ILaunchManager;
 import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IStackFrame;
 
 /**
  * Utility class to process routine debug model objects.
@@ -291,4 +293,45 @@
             }
         }
     }
+    
+    public static boolean isProcInDebugging(ProcIdentifier procid)
+    {
+        if (procid == null)
+        {
+            return false;
+        }
+        ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
+        IDebugTarget[] targets = manager.getDebugTargets();
+        for (int i = 0; i < targets.length; i++)
+        {
+            if (targets[i] instanceof SPDebugTarget)
+            {
+                SPThread thread = ((SPDebugTarget)targets[i]).getSPThread();
+                if (thread == null)
+                {
+                    continue;
+                }
+                IStackFrame[] frames;
+                try
+                {
+                    frames = thread.getStackFrames();
+                    for (int j = 0; j < frames.length; j++)
+                    {
+                        if (frames[j] instanceof SPStackFrame)
+                        {
+                            ProcIdentifier debugProc = ((SPStackFrame)frames[j]).getProcIdentifier();
+                            if (procid.equalsByServer(debugProc))
+                            {
+                                return true;
+                            }
+                        }
+                    }
+                }
+                catch (DebugException e)
+                {
+                }
+            }
+        }
+        return false;
+    }
 }