title: Eclipse RCP setselectionprovider not working
body: <p>I am using the following code to set the selection provider outside the createpartcontrol method of the view, my project view is restricted wherein the createpartcontrol is a generic and I will not be able to use the selection provider inside it. The following code does not work with enabling menu by property testers where in I am using <code>&lt;enabled when&gt; variable="selection" &lt;/enabled when&gt;</code> when the view loads initially but when click outside the view and click backed into the view then property testers works fine and my menu items get enabled.</p>
  
  <p>Also I found this post in the eclipse documentation that Replacing the selection provider during the lifetime of the part is not properly supported by the workbench :</p>
  
  <p><a href="https://eclipse.org/articles/Article-WorkbenchSelections/article.html" rel="nofollow">https://eclipse.org/articles/Article-WorkbenchSelections/article.html</a></p>
  
  <p>Not sure where am i going wrong? Could someone provide some help with respect to this.
  Also when i debug through eclipse it goes through this part of the code and everything works fine , but when run as an application outside debug mode the issue occurs.</p>
  
  <pre><code>IWorkbenchWindow iw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  iw.getActivePage().getActivePart().getSite().setSelectionProvider(objectComposite.getViewer());
  </code></pre>