Java Code Examples for org.eclipse.ui.dialogs.ContainerSelectionDialog#showClosedProjects()

The following examples show how to use org.eclipse.ui.dialogs.ContainerSelectionDialog#showClosedProjects() . 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: CompilerWorkingDirectoryBlock.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Show a dialog that lets the user select a working directory from 
 * the workspace
 */
private void handleWorkspaceDirBrowseButtonSelected() {
    IContainer currentContainer= getContainer(getOtherDirectoryText());
    if (currentContainer == null) {
        currentContainer = ResourcesPlugin.getWorkspace().getRoot();
    } 
    ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), currentContainer, false, Messages.CompilerWorkingDirectoryBlock_SelectWorkspaceRelWorkDir+':'); 
    dialog.showClosedProjects(false);
    dialog.open();
    Object[] results = dialog.getResult();      
    if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) {
        IPath path = (IPath)results[0];
        String containerName = path.makeRelative().toString();
        setOtherWorkingDirectoryText("${workspace_loc:" + containerName + "}"); //$NON-NLS-1$ //$NON-NLS-2$
        if (actionListener != null) {
            actionListener.actionPerformed(null);
        }
    }           
}
 
Example 2
Source File: H5ResourcePage.java    From dawnsci with Eclipse Public License 1.0 6 votes vote down vote up
/**
   * Queries the user to supply a container resource.
   *
   * @return the path to an existing or new container, or <code>null</code> if the
   *    user cancelled the dialog
   */
  protected IPath queryForContainer(IContainer initialSelection, String msg,
          String title) {
      ContainerSelectionDialog dialog = new ContainerSelectionDialog(
              getControl().getShell(), initialSelection,
              false, msg);
      if (title != null) {
	dialog.setTitle(title);
}
      dialog.showClosedProjects(false);
      dialog.open();
      Object[] result = dialog.getResult();
      if (result != null && result.length == 1) {
          return (IPath) result[0];
      }
      return null;
  }
 
Example 3
Source File: PyMoveResourceAction.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
private IPath pyQueryDestinationResource() {
    // start traversal at root resource, should probably start at a
    // better location in the tree
    String title;
    if (selected.size() == 1) {
        title = "Choose destination for ''" + selected.get(0).getName() + "'':";
    } else {
        title = "Choose destination for " + selected.size() + " selected resources:";
    }
    ContainerSelectionDialog dialog = new ContainerSelectionDialog(shellProvider.getShell(),
            selected.get(0).getParent(), true, title);
    dialog.setTitle("Move Resources");
    dialog.setValidator(this);
    dialog.showClosedProjects(false);
    dialog.open();
    Object[] result = dialog.getResult();
    if (result != null && result.length == 1) {
        return (IPath) result[0];
    }
    return null;
}
 
Example 4
Source File: WorkingDirectoryBlock.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Show a dialog that lets the user select a working directory from 
 * the workspace
 */
private void handleWorkspaceDirBrowseButtonSelected() {
    IContainer currentContainer = getContainer();
    if (currentContainer == null) {
        currentContainer = ResourcesPlugin.getWorkspace().getRoot();
    }
    ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), currentContainer, false,
            "Select a workspace relative working directory");
    dialog.showClosedProjects(false);
    dialog.open();
    Object[] results = dialog.getResult();
    if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) {
        IPath path = (IPath) results[0];
        String containerName = path.makeRelative().toString();
        setOtherWorkingDirectoryText("${workspace_loc:" + containerName + "}"); //$NON-NLS-1$ //$NON-NLS-2$
    }
}
 
Example 5
Source File: PyCodeCoverageView.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run() {
    ContainerSelectionDialog dialog = new ContainerSelectionDialog(getSite().getShell(), null, false,
            "Choose folder to be analyzed in the code-coverage");
    dialog.showClosedProjects(false);
    if (dialog.open() != Window.OK) {
        return;
    }
    Object[] objects = dialog.getResult();
    if (objects.length == 1) { //only one folder can be selected
        if (objects[0] instanceof IPath) {
            IPath p = (IPath) objects[0];

            IWorkspace w = ResourcesPlugin.getWorkspace();
            IContainer folderForLocation = (IContainer) w.getRoot().findMember(p);
            setSelectedContainer(folderForLocation);
        }
    }
}