*** empty log message ***
diff --git a/bundles/org.eclipse.wst.xsl.launching/src/org/eclipse/wst/xsl/internal/launching/XSLTLaunchConfigurationDelegate.java b/bundles/org.eclipse.wst.xsl.launching/src/org/eclipse/wst/xsl/internal/launching/XSLTLaunchConfigurationDelegate.java
index 261d75f..6ba8f25 100644
--- a/bundles/org.eclipse.wst.xsl.launching/src/org/eclipse/wst/xsl/internal/launching/XSLTLaunchConfigurationDelegate.java
+++ b/bundles/org.eclipse.wst.xsl.launching/src/org/eclipse/wst/xsl/internal/launching/XSLTLaunchConfigurationDelegate.java
@@ -21,10 +21,14 @@
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
+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.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@@ -38,7 +42,6 @@
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.IProcess;
import org.eclipse.debug.core.model.ISourceLocator;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.jdt.launching.IVMRunner;
@@ -62,6 +65,78 @@
{
private String mode;
private LaunchHelper launchHelper;
+
+ private class XSLDebugEventSetListener implements IDebugEventSetListener
+ {
+ private ILaunch launch;
+
+ public XSLDebugEventSetListener(ILaunch launch)
+ {
+ this.launch = launch;
+ }
+
+ public void handleDebugEvents(DebugEvent[] events)
+ {
+ for (DebugEvent debugEvent : events)
+ {
+ if (debugEvent.getSource() == launch.getProcesses()[0] && debugEvent.getKind() == DebugEvent.TERMINATE)
+ {
+ // remove self as listener
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ File file = launchHelper.getTarget();
+ IFile ifile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(file.getAbsolutePath()));
+ if (ifile != null)
+ {// refresh this workspace file..
+ try
+ {
+ ifile.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor(){
+ @Override
+ public void done()
+ {
+ openFileIfRequired();
+ }
+ });
+ }
+ catch (CoreException e)
+ {
+ LaunchingPlugin.log(e);
+ }
+ }
+ else
+ {
+ openFileIfRequired();
+ }
+ }
+ }
+ }
+
+ private void openFileIfRequired()
+ {
+ // TODO this is dirty - need to declare extension point and move the UI code into the UI plugin
+ if (launchHelper.getOpenFileOnCompletion())
+ {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ // Open editor on new file.
+ IWorkbenchWindow dw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ try
+ {
+ File file = launchHelper.getTarget();
+ Path path = new Path(file.getAbsolutePath());
+ IFileStore filestore = EFS.getLocalFileSystem().getStore(path);
+ IDE.openEditorOnFileStore(dw.getActivePage(), filestore);
+ }
+ catch (PartInitException e)
+ {
+ LaunchingPlugin.log(e);
+ }
+ }
+ });
+ }
+ }
+ }
@Override
public synchronized void launch(ILaunchConfiguration configuration, final String mode, final ILaunch launch, IProgressMonitor monitor) throws CoreException
@@ -69,52 +144,7 @@
this.mode = mode;
launchHelper = new LaunchHelper(configuration);
launchHelper.save(getLaunchConfigFile());
- DebugPlugin.getDefault().addDebugEventListener(new IDebugEventSetListener()
- {
-
- public void handleDebugEvents(DebugEvent[] events)
- {
- if (launch.getProcesses().length == 1)
- {
- IProcess process = launch.getProcesses()[0];
- for (DebugEvent debugEvent : events)
- {
- if (debugEvent.getSource() == process)
- {
- if (debugEvent.getKind() == DebugEvent.TERMINATE)
- {
- // remove self as listener
- DebugPlugin.getDefault().removeDebugEventListener(this);
- // TODO this is dirty - need to declare extension point and move the UI code into the UI plugin
- if (launchHelper.getOpenFileOnCompletion())
- {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- // Open editor on new file.
- IWorkbenchWindow dw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- try
- {
- File file = launchHelper.getTarget();
- Path path = new Path(file.getAbsolutePath());
- IFileStore filestore = EFS.getLocalFileSystem().getStore(path);
- IDE.openEditorOnFileStore(dw.getActivePage(), filestore);
- }
- catch (PartInitException e)
- {
- LaunchingPlugin.log(e);
- }
- }
- });
- }
- }
- }
- }
- }
- }
-
- });
+ DebugPlugin.getDefault().addDebugEventListener(new XSLDebugEventSetListener(launch));
// the super.launch will add a Java source director if we set it to null here
final ISourceLocator configuredLocator = launch.getSourceLocator();
diff --git a/bundles/org.eclipse.wst.xsl.launching/src/org/eclipse/wst/xsl/launching/model/XSLDebugTarget.java b/bundles/org.eclipse.wst.xsl.launching/src/org/eclipse/wst/xsl/launching/model/XSLDebugTarget.java
index 72eff17..b9906c4 100644
--- a/bundles/org.eclipse.wst.xsl.launching/src/org/eclipse/wst/xsl/launching/model/XSLDebugTarget.java
+++ b/bundles/org.eclipse.wst.xsl.launching/src/org/eclipse/wst/xsl/launching/model/XSLDebugTarget.java
@@ -84,7 +84,7 @@
this.requestSocket = attemptConnect(launchHelper.getRequestPort());
this.eventSocket = attemptConnect(launchHelper.getEventPort());
- if (requestSocket != null && eventSocket != null)
+ if (!process.isTerminated())
{
try
{
@@ -100,7 +100,7 @@
this.threads = new IThread[]{ thread };
this.eventDispatch = new EventDispatchJob();
this.eventDispatch.schedule();
-
+
DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this);
}
}
@@ -147,7 +147,7 @@
public boolean hasThreads() throws DebugException
{
- return threads.length > 0;
+ return threads != null && threads.length > 0;
}
public String getName() throws DebugException