Bug 288624 - [EditorMgmt] Mac: Error when browsing to external editor and then launching
[EditorMgmt] Mac: Error when browsing to external editor and then launching
Status: VERIFIED FIXED
Product: Platform
Classification: Eclipse
Component: UI
3.5
PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
: 3.6 M5
Assigned To: Remy Suen CLA Friend
Remy Suen CLA Friend
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2009-09-04 07:24 EDT by Lakshmi Shanmugam CLA Friend
Modified: 2010-01-26 10:29 EST (History)
2 users (show)

See Also:


Attachments
ExternalEditor patch v1 (1.82 KB, patch)
2009-11-25 10:35 EST, Remy Suen CLA Friend
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lakshmi Shanmugam CLA Friend 2009-09-04 07:24:12 EDT
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.
Comment 1 Boris Bokowski CLA Friend 2009-11-17 13:04:28 EST
Remy is now responsible for watching the [EditorMgmt] component area.
Comment 2 Remy Suen CLA Friend 2009-11-25 08:52:51 EST
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
Comment 3 Remy Suen CLA Friend 2009-11-25 10:35:59 EST
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?
Comment 4 Mike Morearty CLA Friend 2009-12-08 17:23:43 EST
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" });
Comment 5 Remy Suen CLA Friend 2009-12-09 08:47:26 EST
(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.
Comment 6 Paul Webster CLA Friend 2009-12-09 10:10:50 EST
*** Bug 297273 has been marked as a duplicate of this bug. ***
Comment 7 Oleg Besedin CLA Friend 2010-01-20 17:26:56 EST
The patch works for me on Mac Cocoa; UI test suite passes with the patch.
Comment 8 Remy Suen CLA Friend 2010-01-20 17:28:06 EST
(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.
Comment 9 Remy Suen CLA Friend 2010-01-21 07:41:32 EST
(In reply to comment #3)
> Created an attachment (id=153071) [details]
> ExternalEditor patch v1

Patch released to HEAD >20100121.
Comment 10 Remy Suen CLA Friend 2010-01-26 10:29:04 EST
Verified with I20100125-1800. Thanks Lakshmi for the bug report, Kevin, Mike, and Oleg for helping with the fix.