I have implemented a complex view using SWT/JFace and unfortunately I have been using a lot of static members for different elements. Now I want to refactor those elements to instance variables, but also a lot of external classes and methods rely on those.
For example a TreeViewer in this View was declared static and I had a simple static getTreeViewer method implemented, which was called e.g. by a JFace Action, again statically. It worked fine.
So I was thinking about implementing a-kind-of-getter method for my view class extending org.eclipse.ui.part.ViewPart. I hoped that this way, I could be able to return the instance of this View, which is in a runtime-Eclipse, to the external classes if needed, and this way the actual values of the the previously static now instance fields could be accessed.
But now, without the static fields and methods, I either have to use new keyword to be able to call the non-static methods, which will obviously result in an NPE, because there won't be any createPartControl() method called. Or I should be able to return the already instantiated view somehow? And this is where I lack? How should be a return-method look like for an entire View so its internal can be accessed in their actual state? Is there a simple way to do that? Thanks!