@Override public void setFocus() { innerEditors[activeEditorIndex].setFocus(); }
public void setMaximizedEditor(IEditorPart part) { if (part != null) { Composite c = (Composite) _editorToComposite.get(part); if (c != null && _sashForm != null && !_sashForm.isDisposed()) { _sashForm.setMaximizedControl(c); part.setFocus(); } } else { if (_sashForm != null && !_sashForm.isDisposed()) { _sashForm.setMaximizedControl(null); } } } }
@Override public void run(IMarker[] markers, IProgressMonitor monitor) { if (markers.length == 1) { run(markers[0]); return; } if (!(fProposal instanceof FixCorrectionProposal)) return; if (monitor == null) monitor= new NullProgressMonitor(); try { MultiFixTarget[] problems= getCleanUpTargets(markers); ((FixCorrectionProposal)fProposal).resolve(problems, monitor); IEditorPart part= EditorUtility.isOpenInEditor(fCompilationUnit); if (part instanceof ITextEditor) { ((ITextEditor) part).selectAndReveal(fOffset, fLength); part.setFocus(); } } catch (CoreException e) { JavaPlugin.log(e); } finally { monitor.done(); } }
if (part instanceof ITextEditor) { ((ITextEditor) part).selectAndReveal(fOffset, fLength); part.setFocus();
/** * Sets focus to the control for the given page. If the page has an editor, * this calls its <code>setFocus()</code> method. Otherwise, this calls * <code>setFocus</code> on the control for the page. * * @param pageIndex * the index of the page */ private void setFocus(int pageIndex) { if (pageIndex < 0 || pageIndex >= getPageCount()) { // page index out of bounds, don't set focus. return; } final IEditorPart editor = getEditor(pageIndex); if (editor != null) { editor.setFocus(); } else { // Give the page's control focus. final Control control = getControl(pageIndex); if (control != null) { control.setFocus(); } } }
@Override public void run(IMarker[] markers, IProgressMonitor monitor) { if (markers.length == 1) { run(markers[0]); return; } if (!(fProposal instanceof FixCorrectionProposal) && !(fProposal instanceof CreatePackageInfoWithDefaultNullnessProposal)) return; if (monitor == null) monitor= new NullProgressMonitor(); try { MultiFixTarget[] problems= getCleanUpTargets(markers); if (fProposal instanceof CreatePackageInfoWithDefaultNullnessProposal) { ((CreatePackageInfoWithDefaultNullnessProposal) fProposal).resolve(problems, monitor); return; } ((FixCorrectionProposal)fProposal).resolve(problems, monitor); IEditorPart part= EditorUtility.isOpenInEditor(fCompilationUnit); if (part instanceof ITextEditor) { ((ITextEditor) part).selectAndReveal(fOffset, fLength); part.setFocus(); } } catch (CoreException e) { JavaPlugin.log(e); } finally { monitor.done(); } }
@Override public void apply(org.eclipse.jface.text.IDocument document) { super.apply(document); IEditorPart part= null; if (fUnit.getResource().exists()) { part= EditorUtility.isOpenInEditor(fUnit); if (part == null) { try { part= JavaUI.openInEditor(fUnit); } catch (PartInitException | JavaModelException e) { return; } } IWorkbenchPage page= JavaPlugin.getActivePage(); if (page != null && part != null) { page.bringToTop(part); } if (part != null) { part.setFocus(); } } }
public void apply(IDocument document) { try { ICompilationUnit unit= getCompilationUnit(); IEditorPart part= null; if (unit.getResource().exists()) { boolean canEdit= performValidateEdit(unit); if (!canEdit) { return; } part= EditorUtility.isOpenInEditor(unit); if (part == null) { part= JavaUI.openInEditor(unit); if (part != null) { document= JavaUI.getDocumentProvider().getDocument(part.getEditorInput()); } } IWorkbenchPage page= JavaPlugin.getActivePage(); if (page != null && part != null) { page.bringToTop(part); } if (part != null) { part.setFocus(); } } performChange(part, document); } catch (CoreException e) { ExceptionHandler.handle(e, CorrectionMessages.CUCorrectionProposal_error_title, CorrectionMessages.CUCorrectionProposal_error_message); } }