[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: Adding a view to a perspective

OK. Here is what I have done.

I have registered a perspectiveListener and registered it during my earlyStartup:

public void perspectiveActivated(IWorkbenchPage page,
			IPerspectiveDescriptor desc) {
  if (isMyPerspective(desc)) {
    // 'my' view should be in this perspective
    Perspective persp = ((WorkbenchPage) page).getActivePerspective();
    IViewReference[] refs = persp.getViewReferences();
    if (!containsMyView(refs)) {
      // 'my' view is not currently shown
      if (queryShowView()) {
        // user has agreed to show 'my' view
        page.showView(MY_VIEW_ID);
      }
    }
  }
}

This works, but I get a 'access restriction' on Perspective. Is there an API way to do this?

Thanks,

Paul Webster wrote:
I can think of round-about ways to do it ... for example, when your plugin starts up read all of the relevant perspectiveExtensions from the IExtensionRegistry ... you can save the information you need in your plugin state location.

Then if you startup and find the view not in your plugin state location file, you know it has been added or removed.

PW




--
Derek