From 60ec41ad2183d505f37853bbf9a2a90a6c20293f Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Mon, 25 Apr 2016 21:13:00 +0200 Subject: [PATCH] [platform] in desktop entry/launcher script configuration; default to user-scope changes (IDEA-152531) I.e. do not ask for super-user privileges unless system-wide scope was chosen explicitly. --- .../options/InitialConfigurationDialog.java | 13 ++++--------- .../ide/customize/CustomizeDesktopEntryStep.java | 9 +++------ .../ide/customize/CustomizeLauncherScriptStep.java | 2 +- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/application/options/InitialConfigurationDialog.java b/platform/lang-impl/src/com/intellij/application/options/InitialConfigurationDialog.java index 8d4374afe7ec..7fad0acfd1eb 100644 --- a/platform/lang-impl/src/com/intellij/application/options/InitialConfigurationDialog.java +++ b/platform/lang-impl/src/com/intellij/application/options/InitialConfigurationDialog.java @@ -32,7 +32,6 @@ import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationNamesInfo; -import com.intellij.openapi.application.PathManager; import com.intellij.openapi.application.impl.ApplicationImpl; import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.colors.EditorColorsScheme; @@ -164,22 +163,18 @@ public class InitialConfigurationDialog extends DialogWrapper { init(); final boolean canCreateLauncherScript = canCreateLauncherScript(); - myCreateScriptCheckbox.setVisible(canCreateLauncherScript); - myCreateScriptCheckbox.setSelected(canCreateLauncherScript); myCreateScriptPanel.setVisible(canCreateLauncherScript); + myCreateScriptCheckbox.setSelected(false); if (canCreateLauncherScript) { myScriptPathTextField.setText(CreateLauncherScriptAction.defaultScriptPath()); } final boolean canCreateDesktopEntry = canCreateDesktopEntry(); - myCreateEntryCheckBox.setVisible(canCreateDesktopEntry); - myCreateEntryCheckBox.setSelected(canCreateDesktopEntry); myCreateEntryPanel.setVisible(canCreateDesktopEntry); - if (canCreateDesktopEntry) { - myGlobalEntryCheckBox.setSelected(!PathManager.getHomePath().startsWith("/home")); - } + myCreateEntryCheckBox.setSelected(canCreateDesktopEntry); + myGlobalEntryCheckBox.setSelected(false); - myPreferencesLabel.setText("You can use "+ CommonBundle.settingsActionPath() + " to configure any of these settings later."); + myPreferencesLabel.setText("You can use " + CommonBundle.settingsActionPath() + " to configure any of these settings later."); Disposer.register(myDisposable, new Disposable() { @Override diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeDesktopEntryStep.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeDesktopEntryStep.java index 058c89f6a681..97996df5e4ec 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeDesktopEntryStep.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeDesktopEntryStep.java @@ -17,7 +17,6 @@ package com.intellij.ide.customize; import com.intellij.ide.actions.CreateDesktopEntryAction; import com.intellij.idea.ActionsBundle; -import com.intellij.openapi.application.PathManager; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.EmptyRunnable; import com.intellij.openapi.util.IconLoader; @@ -65,12 +64,10 @@ public class CustomizeDesktopEntryStep extends AbstractCustomizeWizardStep { add(panel, BorderLayout.CENTER); - myCreateEntryCheckBox.addChangeListener(e -> { - myGlobalEntryCheckBox.setEnabled(myCreateEntryCheckBox.isSelected()); - myGlobalEntryCheckBox.setSelected(myCreateEntryCheckBox.isSelected() && !PathManager.getHomePath().startsWith("/home")); - }); + myCreateEntryCheckBox.addChangeListener(e -> myGlobalEntryCheckBox.setEnabled(myCreateEntryCheckBox.isSelected())); + myCreateEntryCheckBox.setSelected(!"true".equals(System.getProperty("idea.debug.mode"))); - myCreateEntryCheckBox.setSelected(true); + myGlobalEntryCheckBox.setSelected(false); } @Override diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeLauncherScriptStep.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeLauncherScriptStep.java index ec588376becc..b1efc0596173 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeLauncherScriptStep.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeLauncherScriptStep.java @@ -37,7 +37,7 @@ public class CustomizeLauncherScriptStep extends AbstractCustomizeWizardStep { setLayout(new BorderLayout()); myCreateScriptCheckBox.setOpaque(false); - myCreateScriptCheckBox.setSelected(true); + myCreateScriptCheckBox.setSelected(false); myCreateScriptCheckBox.addChangeListener(e -> myScriptPathTextField.setEnabled(myCreateScriptCheckBox.isSelected())); myScriptPathTextField.setText(CreateLauncherScriptAction.defaultScriptPath());