diff options
| author | Ed Merks | 2015-06-09 07:44:03 +0000 |
|---|---|---|
| committer | Ed Merks | 2015-06-09 07:44:03 +0000 |
| commit | 10099d962bec5e364dbaf890faa67e0bffde0eeb (patch) | |
| tree | 82eab5c6d9f0f51e8a6a883aa9fab05dc8981af3 | |
| parent | 415dd83aec8400aa72300f7e9caefe8db4576dfb (diff) | |
| download | org.eclipse.oomph-10099d962bec5e364dbaf890faa67e0bffde0eeb.tar.gz org.eclipse.oomph-10099d962bec5e364dbaf890faa67e0bffde0eeb.tar.xz org.eclipse.oomph-10099d962bec5e364dbaf890faa67e0bffde0eeb.zip | |
[459589] Windows: Add shortcuts for installed product to the menu and
desktop
https://bugs.eclipse.org/bugs/show_bug.cgi?id=459589
2 files changed, 29 insertions, 11 deletions
diff --git a/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/KeepInstallerUtil.java b/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/KeepInstallerUtil.java index 10dd05038..7e4bc58e6 100644 --- a/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/KeepInstallerUtil.java +++ b/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/KeepInstallerUtil.java @@ -36,24 +36,42 @@ public final class KeepInstallerUtil public static void createShortCut(String specialFolder, String target) { - createShortCut(specialFolder, target, "Eclipse Installer"); - + createShortCut(specialFolder, null, target, "Eclipse Installer"); } - public static void createShortCut(String specialFolder, String target, String shortcutName) + public static void createShortCut(String specialFolder, String groupName, String target, String shortcutName) { try { String powerShell = KeepInstallerUtil.getPowerShell(); if (powerShell != null) { - Runtime.getRuntime().exec( - new String[] { - powerShell, - "-command", - "& {$linkPath = Join-Path ([Environment]::GetFolderPath('" + specialFolder + "')) '" + shortcutName + ".lnk'; $targetPath = '" + target - + "'; $link = (New-Object -ComObject WScript.Shell).CreateShortcut( $linkpath ); $link.TargetPath = $targetPath; $link.Save()}" }); + if (groupName != null) + { + Runtime.getRuntime().exec( + new String[] { + powerShell, + "-command", + "& { " + "$folderPath = Join-Path ([Environment]::GetFolderPath('" + specialFolder + "')) '" + groupName + "';" + + // + "[system.io.directory]::CreateDirectory($folderPath); " + + // + "$linkPath = Join-Path $folderPath '" + shortcutName + ".lnk'; $targetPath = '" + target + + "'; $link = (New-Object -ComObject WScript.Shell).CreateShortcut( $linkpath ); $link.TargetPath = $targetPath; $link.Save()}" }); + + } + else + { + Runtime.getRuntime().exec( + new String[] { + powerShell, + "-command", + "& {$linkPath = Join-Path ([Environment]::GetFolderPath('" + specialFolder + "')) '" + shortcutName + ".lnk'; $targetPath = '" + target + + "'; $link = (New-Object -ComObject WScript.Shell).CreateShortcut( $linkpath ); $link.TargetPath = $targetPath; $link.Save()}" }); + + } } + // [system.io.directory]::CreateDirectory("C:\test") } catch (IOException ex) { diff --git a/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleVariablePage.java b/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleVariablePage.java index 98ea8fdb1..4b10eafc7 100644 --- a/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleVariablePage.java +++ b/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleVariablePage.java @@ -1166,12 +1166,12 @@ public class SimpleVariablePage extends SimpleInstallerPage if (createStartMenuEntryButton != null && createStartMenuEntryButton.isChecked()) { - KeepInstallerUtil.createShortCut("Programs", executable.getAbsolutePath(), shortCutName); + KeepInstallerUtil.createShortCut("Programs", "Eclipse", executable.getAbsolutePath(), shortCutName); } if (createDesktopShortcutButton != null && createDesktopShortcutButton.isChecked()) { - KeepInstallerUtil.createShortCut("Desktop", executable.getAbsolutePath(), shortCutName); + KeepInstallerUtil.createShortCut("Desktop", null, executable.getAbsolutePath(), shortCutName); } } |
