dkandalov / tab-shifter

Plugin for IntelliJ IDEA to move and split editor tabs
https://plugins.jetbrains.com/plugin/7475
169 stars 12 forks source link

Add ToggleMaximizeRestore action #9

Closed sttts closed 7 years ago

sttts commented 7 years ago

This adds the ToggleMaximizeRestore action (Alt-Shift-M) which toggles the current editor inside a splitter between maximal and original proportion, giving a "fullscreen effect". On maximization, also the tool windows are hidden.

dkandalov commented 7 years ago

Thanks a lot for adding maximise/restore split feature! I just installed plugin locally and found couple problems (I might fix them myself or if you feel like sending a pull request or commenting that these are not problems, it'll be great :)) :

sttts commented 7 years ago

The first two "issues" are kind of intentional.

About the second: I assumed that it's not possible to hide it completely (cleanly), at least not via setProportion.

About the third: can you try to debug this? The only thing my patch is doing is resizing the splitter. Why should that influence getComponent? I also changed that Ide is static per project, compare https://github.com/dkandalov/tab-shifter/pull/10.

dkandalov commented 7 years ago

Regarding "usability issues" I agree that API doesn't make it easy. But I'll try to fix them anyway. E.g. it should be possible to save state of toolwindows (there is built-in action which does it).

10 fixes the exception 👍 It's not obvious to me what was the problem and why getComponent failed. Although I suspect in #10 projectTabShifter field will now leak memory by keeping reference to Project objects. <-- Hm, this was happening since #9 anyway via FileEditorManagerEx. May be it's better to keep state in Project itself.

sttts commented 7 years ago

Right about leaking. We can also use a WeakReference.

dkandalov commented 7 years ago

I think this is probably more idiomatic for IJ codebase:

Disposer.register(project, new Disposable() {
    @Override public void dispose() {
        projectTabShifter.remove(project.getProjectFilePath());
    }
});
sttts commented 7 years ago

Looks better indeed. I can create a PR if you are not on it already. Also let me know if you need some review or testing of the other changes.

dkandalov commented 7 years ago

I'm not actively working on it right now. Sure, review/testing is always useful :)