how to open editor on IDE restart

Hi

I have created editor with own FileEditorProvider.

For the same i have implemented readstate and getState.

public class CustomViewProvider implements FileEditorProvider, ApplicationComponent{

public FileEditorState readState(@NotNull Element element, @NotNull Project project, @NotNull VirtualFile virtualFile) {
     return FileEditorState.INSTANCE;
}

......
}

and

public class CustomEditor implements FileEditor {

@NotNull
    @Override
    public FileEditorState getState(@NotNull FileEditorStateLevel fileEditorStateLevel) {

        return FileEditorState.INSTANCE;
    }

........
}


Please help me help  implementation of opening the editors ( unclosed editors ) on restarting the IDE.

4 comments
Comment actions Permalink

You need to make sure that your VirtualFileSystem correctly implements the findFileByPath() method matching the getPath() implementation of your VirtualFile.

0
Comment actions Permalink

Thanks Dmitry

After implementing findFileByPath() and getPath() values same, findFileByPath() method is called on restarting IDE but editors are not opening.

Do i have to implement any other method in virtualFile or VirtualFileSystem which helps IDE to open Editor at startup.

Please help for the same.

0
Comment actions Permalink

Please try adding "implements DumbAware" to your FIleEditorProvider implementation class.


0
Comment actions Permalink

Thank you Dmitry.

After adding "implements DumbAware" to FIleEditorProvider implementation class.

Unclosed Editors are started to open on IDE restart.

0

Please sign in to leave a comment.