Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 488289

Summary: UnassociatedEditorStrategyRegistry should not be static
Product: [Eclipse Project] Platform Reporter: Dani Megert <daniel_megert>
Component: IDEAssignee: Mickael Istria <mistria>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 4.6   
Target Milestone: 4.6 M7   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/67745
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=7a96414a097129f863ff053184ab33a679467890
Whiteboard:
Bug Depends on:    
Bug Blocks: 90292    

Description Dani Megert CLA 2016-02-23 08:02:23 EST
UnassociatedEditorStrategyRegistry should not be static. See org.eclipse.ui.internal.registry.EditorRegistry as an example.

Currently the registry is read each time one opens an editor.
Comment 1 Mickael Istria CLA 2016-02-23 08:43:21 EST
So we should create a WorkbenchPlugin.getDefault().getUnassociatedFilesStrategyRegistry() method ?
Comment 2 Dani Megert CLA 2016-02-23 16:12:42 EST
(In reply to Mickael Istria from comment #1)
> So we should create a
> WorkbenchPlugin.getDefault().getUnassociatedFilesStrategyRegistry() method ?

I would even think about putting the code into the existing editor registry.
Comment 3 Mickael Istria CLA 2016-02-24 03:21:50 EST
(In reply to Dani Megert from comment #2)
> (In reply to Mickael Istria from comment #1)
> > So we should create a
> > WorkbenchPlugin.getDefault().getUnassociatedFilesStrategyRegistry() method ?
> 
> I would even think about putting the code into the existing editor registry.

I like this proposal. I'll try that.
Comment 4 Mickael Istria CLA 2016-03-03 08:09:35 EST
(In reply to Dani Megert from comment #2)
> (In reply to Mickael Istria from comment #1)
> > So we should create a
> > WorkbenchPlugin.getDefault().getUnassociatedFilesStrategyRegistry() method ?
> 
> I would even think about putting the code into the existing editor registry.

Unassociated editor strategy is currently in org.eclipse.ui.ide (where the IDE.openEditor classes are), and EditorRegistry is currently in org.eclipse.ui.workbench.

Should I move it and the extension point definition to org.eclipse.ui.workbench then?
Comment 5 Dani Megert CLA 2016-03-03 08:12:56 EST
(In reply to Mickael Istria from comment #4)
> (In reply to Dani Megert from comment #2)
> > (In reply to Mickael Istria from comment #1)
> > > So we should create a
> > > WorkbenchPlugin.getDefault().getUnassociatedFilesStrategyRegistry() method ?
> > 
> > I would even think about putting the code into the existing editor registry.
> 
> Unassociated editor strategy is currently in org.eclipse.ui.ide (where the
> IDE.openEditor classes are), and EditorRegistry is currently in
> org.eclipse.ui.workbench.
> 
> Should I move it and the extension point definition to
> org.eclipse.ui.workbench then?

Uh oh. No. In that case leave it where it is.
Comment 6 Mickael Istria CLA 2016-03-03 08:32:12 EST
What about accessing it as a (private static) field of the IDE class then?
Comment 7 Dani Megert CLA 2016-03-03 08:36:04 EST
(In reply to Mickael Istria from comment #6)
> What about accessing it as a (private static) field of the IDE class then?

*it* == ?
Comment 8 Mickael Istria CLA 2016-03-03 08:40:16 EST
(In reply to Dani Megert from comment #7)
> *it* == ?
Sorry for the lack of context, let me try to state something more "stateless".

What about adding a (private static) "unassociatedEditorRegistry" field to the IDE class, removing the "static" field on methods, and access them inside the IDE class by dereferencing the unassociatedEditorRegistry field?
Comment 9 Dani Megert CLA 2016-03-03 08:55:02 EST
(In reply to Mickael Istria from comment #8)
> (In reply to Dani Megert from comment #7)
> > *it* == ?
> Sorry for the lack of context, let me try to state something more
> "stateless".
> 
> What about adding a (private static) "unassociatedEditorRegistry" field to
> the IDE class

static is static ;-). The registry has to be an instance/field of the plug-in instance.
Comment 10 Eclipse Genie CLA 2016-03-03 09:08:00 EST
New Gerrit change created: https://git.eclipse.org/r/67745