use of com.android.tools.idea.editors.hprof.HprofEditor in project android by JetBrains.
the class HprofEditorFixture method findByFileName.
@NotNull
public static HprofEditorFixture findByFileName(@NotNull Robot robot, @NotNull final IdeFrameFixture frame, @NotNull final String hprofFileName) {
HprofEditor hprofEditor = GuiQuery.getNonNull(() -> {
FileEditor[] openEditors = null;
FileEditorManagerImpl fileEditorManager = (FileEditorManagerImpl) FileEditorManager.getInstance(frame.getProject());
for (EditorsSplitters splitters : fileEditorManager.getAllSplitters()) {
for (EditorWindow window : splitters.getWindows()) {
for (EditorWithProviderComposite editorWithProviderComposite : window.getEditors()) {
if (editorWithProviderComposite.getFile().getName().endsWith(hprofFileName)) {
if (openEditors != null) {
throw new ComponentLookupException(String.format("More than one Hprof editor for file '%s' found", hprofFileName));
}
openEditors = editorWithProviderComposite.getEditors();
}
}
}
}
if (openEditors == null) {
throw new ComponentLookupException(String.format("Cannot find any open Hprof editors for file '%s'", hprofFileName));
}
HprofEditor targetEditor = null;
for (FileEditor editor : openEditors) {
if (editor instanceof HprofEditor) {
if (targetEditor != null) {
throw new ComponentLookupException(String.format("More than one Hprof editor pane for file '%s' found", hprofFileName));
} else {
targetEditor = (HprofEditor) editor;
}
}
}
return targetEditor;
});
return new HprofEditorFixture(robot, frame, hprofEditor);
}
Aggregations