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

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

Introduction

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

Prototype

String getEditorId();

Source Link

Document

Returns unique editor ID

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  w  w  . j  ava2  s.  co 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 w  ww . j a va 2s  .co m*/
    }
}