Bug 98002 - [EditorMgmt] 'Open With' for external files
Summary: [EditorMgmt] 'Open With' for external files
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement with 4 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 71543 160978 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-01 17:06 EDT by Michael Van Meekeren CLA
Modified: 2019-09-06 15:37 EDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Van Meekeren CLA 2005-06-01 17:06:09 EDT
When you open an external file using File->Open File..., you cannot specify
which editor should be used to edit the file.
Comment 1 Kim Horne CLA 2005-06-01 18:43:17 EDT
It uses whatever editor is defined by the system for editing files of that name/content type.  At least, thats 
what the code seems to do.   If I open a Java file I dont seem to get the java editor but if I open an HTML 
editor I get the browser...
Comment 2 Dani Megert CLA 2005-06-02 02:09:13 EDT
>If I open a Java file I dont seem to get the java editor but if I open an HTML 
>editor I get the browser...

That would be a severe bug and a regression. I just tried it using 3.1 RC2 and
it works as expected. Please file a new bug report and provide steps to
reproduce since this isn't related to the bug reported in this PR.
Comment 3 Dani Megert CLA 2005-06-02 04:31:10 EDT
Just tried to open a *.java file in N20050602-0010 and it works too.

Adding a File > Open File With > [List of all editors] doesn't scale.

The solution we should target is a file chooser that actually lets us select
external *and* also files from the workspace. The context menu would contain
'Open With'.

Michael, AFAIK there's no such dialog yet in Platform UI. Are there plans to do
so, or are clients expected to do this? Similar dialog would be useful for the
Save As... scenario, see bug 74375 for a discussion about that.
Comment 4 Kim Horne CLA 2005-06-02 08:03:55 EDT
Dani : I must've been mistaken.  I can indeed open .java files with the Java editor.  Maybe I was trying to 
open a .jawa file or something.  Sorry to have raised the red flag.
Comment 5 Dani Megert CLA 2005-06-02 09:08:06 EDT
np. maybe you were simply confused because there's no model for such an external
Java file and hence no ruler info and no Java Outline.
Comment 6 Michael Van Meekeren CLA 2005-06-02 09:38:28 EDT
no I don't think we have this type of dialog now.
Comment 7 Dani Megert CLA 2006-08-31 12:21:38 EDT
*** Bug 71543 has been marked as a duplicate of this bug. ***
Comment 8 Dani Megert CLA 2007-02-15 12:31:51 EST
*** Bug 160978 has been marked as a duplicate of this bug. ***
Comment 9 Dani Megert CLA 2007-02-22 02:19:34 EST
Since 'Open File...' is now owned by Platform UI, this bug should be handled on the same layer.
Comment 10 Eric Moffatt CLA 2007-02-23 15:36:53 EST
Is this still an issue ? I've just used it to successfully open an external '.java' file using M5.
Comment 11 Dani Megert CLA 2007-02-26 03:04:46 EST
1. read comment 0
2. try to open the Java file with e.g. the Text Editor
Comment 12 Boris Bokowski CLA 2007-06-21 16:03:30 EDT
This would be nice...
Comment 13 Boris Bokowski CLA 2008-05-02 14:56:59 EDT
Mass update - removing 3.4 target. This was one of the bugs I marked for investigation (and potential fixing) in 3.4 but I ran out of time. Please ping on the bug if fixing it would be really important for 3.4, and does not require API changes or feature work.
Comment 14 Ed Merks CLA 2008-05-06 16:28:09 EDT
Is there something I could do to investigate and help?
Comment 15 David Whiteman CLA 2008-05-06 17:25:28 EDT
I would like to see this too.  I have my own editor for specific XML files but when I open .xml files using File > Open File... the standard XML editor is invoked (as opposed to opening the same file if living in the workspace).  Naive question: why can't we use the same mechanisms for determining the correct editor for external files that we do for workspace files?

Note that this same problem occurs for Ant files that are external, since they share the same file extension as generic *.xml files.
Comment 16 Boris Bokowski CLA 2008-05-06 17:30:19 EDT
(In reply to comment #14)
> Is there something I could do to investigate and help?

Sure - the first step would be to find out if this can be fixed without API changes...
Comment 17 Dani Megert CLA 2008-05-07 02:22:00 EDT
Re comment 14: I guess it should be doable without API additions but the hard part will be to find a good UI.

Re comment 15: I think that's a different use case / bug: it seems that a different algorithm is used to get the default editor when opening your external file. I suggest to file this separately as this feature request is about having 'Open With'.

Note that if in 3.4 M7 you define a file extension (General > Editors > File Associatiions) along with an editor then this editor will be used to open the external file i.e. duplicate bug 160978 and bug 71543 are actually fixed in 3.4 M7.
Comment 18 David Whiteman CLA 2008-05-07 06:51:12 EDT
(In reply to comment #17)
> Re comment 15: I think that's a different use case / bug: it seems that a
> different algorithm is used to get the default editor when opening your
> external file. I suggest to file this separately as this feature request is
> about having 'Open With'.

OK, I have opened bug 230865 for this (as a bug not an enhancement, since there should be consistent behavior in editor choice).
 
> Note that if in 3.4 M7 you define a file extension (General > Editors > File
> Associatiions) along with an editor then this editor will be used to open the
> external file i.e. duplicate bug 160978 and bug 71543 are actually fixed in 3.4
> M7.

This won't help my situation, since I am providing an editor for a file extension that already has a default editor (same situation as Ant, providing a specific editor for certain types of .xml files). 

Comment 19 Ed Merks CLA 2008-05-07 08:32:06 EDT
I think this problem is made worse by the fact that proper content type analysis (checking the actual contents of the file store) isn't being done.  The patch in https://bugs.eclipse.org/bugs/show_bug.cgi?id=230865 helps with that...

One approach Dani and I discussed was to augment the "New Editor" action on the tab of the opened editor so you can open any appropriate editor not just a duplicate of the existing editor.  Then if you opened a file and the desired type of editor didn't open, you'd at least be able to open it this way...
Comment 20 Teddy Walker CLA 2008-05-07 10:06:40 EDT
I think, the most intuitive solution would be a drop down option for the open button in the file selection dialog (of File > Open File...). Several other software uses this solution in similar use cases. If a user selects this option, the same dialog like for workbench file will be shown to choose the editor to open.

I know the SWT filedialog doesn't support it at moment, but perhaps this could be added in the next version?
Comment 21 Boris Bokowski CLA 2008-05-07 17:18:21 EDT
(In reply to comment #19)
> One approach Dani and I discussed was to augment the "New Editor" action on the
> tab of the opened editor so you can open any appropriate editor not just a
> duplicate of the existing editor.  Then if you opened a file and the desired
> type of editor didn't open, you'd at least be able to open it this way...

This looks like feature work to me, which we were asked today by our PMC to not do at this point in the cycle.

If you include the file in question in your workspace as a linked file (or inside a linked folder), can you get it to open with any editor? I know that this is not a very good workaround, but it might be worth a try.
Comment 22 Ed Merks CLA 2008-05-07 17:35:10 EDT
I can't imagine a way for the file dialog to be extensible that's workable across multiple platforms.  Also consider that the selection dialog lets you select multiple files and so it gets even worse to chose one editor for many files. 
Comment 23 Dani Megert CLA 2008-05-08 03:04:54 EDT
With bug 230865 being fixed now, people get the same editor when opening an external file as they get when opening the file from the workspace. I suggest to defer this bug to 3.5 as a good solution will need some discussion, e.g. whether it's OK to add actions like this to the editor tab.
Comment 24 Ed Merks CLA 2008-05-08 05:56:24 EDT
Dani,

I agree. I think getting the same behavior for open was the worst aspect of this shortcoming so having fixed that, the need for changes is significantly reduced.
Comment 25 Markus Keller CLA 2009-07-16 11:06:22 EDT
(In reply to comment #19)
> One approach Dani and I discussed was to augment the "New Editor" action on the
> tab of the opened editor so you can open any appropriate editor not just a
> duplicate of the existing editor.  Then if you opened a file and the desired
> type of editor didn't open, you'd at least be able to open it this way...

Bug 69681 is similar to this.
Comment 26 Boris Bokowski CLA 2009-11-17 13:01:16 EST
Remy is now responsible for watching the [EditorMgmt] component area.
Comment 27 Eclipse Webmaster CLA 2019-09-06 15:37:47 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.