\r
import java.net.URL;\r
\r
+import org.eclipse.core.resources.IResource;\r
+import org.eclipse.core.runtime.CoreException;\r
+import org.eclipse.debug.core.DebugEvent;\r
+import org.eclipse.debug.core.DebugPlugin;\r
+import org.eclipse.debug.core.IDebugEventSetListener;\r
+import org.eclipse.debug.core.ILaunch;\r
+import org.eclipse.debug.core.model.IProcess;\r
import org.eclipse.jface.resource.ImageDescriptor;\r
import org.eclipse.jface.resource.ImageRegistry;\r
import org.eclipse.swt.graphics.Image;\r
public void start(BundleContext context) throws Exception {\r
super.start(context);\r
plugin = this;\r
+ DebugPlugin.getDefault()\r
+ .addDebugEventListener(new DebugEventListener());\r
}\r
\r
@Override\r
}\r
return image;\r
}\r
+\r
+ protected static class DebugEventListener implements IDebugEventSetListener {\r
+ public void handleDebugEvents(DebugEvent[] events) {\r
+ for (int i = 0; i < events.length; i++) {\r
+ DebugEvent event = events[i];\r
+ Object source = event.getSource();\r
+ if (source instanceof IProcess\r
+ && event.getKind() == DebugEvent.TERMINATE) {\r
+ IProcess process = (IProcess) source;\r
+ ILaunch launch = process.getLaunch();\r
+ if (launch != null) {\r
+ refreshOsgiBootLaunch(launch);\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ protected void refreshOsgiBootLaunch(ILaunch launch) {\r
+ try {\r
+ IResource[] resources = launch.getLaunchConfiguration()\r
+ .getMappedResources();\r
+ if (resources.length > 0) {\r
+ IResource propertiesFile = resources[0];\r
+ propertiesFile.getParent().refreshLocal(\r
+ IResource.DEPTH_INFINITE, null);\r
+// System.out.println("Refreshed "\r
+// + propertiesFile.getParent());\r
+ }\r
+ } catch (CoreException e) {\r
+ e.printStackTrace();\r
+ }\r
+\r
+ }\r
+\r
+ }\r
+\r
}\r