Bug 488289 - UnassociatedEditorStrategyRegistry should not be static
Summary: UnassociatedEditorStrategyRegistry should not be static
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.6 M7   Edit
Assignee: Mickael Istria CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 90292
  Show dependency tree
 
Reported: 2016-02-23 08:02 EST by Dani Megert CLA
Modified: 2016-04-15 11:33 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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