Java 类com.intellij.openapi.vfs.encoding.ChangeFileEncodingAction 实例源码

项目:intellij-ce-playground    文件:EncodingPanel.java   
private void showPopup(@NotNull MouseEvent e) {
  if (!actionEnabled) {
    return;
  }
  DataContext dataContext = getContext();
  ListPopup popup = new ChangeFileEncodingAction().createPopup(dataContext);

  if (popup != null) {
    Dimension dimension = popup.getContent().getPreferredSize();
    Point at = new Point(0, -dimension.height);
    popup.show(new RelativePoint(e.getComponent(), at));
    Disposer.register(this, popup); // destroy popup on unexpected project close
  }
}
项目:intellij-ce-playground    文件:LossyEncodingInspection.java   
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
  PsiFile psiFile = descriptor.getPsiElement().getContainingFile();
  VirtualFile virtualFile = psiFile.getVirtualFile();

  Editor editor = PsiUtilBase.findEditor(psiFile);
  DataContext dataContext = createDataContext(editor, editor == null ? null : editor.getComponent(), virtualFile, project);
  ListPopup popup = new ChangeFileEncodingAction().createPopup(dataContext);
  if (popup != null) {
    popup.showInBestPositionFor(dataContext);
  }
}
项目:tools-idea    文件:EncodingPanel.java   
private void showPopup(@NotNull MouseEvent e) {
  if (!actionEnabled) {
    return;
  }
  DataContext dataContext = getContext();
  ListPopup popup = new ChangeFileEncodingAction().createPopup(dataContext);

  if (popup != null) {
    Dimension dimension = popup.getContent().getPreferredSize();
    Point at = new Point(0, -dimension.height);
    popup.show(new RelativePoint(e.getComponent(), at));
    Disposer.register(this, popup); // destroy popup on unexpected project close
  }
}
项目:tools-idea    文件:LossyEncodingInspection.java   
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
  PsiFile psiFile = descriptor.getPsiElement().getContainingFile();
  VirtualFile virtualFile = psiFile.getVirtualFile();

  Editor editor = PsiUtilBase.findEditor(psiFile);
  DataContext dataContext = createDataContext(editor, editor == null ? null : editor.getComponent(), virtualFile, project);
  ListPopup popup = new ChangeFileEncodingAction().createPopup(dataContext);
  if (popup != null) {
    popup.showInBestPositionFor(dataContext);
  }
}
项目:consulo    文件:EncodingPanel.java   
private void showPopup(@Nonnull MouseEvent e) {
  if (!actionEnabled) {
    return;
  }
  DataContext dataContext = getContext();
  ListPopup popup = new ChangeFileEncodingAction().createPopup(dataContext);

  if (popup != null) {
    Dimension dimension = popup.getContent().getPreferredSize();
    Point at = new Point(0, -dimension.height);
    popup.show(new RelativePoint(e.getComponent(), at));
    Disposer.register(this, popup); // destroy popup on unexpected project close
  }
}
项目:consulo    文件:LossyEncodingInspection.java   
@Override
public void applyFix(@Nonnull Project project, @Nonnull ProblemDescriptor descriptor) {
  PsiFile psiFile = descriptor.getPsiElement().getContainingFile();
  VirtualFile virtualFile = psiFile.getVirtualFile();

  Editor editor = PsiUtilBase.findEditor(psiFile);
  DataContext dataContext = createDataContext(editor, editor == null ? null : editor.getComponent(), virtualFile, project);
  ListPopup popup = new ChangeFileEncodingAction().createPopup(dataContext);
  if (popup != null) {
    popup.showInBestPositionFor(dataContext);
  }
}