Search in sources :

Example 1 with PropertyTester

use of org.eclipse.core.expressions.PropertyTester in project jop by jop-devel.

the class ToggleJOPNatureAction method run.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
	 */
public void run(IAction action) {
    if (selection instanceof IStructuredSelection) {
        for (Iterator it = ((IStructuredSelection) selection).iterator(); it.hasNext(); ) {
            Object element = it.next();
            IProject project = null;
            if (element instanceof IProject) {
                project = (IProject) element;
            } else if (element instanceof IAdaptable) {
                project = (IProject) ((IAdaptable) element).getAdapter(IProject.class);
            }
            if (project != null) {
                toggleNature(project);
                System.err.println(project + " > Nature");
                PropertyTester jopPropTest = new JOPNaturePropertyTester();
                jopPropTest.test(project, "hasJOPNature", null, null);
            }
        }
    }
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) PropertyTester(org.eclipse.core.expressions.PropertyTester) Iterator(java.util.Iterator) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IProject(org.eclipse.core.resources.IProject)

Aggregations

Iterator (java.util.Iterator)1 PropertyTester (org.eclipse.core.expressions.PropertyTester)1 IProject (org.eclipse.core.resources.IProject)1 IAdaptable (org.eclipse.core.runtime.IAdaptable)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1