• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Camelcade / Perl5-IDEA / #525521576

05 Jun 2025 06:17AM UTC coverage: 82.298% (-0.02%) from 82.318%
#525521576

push

github

hurricup
Localized strings and improved annotations

26 of 41 new or added lines in 19 files covered. (63.41%)

22 existing lines in 6 files now uncovered.

30837 of 37470 relevant lines covered (82.3%)

0.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

24.14
/plugin/core/src/main/java/com/perl5/lang/perl/util/PerlConfigurationUtil.java
1
/*
2
 * Copyright 2015-2025 Alexandr Evstigneev
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.perl5.lang.perl.util;
18

19
import com.intellij.openapi.fileTypes.*;
20
import com.intellij.openapi.ui.popup.JBPopupFactory;
21
import com.intellij.openapi.ui.popup.PopupStep;
22
import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
23
import com.intellij.ui.AnActionButton;
24
import com.intellij.ui.AnActionButtonRunnable;
25
import com.intellij.ui.CollectionListModel;
26
import com.intellij.ui.ToolbarDecorator;
27
import com.intellij.ui.components.JBList;
28
import com.intellij.util.ui.JBUI;
29
import com.perl5.PerlBundle;
30
import org.jetbrains.annotations.NotNull;
31

32
import javax.swing.*;
33
import java.util.ArrayList;
34
import java.util.List;
35
import java.util.Objects;
36

37

38
public class PerlConfigurationUtil {
×
39
  public static final int WIDGET_HEIGHT = 90;
40

41
  public static JPanel createSubstituteExtensionPanel(final @NotNull CollectionListModel<String> substitutedExtensionsModel,
42
                                                      final @NotNull JBList<String> substitutedExtensionsList
43
  ) {
44
    return ToolbarDecorator
1✔
45
      .createDecorator(substitutedExtensionsList)
1✔
46
      .setAddAction(new AnActionButtonRunnable() {
1✔
47
        @Override
48
        public void run(AnActionButton anActionButton) {
49
          FileTypeManager fileTypeManager = FileTypeManager.getInstance();
×
50
          final List<String> currentItems = substitutedExtensionsModel.getItems();
×
51
          List<FileNameMatcher> possibleItems = new ArrayList<>();
×
52
          List<Icon> itemsIcons = new ArrayList<>();
×
53

54
          for (FileType fileType : fileTypeManager.getRegisteredFileTypes()) {
×
55
            if (fileType instanceof LanguageFileType) {
×
56
              for (FileNameMatcher matcher : fileTypeManager.getAssociations(fileType)) {
×
57
                if (matcher instanceof ExtensionFileNameMatcher) {
×
58
                  String presentableString = matcher.getPresentableString();
×
59
                  if (!currentItems.contains(presentableString)) {
×
60
                    possibleItems.add(matcher);
×
61
                    itemsIcons.add(fileType.getIcon());
×
62
                  }
63
                }
64
              }
×
65
            }
66
          }
67

68
          BaseListPopupStep<FileNameMatcher> fileNameMatcherBaseListPopupStep =
×
NEW
69
            new BaseListPopupStep<>(PerlBundle.message("popup.title.select.extension"), possibleItems, itemsIcons) {
×
70
              @Override
71
              public PopupStep<?> onChosen(FileNameMatcher selectedValue, boolean finalChoice) {
72
                substitutedExtensionsModel.add(selectedValue.getPresentableString());
×
73
                //noinspection unchecked
74
                return super.onChosen(selectedValue, finalChoice);
×
75
              }
76
            };
77

78
          JBPopupFactory.getInstance()
×
79
            .createListPopup(fileNameMatcherBaseListPopupStep)
×
80
            .show(Objects.requireNonNull(anActionButton.getPreferredPopupPoint()));
×
81
        }
×
82
      })
83
      .disableDownAction()
1✔
84
      .disableUpAction()
1✔
85
      .setPreferredSize(JBUI.size(0, PerlConfigurationUtil.WIDGET_HEIGHT))
1✔
86
      .createPanel();
1✔
87
  }
88
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc