Bug 187536

Summary: Drag & Drop file to Editor launchs file in system editor
Product: [Tools] Target Management Reporter: Kevin Doyle <kjdoyle>
Component: RSEAssignee: Kevin Doyle <kjdoyle>
Status: CLOSED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3 CC: dmcknigh, xuanchen
Version: 2.0Keywords: contributed
Target Milestone: 2.0.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 197326    
Bug Blocks:    
Attachments:
Description Flags
Added a check if editor would open external and if so used default editor mober.at+eclipse: iplog+

Description Kevin Doyle CLA 2007-05-17 09:45:38 EDT
When dragging and dropping a file from the Remote Systems View or Remote System Details View the file is launched in it's System Editor application if the file is not associated with an editor inside eclipse.  Double clicking on the file inside RSE though brings it up in the Default Editor.

I created a java project and exported the files to the project.  Dragging the files from the Package Explorer to the editor would open the files in the Default Editor.

-----------Enter bugs above this line-----------
TM 2.0M7 Testing
installation : eclipse-SDK-3.3M7
RSE install  : I20070517-0600
java.runtime : Sun 1.5.0_11-b03
os.name:     : Windows XP, Service Pack 2
------------------------------------------------
Comment 1 Martin Oberhuber CLA 2007-05-17 15:01:43 EDT
I agree that dragging the file to the editor area should always open an editor in Eclipse and never outside Eclipse.
Kushal I think you've worked on something like this before, what do you think? Please reassign if you do not have time addressing this for 2.0.
Comment 2 Kevin Doyle CLA 2007-05-30 14:04:50 EDT
This is sort of fixed with the patch attached to bug 189268 except that drag and drop .html, .htm, .shtml to the editor does nothing now.
Comment 3 Martin Oberhuber CLA 2007-05-30 14:32:58 EDT
So it seems like it tries to launch the System Editor for .html etc but cannot do this because the System Editor supports FileTransfer only which we no longer do.

For me, this means that the original bug (opening in the SystemEditor when it should use the Text Editor) is not fixed.
Comment 4 Martin Oberhuber CLA 2007-07-12 08:38:44 EDT
Kevin if I'm not mistaken you've been dealing with Editable support, could you have a look?
Comment 5 Kevin Doyle CLA 2007-07-20 11:51:41 EDT
The reason this happens for any file associated with the Web Browser is because the IEditorDescriptor for the Web Browser has a property for "launcher".

Inside EditorAreaDropAdapter.openNonExternalEditor(IWorkbenchPage, IEditorInput, String) it does this:

            IEditorDescriptor editorDesc = editorReg.findEditor(editorId);
            if (editorDesc != null && !editorDesc.isOpenExternal()) {
                result = page.openEditor(editorInput, editorId);
            } else {
                result = null;
            }

editorDesc.isOpenExternal() returns true because a "launcher" property is set for the Web Browser's editor descriptor.

If you compare the behavior to the Java Perspective it will work the same way RSE does for all files except those associated with the web browser.  Since it uses a different file transfer method it uses a different openNonExternalEditor method.  openNonExternalEditor(IWorkbenchPage page, IFile file)

In this method if isOpenExternal() is true it follows the else code which will open the file in the default editor.
Comment 6 Kevin Doyle CLA 2007-07-27 17:12:13 EDT
Created attachment 74837 [details]
Added a check if editor would open external and if so used default editor

Created a workaround such that if the file would open in an external editor with the preferred editor that we make the preferred editor the default editor.

This is needed till bug #197326 is fixed, which is currently assigned 3.4.

Legal Message: I, Kevin Doyle, declare that I developed attached code from
scratch, without referencing any 3rd party materials except material licensed
under the EPL. I am authorized by my employer, IBM Canada Ltd. to make this
contribution under the EPL.
Comment 7 Xuan Chen CLA 2007-08-08 15:59:45 EDT
The patch is good for the current workaround of the platform bug #197326.

I will commit the patch.
Comment 8 Xuan Chen CLA 2007-08-08 16:07:39 EDT
I committed the patch.
Comment 9 Kevin Doyle CLA 2007-08-24 15:12:12 EDT
Verified fixed with I20070823-0800.