[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: How do i initialize a ViewPart ?

Genu George wrote:
You said ---
Store the initialization information for your view somewhere else ... like in the plugin. Then in IViewPart#init() method go back to your plugin and initialize the internal variable from the plugin.
---


can u give me an example how to do that ?


the unoptimized way is:

Say your action is opening the view:

ActionDelegate
public void run() {
  Map options = TestPlugin.getOptions(MY_VIEW_ID);
  options.clear();
  options.put(VIEW_INFO, "SLOW_VIEW");
}

MyViewPart
public void init(IViewSite s) {
  super(s);
  Map options = TestPlugin.getOptions(MY_VIEW_ID);
  goSlow = "SLOW_VIEW".equals(options.get(VIEW_INFO));
}

You'd have to make sure that the code is safe, but basically that's one way.

Later,
PW