}
// Phase 2: check materialized editors (without their own matching
// strategy)
for (Iterator i = editorList.iterator(); i.hasNext();) {
IEditorReference editor = (IEditorReference) i.next();
IEditorPart part = (IEditorPart) editor.getPart(false);
if (part != null) {
i.remove(); // We're handling this one here, so remove it from
// the list.
if (part.getEditorInput() != null
&& part.getEditorInput().equals(input)) {
result.add(editor);
}
}
}
// Phase 3: check unmaterialized editors for input equality,
// delaying plug-in activation further by only restoring the editor
// input
// if the editor reference's factory id and name match.
String name = input.getName();
IPersistableElement persistable = input.getPersistable();
if (name == null || persistable == null) {
return;
}
String id = persistable.getFactoryId();
if (id == null) {
return;
}
for (Iterator i = editorList.iterator(); i.hasNext();) {
EditorReference editor = (EditorReference) i.next();
if (name.equals(editor.getName())
&& id.equals(editor.getFactoryId())) {
IEditorInput restoredInput;
try {
restoredInput = editor.getEditorInput();
if (Util.equals(restoredInput, input)) {
result.add(editor);
}
} catch (PartInitException e1) {
WorkbenchPlugin.log(e1);