Search in sources :

Example 1 with ChangeFileEncodingAction

use of com.intellij.openapi.vfs.encoding.ChangeFileEncodingAction in project intellij-community by JetBrains.

the class EncodingPanel method showPopup.

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));
        // destroy popup on unexpected project close
        Disposer.register(this, popup);
    }
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) SimpleDataContext(com.intellij.openapi.actionSystem.impl.SimpleDataContext) ListPopup(com.intellij.openapi.ui.popup.ListPopup) ChangeFileEncodingAction(com.intellij.openapi.vfs.encoding.ChangeFileEncodingAction) RelativePoint(com.intellij.ui.awt.RelativePoint) RelativePoint(com.intellij.ui.awt.RelativePoint)

Aggregations

DataContext (com.intellij.openapi.actionSystem.DataContext)1 SimpleDataContext (com.intellij.openapi.actionSystem.impl.SimpleDataContext)1 ListPopup (com.intellij.openapi.ui.popup.ListPopup)1 ChangeFileEncodingAction (com.intellij.openapi.vfs.encoding.ChangeFileEncodingAction)1 RelativePoint (com.intellij.ui.awt.RelativePoint)1