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