public void init(IWorkbench workbench, IStructuredSelection s) { this.selection = s; if (this.selection.isEmpty()) { return; } PlatformObject po = (PlatformObject) selection.getFirstElement(); IResource res = (IResource) po.getAdapter(IResource.class); try { root = MercurialTeamProvider.getHgRoot(res); if (root != null) { this.page = new BundleRepoPage( "bundleRepoPage", "Export Mercurial Repository as Bundle", null, root); initPage(page.getDescription(), page); addPage(page); outgoingPage = new OutgoingPage("outgoingPage"); initPage(outgoingPage.getDescription(), outgoingPage); addPage(outgoingPage); } else { throw new HgException("Could not find a Mercurial repository for export."); } } catch (HgException e) { MercurialEclipsePlugin.logError(e); MercurialEclipsePlugin.showError(e); } }