1 11 package org.eclipse.pde.internal.ui.editor.text; 12 13 import org.eclipse.core.resources.IResource; 14 import org.eclipse.jdt.core.IPackageFragment; 15 import org.eclipse.jdt.ui.JavaUI; 16 import org.eclipse.jdt.ui.actions.ShowInPackageViewAction; 17 import org.eclipse.jface.text.IRegion; 18 import org.eclipse.pde.internal.core.text.bundle.BasePackageHeader; 19 import org.eclipse.pde.internal.core.util.PDEJavaHelper; 20 import org.eclipse.pde.internal.ui.PDEPlugin; 21 import org.eclipse.ui.IViewPart; 22 import org.eclipse.ui.PartInitException; 23 24 public class PackageHyperlink extends ManifestElementHyperlink { 25 26 BasePackageHeader fHeader; 27 28 public PackageHyperlink(IRegion region, String pack, BasePackageHeader header) { 29 super(region, pack); 30 fHeader = header; 31 } 32 33 protected void open2() { 34 IResource res = fHeader.getBundle().getModel().getUnderlyingResource(); 35 if (res == null) 36 return; 37 IPackageFragment frag = PDEJavaHelper.getPackageFragment(fElement, null, res.getProject()); 38 if (frag == null) 39 return; 40 try { 41 IViewPart part = PDEPlugin.getActivePage().showView(JavaUI.ID_PACKAGES); 42 ShowInPackageViewAction action = new ShowInPackageViewAction(part.getSite()); 43 action.run(frag); 44 } catch (PartInitException e) { 45 PDEPlugin.logException(e); 46 } 47 } 48 49 } 50 | Popular Tags |