1919
2020import java .util .HashMap ;
2121import java .util .Map ;
22+ import java .util .regex .Pattern ;
2223
2324import org .eclipse .help .IContext ;
2425import org .eclipse .jface .action .Action ;
2526import org .eclipse .jface .action .ToolBarManager ;
2627import org .eclipse .jface .dialogs .PopupDialog ;
2728import org .eclipse .osgi .util .NLS ;
29+ import org .eclipse .pde .internal .core .util .ManifestUtils ;
2830import org .eclipse .pde .internal .runtime .PDERuntimeMessages ;
2931import org .eclipse .pde .internal .runtime .PDERuntimePlugin ;
3032import org .eclipse .pde .internal .runtime .PDERuntimePluginImages ;
4143import org .eclipse .swt .graphics .Image ;
4244import org .eclipse .swt .graphics .ImageData ;
4345import org .eclipse .swt .graphics .ImageLoader ;
46+ import org .eclipse .swt .program .Program ;
4447import org .eclipse .swt .widgets .Composite ;
4548import org .eclipse .swt .widgets .Display ;
4649import org .eclipse .swt .widgets .FileDialog ;
4750import org .eclipse .swt .widgets .Menu ;
4851import org .eclipse .swt .widgets .MenuItem ;
4952import org .eclipse .swt .widgets .ToolBar ;
5053import org .eclipse .swt .widgets .Widget ;
54+ import org .eclipse .ui .IWorkbenchPart ;
5155import org .eclipse .ui .forms .events .HyperlinkAdapter ;
5256import org .eclipse .ui .forms .events .HyperlinkEvent ;
5357import org .eclipse .ui .forms .widgets .FormText ;
@@ -62,6 +66,8 @@ public class SpyFormToolkit extends FormToolkit {
6266
6367 private static final String BUNDLE_PROTOCOL_PREFIX = "bundle://" ; //$NON-NLS-1$
6468
69+ private static final Pattern URL_PATTERN = Pattern .compile ("https?://\\ S+" ); //$NON-NLS-1$
70+
6571 private class SpyHyperlinkAdapter extends HyperlinkAdapter {
6672
6773 private final PopupDialog fDialog ;
@@ -82,6 +88,8 @@ public void linkActivated(HyperlinkEvent e) {
8288 String bundle = href .substring (BUNDLE_PROTOCOL_PREFIX .length ());
8389 SpyIDEUtil .openBundleManifest (bundle );
8490 fDialog .close ();
91+ } else if (URL_PATTERN .matcher (href ).matches ()) {
92+ Program .launch (href );
8593 }
8694 }
8795 }
@@ -269,8 +277,18 @@ private void createClassReference(StringBuilder buffer, Class<?> clazz) {
269277 }
270278
271279 // TODO refactor me, I'm ugly
272- public void generatePluginDetailsText (Bundle bundle , String objectId , String objectType , StringBuilder buffer , FormText text ) {
280+ @ SuppressWarnings ("restriction" )
281+ public void generatePluginDetailsText (Bundle bundle , IWorkbenchPart part , String objectType , StringBuilder buffer ,
282+ FormText text ) {
273283 if (bundle != null ) {
284+ String objectId = null ;
285+ String srcRef ;
286+ if (part != null ) {
287+ objectId = part .getSite ().getId ();
288+ srcRef = ManifestUtils .getSourceReferences (FrameworkUtil .getBundle (part .getClass ()));
289+ } else {
290+ srcRef = ManifestUtils .getSourceReferences (bundle );
291+ }
274292 String version = (bundle .getHeaders ().get (org .osgi .framework .Constants .BUNDLE_VERSION ));
275293
276294 buffer .append ("<p>" ); //$NON-NLS-1$
@@ -292,6 +310,23 @@ public void generatePluginDetailsText(Bundle bundle, String objectId, String obj
292310 }
293311 buffer .append ("</li>" ); //$NON-NLS-1$
294312
313+ if (srcRef != null ) {
314+ buffer .append ("<p>" ); //$NON-NLS-1$
315+ buffer .append (PDERuntimeMessages .SpyDialog_sourceRepository );
316+ buffer .append ("</p>" ); //$NON-NLS-1$
317+ buffer .append ("<li bindent=\" 20\" style=\" image\" value=\" menu\" >" ); //$NON-NLS-1$
318+ if (PDERuntimePlugin .HAS_IDE_BUNDLES ) {
319+ buffer .append ("<a href=\" " ); //$NON-NLS-1$
320+ buffer .append (srcRef );
321+ buffer .append ("\" >" ); //$NON-NLS-1$
322+ }
323+ buffer .append (srcRef );
324+ if (PDERuntimePlugin .HAS_IDE_BUNDLES ) {
325+ buffer .append ("</a>" ); //$NON-NLS-1$
326+ }
327+ buffer .append ("</li>" ); //$NON-NLS-1$
328+ }
329+
295330 Image pluginImage = PDERuntimePluginImages .get (PDERuntimePluginImages .IMG_PLUGIN_OBJ );
296331 text .setImage ("plugin" , pluginImage ); //$NON-NLS-1$
297332
0 commit comments