mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
DEA-66868 Can't open browser in MAC OSX + IDEA-74733 MacOSX: Settings:WebBrowser: impossible to select aplication as default browser + IDEA-74965 Astella: Reveal log in Finder, Submit feedback and open keymap PDF actions do not work on Mac
This commit is contained in:
@@ -18,6 +18,7 @@ package org.intellij.images.actions;
|
||||
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.util.ExecUtil;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
@@ -74,7 +75,7 @@ public final class EditExternallyAction extends AnAction {
|
||||
GeneralCommandLine commandLine = new GeneralCommandLine();
|
||||
final String path = executable.exists() ? executable.getAbsolutePath() : executablePath;
|
||||
if (SystemInfo.isMac) {
|
||||
commandLine.setExePath("open");
|
||||
commandLine.setExePath(ExecUtil.getOpenCommandPath());
|
||||
commandLine.addParameter("-a");
|
||||
commandLine.addParameter(path);
|
||||
} else {
|
||||
|
||||
@@ -79,6 +79,14 @@ public class ExecUtil {
|
||||
}
|
||||
return tempFile;
|
||||
}
|
||||
|
||||
public static String getOsascriptPath() {
|
||||
return "/usr/bin/osascript";
|
||||
}
|
||||
|
||||
public static String getOpenCommandPath() {
|
||||
return "/usr/bin/open";
|
||||
}
|
||||
|
||||
public static int sudoAndGetResult(@NotNull final String scriptPath,
|
||||
@NotNull final String prompt) throws IOException, ExecutionException, ScriptException, InterruptedException {
|
||||
@@ -92,7 +100,7 @@ public class ExecUtil {
|
||||
*/
|
||||
final String script = "do shell script \"" + scriptPath + "\" with administrator privileges";
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
String[] args = {"osascript", "-e", script};
|
||||
String[] args = {getOsascriptPath(), "-e", script};
|
||||
runtime.exec(args);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.ide;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.execution.util.ExecUtil;
|
||||
import com.intellij.openapi.application.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
@@ -375,7 +376,7 @@ public class BrowserUtil {
|
||||
return new String[]{"cmd.exe", "/c", "start"};
|
||||
}
|
||||
else if (SystemInfo.isMac) {
|
||||
return new String[]{"open"};
|
||||
return new String[]{ExecUtil.getOpenCommandPath()};
|
||||
}
|
||||
else if (SystemInfo.isUnix) {
|
||||
return new String[]{"mozilla"};
|
||||
@@ -417,7 +418,7 @@ public class BrowserUtil {
|
||||
command = new String[] {browserPath};
|
||||
}
|
||||
else {
|
||||
command = new String[]{"open", "-a", browserPath};
|
||||
command = new String[]{ExecUtil.getOpenCommandPath(), "-a", browserPath};
|
||||
}
|
||||
}
|
||||
else if (SystemInfo.isWindows9x) {
|
||||
|
||||
@@ -21,6 +21,8 @@ import com.intellij.openapi.options.AbstractConfigurableEP;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -82,7 +84,13 @@ public class BrowserSettingsPanel extends JPanel {
|
||||
|
||||
outerPanel.add(genericPanel);
|
||||
|
||||
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
|
||||
FileChooserDescriptor descriptor = SystemInfo.isMac ?
|
||||
new FileChooserDescriptor(false, true, false, false, false, false) {
|
||||
@Override
|
||||
public boolean isFileSelectable(VirtualFile file) {
|
||||
return file.getName().endsWith(".app");
|
||||
}
|
||||
} : FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
|
||||
myBrowserPathField.addBrowseFolderListener(IdeBundle.message("title.select.path.to.browser"), null, null, descriptor);
|
||||
|
||||
if (BrowserUtil.canStartDefaultBrowser()) {
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.util.ExecUtil;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
@@ -193,7 +194,7 @@ public class ShowFilePathAction extends AnAction {
|
||||
"\treveal {\"%s\"} as POSIX file\n" +
|
||||
"\tactivate\n" +
|
||||
"end tell", path);
|
||||
new GeneralCommandLine("osascript", "-e", script).createProcess();
|
||||
new GeneralCommandLine(ExecUtil.getOpenCommandPath(), "-e", script).createProcess();
|
||||
}
|
||||
else if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.OPEN)) {
|
||||
Desktop.getDesktop().open(new File(path));
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.ide.browsers;
|
||||
|
||||
import com.intellij.execution.util.ExecUtil;
|
||||
import com.intellij.ide.BrowserUtil;
|
||||
import com.intellij.ide.browsers.chrome.ChromeSettings;
|
||||
import com.intellij.ide.browsers.firefox.FirefoxSettings;
|
||||
@@ -249,7 +250,7 @@ public class BrowsersConfiguration implements PersistentStateComponent<Element>
|
||||
final String[] command = BrowserUtil.getOpenBrowserCommand(browserPath);
|
||||
String[] args = {url};
|
||||
if (browserArgs.length > 0) {
|
||||
if (SystemInfo.isMac && "open".equals(command[0])) {
|
||||
if (SystemInfo.isMac && ExecUtil.getOpenCommandPath().equals(command[0])) {
|
||||
if (BrowserUtil.isOpenCommandSupportArgs()) {
|
||||
args = ArrayUtil.mergeArrays(new String[]{url, "--args"}, browserArgs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user