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

devonfw / IDEasy / 38742671777

15 Oct 2026 01:26PM UTC coverage: 74.782% (+0.2%) from 74.57%
38742671777

Pull #2525

github

web-flow
Merge 4fcc7cc8f into 7e7928d01
Pull Request #2525: #2452: Fixed checkstyle violations in cli module

5866 of 8721 branches covered (67.26%)

Branch coverage included in aggregate %.

15343 of 19640 relevant lines covered (78.12%)

3.36 hits per line

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

85.42
cli/src/main/java/com/devonfw/tools/ide/tool/ide/AbstractIdeToolCommandlet.java
1
package com.devonfw.tools.ide.tool.ide;
2

3
import java.nio.file.Path;
4
import java.util.ArrayList;
5
import java.util.List;
6
import java.util.Set;
7

8
import com.devonfw.tools.ide.common.Tag;
9
import com.devonfw.tools.ide.context.IdeContext;
10
import com.devonfw.tools.ide.environment.EnvironmentVariables;
11
import com.devonfw.tools.ide.process.ProcessContext;
12
import com.devonfw.tools.ide.process.ProcessMode;
13
import com.devonfw.tools.ide.process.ProcessResult;
14
import com.devonfw.tools.ide.tool.AbstractToolCommandlet;
15
import com.devonfw.tools.ide.tool.ToolInstallRequest;
16
import com.devonfw.tools.ide.tool.eclipse.Eclipse;
17
import com.devonfw.tools.ide.tool.intellij.Intellij;
18
import com.devonfw.tools.ide.tool.plugin.AbstractPluginBasedCommandlet;
19
import com.devonfw.tools.ide.tool.vscode.Vscode;
20

21
/**
22
 * {@link AbstractToolCommandlet} for an IDE (integrated development environment) such as {@link Eclipse}, {@link Vscode}, or {@link Intellij}.
23
 */
24
public abstract class AbstractIdeToolCommandlet extends AbstractPluginBasedCommandlet implements IdeToolCommandlet {
1 ✔
25

26
  private static final String OPTIONS_ENV_SUFFIX = "_OPTIONS";
27

28
  private final IdeWorkspaceConfigurer workspaceConfigurer;
29

30
  /**
31
   * The constructor.
32
   *
33
   * @param context the {@link IdeContext}.
34
   * @param tool the {@link #getName() tool name}.
35
   * @param tags the {@link #getTags() tags} classifying the tool. Should be created via {@link Set#of(Object) Set.of} method.
36
   */
37
  public AbstractIdeToolCommandlet(IdeContext context, String tool, Set<Tag> tags) {
38

39
    super(context, tool, tags);
5 ✔
40
    assert (hasIde(tags));
5 !
41
    this.workspaceConfigurer = new IdeWorkspaceConfigurer(context, tool);
7 ✔
42
  }
1 ✔
43

44
  private boolean hasIde(Set<Tag> tags) {
45

46
    for (Tag tag : tags) {
10 !
47
      if (tag.isAncestorOf(Tag.IDE) || (tag == Tag.IDE)) {
7 !
48
        return true;
2 ✔
49
      }
50
    }
×
51
    throw new IllegalStateException("Tags of IdeTool has to be connected with tag IDE: " + tags);
×
52
  }
53

54
  @Override
55
  protected final void doRun() {
56
    super.doRun();
2 ✔
57
  }
1 ✔
58

59
  @Override
60
  public ProcessResult runTool(List<String> args) {
61

62
    List<String> effectiveArgs = new ArrayList<>(args);
5 ✔
63
    addIdeOptions(effectiveArgs);
3 ✔
64
    return runTool(ProcessMode.BACKGROUND, null, effectiveArgs);
6 ✔
65
  }
66

67
  /**
68
   * Appends the tokens of {@code «IDE»_OPTIONS} (e.g. {@code INTELLIJ_OPTIONS}) to the given {@code args}. This is the per-tool analogue of the global
69
   * {@code IDE_OPTIONS} and only applies when actually starting the IDE (not for internal calls like plugin installation or repository import).
70
   *
71
   * @param args the command-line arguments to launch this IDE, extended in place.
72
   */
73
  private void addIdeOptions(List<String> args) {
74

75
    String variableName = EnvironmentVariables.getToolVariablePrefix(this.tool) + OPTIONS_ENV_SUFFIX;
5 ✔
76
    String options = this.context.getVariables().get(variableName);
6 ✔
77
    if ((options != null) && !options.isBlank()) {
5 !
78
      for (String option : options.trim().split("\\s+")) {
19 ✔
79
        args.add(option);
4 ✔
80
      }
81
    }
82
  }
1 ✔
83

84
  @Override
85
  public ProcessResult runTool(ProcessContext pc, ProcessMode processMode, List<String> args) {
86

87
    if ((processMode != null) && processMode.isBackground()) {
5 !
88
      configureWorkspace();
2 ✔
89
    }
90
    return super.runTool(pc, processMode, args);
6 ✔
91
  }
92

93
  @Override
94
  protected void postInstall(ToolInstallRequest request) {
95
    configureWorkspace();
2 ✔
96
    super.postInstall(request);
3 ✔
97
  }
1 ✔
98

99
  /**
100
   * @return the {@link IdeWorkspaceConfigurer} for this IDE.
101
   */
102
  @Override
103
  public IdeWorkspaceConfigurer getWorkspaceConfigurer() {
104

105
    return this.workspaceConfigurer;
3 ✔
106
  }
107

108
  /**
109
   * Registers support for synchronizing an extra SDK/template for this IDE.
110
   *
111
   * <p>
112
   * The registered template path must be relative to the IDE workspace root. During workspace synchronization, the generic extra-SDK handling performed by the
113
   * {@link IdeWorkspaceConfigurer} uses this mapping to locate the corresponding template file in the settings repository and merge it into the current
114
   * workspace.
115
   * </p>
116
   *
117
   * @param sdk the name of the extra SDK/tool as configured in {@code ide-extra-tools.json}.
118
   * @param relativeTemplatePath the workspace-relative path of the IDE-specific template file to merge.
119
   */
120
  protected void registerExtraSdkTemplate(String sdk, Path relativeTemplatePath) {
121

122
    this.workspaceConfigurer.registerExtraSdkTemplate(sdk, relativeTemplatePath);
5 ✔
123
  }
1 ✔
124
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc