Package org.testng.eclipse.ui.util

Source Code of org.testng.eclipse.ui.util.ProjectChooserDialog

package org.testng.eclipse.ui.util;

import org.testng.eclipse.util.JDTUtil;
import org.testng.eclipse.util.ResourceUtil;

import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;


/**
* Class usage XXX
*
* @version $Revision$
*/
public class ProjectChooserDialog {
  public static IJavaProject getSelectedProject(Shell parentShell) {
    ElementListSelectionDialog dialog= new ElementListSelectionDialog(
          parentShell,
          new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT)
    );
    dialog.setTitle(ResourceUtil.getString("TestNGMainTab.projectdialog.title")); //$NON-NLS-1$
    dialog.setMessage(ResourceUtil.getString("TestNGMainTab.projectdialog.message")); //$NON-NLS-1$
    dialog.setElements(JDTUtil.getJavaProjects());
   
    if(Window.OK == dialog.open()) {     
      return (IJavaProject) dialog.getFirstResult();
    }     
   
    return null;
  }
}
TOP

Related Classes of org.testng.eclipse.ui.util.ProjectChooserDialog

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.