Replies: 1 comment 5 replies
-
Hm... the |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In our application, we have limited the amount of editors that can be opened at the same time to twelve. Once this limit is reached, the user is given a list of all open editors and asked to select the ones that should be closed.
Sadly, this doesn't work when using "Open With" after right-clicking on a file, as the underlying implementation is internal. The editor-to-close is determined via the TabBehavior, more specifically the TabBehaviorMRU. Here the least recently editor is selected (with special handling of pinned/dirty editors), without the chance of any user interaction.
This behavior is leads to inconsistencies in our project and to solve it, I'd like to have more control over which editors are selected, rather than simply picking the oldest one. After thinking about this for a bit, I came up with two possible solutions, with my personal preference being the second one:
One could simply define an
ITabBehaviour
interface, which declares thefindReusableEditor(IWorkbenchPage page)
methods. Implementation of this class could either be contributed via an extension point or a plain OSGi service. Alternatively, one also define a staticsetDefault(ITabBehaviour)
method (similar to what already exists for the Tweaklets). If no other contribution exists, one would then default to theTabBehaviourMRU
for the current behavior.Alternatively, I could also simply ignore the "internal" warning and implement the TabBehavior directly. Though I'd like to avoid that unless it's unavoidable...
Do you have any concerns regarding this approach or perhaps know of a better way to do this?
Beta Was this translation helpful? Give feedback.
All reactions