eclipse.platform.ui icon indicating copy to clipboard operation
eclipse.platform.ui copied to clipboard

'Switch to Editor' dialog does not include parts contributed via e4 model fragment which represent an Editor

Open feilimb opened this issue 11 months ago • 6 comments

Steps to Reproduce

To reproduce you will need to define an editor part which is contributed via an e4 model fragment (eg. via a PartDescriptor), and can be opened eg. via a Menu addition.

It should be marked as closeable and given the magic 'Editor' tag (see screenshot snippet below):

Image

Launch the IDE application and open the newly contributed Part which represents an Editor and was contributed via a model fragment.

Go to the Switch to Editor dialog, via Window/Navigation/Switch to Editor

The dialog does not include the Part contributed via model fragment which represents an Editor, it will contain any other compatibility layer editors which have been opened, eg. the simple Text Editor.

Notes

Looking at platform source code, there appears to multiple places where the 'Editor' tag is checked to perform some handling based on its presence.

Would it be possible to update the Switch to Editor dialog, to also cater for e4 part(s) contributed which represent Editor(s).

feilimb avatar Jan 29 '25 12:01 feilimb

Could you please attach a simple bundle project that contributes such an editor, so whoever is interesting in the bugfix could quickly debug the problem without wasting time on creating the reproducible example? Thanks.

iloveeclipse avatar Jan 29 '25 18:01 iloveeclipse

Could you please attach a simple bundle project that contributes such an editor, so whoever is interesting in the bugfix could quickly debug the problem without wasting time on creating the reproducible example? Thanks.

Yes of course, apologies for not including in the original post. I will put that together and attach here today.

feilimb avatar Jan 30 '25 08:01 feilimb

Sample plugin is now available on the master branch in the org.eclipse.e4.ui.examples collection.

Instructions

  • Open the Run Configurations in your Platform SDK, select the 'Runtime Workspace' run configuration, and choose the 'Select plug-ins..' - with the following dialog enter the newly added plugin id, ie. 'org.eclipse.e4.ui.examples.e4editor' - and choose OK, it should now be listed in the Plugins list/table, at the bottom, under 'Additional Plugins', ensure the checkbox is checked.
  • Run this Runtime Workspace run configuration, to start up the IDE, close the Welcome to Eclipse screen/view
  • to demonstrate the issue, open eg. a dummy text file, via File / Open and just open any text file
  • now open our E4 Editor (example), note: a menu contribution will be present in the 'Window' menu, see the screenshot below, select this to open the E4 Editor (in screenshot it appears as 'Open Dummy Editor' but on master branch now it appears as 'Open E4 Editor')

Image

  • with the E4 editor, and some random text file open, there are now effectively 2 editors open in the workspace, go to Window /Navigation / Switch to Editor... - see example screenshot below:

Image

Observed The E4 editor is not listed in the Switch to Editor dialog, only the text editor is present

Notes The Close Editor menu option under the File menu does close the dummy editor.

feilimb avatar Jan 30 '25 10:01 feilimb

@feilimb would you mind open a PR and adding it here:

https://github.com/eclipse-platform/eclipse.platform.ui/tree/master/examples

laeubi avatar Jan 30 '25 10:01 laeubi

@feilimb would you mind open a PR and adding it here:

https://github.com/eclipse-platform/eclipse.platform.ui/tree/master/examples

I have created a PR now (https://github.com/eclipse-platform/eclipse.platform.ui/pull/2766), purely for the addition of sample dummy e4 editor addition/contribution via model fragment.

feilimb avatar Jan 30 '25 11:01 feilimb

Update: the PR above, purely for addition of sample E4 Editor was now merged to master.

Therefore to reproduce this Issue, one simply needs to use the run configuration 'Runtime Workspace', but add the 'org.eclipse.e4.ui.examples.e4editor' additional plugin via the 'Select plug-ins..' option on right hand side.

Reproduction steps updated in the post above also, for full details.

feilimb avatar Feb 04 '25 09:02 feilimb