[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: M4 getInstance Not Working ?

- Can you post the NPE stack trace? Would getInstance be called before
create part control?
- The constructor and createPartControl will get called every time a view is
created. So if I have 2 windows and open you view in both windows we will
have 2 instances of ResultView. I.E getInstance does not work.

Eduardo.


"Colin" <colin@xxxxxxxxxxxxxx> wrote in message
news:atvdc8$vj8$1@xxxxxxxxxxxxxxxx
> Maybe a stupid question, but is it somehow possible that the following
> construction is not working anymore in M4 (When I test my plugin, when I
> it's deployed there seems to be no problem) ?
>
> public class ResultView extends ViewPart
> {
>     private static ResultView instance = null;
>
>     public static ResultView getInstance()
>     {
>         return instance;
>     }
>
>     public void createPartControl(Composite parent)
>     {
>         instance = this;
>     }
> }
>
> The problem is that getInstance gives null. That was never the case. The
> partcontrol is there, so how is it possible ?
>
> Is this the way for other code to get the one and only instance of a view
> anyway, or is there a prefered other way ?
>
> Kind regards,
>
> Colin.
>