/*
 * Copyright 2000-2014 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.core;

import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.encoding.EncodingRegistry;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.nio.charset.Charset;

/**
 * @author yole
 */
public class CoreEncodingRegistry extends EncodingRegistry {
  @Override
  public boolean isNative2Ascii(@NotNull VirtualFile virtualFile) {
    return false;
  }

  @NotNull
  @Override
  public Charset getDefaultCharset() {
    return CharsetToolkit.getDefaultSystemCharset();
  }

  @Override
  public Charset getEncoding(@Nullable VirtualFile virtualFile, boolean useParentDefaults) {
    return getDefaultCharset();
  }

  @Override
  public boolean isUseUTFGuessing(VirtualFile virtualFile) {
    return true;
  }

  @Override
  public void setEncoding(@Nullable VirtualFile virtualFileOrDir, @Nullable Charset charset) {
  }

  @Override
  public boolean isNative2AsciiForPropertiesFiles() {
    return false;
  }
}

@@ -618,24 +618,109 @@
 llij.core;%0A%0A
+import com.intellij.openapi.Disposable;%0Aimport com.intellij.openapi.editor.Document;%0A
 import com.i
@@ -849,24 +849,23 @@
 Encoding
-Registry
+Manager
 ;%0Aimport
@@ -960,27 +960,128 @@
 ava.
-nio.charset.Charset
+beans.PropertyChangeListener;%0Aimport java.nio.charset.Charset;%0Aimport java.util.Collection;%0Aimport java.util.Collections
 ;%0A%0A/
@@ -1153,24 +1153,23 @@
 Encoding
-Registry
+Manager
  %7B%0A  @Ov
@@ -1822,11 +1822,1010 @@
 lse;%0A  %7D
+%0A%0A  @NotNull%0A  @Override%0A  public Collection%3CCharset%3E getFavorites() %7B%0A    return Collections.singletonList(CharsetToolkit.UTF8_CHARSET);%0A  %7D%0A%0A  @Override%0A  public void setNative2AsciiForPropertiesFiles(VirtualFile virtualFile, boolean native2Ascii) %7B%0A%0A  %7D%0A%0A  @NotNull%0A  @Override%0A  public String getDefaultCharsetName() %7B%0A    return getDefaultCharset().name();%0A  %7D%0A%0A  @Nullable%0A  @Override%0A  public Charset getDefaultCharsetForPropertiesFiles(@Nullable VirtualFile virtualFile) %7B%0A    return null;%0A  %7D%0A%0A  @Override%0A  public void setDefaultCharsetForPropertiesFiles(@Nullable VirtualFile virtualFile, @Nullable Charset charset) %7B%0A%0A  %7D%0A%0A  @Override%0A  public void addPropertyChangeListener(@NotNull PropertyChangeListener listener, @NotNull Disposable parentDisposable) %7B%0A%0A  %7D%0A%0A  @Override%0A  public void removePropertyChangeListener(@NotNull PropertyChangeListener listener) %7B%0A%0A  %7D%0A%0A  @Nullable%0A  @Override%0A  public Charset getCachedCharsetFromContent(@NotNull Document document) %7B%0A    return null;%0A  %7D
 %0A%7D%0A

implement EncodingManager for Upsource