Community
Participate
Working Groups
Bugzilla – Bug 288624
[EditorMgmt] Mac: Error when browsing to external editor and then launching
Last modified: 2010-01-26 10:29:04 EST
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.11) Gecko/2009060214 Firefox/3.0.11 Build Identifier: 3.5 Launch an external editor from the Project Explorer as follows. Reproducible: Always Steps to Reproduce: 1.Right click on the file in Project Explorer 2.Select Open With --> Other... 3.In the Editor selection dialog that opens up, select external editors radio button. 4.Instead of selecting the application from the list here, browse to the application using the Browse button, click on open 5.Click on OK in the Editor Selection dialog. Error dialog shows up with the message "Unable to open external editor". Note that selecting the application from the list doesn't works fine. The error, because the code to open the ExternalEditor tries to execute(exec) the .app and not the executable. It is reproducible in both Carbon and Cocoa.
Remy is now responsible for watching the [EditorMgmt] component area.
We're manually calling Runtime's exec(String[]) method which could be the problem. I will have to get in touch with SWT to see if using Program is the right way to workaround this problem. Thread [main] (Suspended (breakpoint at line 129 in ExternalEditor)) ExternalEditor.openWithUserDefinedProgram() line: 129 ExternalEditor.open() line: 52 EditorManager$3.run() line: 707 BusyIndicator.showWhile(Display, Runnable) line: 70 EditorManager.openExternalEditor(EditorDescriptor, IEditorInput) line: 694 EditorManager.openEditorFromDescriptor(EditorDescriptor, IEditorInput, IMemento) line: 668 WorkbenchPage.busyOpenEditorFromDescriptorBatched(IEditorInput, EditorDescriptor, boolean, IMemento) line: 2896 WorkbenchPage.busyOpenEditorFromDescriptor(IEditorInput, EditorDescriptor, boolean, IMemento) line: 2783 WorkbenchPage.access$12(WorkbenchPage, IEditorInput, EditorDescriptor, boolean, IMemento) line: 2775 WorkbenchPage$11.run() line: 2740 BusyIndicator.showWhile(Display, Runnable) line: 70 WorkbenchPage.openEditorFromDescriptor(IEditorInput, IEditorDescriptor, boolean, IMemento) line: 2736 OpenWithMenu.openEditor(IEditorDescriptor, boolean) line: 339 OpenWithMenu$3.handleEvent(Event) line: 228 EventTable.sendEvent(Event) line: 84
Created attachment 153071 [details] ExternalEditor patch v1 So Kevin suggested we use the 'open' command instead, so I've attached a patch that does just that. I am however concerned over the case if someone selects a file that isn't a .app. Would the semantics of "open -a x abc.def" still work?
In response to comment 3: I just tried specifying a full path that wasn't a .app directory, and it worked. In other words, both of these worked: Runtime.getRuntime().exec(new String[] { "open", "-a", "/Applications/TextEdit.app/Contents/MacOS/TextEdit", "/Users/mmoreart/log.txt" }); Runtime.getRuntime().exec(new String[] { "open", "-a", "/Applications/TextEdit.app", "/Users/mmoreart/log.txt" });
(In reply to comment #4) > In response to comment 3: I just tried specifying a full path that wasn't a > .app directory, and it worked. Thanks for the information, Mike. I'll try and get this in for 3.6M5.
*** Bug 297273 has been marked as a duplicate of this bug. ***
The patch works for me on Mac Cocoa; UI test suite passes with the patch.
(In reply to comment #7) > The patch works for me on Mac Cocoa; UI test suite passes with the patch. Thanks a ton for the help, Oleg. I'll release this tomorrow morning.
(In reply to comment #3) > Created an attachment (id=153071) [details] > ExternalEditor patch v1 Patch released to HEAD >20100121.
Verified with I20100125-1800. Thanks Lakshmi for the bug report, Kevin, Mike, and Oleg for helping with the fix.