if(editor != null) {
ISelectionProvider provider = editor.getSite().getSelectionProvider();
IStructuredSelection selection = (IStructuredSelection)provider.getSelection();
if(selection != null) {
DeckParticle particle = (DeckParticle)selection.getFirstElement();
CardGroup group = null;
if(particle != null && particle instanceof CardGroup) {
group = (CardGroup)particle;
} else if(particle != null && particle instanceof Card) {
group = (CardGroup)particle.getParent();
} else {
Deck deck = (Deck)editor.getEditorInput().getAdapter(Deck.class);
if(deck != null)
group = deck.main;