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

Camelcade / Perl5-IDEA / #525521642

22 Jul 2025 01:00PM UTC coverage: 82.312% (+0.008%) from 82.304%
#525521642

push

github

hurricup
#2842 Split Template Toolkit plugin

23 of 42 new or added lines in 5 files covered. (54.76%)

55 existing lines in 10 files now uncovered.

30975 of 37631 relevant lines covered (82.31%)

0.82 hits per line

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

66.67
/tt2/common/src/main/java/com/perl5/lang/tt2/idea/settings/TemplateToolkitSettings.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.tt2.idea.settings;
18

19
import com.intellij.openapi.application.ApplicationManager;
20
import com.intellij.openapi.application.WriteAction;
21
import com.intellij.openapi.components.PersistentStateComponent;
22
import com.intellij.openapi.components.State;
23
import com.intellij.openapi.components.Storage;
24
import com.intellij.openapi.project.Project;
25
import com.intellij.openapi.project.RootsChangeRescanningInfo;
26
import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
27
import com.intellij.openapi.util.EmptyRunnable;
28
import com.intellij.util.messages.Topic;
29
import com.intellij.util.xmlb.XmlSerializerUtil;
30
import com.intellij.util.xmlb.annotations.Transient;
31
import com.perl5.lang.perl.idea.PerlPathMacros;
32
import org.jetbrains.annotations.NotNull;
33
import org.jetbrains.annotations.Nullable;
34

35
import java.util.ArrayList;
36
import java.util.List;
37
import java.util.Objects;
38

39

40
@State(
41
  name = "TemplateToolkitSettings",
42
  storages = @Storage(PerlPathMacros.PERL5_PROJECT_SHARED_SETTINGS_FILE)
43
)
44
public class TemplateToolkitSettings implements PersistentStateComponent<TemplateToolkitSettings> {
45
  public static final Topic<SettingsListener> TT2_SETTINGS_TOPIC =
1✔
46
    Topic.create("TT2 settings topiec", SettingsListener.class, Topic.BroadcastDirection.NONE);
1✔
47
  public static final String DEFAULT_START_TAG = "[%";
48
  public static final String DEFAULT_END_TAG = "%]";
49
  public static final String DEFAULT_OUTLINE_TAG = "%%";
50

51
  public final @NotNull List<String> substitutedExtensions = new ArrayList<>();
1✔
52
  public String START_TAG = DEFAULT_START_TAG;
1✔
53
  public String END_TAG = DEFAULT_END_TAG;
1✔
54
  public String OUTLINE_TAG = DEFAULT_OUTLINE_TAG;
1✔
55
  public boolean ENABLE_ANYCASE = false;
1✔
56

57
  @Transient
58
  private final transient @Nullable Project myProject;
59

60
  public TemplateToolkitSettings() {
1✔
61
    myProject = null;
1✔
62
  }
1✔
63

64
  public TemplateToolkitSettings(@NotNull Project project) {
1✔
65
    myProject = project;
1✔
66
  }
1✔
67

68
  public @NotNull Project getProject() {
NEW
69
    return Objects.requireNonNull(myProject);
×
70
  }
71

72
  public void settingsUpdated() {
NEW
73
    myProject.getMessageBus().syncPublisher(TT2_SETTINGS_TOPIC).settingsUpdated();
×
NEW
74
    ApplicationManager.getApplication().invokeLater(() -> WriteAction.run(
×
NEW
75
      () -> ProjectRootManagerEx.getInstanceEx(getProject()).makeRootsChange(
×
NEW
76
        EmptyRunnable.getInstance(), RootsChangeRescanningInfo.TOTAL_RESCAN)));
×
NEW
77
  }
×
78

79
  public @NotNull List<String> getSubstitutedExtensions() {
NEW
80
    return substitutedExtensions;
×
81
  }
82

83
  @Override
84
  public @Nullable TemplateToolkitSettings getState() {
NEW
85
    return this;
×
86
  }
87

88
  @Override
89
  public void loadState(@NotNull TemplateToolkitSettings state) {
90
    XmlSerializerUtil.copyBean(state, this);
1✔
91
  }
1✔
92

93
  public static @NotNull TemplateToolkitSettings getInstance(@NotNull Project project) {
94
    return project.getService(TemplateToolkitSettings.class);
1✔
95
  }
96

97
  public interface SettingsListener {
98
    void settingsUpdated();
99
  }
100
}
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