public void widgetSelected(SelectionEvent e) { String currentContainerString = outputFolderText.getText(); IContainer currentContainer = getContainer(currentContainerString); ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), currentContainer, false, "Select output folder"); 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.toOSString(); outputFolderText.setText(containerName); } } });
/** * Creates a resource container selection dialog rooted at the given resource. * All selections are considered valid. * * @param parentShell the parent shell * @param initialRoot the initial selection in the tree * @param allowNewContainerName <code>true</code> to enable the user to type in * a new container name, and <code>false</code> to restrict the user to just * selecting from existing ones * @param message the message to be displayed at the top of this dialog, or * <code>null</code> to display a default message */ public ContainerSelectionDialog(Shell parentShell, IContainer initialRoot, boolean allowNewContainerName, String message) { super(parentShell); setTitle(IDEWorkbenchMessages.ContainerSelectionDialog_title); this.initialSelection = initialRoot; this.allowNewContainerName = allowNewContainerName; if (message != null) { setMessage(message); } else { setMessage(IDEWorkbenchMessages.ContainerSelectionDialog_message); } setShellStyle(getShellStyle() | SWT.SHEET); }
/** * Handle browsing for a container. */ protected void handleContainerBrowse() { // Dialog to select container ContainerSelectionDialog dialog = new ContainerSelectionDialog( this.getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, "Select new container"); if (dialog.open() == ContainerSelectionDialog.OK) { // Specify container Object[] result = dialog.getResult(); if (result.length == 1) { this.containerText.setText(result[0].toString()); } } }
/** * Handle browse. */ void handleBrowse() { ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin .getWorkspace().getRoot(), false, "Select a containing folder"); if (dialog.open() == Window.OK) { Object[] result = dialog.getResult(); if (result.length == 1) { containerText.setText(((Path) result[0]).toOSString()); } } }
public void widgetSelected(SelectionEvent e) { ContainerSelectionDialog dialog = new ContainerSelectionDialog(container.getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, "Select new file container"); dialog.showClosedProjects(false); if (dialog.open() == ContainerSelectionDialog.OK) { Object[] res = dialog.getResult(); if (res.length == 1) { result.setText(((Path) res[0]).toString()); } } } });
protected void handleBrowseWorkspace() { ContainerSelectionDialog dialog = new ContainerSelectionDialog(fLocationText.getShell(), getContainer(), true, PDEUIMessages.BaseBlock_relative); if (dialog.open() == Window.OK) { Object[] result = dialog.getResult(); if (result.length == 0) return; IPath path = (IPath) result[0]; fLocationText.setText("${workspace_loc:" + path.makeRelative().toString() + "}"); //$NON-NLS-1$ //$NON-NLS-2$ } }
/** * Asks the user for the destination of this action. * * @return the path on an existing or new resource container, or * <code>null</code> if the operation should be abandoned */ IPath queryDestinationResource() { // start traversal at root resource, should probably start at a // better location in the tree ContainerSelectionDialog dialog = new ContainerSelectionDialog(shellProvider.getShell(), getInitialContainer(), true, IDEWorkbenchMessages.CopyResourceAction_selectDestination); dialog.setValidator(this); dialog.showClosedProjects(false); dialog.open(); Object[] result = dialog.getResult(); if (result != null && result.length == 1) { return (IPath) result[0]; } return null; }
browseButton.setText(Messages.DotnetRunTab_browse); browseButton.addSelectionListener(widgetSelectedAdapter(e -> { ContainerSelectionDialog dialog = new ContainerSelectionDialog(browseButton.getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, Messages.DotnetRunTab_projectFolder); int path = dialog.open(); Object[] results = dialog.getResult(); if (path == 0 && results.length > 0) { pathText.setText(
/** * Shows a dialog to select a folder from the workspace * * @param project the project * @param shell the shell * @param title the title * @param message the message * @param path the initial path * @return the result, null if canceled */ public static String chooseWorkspaceDirectory(Shell shell, IProject project, String title, String message, String path) { path = JettyPluginUtils.resolveVariables(path); ContainerSelectionDialog dialog = new ContainerSelectionDialog(shell, project, false, message); dialog.setTitle(title); if (project != null) { dialog.setInitialSelections(new Object[]{path}); } dialog.showClosedProjects(false); dialog.open(); Object[] results = dialog.getResult(); if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) { IPath folder = (IPath) results[0]; return JettyPluginUtils.toRelativePath(project, folder.toString()); } return null; }
ContainerSelectionDialog dialog = new ContainerSelectionDialog(parentShell,(IContainer)initialResource,true,null); dialog.open(); Object[] result = dialog.getResult(); if (result != null && result.length > 0)
/** * 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, allowNewContainerName(), 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; }
/** * 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, DebugUIMessages.WorkingDirectoryBlock_4); 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$ } }
/** * Handles the shared location button being selected */ private void handleSharedLocationButtonSelected() { String currentContainerString = fSharedLocationText.getText(); IContainer currentContainer = getContainer(currentContainerString); ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), currentContainer, false, LaunchConfigurationsMessages.CommonTab_Select_a_location_for_the_launch_configuration_13); dialog.showClosedProjects(false); dialog.setDialogBoundsSettings(getDialogBoundsSettings(), Dialog.DIALOG_PERSISTSIZE); dialog.open(); Object[] results = dialog.getResult(); if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) { IPath path = (IPath)results[0]; String containerName = path.toOSString(); fSharedLocationText.setText(containerName); } }
/** * Handles the shared location button being selected */ private void handleSharedLocationButtonSelected() { String currentContainerString = fSharedLocationText.getText(); IContainer currentContainer = getContainer(currentContainerString); ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), currentContainer, false, LaunchConfigurationsMessages.CommonTab_Select_a_location_for_the_launch_configuration_13); dialog.showClosedProjects(false); dialog.setDialogBoundsSettings(getDialogBoundsSettings(SHARED_LAUNCH_CONFIGURATON_DIALOG), Dialog.DIALOG_PERSISTSIZE); dialog.open(); Object[] results = dialog.getResult(); if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) { IPath path = (IPath)results[0]; String containerName = path.toOSString(); fSharedLocationText.setText(containerName); } }
private void chooseWebappDir() { IProject project = ResourcesPlugin.getWorkspace().getRoot() .getProject(fProjText.getText()); ContainerSelectionDialog dialog = new ContainerSelectionDialog( getShell(), project, false, "Select Web Application Directory"); dialog.setTitle("Folder Selection"); if (project != null) { IPath path = project.getFullPath(); dialog.setInitialSelections(new Object[] { path }); } dialog.showClosedProjects(false); dialog.open(); Object[] results = dialog.getResult(); if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) { IPath path = (IPath) results[0]; path = path.removeFirstSegments(1); String containerName = path.makeRelative().toString(); fWebAppDirText.setText(containerName); } }
/** * 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, LauncherMessages.WorkingDirectoryBlock_4); 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$ } }
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, Messages.MavenPomWizardPage_dialog_title); dialog.showClosedProjects(false); if(dialog.open() == Window.OK) { Object[] result = dialog.getResult(); if(result.length == 1) { projectText.setText(((Path) result[0]).toString());