Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I revisit my answer "<a href="https://stackoverflow.com/questions/552435/eclipse-rcp-actions-vs-commands">Eclipse RCP: Actions VS Commands</a>", you need a Command handler.</p> <p><a href="http://dev.eclipse.org/newslists/news.eclipse.platform/msg77651.html" rel="nofollow noreferrer">This thread</a> seems to sum up your options:</p> <blockquote> <ul> <li><p>One is a common pattern, to instantiate the handler in the view itself and have the handler simply look at the view selection and control its own enabled state.<br> The handler API allows it to fire an event on enabled change, see <a href="http://kickjava.com/src/org/eclipse/core/commands/AbstractHandler.java.htm" rel="nofollow noreferrer"><code>org.eclipse.core.commands.AbstractHandler</code></a>.</p></li> <li><p>The other is to create a property tester that can get your view selection.</p></li> </ul> </blockquote> <pre><code>IWorkbenchPart p = page.findViewReference("your.id").getPart(false); if (p!=null) { p.getSite().getSelectionProvider().getSelection() ... whatever } </code></pre> <blockquote> <p>Your view would monitor its own selection change events, and call <a href="http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/services/IEvaluationService.html" rel="nofollow noreferrer"><code>org.eclipse.ui.services.IEvaluationService.requestEvaluation(String)</code></a> (source <a href="http://www.java2s.com/Open-Source/Java-Document/IDE-Eclipse/ui-workbench/org/eclipse/ui/internal/services/IEvaluationService.java.htm" rel="nofollow noreferrer">here</a>) for that property (which would cause all core expressions using that property tester to be re-evaluated).<br> The important point is that simply changing views would not cause a re-evaluation (and not change enabled state).</p> <p>You can set up the property tester to be specific to each view that you need this for, or create one <code>com.example.views.localSelection</code> and use <code>args</code> to specify the view <code>id</code>.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload