protected void reveal(ITextEditor textEditor) { if (fRange != null) { textEditor.selectAndReveal(fRange.getOffset(), fRange.getLength()); } }
/** * Restores this location. */ @Override public void restoreLocation() { if (fPosition == null || fPosition.isDeleted) return; IEditorPart part= getEditorPart(); if (part instanceof ITextEditor) { ITextEditor editor= (ITextEditor) getEditorPart(); editor.selectAndReveal(fPosition.offset, fPosition.length); } }
/** * Restores this location. */ public void restoreLocation() { if (fPosition == null || fPosition.isDeleted) return; IEditorPart part= getEditorPart(); if (part instanceof ITextEditor) { ITextEditor editor= (ITextEditor) getEditorPart(); editor.selectAndReveal(fPosition.offset, fPosition.length); } }
/** * Restores this location. */ @Override public void restoreLocation() { if (fPosition == null || fPosition.isDeleted) return; IEditorPart part= getEditorPart(); if (part instanceof ITextEditor) { ITextEditor editor= (ITextEditor) getEditorPart(); editor.selectAndReveal(fPosition.offset, fPosition.length); } }
protected void showMatch(Match match, int offset, int length, boolean activate) throws PartInitException { IFile file= (IFile) match.getElement(); IEditorPart editor= fEditorOpener.open(file, activate); if (offset != 0 && length != 0) { if (editor instanceof ITextEditor) { ITextEditor textEditor= (ITextEditor) editor; textEditor.selectAndReveal(offset, length); } else if (editor != null) { showWithMarker(editor, file, offset, length); } } }
public static ITextEditor selectAndReveal(IMember member) throws CoreException { IEditorPart part = JavaUI.openInEditor(member); ITextEditor editor = TextEditorUtils.toTextEditor(part); ISourceRange range = member.getNameRange(); editor.selectAndReveal(range.getOffset(), 0); return editor; } }
public void annotationDefaultSelected(VerticalRulerEvent event) { Annotation a= event.getSelectedAnnotation(); IAnnotationModel model= getAnnotationModel(); Position position= model.getPosition(a); if (position == null) return; getTextEditor().selectAndReveal(position.offset, position.length); }
@Override protected void showMatch(Match match, int currentOffset, int currentLength, boolean activate) throws PartInitException { IEditorPart editor= fEditorOpener.openMatch(match); if (editor != null && activate) editor.getEditorSite().getPage().activate(editor); if (editor instanceof ITextEditor) { ITextEditor textEditor= (ITextEditor) editor; textEditor.selectAndReveal(currentOffset, currentLength); } }
@Override protected void showMatch(Match match, int currentOffset, int currentLength, boolean activate) throws PartInitException { IEditorPart editor= fEditorOpener.openMatch(match); if (editor != null && activate) editor.getEditorSite().getPage().activate(editor); if (editor instanceof ITextEditor) { ITextEditor textEditor= (ITextEditor) editor; textEditor.selectAndReveal(currentOffset, currentLength); } }
@Override public void annotationDefaultSelected(VerticalRulerEvent event) { Annotation a= event.getSelectedAnnotation(); IAnnotationModel model= getAnnotationModel(); Position position= model.getPosition(a); if (position == null) return; getTextEditor().selectAndReveal(position.offset, position.length); }
@Override public void annotationDefaultSelected(VerticalRulerEvent event) { Annotation a= event.getSelectedAnnotation(); IAnnotationModel model= getAnnotationModel(); Position position= model.getPosition(a); if (position == null) return; getTextEditor().selectAndReveal(position.offset, position.length); }
IEditorPart openEditor11; String filePath = "file path" ; final IFile inputFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(Path.fromOSString(filePath)); if (inputFile != null) { IWorkbenchPage page1 = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); openEditor11 = IDE.openEditor(page1, inputFile); } int Line = 20; if (openEditor11 instanceof ITextEditor) { ITextEditor textEditor = (ITextEditor) openEditor ; IDocument document= textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); textEditor.selectAndReveal(document.getLineOffset(Line - 1), document.getLineLength(Line-1)); }
private void revealLine(ITextEditor editor, int lineNumber) throws BadLocationException { IDocument document= editor.getDocumentProvider().getDocument(editor.getEditorInput()); IRegion region= document.getLineInformation(lineNumber - 1); editor.selectAndReveal(region.getOffset(), 0); }
private void revealLine(ITextEditor editor, int lineNumber) throws BadLocationException { IDocument document= editor.getDocumentProvider().getDocument(editor.getEditorInput()); IRegion region= document.getLineInformation(lineNumber - 1); editor.selectAndReveal(region.getOffset(), 0); }
private void revealLine(ITextEditor editor, int lineNumber) throws BadLocationException { IDocument document= editor.getDocumentProvider().getDocument(editor.getEditorInput()); IRegion region= document.getLineInformation(lineNumber - 1); editor.selectAndReveal(region.getOffset(), 0); }
protected void reveal(ITextEditor textEditor) { if (fLineNumber >= 0) { try { IDocument document= textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); textEditor.selectAndReveal(document.getLineOffset(fLineNumber-1), document.getLineLength(fLineNumber-1)); } catch (BadLocationException x) { // marker refers to invalid text position -> do nothing } } }
protected void showMatch(Match match, int currentOffset, int currentLength, boolean activate) throws PartInitException { try { IEditorPart editor= fEditorOpener.openMatch(match); if (editor != null && activate) editor.getEditorSite().getPage().activate(editor); if (editor instanceof ITextEditor) { ITextEditor textEditor= (ITextEditor) editor; textEditor.selectAndReveal(currentOffset, currentLength); } } catch (JavaModelException e1) { throw new PartInitException(e1.getStatus()); } }
@Override public void runWithEvent(Event event) { if (fIsEditable) { ITextOperationTarget operation = fTextEditor.getAdapter(ITextOperationTarget.class); final int opCode = ISourceViewer.QUICK_ASSIST; if (operation != null && operation.canDoOperation(opCode)) { fTextEditor.selectAndReveal(fPosition.getOffset(), fPosition.getLength()); operation.doOperation(opCode); } return; } super.run(); }
public EndStatementCodeMining(Statement node, ITextEditor textEditor, ITextViewer viewer, int minLineNumber, ICodeMiningProvider provider) { super(new Position(node.getStartPosition() + node.getLength(), 1), provider, e -> { textEditor.selectAndReveal(node.getStartPosition(), 0); }); String label = getLabel(node, viewer.getDocument(), minLineNumber); super.setLabel(label); }
public static void jumpToLocation(CallLocation callLocation) { try { IEditorPart methodEditor = JavaUI.openInEditor(callLocation.getMember(), false, false); if (methodEditor instanceof ITextEditor) { ITextEditor editor = (ITextEditor) methodEditor; editor.selectAndReveal(callLocation.getStart(), (callLocation.getEnd() - callLocation.getStart())); } } catch (JavaModelException e) { JavaPlugin.log(e); } catch (PartInitException e) { JavaPlugin.log(e); } }