How to incorporate default image editor into a custom image editor implementation?



I'm trying to implement a custom image editor which can display a single image (or two images side-by-side) similar to how the Git image diffing works, but in a simpler way, without the Git features.

It would also have a pagination feature with which screenshots (in an E2E test automation framework) with the same name but different contexts could be viewed in a single editor.

I tried to use org.intellij.images.editor.impl.ImageEditorUI, org.intellij.images.editor.impl.ImageFileEditorImpl and related classes, so that I don't have to reinvent the wheel for image display, proper scaling, toolbar actions, etc., however I had no luck using any of them, partially due to these classes are package private.


Do you have any suggestion/recommendation how I could embed the standard/default image editor into a custom editor, and extend it with extra functionality?

Comment actions Permalink

This code is not really meant for re-use, but you can use the editor "as-is" via org.intellij.images.editor.impl.ImageEditorManagerImpl#createImageEditorUI or org.intellij.images.editor.impl.ImageEditorImpl#ImageEditorImpl(com.intellij.openapi.project.Project, com.intellij.openapi.vfs.VirtualFile, boolean) with isEmbedded=true to disable some components.

Comment actions Permalink

Thanks much Yann, I will look into them.


Please sign in to leave a comment.