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

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

Introduction

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

Prototype

Map<String, String> getTransferableOptions();

Source Link

Document

Options name-value string mapping.

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  w  ww . j a v a  2s. c o m
        }
        editorState.setTransferableOptions(options);
        editor.setState(editorState);
    }
}

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

License:Apache License

private static void saveCustomState(FileEditor editor) {
    final FileEditorState state = editor.getState(FileEditorStateLevel.FULL);
    if (state instanceof TransferableFileEditorState) {
        final TransferableFileEditorState editorState = (TransferableFileEditorState) state;
        final String id = editorState.getEditorId();
        final PropertiesComponent properties = PropertiesComponent.getInstance();
        final Map<String, String> options = editorState.getTransferableOptions();
        for (String key : options.keySet()) {
            properties.setValue(getKey(id, key), options.get(key));
        }//from  www  . j a  v a  2  s  .c  om
    }
}