Example usage for com.intellij.openapi.fileEditor TransferableFileEditorState setTransferableOptions

List of usage examples for com.intellij.openapi.fileEditor TransferableFileEditorState setTransferableOptions

Introduction

In this page you can find the example usage for com.intellij.openapi.fileEditor TransferableFileEditorState setTransferableOptions.

Prototype

void setTransferableOptions(Map<String, String> options);

Source Link

Document

Applies options to the editor

Usage

From source file:com.intellij.ide.diff.VirtualFileDiffElement.java

License:Apache License

private static void setCustomState(FileEditor editor) {
    final FileEditorState state = editor.getState(FileEditorStateLevel.FULL);
    if (state instanceof TransferableFileEditorState) {
        final TransferableFileEditorState editorState = (TransferableFileEditorState) state;
        final String id = editorState.getEditorId();
        final HashMap<String, String> options = new HashMap<String, String>();
        final PropertiesComponent properties = PropertiesComponent.getInstance();
        for (String key : editorState.getTransferableOptions().keySet()) {
            final String value = properties.getValue(getKey(id, key));
            if (value != null) {
                options.put(key, value);
            }/*from  ww w .  j a  v a 2s  . c o m*/
        }
        editorState.setTransferableOptions(options);
        editor.setState(editorState);
    }
}