Java Code Examples for org.eclipse.ui.dialogs.ElementListSelectionDialog#setHelpAvailable()

The following examples show how to use org.eclipse.ui.dialogs.ElementListSelectionDialog#setHelpAvailable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NewSourceFolderWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private IJavaProject chooseProject() {
	IJavaProject[] projects;
	try {
		projects= JavaCore.create(fWorkspaceRoot).getJavaProjects();
	} catch (JavaModelException e) {
		JavaPlugin.log(e);
		projects= new IJavaProject[0];
	}

	ILabelProvider labelProvider= new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
	ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), labelProvider);
	dialog.setTitle(NewWizardMessages.NewSourceFolderWizardPage_ChooseProjectDialog_title);
	dialog.setMessage(NewWizardMessages.NewSourceFolderWizardPage_ChooseProjectDialog_description);
	dialog.setElements(projects);
	dialog.setInitialSelections(new Object[] { fCurrJProject });
	dialog.setHelpAvailable(false);
	if (dialog.open() == Window.OK) {
		return (IJavaProject) dialog.getFirstResult();
	}
	return null;
}
 
Example 2
Source File: GWTCompileDialog.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private IJavaProject chooseProject() {
  IJavaProject[] javaProjects;

  try {
    javaProjects = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProjects();
  } catch (JavaModelException e) {
    GWTPluginLog.logError(e);
    javaProjects = new IJavaProject[0];
  }

  // Filter the list to only show GWT projects
  List<IJavaProject> gwtProjects = new ArrayList<IJavaProject>();
  for (IJavaProject javaProject : javaProjects) {
    if (GWTNature.isGWTProject(javaProject.getProject())) {
      gwtProjects.add(javaProject);
    }
  }

  ILabelProvider labelProvider = new JavaElementLabelProvider(
      JavaElementLabelProvider.SHOW_DEFAULT);
  ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
  dialog.setTitle("Project Selection");
  dialog.setMessage("Choose a project to compile");
  dialog.setElements(gwtProjects.toArray(new IJavaProject[0]));
  dialog.setInitialSelections(new Object[] {JavaCore.create(project)});

  dialog.setHelpAvailable(false);
  if (dialog.open() == Window.OK) {
    return (IJavaProject) dialog.getFirstResult();
  }
  return null;
}
 
Example 3
Source File: NewModuleWizardPage.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private IPackageFragment choosePackage() {
  IPackageFragmentRoot root = getPackageFragmentRoot();
  IJavaElement[] packages = null;
  try {
    if (root != null && root.exists()) {
      packages = root.getChildren();
    }
  } catch (JavaModelException e) {
    JavaPlugin.log(e);
  }
  if (packages == null) {
    packages = new IJavaElement[0];
  }

  ElementListSelectionDialog dialog = new ElementListSelectionDialog(
      getShell(), new JavaElementLabelProvider(
          JavaElementLabelProvider.SHOW_DEFAULT));
  dialog.setIgnoreCase(false);
  dialog.setTitle(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_title);
  dialog.setMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_description);
  dialog.setEmptyListMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_empty);
  dialog.setElements(packages);
  dialog.setHelpAvailable(false);

  if (dialog.open() == Window.OK) {
    return (IPackageFragment) dialog.getFirstResult();
  }
  return null;
}
 
Example 4
Source File: NewHostPageWizardPage.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private IJavaProject chooseProject() {
  IJavaProject[] projects;
  try {
    projects = JavaCore.create(Util.getWorkspaceRoot()).getJavaProjects();
  } catch (JavaModelException e) {
    JavaPlugin.log(e);
    projects = new IJavaProject[0];
  }

  // Filter the list to only show GWT projects
  List<IJavaProject> gwtProjects = new ArrayList<IJavaProject>();
  for (IJavaProject project : projects) {
    if (GWTNature.isGWTProject(project.getProject())) {
      gwtProjects.add(project);
    }
  }

  // TODO: refactor this into utility function
  ILabelProvider labelProvider = new JavaElementLabelProvider(
      JavaElementLabelProvider.SHOW_DEFAULT);
  ElementListSelectionDialog dialog = new ElementListSelectionDialog(
      getShell(), labelProvider);
  dialog.setTitle("Project Selection");
  dialog.setMessage("Choose a project for the new HTML page");
  dialog.setElements(gwtProjects.toArray(new IJavaProject[0]));
  dialog.setInitialSelections(new Object[] {getJavaProject()});
  dialog.setHelpAvailable(false);
  if (dialog.open() == Window.OK) {
    return (IJavaProject) dialog.getFirstResult();
  }
  return null;
}
 
Example 5
Source File: NewTypeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Opens a selection dialog that allows to select a package.
 *
 * @return returns the selected package or <code>null</code> if the dialog has been canceled.
 * The caller typically sets the result to the package input field.
 * <p>
 * Clients can override this method if they want to offer a different dialog.
 * </p>
 *
 * @since 3.2
 */
protected IPackageFragment choosePackage() {
	IPackageFragmentRoot froot= getPackageFragmentRoot();
	IJavaElement[] packages= null;
	try {
		if (froot != null && froot.exists()) {
			packages= froot.getChildren();
		}
	} catch (JavaModelException e) {
		JavaPlugin.log(e);
	}
	if (packages == null) {
		packages= new IJavaElement[0];
	}

	ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT));
	dialog.setIgnoreCase(false);
	dialog.setTitle(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_title);
	dialog.setMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_description);
	dialog.setEmptyListMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_empty);
	dialog.setElements(packages);
	dialog.setHelpAvailable(false);

	IPackageFragment pack= getPackageFragment();
	if (pack != null) {
		dialog.setInitialSelections(new Object[] { pack });
	}

	if (dialog.open() == Window.OK) {
		return (IPackageFragment) dialog.getFirstResult();
	}
	return null;
}