if (activate) {
page.activate(editor);
}
return editor;
}
IEditorReference reusedEditorRef = fReusedEditor;
if (reusedEditorRef != null) {
boolean isOpen = reusedEditorRef.getEditor(false) != null;
boolean canBeReused = isOpen && !reusedEditorRef.isDirty() && !reusedEditorRef.isPinned();
if (canBeReused) {
boolean showsSameInputType = reusedEditorRef.getId().equals(editorId);
if (!showsSameInputType) {
page.closeEditors(new IEditorReference[] { reusedEditorRef }, false);
fReusedEditor = null;
} else {
editor = reusedEditorRef.getEditor(true);
if (editor instanceof IReusableEditor) {
((IReusableEditor) editor).setInput(input);
page.bringToTop(editor);
if (activate) {
page.activate(editor);
}
return editor;
}
}
}
}
editor = page.openEditor(input, editorId, activate);
if (editor instanceof IReusableEditor) {
IEditorReference reference = (IEditorReference) page.getReference(editor);
fReusedEditor = reference;
} else {
fReusedEditor = null;
}
return editor;