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

devonfw / IDEasy / 30885547918

04 Aug 2026 06:52AM UTC coverage: 72.715% (+0.1%) from 72.61%
30885547918

Pull #2258

github

web-flow
Merge bc4337a4b into cd9770b9c
Pull Request #2258: #2250 uninstall commands from package manager

5033 of 7671 branches covered (65.61%)

Branch coverage included in aggregate %.

13126 of 17302 relevant lines covered (75.86%)

3.22 hits per line

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

5.56
cli/src/main/java/com/devonfw/tools/ide/tool/pgadmin/PgAdmin.java
1
package com.devonfw.tools.ide.tool.pgadmin;
2

3
import java.nio.file.Files;
4
import java.nio.file.Path;
5
import java.nio.file.Paths;
6
import java.util.List;
7
import java.util.Set;
8

9
import com.devonfw.tools.ide.common.Tag;
10
import com.devonfw.tools.ide.context.IdeContext;
11
import com.devonfw.tools.ide.os.WindowsHelper;
12
import com.devonfw.tools.ide.tool.GlobalToolCommandlet;
13
import com.devonfw.tools.ide.tool.NativePackage;
14
import com.devonfw.tools.ide.tool.NativePackageManager;
15
import com.devonfw.tools.ide.version.VersionIdentifier;
16

17
/**
18
 * {@link GlobalToolCommandlet} for <a href="https://www.pgadmin.org/">pgadmin</a>
19
 */
20
public class PgAdmin extends GlobalToolCommandlet {
21

22
  /**
23
   * The constructor.
24
   *
25
   * @param context the {@link IdeContext}.
26
   */
27
  public PgAdmin(IdeContext context) {
28

29
    super(context, "pgadmin", Set.of(Tag.DB, Tag.ADMIN));
7✔
30
  }
1✔
31

32
  @Override
33
  protected List<NativePackage> getNativePackages() {
34
    return List.of(new NativePackage(
×
35
        NativePackageManager.APT,
36
        List.of("pgadmin4", "pgadmin4-server", "pgadmin4-desktop", "pgadmin4-web"),
×
37
        List.of("--allow-downgrades"),
×
38
        List.of("curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --yes --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg",
×
39
            "sudo sh -c 'echo \"deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] "
40
                + "https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main\" "
41
                + "> /etc/apt/sources.list.d/pgadmin4.list && apt update'"),
42
        List.of("sudo rm -f /etc/apt/sources.list.d/pgadmin4.list", "sudo rm -f /usr/share/keyrings/packages-pgadmin-org.gpg")
×
43
    ));
44
  }
45

46
  @Override
47
  protected String getBinaryName() {
48

49
    return "pgadmin4";
×
50
  }
51

52
  @Override
53
  protected Path getInstallationPath(String edition, VersionIdentifier resolvedVersion) {
54
    if (super.getInstallationPath(edition, resolvedVersion) == null) {
×
55
      if (this.context.getSystemInfo().isWindows()) {
×
56
        return getExecutableFolderFromWindowsRegistry();
×
57
      }
58
    }
59
    return null;
×
60
  }
61

62
  @Override
63
  public VersionIdentifier getInstalledVersion() {
64
    if (!isCommandAvailable(getBinaryName())) {
×
65
      return null;
×
66
    }
67
    String output = this.context.newProcess().runAndGetSingleOutput(getBinaryName(), "--version");
×
68
    return VersionIdentifier.of(output.replace("pgAdmin 4", "").trim());
×
69
  }
70

71
  private Path getExecutableFolderFromWindowsRegistry() {
72

73
    WindowsHelper windowsHelper = WindowsHelper.get(this.context);
×
74
    String registryPath = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\pgAdmin 4v9_is1";
×
75
    String displayIcon = windowsHelper.getRegistryValue(registryPath, "DisplayIcon");
×
76
    if (displayIcon != null) {
×
77
      Path executablePath = Paths.get(displayIcon);
×
78
      if (Files.isExecutable(executablePath)) {
×
79
        Path installationDir = executablePath.getParent();
×
80
        this.context.getPath().setPath(getName(), installationDir);
×
81
        return installationDir;
×
82
      }
83
    }
84
    return null;
×
85
  }
86
}
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