// If we had a selection lets open the editor
if (obj != null) {
RuleModel rule = (RuleModel) obj;
ShapeGrammarModel grammar = (ShapeGrammarModel) rule
.getParent();
grammar.deleteRule(rule);
// now close the editor holding this rule
for (IEditorReference editor : window.getActivePage()
.getEditorReferences()) {
if (editor.getEditor(false) instanceof RuleEditor) {