• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing a parameter to a class outside your control

 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Implementors are required to implement an interface, IView.

The container will do a newInstance on contributed implementations; then call createPartControl. In my implementation of IView, I need to use a String value inside createPartControl & this value must be passed in to me via some mechanism. Obviously I'm NOT able to provide another constructor that can accept a parameter.

My initial thought is to use a ThreadLocal. Ideas ?

Thanks
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15216
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you're writing an Eclipse plugin...

The information to provide is too vague to give you good advice. Where does this string that you need in createPartControl(...) come from? ThreadLocal is for thread-local storage, i.e. if you need one copy of some data for each thread that uses your implementation of IView. Why do you think that that is what you need? You don't specify anything about multi-threading in the rest of your question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic