Parser: parse a PHP expression after <?= ; statements aren't allowed
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / externaltools / launchConfigurations / ExternalToolsMainTab.java
index 1351b55..2aa0933 100644 (file)
@@ -1,11 +1,9 @@
 package net.sourceforge.phpdt.externaltools.launchConfigurations;
 
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp.  All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
+/***********************************************************************************************************************************
+ * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. This file is made available under the terms of the Common Public License
+ * v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html
+ **********************************************************************************************************************************/
 
 import java.io.File;
 
@@ -28,6 +26,7 @@ import org.eclipse.core.runtime.MultiStatus;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
 import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.IMessageProvider;
 import org.eclipse.jface.preference.IPreferenceStore;
@@ -57,14 +56,21 @@ import org.eclipse.ui.dialogs.SelectionDialog;
 public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
 
   protected Combo locationField;
+
   protected Text workDirectoryField;
+
   protected Button fileLocationButton;
+
   protected Button workspaceLocationButton;
+
   protected Button fileWorkingDirectoryButton;
+
   protected Button workspaceWorkingDirectoryButton;
 
   protected Button runBackgroundButton;
+
   protected Text argumentField;
+
   protected Button variableButton;
 
   protected SelectionAdapter selectionAdapter;
@@ -95,10 +101,10 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
   }
 
   /**
-   * Creates the controls needed to edit the location
-   * attribute of an external tool
+   * Creates the controls needed to edit the location attribute of an external tool
    * 
-   * @param parent the composite to create the controls in
+   * @param parent
+   *          the composite to create the controls in
    */
   protected void createLocationComponent(Composite parent) {
     Font font = parent.getFont();
@@ -122,10 +128,11 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
     data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
     locationField.setLayoutData(data);
     locationField.setFont(font);
-    locationField.add( store.getString(PHPeclipsePlugin.PHP_RUN_PREF), 0);
-               locationField.add( store.getString(PHPeclipsePlugin.APACHE_RUN_PREF), 1);
-               locationField.add( store.getString(PHPeclipsePlugin.MYSQL_RUN_PREF), 2);
-
+    locationField.add(store.getString(PHPeclipsePlugin.PHP_RUN_PREF), 0);
+    locationField.add(store.getString(PHPeclipsePlugin.APACHE_RUN_PREF), 1);
+    locationField.add(store.getString(PHPeclipsePlugin.MYSQL_RUN_PREF), 2);
+    locationField.add(store.getString(PHPeclipsePlugin.XAMPP_START_PREF), 3);
+    locationField.add(store.getString(PHPeclipsePlugin.XAMPP_STOP_PREF), 4);
     Composite buttonComposite = new Composite(parent, SWT.NONE);
     layout = new GridLayout();
     layout.marginWidth = 0;
@@ -138,13 +145,15 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
 
     createVerticalSpacer(buttonComposite, 1);
 
-    workspaceLocationButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.&Browse_Workspace..._3"), null); //$NON-NLS-1$
+    workspaceLocationButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages
+        .getString("ExternalToolsMainTab.&Browse_Workspace..._3"), null); //$NON-NLS-1$
     workspaceLocationButton.addSelectionListener(new SelectionAdapter() {
       public void widgetSelected(SelectionEvent evt) {
         handleWorkspaceLocationButtonSelected();
       }
     });
-    fileLocationButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Brows&e_File_System..._4"), null); //$NON-NLS-1$
+    fileLocationButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages
+        .getString("ExternalToolsMainTab.Brows&e_File_System..._4"), null); //$NON-NLS-1$
     fileLocationButton.addSelectionListener(new SelectionAdapter() {
       public void widgetSelected(SelectionEvent evt) {
         handleLocationButtonSelected();
@@ -153,10 +162,10 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
   }
 
   /**
-   * Creates the controls needed to edit the working directory
-   * attribute of an external tool
+   * Creates the controls needed to edit the working directory attribute of an external tool
    * 
-   * @param parent the composite to create the controls in
+   * @param parent
+   *          the composite to create the controls in
    */
   protected void createWorkDirectoryComponent(Composite parent) {
     Font font = parent.getFont();
@@ -191,13 +200,15 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
     buttonComposite.setFont(font);
 
     createVerticalSpacer(buttonComposite, 1);
-    workspaceWorkingDirectoryButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Browse_Wor&kspace..._6"), null); //$NON-NLS-1$
+    workspaceWorkingDirectoryButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages
+        .getString("ExternalToolsMainTab.Browse_Wor&kspace..._6"), null); //$NON-NLS-1$
     workspaceWorkingDirectoryButton.addSelectionListener(new SelectionAdapter() {
       public void widgetSelected(SelectionEvent evt) {
         handleWorkspaceWorkingDirectoryButtonSelected();
       }
     });
-    fileWorkingDirectoryButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Browse_F&ile_System..._7"), null); //$NON-NLS-1$
+    fileWorkingDirectoryButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages
+        .getString("ExternalToolsMainTab.Browse_F&ile_System..._7"), null); //$NON-NLS-1$
     fileWorkingDirectoryButton.addSelectionListener(new SelectionAdapter() {
       public void widgetSelected(SelectionEvent evt) {
         handleFileWorkingDirectoryButtonSelected();
@@ -206,10 +217,10 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
   }
 
   /**
-   * Creates the controls needed to edit the argument and
-   * prompt for argument attributes of an external tool
-   *
-   * @param parent the composite to create the controls in
+   * Creates the controls needed to edit the argument and prompt for argument attributes of an external tool
+   * 
+   * @param parent
+   *          the composite to create the controls in
    */
   protected void createArgumentComponent(Composite parent) {
     Font font = parent.getFont();
@@ -232,7 +243,8 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
       }
     });
 
-    variableButton = createPushButton(parent, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsOptionTab.Varia&bles..._2"), null); //$NON-NLS-1$
+    variableButton = createPushButton(parent, ExternalToolsLaunchConfigurationMessages
+        .getString("ExternalToolsOptionTab.Varia&bles..._2"), null); //$NON-NLS-1$
     variableButton.addSelectionListener(new SelectionAdapter() {
       public void widgetSelected(SelectionEvent e) {
         VariableSelectionDialog dialog = new VariableSelectionDialog(getShell());
@@ -243,7 +255,9 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
     });
 
     Label instruction = new Label(parent, SWT.NONE);
-    instruction.setText(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsOptionTab.Note__Enclose_an_argument_containing_spaces_using_double-quotes_(__)._Not_applicable_for_variables._3")); //$NON-NLS-1$
+    instruction
+        .setText(ExternalToolsLaunchConfigurationMessages
+            .getString("ExternalToolsOptionTab.Note__Enclose_an_argument_containing_spaces_using_double-quotes_(__)._Not_applicable_for_variables._3")); //$NON-NLS-1$
     data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
     data.horizontalSpan = 2;
     instruction.setLayoutData(data);
@@ -251,14 +265,15 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
   }
 
   /**
-   * Creates the controls needed to edit the run in background
-   * attribute of an external tool
-   *
-   * @param parent the composite to create the controls in
+   * Creates the controls needed to edit the run in background attribute of an external tool
+   * 
+   * @param parent
+   *          the composite to create the controls in
    */
   protected void createRunBackgroundComponent(Composite parent) {
     runBackgroundButton = new Button(parent, SWT.CHECK);
-    runBackgroundButton.setText(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsOptionTab.Run_tool_in_bac&kground_4")); //$NON-NLS-1$
+    runBackgroundButton.setText(ExternalToolsLaunchConfigurationMessages
+        .getString("ExternalToolsOptionTab.Run_tool_in_bac&kground_4")); //$NON-NLS-1$
     GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
     runBackgroundButton.setLayoutData(data);
     runBackgroundButton.setFont(parent.getFont());
@@ -287,7 +302,8 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
     try {
       workingDir = configuration.getAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, ""); //$NON-NLS-1$
     } catch (CoreException ce) {
-      ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Error_reading_configuration_10"), ce); //$NON-NLS-1$
+      ExternalToolsPlugin.getDefault().log(
+          ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Error_reading_configuration_10"), ce); //$NON-NLS-1$
     }
     workDirectoryField.setText(workingDir);
     workDirectoryField.addModifyListener(modifyListener);
@@ -299,7 +315,8 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
     try {
       location = configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, ""); //$NON-NLS-1$
     } catch (CoreException ce) {
-      ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Error_reading_configuration_10"), ce); //$NON-NLS-1$
+      ExternalToolsPlugin.getDefault().log(
+          ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Error_reading_configuration_10"), ce); //$NON-NLS-1$
     }
     locationField.setText(location);
     locationField.addModifyListener(modifyListener);
@@ -310,7 +327,8 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
     try {
       arguments = configuration.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, ""); //$NON-NLS-1$
     } catch (CoreException ce) {
-      ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsOptionTab.Error_reading_configuration_7"), ce); //$NON-NLS-1$
+      ExternalToolsPlugin.getDefault().log(
+          ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsOptionTab.Error_reading_configuration_7"), ce); //$NON-NLS-1$
     }
     argumentField.setText(arguments);
   }
@@ -320,7 +338,8 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
     try {
       runInBackgroud = configuration.getAttribute(IExternalToolConstants.ATTR_RUN_IN_BACKGROUND, false);
     } catch (CoreException ce) {
-      ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsOptionTab.Error_reading_configuration_7"), ce); //$NON-NLS-1$
+      ExternalToolsPlugin.getDefault().log(
+          ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsOptionTab.Error_reading_configuration_7"), ce); //$NON-NLS-1$
     }
     runBackgroundButton.setSelection(runInBackgroud);
   }
@@ -375,7 +394,8 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
   protected boolean validateLocation() {
     String value = locationField.getText().trim();
     if (value.length() < 1) {
-      setErrorMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.External_tool_location_cannot_be_empty_18")); //$NON-NLS-1$
+      setErrorMessage(ExternalToolsLaunchConfigurationMessages
+          .getString("ExternalToolsMainTab.External_tool_location_cannot_be_empty_18")); //$NON-NLS-1$
       setMessage(null);
       return false;
     }
@@ -395,11 +415,13 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
 
     File file = new File(value);
     if (!file.exists()) { // The file does not exist.
-      setErrorMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.External_tool_location_does_not_exist_19")); //$NON-NLS-1$
+      setErrorMessage(ExternalToolsLaunchConfigurationMessages
+          .getString("ExternalToolsMainTab.External_tool_location_does_not_exist_19")); //$NON-NLS-1$
       return false;
     }
     if (!file.isFile()) {
-      setErrorMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.External_tool_location_specified_is_not_a_file_20")); //$NON-NLS-1$
+      setErrorMessage(ExternalToolsLaunchConfigurationMessages
+          .getString("ExternalToolsMainTab.External_tool_location_specified_is_not_a_file_20")); //$NON-NLS-1$
       return false;
     }
     return true;
@@ -426,7 +448,8 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
 
       File file = new File(value);
       if (!file.exists()) { // The directory does not exist.
-        setErrorMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.External_tool_working_directory_does_not_exist_or_is_invalid_21")); //$NON-NLS-1$
+        setErrorMessage(ExternalToolsLaunchConfigurationMessages
+            .getString("ExternalToolsMainTab.External_tool_working_directory_does_not_exist_or_is_invalid_21")); //$NON-NLS-1$
         return false;
       }
     }
@@ -443,13 +466,13 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
   }
 
   /**
-   * Prompts the user for a workspace location within the workspace and sets
-   * the location as a String containing the workspace_loc variable or
-   * <code>null</code> if no location was obtained from the user.
+   * Prompts the user for a workspace location within the workspace and sets the location as a String containing the workspace_loc
+   * variable or <code>null</code> if no location was obtained from the user.
    */
   protected void handleWorkspaceLocationButtonSelected() {
     ResourceSelectionDialog dialog;
-    dialog = new ResourceSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Select_a_resource_22")); //$NON-NLS-1$
+    dialog = new ResourceSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(),
+        ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Select_a_resource_22")); //$NON-NLS-1$
     dialog.open();
     Object[] results = dialog.getResult();
     if (results == null || results.length < 1) {
@@ -465,13 +488,13 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
   }
 
   /**
-   * Prompts the user for a working directory location within the workspace
-   * and sets the working directory as a String containing the workspace_loc
-   * variable or <code>null</code> if no location was obtained from the user.
+   * Prompts the user for a working directory location within the workspace and sets the working directory as a String containing
+   * the workspace_loc variable or <code>null</code> if no location was obtained from the user.
    */
   protected void handleWorkspaceWorkingDirectoryButtonSelected() {
     ContainerSelectionDialog containerDialog;
-    containerDialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.&Select_a_directory__23")); //$NON-NLS-1$
+    containerDialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
+        ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.&Select_a_directory__23")); //$NON-NLS-1$
     containerDialog.open();
     Object[] resource = containerDialog.getResult();
     String text = null;
@@ -502,6 +525,7 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
 
   /**
    * Method getSelectionAdapter.
+   * 
    * @return SelectionListener
    */
   protected SelectionListener getSelectionAdapter() {
@@ -517,15 +541,18 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
 
   private class VariableSelectionDialog extends SelectionDialog {
     private ExternalToolVariableForm form;
+
     private VariableSelectionDialog(Shell parent) {
       super(parent);
       setTitle(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsOptionTab.Select_variable_10")); //$NON-NLS-1$
     }
+
     protected Control createDialogArea(Composite parent) {
       // Create the dialog area
       Composite composite = (Composite) super.createDialogArea(parent);
       ExternalToolVariable[] variables = ExternalToolsPlugin.getDefault().getArgumentVariableRegistry().getArgumentVariables();
-      form = new ExternalToolVariableForm(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsOptionTab.&Choose_a_variable__11"), variables); //$NON-NLS-1$
+      form = new ExternalToolVariableForm(ExternalToolsLaunchConfigurationMessages
+          .getString("ExternalToolsOptionTab.&Choose_a_variable__11"), variables); //$NON-NLS-1$
       form.createContents(composite, new IGroupDialogPage() {
         public GridData setButtonGridData(Button button) {
           GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
@@ -569,4 +596,4 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
     }
   }
 
-}
+}
\ No newline at end of file