Providing a Browser View
Finally, it would be nice that when we double click on any of the entries that we could view the video within Eclipse.
There are three stages to this - providing a view, implementing a browser instance and finding the view through a double click action.
To provide the view, rather than using templates again, we just need to create a new instance of the org.eclipse.ui.views extension point in the Plugin Manifest Editor.
Eclipse provides a Browser class which renders HTML using the default browser on your machine. In our generated view, we can just create a browser instance in the createPartControl method.
browser = new Browser(parent, SWT.NONE);
We also need to add a method in the view to set the URL of the browser
public void setURL(String url)
As you can see, it's quite easy to do all of this. A double-click action was provided when we created the view from the template. We just need to alter the run method to find the browser view and pass through the URL of the selected item in the results table.
ISelection selection = viewer.getSelection();
VideoEntry video = (VideoEntry)((IStructuredSelection)selection).getFirstElement();
//open a browser window for this item
IViewReference views = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
for(int i = 0; i < views.length; i++)
IViewReference ref = views[i];
catch (WorkbenchException e)
The result of these few lines of code is quite satisfying - a browser view will open up within Eclipse to play the video.
This article shows how much you can do with the Plugin Development Environment in Eclipse. There's a learning curve involved, as you get used to creating views and actions through the plugin manifest, but it's very rewarding to see the end product.
The best way to learn is by practice. Try implementing the plugin described in this article, and let me know of any extra functionality that you add to it.