Exemplo n.º 1
0
  private IJavaProject chooseJavaProject() {
    IJavaProject[] projects;
    try {
      projects = JavaCore.create(getWorkspaceRoot()).getJavaProjects();
    } catch (JavaModelException e) {
      EasybLaunchActivator.getDefault().getLog().log(e.getStatus());
      projects = new IJavaProject[0];
    }

    ILabelProvider labelProvider =
        new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
    ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
    dialog.setTitle("Projects");
    dialog.setMessage("Please choose a project");
    dialog.setElements(projects);

    IJavaProject javaProject = getJavaProject();
    if (javaProject != null) {
      dialog.setInitialSelections(new Object[] {javaProject});
    }
    if (dialog.open() == Window.OK) {
      return (IJavaProject) dialog.getFirstResult();
    }
    return null;
  }
Exemplo n.º 2
0
  @Override
  public void setDefaults(ILaunchConfigurationWorkingCopy config) {

    IProject proj = EasybLaunchActivator.getDefault().getSelectedProject();

    if (proj != null) {
      config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, proj.getName());
    }
  }