}
}
// if primaryCategories are present, create an "Other" submenu
if (contextManager.getItems().length != 0) {
RunOperationsAction action = new RunOperationsAction();
action.setText(Messages.ToolCategory_other);
contextManager.add(new Separator());
contextManager.add(action);
} else {
Iterator iter = secondaryCategories.iterator();
while( iter.hasNext() ) {
OperationCategory category = (OperationCategory) iter.next();
for( OpAction action : category.getActions() ) {
if( selection instanceof IStructuredSelection )
action.updateEnablement((IStructuredSelection) selection, true);
if (action.isEnabled())
contextManager.add(action);
}
if (iter.hasNext())
contextManager.add(new Separator());
}
if (getOperationMenuFactory().getActions().size() != 0) {
contextManager.add(new Separator());
}
for( OpAction action : getOperationMenuFactory().getActions() ) {
if( selection instanceof IStructuredSelection )
action.updateEnablement((IStructuredSelection) selection, true);
if (action.isEnabled()) {
contextManager.add(action);
}
}
}