title: Eclipse Plugin isEnabled getEditor Infinite Loop
body: <p>I am developing an eclipse plugin.</p>
  
  <p>I want to only enable a button on the toolbar when a certain file type is active in the editor.  Seeming easily enough, I used the following code:</p>
  
  <pre><code>@Override
  public boolean isEnabled() {
      if(FileGetter.getCurrentEditorFile().getFileExtension().equals("jvw"))
          return true;
      return false;
  }
  </code></pre>
  
  <p>In this example, "getCurrentEditorFile()" gets the active editor via PlatformUI and so on.</p>
  
  <p>While running eclipse, this works perfectly! Switching files in the editor causes the button to enable/disable as files with different extensions selected.</p>
  
  <p>However, upon closing eclipse, it gives hundreds of lines of error tracing, seemingly in a loop.</p>
  
  <p>The error trace (some of it) can be found here --> <a href="http://pastebin.com/X4pe1n4b" rel="nofollow">http://pastebin.com/X4pe1n4b</a></p>
  
  <p>I believe that when the isEnabled is called, it gets the editor (to check the file extension) which then causes the button isEnabled to trigger again, forming an infinite loop.</p>
  
  <p>If this is correct however, I don't see why it would only happen upon closing eclipse and not during general use.</p>
  
  <p>I know this is a vague question (sorry, stack overflow) but, any vague ideas / suggestions are appreciated.</p>
  
  <p>Thank you!
  Also, feel free to ask more, if you wish.</p>