private void openLocal(IWorkbenchPage activePage, LapgSourceStructure model, ITmaNode resolved) throws PartInitException { TmaIdentifier identifier = null; if (resolved instanceof TmaNonterm) { identifier = ((TmaNonterm) resolved).getName(); } else if (resolved instanceof TmaLexeme) { identifier = ((TmaLexeme) resolved).getName(); } int start = resolved.getOffset(); fEditor.reveal( start, identifier != null ? identifier.getOffset() : start, identifier != null ? identifier.getEndoffset() : start, resolved.getEndoffset()); }
public void open() { if (fModel == null) { return; } try { IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (activeWorkbenchWindow == null) { return; } IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage(); if (activePage == null) { return; } String symbolName = getName(); TmaInput root = fModel.getAst().getRoot(); ITmaNode resolved = searchInRoot(root, symbolName); if (resolved == null) { return; } if (resolved.getSource() == fModel.getAst().getSource()) { openLocal(activePage, fModel, resolved); } else { // TODO // activePage.getNavigationHistory().markLocation(activePage.getActiveEditor()); // if (open(activePage, fModel, resolved)) { // activePage.getNavigationHistory().markLocation(activePage.getActiveEditor()); // } } } catch (PartInitException e) { // ignored } }