本文整理汇总了Java中com.intellij.openapi.vfs.encoding.EncodingManager.getDefaultCharset方法的典型用法代码示例。如果您正苦于以下问题:Java EncodingManager.getDefaultCharset方法的具体用法?Java EncodingManager.getDefaultCharset怎么用?Java EncodingManager.getDefaultCharset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vfs.encoding.EncodingManager
的用法示例。
在下文中一共展示了EncodingManager.getDefaultCharset方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCharset
import com.intellij.openapi.vfs.encoding.EncodingManager; //导入方法依赖的package包/类
@Override
public Charset getCharset(Project project) {
// try to find existing virtual file
VirtualFile virtualFile = getVirtualFile();
VirtualFile existing = virtualFile != null && virtualFile.isValid() ? virtualFile : null;
if (existing == null) {
LocalFileSystem lfs = LocalFileSystem.getInstance();
for (File f = myFile; f != null; f = f.getParentFile()) {
existing = lfs.findFileByIoFile(f);
if (existing != null && existing.isValid()) {
break;
}
}
}
if (existing != null) {
Charset rc = existing.getCharset();
if (rc != null) {
return rc;
}
}
EncodingManager e = project != null ? EncodingProjectManager.getInstance(project) : null;
if (e == null) {
e = EncodingManager.getInstance();
}
return e.getDefaultCharset();
}
示例2: getCharset
import com.intellij.openapi.vfs.encoding.EncodingManager; //导入方法依赖的package包/类
@Override
public Charset getCharset(Project project) {
// try to find existing virtual file
VirtualFile existing = myVirtualFile != null && myVirtualFile.isValid() ? myVirtualFile : null;
if (existing == null) {
LocalFileSystem lfs = LocalFileSystem.getInstance();
for (File f = myFile; f != null; f = f.getParentFile()) {
existing = lfs.findFileByIoFile(f);
if (existing != null && existing.isValid()) {
break;
}
}
}
if (existing != null) {
Charset rc = existing.getCharset();
if (rc != null) {
return rc;
}
}
EncodingManager e = project != null ? EncodingProjectManager.getInstance(project) : null;
if (e == null) {
e = EncodingManager.getInstance();
}
return e.getDefaultCharset();
}
示例3: getCharset
import com.intellij.openapi.vfs.encoding.EncodingManager; //导入方法依赖的package包/类
@Override
@NotNull
public Charset getCharset(@Nullable Project project) {
VirtualFile file = getVirtualFile();
String path = myPath;
while ((file == null || !file.isValid()) && !path.isEmpty()) {
path = PathUtil.getParentPath(path);
file = LocalFileSystem.getInstance().findFileByPath(path);
}
if (file != null) {
return file.getCharset();
}
EncodingManager e = project == null ? EncodingManager.getInstance() : EncodingProjectManager.getInstance(project);
return e.getDefaultCharset();
}
示例4: getCharset
import com.intellij.openapi.vfs.encoding.EncodingManager; //导入方法依赖的package包/类
@Override
@Nonnull
public Charset getCharset(@Nullable Project project) {
VirtualFile file = getVirtualFile();
String path = myPath;
while ((file == null || !file.isValid()) && !path.isEmpty()) {
path = PathUtil.getParentPath(path);
file = LocalFileSystem.getInstance().findFileByPath(path);
}
if (file != null) {
return file.getCharset();
}
EncodingManager e = project == null ? EncodingManager.getInstance() : EncodingProjectManager.getInstance(project);
return e.getDefaultCharset();
}
示例5: getCharset
import com.intellij.openapi.vfs.encoding.EncodingManager; //导入方法依赖的package包/类
@NotNull
@Override
public Charset getCharset(@Nullable Project project) {
EncodingManager em = project == null ? EncodingManager.getInstance() : EncodingProjectManager.getInstance(project);
return em.getDefaultCharset();
}
示例6: getCharset
import com.intellij.openapi.vfs.encoding.EncodingManager; //导入方法依赖的package包/类
@Nonnull
@Override
public Charset getCharset(@Nullable Project project) {
EncodingManager em = project == null ? EncodingManager.getInstance() : EncodingProjectManager.getInstance(project);
return em.getDefaultCharset();
}