IWorkspaceRoot root = ResourcesPlugin.getWorkspace( ).getRoot( ); IProject projects[] = root.getProjects( ); boolean foundOpenProject = false; for ( int i = 0; i < projects.length; i++ ) { if ( projects[i].isOpen( ) ) { foundOpenProject = true; break; } } if ( !foundOpenProject ) { MessageDialog.openError( getShell( ), Messages.getString( "NewReportWizard.title.Error" ), Messages.getString( "NewReportWizard.error.NoProject" ) );     }
	public void init( IWorkbench workbench, IStructuredSelection selection )	{		// check existing open project		IWorkspaceRoot root = ResourcesPlugin.getWorkspace( ).getRoot( );		IProject projects[] = root.getProjects( );		boolean foundOpenProject = false;		for ( int i = 0; i < projects.length; i++ )		{			if ( projects[i].isOpen( ) )			{				foundOpenProject = true;				break;			}		}		if ( !foundOpenProject )		{			MessageDialog.openError( getShell( ),					Messages.getString( "NewReportWizard.title.Error" ), //$NON-NLS-1$					Messages.getString( "NewReportWizard.error.NoProject" ) ); //$NON-NLS-1$			// abort wizard. There is no clean way to do it.			/**			 * Remove the exception here 'cause It's safe since the wizard won't			 * create any file without an open project.			 */			//throw new RuntimeException( );		}		// OK		this.selection = selection;		setWindowTitle( NEW );	}