Search in sources :

Example 1 with ActionUsagePanel

use of com.intellij.codeInsight.intention.impl.config.ActionUsagePanel in project intellij-community by JetBrains.

the class PostfixDescriptionPanel method initializeExamplePanel.

private void initializeExamplePanel(@NotNull JPanel panel) {
    panel.setLayout(new BorderLayout());
    ActionUsagePanel actionUsagePanel = new ActionUsagePanel();
    panel.add(actionUsagePanel);
    Disposer.register(this, actionUsagePanel);
}
Also used : ActionUsagePanel(com.intellij.codeInsight.intention.impl.config.ActionUsagePanel)

Example 2 with ActionUsagePanel

use of com.intellij.codeInsight.intention.impl.config.ActionUsagePanel in project intellij-community by JetBrains.

the class PostfixDescriptionPanel method showUsages.

private static void showUsages(@NotNull JPanel panel, @Nullable TextDescriptor exampleUsage) {
    String text = "";
    FileType fileType = PlainTextFileType.INSTANCE;
    if (exampleUsage != null) {
        try {
            text = exampleUsage.getText();
            String name = exampleUsage.getFileName();
            FileTypeManagerEx fileTypeManager = FileTypeManagerEx.getInstanceEx();
            String extension = fileTypeManager.getExtension(name);
            fileType = fileTypeManager.getFileTypeByExtension(extension);
        } catch (IOException e) {
            LOG.error(e);
        }
    }
    ((ActionUsagePanel) panel.getComponent(0)).reset(text, fileType);
    panel.repaint();
}
Also used : FileTypeManagerEx(com.intellij.openapi.fileTypes.ex.FileTypeManagerEx) PlainTextFileType(com.intellij.openapi.fileTypes.PlainTextFileType) FileType(com.intellij.openapi.fileTypes.FileType) ActionUsagePanel(com.intellij.codeInsight.intention.impl.config.ActionUsagePanel) IOException(java.io.IOException)

Aggregations

ActionUsagePanel (com.intellij.codeInsight.intention.impl.config.ActionUsagePanel)2 FileType (com.intellij.openapi.fileTypes.FileType)1 PlainTextFileType (com.intellij.openapi.fileTypes.PlainTextFileType)1 FileTypeManagerEx (com.intellij.openapi.fileTypes.ex.FileTypeManagerEx)1 IOException (java.io.IOException)1