public JPopupMenu getContextualMenu(int textIndex) {
boolean overReference = window.getCurrentReference() != null;
boolean overToken = window.getCurrentToken() != null;
boolean overSelection = window.getTextPane().getSelectionStart() != window.getTextPane().getSelectionEnd();
ContextualStringTemplateMenuFactory factory = new ContextualStringTemplateMenuFactory(this);
factory.addItem(MI_GOTO_RULE);
if(overReference)
factory.addItem(MI_GOTO_DECLARATION);
factory.addSeparator();
if(overToken)
factory.addItem(MI_RENAME);
if(overToken) {
factory.addSeparator();
if(overSelection)
factory.addItem(MI_FIND_TOKEN);
//factory.addItem(MI_FIND_USAGE);
}
return factory.menu;
}