NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Context Aware action gets enabled, but does nothing sometimes

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users
View previous topic :: View next topic  
Author Message
Mvek



Joined: 31 Oct 2011
Posts: 43
Location: Prague, Czech Republic

PostPosted: Thu Apr 26, 2012 10:47 pm    Post subject: Context Aware action gets enabled, but does nothing sometimes Reply with quote

I have strange behaviour of the context aware action. I created it via a wizard, I choose Conditionally enabled and wrote into the combobox "VyrokNode", which is my node class (inherits from AbstractNode).

The action is correctly enabled and functions, when I choose some VyrokNode in explorer view. The problem is, it is enabled also when I open only Properties window (without any ExplorerView, so it is empty), or some other windows, I created... But this time, clicking the button (in toolbar or menu) does nothing, it even does not call the actionPerformed() method, so I cannot debug it and find out, what is in the context really...

Any ideas, why does this happen?
Back to top
Mvek



Joined: 31 Oct 2011
Posts: 43
Location: Prague, Czech Republic

PostPosted: Thu Apr 26, 2012 10:49 pm    Post subject: Reply with quote

The whole code of my action VyrokAction is here:

Code:
@ActionID(category = "VNode",
id = "org.vse.aha.gui.actions.VýrokDetailAction")
@ActionRegistration(iconBase = "org/vse/aha/gui/actions/detailIkona16.png",
displayName = "#CTL_VýrokDetailAction")
@ActionReferences({
  @ActionReference(path = "Menu/File", position = 1300),
  @ActionReference(path = "Toolbars/File", position = 300)
})
@Messages("CTL_VýrokDetailAction=Detail výroku")
public final class VýrokDetailAction implements ActionListener {

  private final VýrokNode context;

  public VýrokDetailAction(VýrokNode context) {
    this.context = context;
  }

  @Override
  public void actionPerformed(ActionEvent ev) {
    WindowManager.getDefault().findTopComponent("DetailVyrokuTopComponent").open();
  }
}


(I know, I used not normal latin characters, because this should be just a demonstrative teaching example and there we often use Czech class and methods names; NB seems working with it ok, except for the name of TopComponent class, but I hope this cannot do this strange enabling, I described)
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo