Support of non-text editor in Scratches

Answered

It looks like that the embedded scratches plugin works improperly with file types requiring custom editor. I am author of the IDEA-MIND-MAP plugin (https://plugins.jetbrains.com/plugin/8045-idea-mind-map) and a customer reported me that he sees text editor instead of graphics editor during scratch file edit
https://github.com/raydac/netbeans-mmd-plugin/issues/61
if support of scratches needs any refactoring or adding of extra support, please provide any link to examples or documentation, I couldn't find anything about it

0
2 comments

Hello Igor,

The problem with scratch files support is caused because the `accept` method in `MindMapDocumentEditorProvider` checks the VFS fileType - so it works for the real files:

https://github.com/raydac/netbeans-mmd-plugin/blob/master/mind-map/idea-mindmap/src/com/igormaznitsa/ideamindmap/editor/MindMapDocumentEditorProvider.java#L34

When creating a scratch file, its type is `ScratchFileType` and doesn't directly reveal its real type. To get this information, you have to use ScratchFileService:

ScratchFileService.getInstance().getScratchesMapping().getMapping(virtualFile) instanceof MMLanguage

Keep in mind that this service has been introduced in IntelliJ SDK 173.

1

Hello Jakub!
Thank you very much for help! it works!

0

Please sign in to leave a comment.