title: Dynamic label of a popup action in eclipse plugin development
body: <p>I want to create a simple eclipse plugin, which does: When you right click a java project, it will show a popup menu which has a item has label "N java files found in this project", where "N" is the file count.</p>
  
  <p>I have an idea that I can update the label in "selectionChanged":</p>
  
  <pre><code>public class CountAction implements IObjectActionDelegate {
      public void selectionChanged(IAction action, ISelection selection) {
          action.setText(countJavaFiles());
      }
  }
  </code></pre>
  
  <p>But it doesn't work if I don't click that menu item, since the <code>CountAction</code> has not been loaded, that <code>selectionChanged</code> won't be invoked when you right-click on the project.</p>
  
  <p>I have spent a lot of time on this, but not solved. Please help me.</p>