08e097870b3bed3cd1e8695e5c2b6652dd116bb5
[phpeclipse.git] /
1 package net.sourceforge.phpdt.externaltools.internal.program.launchConfigurations;
2
3 import org.eclipse.core.resources.IFile;
4 import org.eclipse.core.resources.ResourcesPlugin;
5 import net.sourceforge.phpdt.externaltools.internal.ui.FileSelectionDialog;
6 import net.sourceforge.phpdt.externaltools.launchConfigurations.ExternalToolsMainTab;
7 import net.sourceforge.phpdt.externaltools.model.IExternalToolConstants;
8 import net.sourceforge.phpdt.externaltools.model.ToolUtil;
9
10 public class ProgramMainTab extends ExternalToolsMainTab {
11
12         /**
13          * Prompts the user for a program location within the workspace and sets the
14          * location as a String containing the workspace_loc variable or
15          * <code>null</code> if no location was obtained from the user.
16          */
17         protected void handleWorkspaceLocationButtonSelected() {
18                 FileSelectionDialog dialog;
19                 dialog = new FileSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), "&Select a program");
20                 dialog.open();
21                 IFile file = dialog.getResult();
22                 if (file == null) {
23                         return;
24                 }
25                 StringBuffer buf = new StringBuffer();
26                 ToolUtil.buildVariableTag(IExternalToolConstants.VAR_WORKSPACE_LOC, file.getFullPath().toString(), buf);
27                 String text= buf.toString();
28                 if (text != null) {
29                         locationField.setText(text);
30                 }
31         }
32
33 }