drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/actions/OpenGuvnorWebConsoleAction.java
public void selectionChanged(IAction action, ISelection selection) {
        action.setEnabled(false);

        if (!(selection instanceof IStructuredSelection)) {
            return;
        }

        IStructuredSelection sel = (IStructuredSelection)selection;
        if (sel.size() != 1) {
            return;
        }

        if (sel.getFirstElement() instanceof TreeObject) {
            if (((TreeObject)sel.getFirstElement()).getNodeType() == TreeObject.Type.REPOSITORY) {
                selectedNode = (TreeObject)sel.getFirstElement();
                action.setEnabled(true);
            }
        }
    }
public void selectionChanged(IAction action, ISelection selection) {
        action.setEnabled(false);

        if (!(selection instanceof IStructuredSelection)) {
            return;
        }

        IStructuredSelection sel = (IStructuredSelection)selection;
        if (sel.size() != 1) {
            return;
        }

        if (sel.getFirstElement() instanceof TreeObject) {
            if (((TreeObject)sel.getFirstElement()).getNodeType() == TreeObject.Type.REPOSITORY) {
                selectedNode = (TreeObject)sel.getFirstElement();
                action.setEnabled(true);
            }
        }
    }
public void selectionChanged ( IAction action , ISelection selection ) { action . setEnabled ( false ) ; if ( ! ( selection instanceof IStructuredSelection ) ) { return ; } IStructuredSelection sel = ( IStructuredSelection ) selection ; if ( sel . size ( ) != 1 ) { return ; } if ( sel . getFirstElement ( ) instanceof TreeObject ) { if ( ( ( TreeObject ) sel . getFirstElement ( ) ) . getNodeType ( ) == TreeObject . Type . REPOSITORY ) { selectedNode = ( TreeObject ) sel . getFirstElement ( ) ; action . setEnabled ( true ) ; } } }
/*
(non-Javadoc)
@see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
/ * ( non - Javadoc )