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 } }
@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); } }
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 } }
@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); } }