@Override public void open() { if (fResource == null) return; IResource resource = processAbsolutePathes(); if (resource == null) { if (fElement.indexOf("$nl$/") == 0) //$NON-NLS-1$ fElement = fElement.substring(5); resource = fResource.getProject().findMember(fElement); } try { if (resource instanceof IFile) { IDE.openEditor(PDEPlugin.getActivePage(), (IFile) resource, true); } else if (resource != null) { IPackagesViewPart part = (IPackagesViewPart) PDEPlugin.getActivePage().showView(JavaUI.ID_PACKAGES); part.selectAndReveal(resource); } else { Display.getDefault().beep(); } } catch (PartInitException e) { PDEPlugin.logException(e); } }
/** * @see org.eclipse.ui.IWorkbenchPart#setFocus() */ public void setFocus() { // AMC -added this method to catch user switching between multiple open // files // in the editor - used to trigger a structured selection event, but now // triggers a TextSelection event. TextSelection event does not give AJP // enouhg info to determine project, so have to do from here instead. IEditorInput input = getEditorInput(); super.setFocus(); // Sian: Added the code below to fix bug 77479 - link with editor does not work for .aj files if(isEditingAjFile) { IViewPart view = getEditorSite().getPage().findView(JavaUI.ID_PACKAGES); if(view != null) { IPackagesViewPart packageExplorer = (IPackagesViewPart)view; if(packageExplorer.isLinkingEnabled()) { IFileEditorInput fInput = (IFileEditorInput) input; AJCompilationUnit ajc = AJCompilationUnitManager.INSTANCE.getAJCompilationUnit(fInput.getFile()); if (ajc != null) { packageExplorer.selectAndReveal(ajc); } } } } }