IDEA-200235 No option to disable "Open Folder as <IDE> Project" context menu.

This commit is contained in:
Vladimir.Orlov
2018-10-11 09:45:57 +03:00
parent 1596d9f3b8
commit aab2fdb3b8
5 changed files with 81 additions and 31 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
!define INSTALL_OPTION_ELEMENTS 7
!define INSTALL_OPTION_ELEMENTS 9
!define CUSTOM_SILENT_CONFIG 0
Function customPreInstallActions
+46 -28
View File
@@ -1,9 +1,10 @@
[Settings]
NumFields=7
NumFields=9
DesktopShortcutToLauncher=2
DesktopShortcutToSecondLauncher=3
AddToPath=5
DownloadJRE=6
UpdateContextMenu=8
[Field 1]
Type=GroupBox
@@ -60,63 +61,80 @@ State=0
[Field 7]
Type=GroupBox
Left=1
Right=-1
Right=160
Top=45
Bottom=75
Text=Create Associations
Text=Update context menu
[Field 8]
Type=checkbox
Text="Add "Open Folder as Project""
Left=5
Right=43
Right=-1
Top=60
Bottom=70
State=0
[Field 9]
Type=checkbox
Left=48
Right=86
Top=60
Bottom=70
State=0
Type=GroupBox
Left=1
Right=-1
Top=80
Bottom=110
Text=Create Associations
[Field 10]
Type=checkbox
Left=91
Right=129
Top=60
Bottom=70
Left=5
Right=43
Top=95
Bottom=105
State=0
[Field 11]
Type=checkbox
Left=134
Right=172
Top=60
Bottom=70
Left=48
Right=86
Top=95
Bottom=105
State=0
[Field 12]
Type=checkbox
Left=177
Right=215
Top=60
Bottom=70
Left=91
Right=129
Top=95
Bottom=105
State=0
[Field 13]
Type=checkbox
Left=220
Right=258
Top=60
Bottom=70
Left=134
Right=172
Top=95
Bottom=105
State=0
[Field 14]
Type=checkbox
Left=177
Right=215
Top=95
Bottom=105
State=0
[Field 15]
Type=checkbox
Left=220
Right=258
Top=95
Bottom=105
State=0
[Field 16]
Type=checkbox
Left=263
Right=301
Top=60
Bottom=70
Top=95
Bottom=105
State=0
+30 -2
View File
@@ -52,6 +52,7 @@ var launcherShortcut
var secondLauncherShortcut
var addToPath
var downloadJRE
var updateContextMenu
;------------------------------------------------------------------------------
; include "Modern User Interface"
@@ -355,6 +356,7 @@ Function getInstallationOptionsPositions
!insertmacro INSTALLOPTIONS_READ $secondLauncherShortcut "Desktop.ini" "Settings" "DesktopShortcutToSecondLauncher"
!insertmacro INSTALLOPTIONS_READ $addToPath "Desktop.ini" "Settings" "AddToPath"
!insertmacro INSTALLOPTIONS_READ $downloadJRE "Desktop.ini" "Settings" "DownloadJRE"
!insertmacro INSTALLOPTIONS_READ $updateContextMenu "Desktop.ini" "Settings" "UpdateContextMenu"
FunctionEnd
@@ -588,11 +590,19 @@ launcher_64:
update_PATH:
ClearErrors
${ConfigRead} "$R1" "updatePATH=" $R3
IfErrors download_jre32
IfErrors update_context_menu
${LogText} " update PATH env var: $R3"
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field $addToPath" "Type" "checkbox"
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field $addToPath" "State" $R3
update_context_menu:
ClearErrors
${ConfigRead} "$R1" "updateContextMenu=" $R3
IfErrors download_jre32
${LogText} " update Context Menu: $R3"
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field $updateContextMenu" "Type" "checkbox"
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field $updateContextMenu" "State" $R3
download_jre32:
ClearErrors
${ConfigRead} "$R1" "jre32=" $R3
@@ -903,6 +913,11 @@ createRegistration:
StrCpy $2 ""
StrCpy $3 '"$productLauncher" "%1"'
call OMWriteRegStr
FunctionEnd
Function UpdateContextMenu
${LogText} "update Context Menu"
; add "Open with PRODUCT" action for files to Windows context menu
StrCpy $0 "HKCU"
@@ -951,6 +966,7 @@ createRegistration:
call OMWriteRegStr
FunctionEnd
Function ProductAssociation
${LogText} "do associations ${MUI_PRODUCT} ${VER_BUILD}"
push $0
@@ -1011,12 +1027,14 @@ FunctionEnd
Function getPathEnvVar
${LogText} " get value of user's PATH env var"
ClearErrors
ReadRegStr $pathEnvVar HKCU ${Environment} "Path"
${LogText} " PATH: HKCU ${Environment} Path $pathEnvVar"
IfErrors do_not_change_path ;size of PATH is more than NSIS_MAX_STRLEN
${LogText} " Path: $pathEnvVar"
Goto done
do_not_change_path:
${LogText} " an error occured on readyng value of PATH env var"
StrCpy $pathEnvVar ""
done:
FunctionEnd
@@ -1087,6 +1105,16 @@ add_to_path:
SetRebootFlag true
${EndIf}
update_context_menu:
${LogText} "update context menu: $updateContextMenu"
${If} $updateContextMenu > 0
!insertmacro INSTALLOPTIONS_READ $R0 "Desktop.ini" "Field $updateContextMenu" "State"
${If} $R0 == 1
${LogText} "update context menu"
Call UpdateContextMenu
${EndIf}
${EndIf}
!insertmacro INSTALLOPTIONS_READ $R1 "Desktop.ini" "Settings" "NumFields"
IntCmp $R1 ${INSTALL_OPTION_ELEMENTS} do_association done do_association
do_association:
@@ -9,5 +9,8 @@ launcher64=1
; Add launchers path to PATH env variable
updatePATH=0
; Add "Open Folder as Project" to context menu
updateContextMenu=0
; Download and install jre32
jre32=0
@@ -6,6 +6,7 @@ AddToPath=5
DownloadJRE=6
DownloadPython2=8
DownloadPython3=9
UpdateContextMenu=0
[Field 1]
Type=GroupBox