final IEditorInput input = new FileEditorInput(file);
// try to find an open editor with this input
IEditorPart part = page.findEditor(input);
if (part != null) {
// found one, activate it
page.activate(part);
} else {
// no editor found, open a new one
final String editorId = getEditorIdForFile(file);
part = page.openEditor(input, editorId);
}