Java Code Examples for org.eclipse.search.ui.NewSearchUI#reuseEditor()

The following examples show how to use org.eclipse.search.ui.NewSearchUI#reuseEditor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditorOpener.java    From typescript.java with MIT License 8 votes vote down vote up
public IEditorPart openAndSelect(IWorkbenchPage wbPage, IFile file, int offset, int length, boolean activate) throws PartInitException {
	String editorId= null;
	IEditorDescriptor desc= IDE.getEditorDescriptor(file);
	if (desc == null || !desc.isInternal()) {
		editorId= "org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
	} else {
		editorId= desc.getId();
	}

	IEditorPart editor;
	if (NewSearchUI.reuseEditor()) {
		editor= showWithReuse(file, wbPage, editorId, activate);
	} else {
		editor= showWithoutReuse(file, wbPage, editorId, activate);
	}

	if (editor instanceof ITextEditor) {
		ITextEditor textEditor= (ITextEditor) editor;
		textEditor.selectAndReveal(offset, length);
	} else if (editor != null) {
		showWithMarker(editor, file, offset, length);
	}
	return editor;
}
 
Example 2
Source File: EditorOpener.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
public IEditorPart openAndSelect(IWorkbenchPage wbPage, IFile file, int offset, int length, boolean activate)
        throws PartInitException {
    String editorId = null;
    IEditorDescriptor desc = IDE.getEditorDescriptor(file);
    if (desc == null || !desc.isInternal()) {
        editorId = "org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
    } else {
        editorId = desc.getId();
    }

    IEditorPart editor;
    if (NewSearchUI.reuseEditor()) {
        editor = showWithReuse(file, wbPage, editorId, activate);
    } else {
        editor = showWithoutReuse(file, wbPage, editorId, activate);
    }

    if (editor instanceof ITextEditor) {
        ITextEditor textEditor = (ITextEditor) editor;
        textEditor.selectAndReveal(offset, length);
    } else if (editor != null) {
        showWithMarker(editor, file, offset, length);
    }
    return editor;
}
 
Example 3
Source File: JavaSearchEditorOpener.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public IEditorPart openElement(Object element) throws PartInitException {
	IWorkbenchPage wbPage= JavaPlugin.getActivePage();
	IEditorPart editor;
	if (NewSearchUI.reuseEditor())
		editor= showWithReuse(element, wbPage);
	else
		editor= showWithoutReuse(element);

	if (element instanceof IJavaElement)
		EditorUtility.revealInEditor(editor, (IJavaElement) element);

	return editor;
}
 
Example 4
Source File: EditorOpener.java    From typescript.java with MIT License 4 votes vote down vote up
public IEditorPart open(IWorkbenchPage wbPage, IFile file, boolean activate) throws PartInitException {
	if (NewSearchUI.reuseEditor())
		return showWithReuse(file, wbPage, getEditorID(file), activate);
	return showWithoutReuse(file, wbPage, getEditorID(file), activate);
}
 
Example 5
Source File: EditorOpener.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
public IEditorPart open(IWorkbenchPage wbPage, IFile file, boolean activate) throws PartInitException {
    if (NewSearchUI.reuseEditor()) {
        return showWithReuse(file, wbPage, getEditorID(file), activate);
    }
    return showWithoutReuse(file, wbPage, getEditorID(file), activate);
}