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

devonfw / IDEasy / 11060995883

26 Sep 2024 10:09PM UTC coverage: 66.053% (-0.05%) from 66.107%
11060995883

Pull #652

github

web-flow
Merge 3cdc5b3b2 into ad80f56d2
Pull Request #652: #593: #651: #564: #439: fixed bugs, refactored tool dependencies

2312 of 3848 branches covered (60.08%)

Branch coverage included in aggregate %.

6078 of 8854 relevant lines covered (68.65%)

3.03 hits per line

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

48.84
cli/src/main/java/com/devonfw/tools/ide/tool/ide/IdeToolCommandlet.java
1
package com.devonfw.tools.ide.tool.ide;
2

3
import java.nio.file.Path;
4
import java.util.Set;
5

6
import com.devonfw.tools.ide.common.Tag;
7
import com.devonfw.tools.ide.context.IdeContext;
8
import com.devonfw.tools.ide.io.FileAccess;
9
import com.devonfw.tools.ide.process.ProcessMode;
10
import com.devonfw.tools.ide.tool.ToolCommandlet;
11
import com.devonfw.tools.ide.tool.eclipse.Eclipse;
12
import com.devonfw.tools.ide.tool.intellij.Intellij;
13
import com.devonfw.tools.ide.tool.plugin.PluginBasedCommandlet;
14
import com.devonfw.tools.ide.tool.vscode.Vscode;
15

16
/**
17
 * {@link ToolCommandlet} for an IDE (integrated development environment) such as {@link Eclipse}, {@link Vscode}, or {@link Intellij}.
18
 */
19
public abstract class IdeToolCommandlet extends PluginBasedCommandlet {
1✔
20

21
  /**
22
   * The constructor.
23
   *
24
   * @param context the {@link IdeContext}.
25
   * @param tool the {@link #getName() tool name}.
26
   * @param tags the {@link #getTags() tags} classifying the tool. Should be created via {@link Set#of(Object) Set.of} method.
27
   */
28
  public IdeToolCommandlet(IdeContext context, String tool, Set<Tag> tags) {
29

30
    super(context, tool, tags);
5✔
31
    assert (hasIde(tags));
5!
32
  }
1✔
33

34
  private boolean hasIde(Set<Tag> tags) {
35

36
    for (Tag tag : tags) {
10!
37
      if (tag.isAncestorOf(Tag.IDE)) {
4!
38
        return true;
2✔
39
      }
40
    }
×
41
    throw new IllegalStateException("Tags of IdeTool hat to be connected with tag IDE: " + tags);
×
42
  }
43

44
  @Override
45
  public final void run() {
46

47
    configureWorkspace();
2✔
48
    super.run();
2✔
49
  }
1✔
50

51
  @Override
52
  public void runTool(String... args) {
53

54
    runTool(ProcessMode.BACKGROUND, null, args);
5✔
55
  }
1✔
56

57
  /**
58
   * Configure the workspace for this IDE using the templates from the settings.
59
   */
60
  protected void configureWorkspace() {
61

62
    Path settingsWorkspaceFolder = this.context.getSettingsPath().resolve(this.tool)
7✔
63
        .resolve(IdeContext.FOLDER_WORKSPACE);
2✔
64
    FileAccess fileAccess = this.context.getFileAccess();
4✔
65
    if (!fileAccess.isExpectedFolder(settingsWorkspaceFolder)) {
4!
66
      return;
1✔
67
    }
68
    Path setupFolder = settingsWorkspaceFolder.resolve(IdeContext.FOLDER_SETUP);
×
69
    Path updateFolder = settingsWorkspaceFolder.resolve(IdeContext.FOLDER_UPDATE);
×
70
    if (!fileAccess.isExpectedFolder(setupFolder) && !fileAccess.isExpectedFolder(updateFolder)) {
×
71
      return;
×
72
    }
73
    Path ideWorkspacePath = this.context.getWorkspacePath();
×
74
    if (!fileAccess.isExpectedFolder(ideWorkspacePath)) {
×
75
      return; // should actually never happen...
×
76
    }
77
    this.context.step("Configuring workspace {} for IDE {}", ideWorkspacePath.getFileName(), this.tool);
×
78
    this.context.getWorkspaceMerger().merge(setupFolder, updateFolder, this.context.getVariables(), ideWorkspacePath);
×
79
  }
×
80
}
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

© 2025 Coveralls, Inc