Java Code Examples for org.eclipse.ui.dialogs.ContainerSelectionDialog#OK

The following examples show how to use org.eclipse.ui.dialogs.ContainerSelectionDialog#OK . 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: NewImpexWizardPage.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 5 votes vote down vote up
private void handleBrowse() {
	ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace()
	                .getRoot(), false, "Select Project/Folder");
	if (dialog.open() == ContainerSelectionDialog.OK) {
		Object[] result = dialog.getResult();
		if (result.length == 1) {
			containerText.setText(((Path) result[0]).toString());
		}
	}
}
 
Example 2
Source File: NewClassWizardPage.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * Uses the standard container selection dialog to choose the new value for
 * the container field.
 */

private void handleBrowse() {
	ContainerSelectionDialog dialog = new ContainerSelectionDialog(
			getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
			"Select new file container");
	if (dialog.open() == ContainerSelectionDialog.OK) {
		Object[] result = dialog.getResult();
		if (result.length == 1) {
			containerText.setText(((Path) result[0]).toString());
		}
	}
}
 
Example 3
Source File: WorkspaceTools.java    From depan with Apache License 2.0 5 votes vote down vote up
/**
 * Open a dialog box asking the user to select an existing project under the
 * current workspace.
 *
 * @param parentShell
 * @param defaultValue
 * @return a String representing the name of the chosen project, or
 *         defaultValue if nothing was selected (or "cancel" button was
 *         pressed...)
 */
public static String selectProject(Shell parentShell, String defaultValue) {
  IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
  ContainerSelectionDialog dialog = new ContainerSelectionDialog(
      parentShell, workspaceRoot, false, "Select new file container");
  if (dialog.open() == ContainerSelectionDialog.OK) {
    Object[] result = dialog.getResult();
    if (result.length == 1) {
      return ((Path) result[0]).toString();
    }
  }
  return defaultValue;
}
 
Example 4
Source File: YangPageFile.java    From yang-design-studio with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Uses the standard container selection dialog to choose the new value for
 * the container field.
 */

private void handleBrowse() {
	ContainerSelectionDialog dialog = new ContainerSelectionDialog(
			getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
			"Select new file container");
	if (dialog.open() == ContainerSelectionDialog.OK) {
		Object[] result = dialog.getResult();
		if (result.length == 1) {
			containerText.setText(((Path) result[0]).toString());
		}
	}
}
 
Example 5
Source File: RadlNewWizardPage.java    From RADL with Apache License 2.0 5 votes vote down vote up
private void selectFolder() {
  ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), root, false, "Select Location");
  if (dialog.open() == ContainerSelectionDialog.OK) {
    Object[] result = dialog.getResult();
    if (result.length == 1) {
      folderText.setText(((Path)result[0]).toString());
    }
  }
}