Reverted to rev 1.4 keys had been mistakenly deleted.
[phpeclipse.git] / net.sourceforge.phpeclipse.externaltools / src / net / sourceforge / phpdt / externaltools / launchConfigurations / ExternalToolsRefreshTab.java
index a097c92..c0a3258 100644 (file)
@@ -1,11 +1,11 @@
 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 net.sourceforge.phpdt.externaltools.group.IGroupDialogPage;
 import net.sourceforge.phpdt.externaltools.internal.dialog.ExternalToolVariableForm;
@@ -29,20 +29,22 @@ import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 
-public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab implements IGroupDialogPage {
+public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab
+               implements IGroupDialogPage {
 
        private ExternalToolVariableForm variableForm;
-       
+
        protected Button refreshField;
+
        protected Button recursiveField;
-       
+
        /**
         * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
         */
        public void createControl(Composite parent) {
                Composite mainComposite = new Composite(parent, SWT.NONE);
                setControl(mainComposite);
-               
+
                GridLayout layout = new GridLayout();
                layout.numColumns = 1;
                GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
@@ -54,16 +56,19 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
                createRecursiveComponent(mainComposite);
                createScopeComponent(mainComposite);
        }
-       
+
        /**
-        * Creates the controls needed to edit the refresh recursive
-        * attribute of an external tool
+        * Creates the controls needed to edit the refresh recursive 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 createRecursiveComponent(Composite parent) {
                recursiveField = new Button(parent, SWT.CHECK);
-               recursiveField.setText(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsRefreshTab.Recursively_&include_sub-folders_1")); //$NON-NLS-1$
+               recursiveField
+                               .setText(ExternalToolsLaunchConfigurationMessages
+                                               .getString("ExternalToolsRefreshTab.Recursively_&include_sub-folders_1")); //$NON-NLS-1$
                GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
                recursiveField.setLayoutData(data);
                recursiveField.setFont(parent.getFont());
@@ -73,16 +78,19 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
                        }
                });
        }
-       
+
        /**
-        * Creates the controls needed to edit the refresh scope
-        * attribute of an external tool
+        * Creates the controls needed to edit the refresh scope 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 createRefreshComponent(Composite parent) {
                refreshField = new Button(parent, SWT.CHECK);
-               refreshField.setText(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsRefreshTab.&Refresh_resources_after_running_tool_1")); //$NON-NLS-1$
+               refreshField
+                               .setText(ExternalToolsLaunchConfigurationMessages
+                                               .getString("ExternalToolsRefreshTab.&Refresh_resources_after_running_tool_1")); //$NON-NLS-1$
                GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
                refreshField.setLayoutData(data);
                refreshField.setFont(parent.getFont());
@@ -93,20 +101,22 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
                        }
                });
        }
-       
+
        /**
-        * Creates the controls needed to edit the refresh scope variable
-        * attribute of an external tool
+        * Creates the controls needed to edit the refresh scope variable 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 createScopeComponent(Composite parent) {
-               String label = ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsRefreshTab.Choose_scope_v&ariable___2"); //$NON-NLS-1$
-               ExternalToolVariable[] vars = ExternalToolsPlugin.getDefault().getRefreshVariableRegistry().getRefreshVariables();
+               String label = ExternalToolsLaunchConfigurationMessages
+                               .getString("ExternalToolsRefreshTab.Choose_scope_v&ariable___2"); //$NON-NLS-1$
+               ExternalToolVariable[] vars = ExternalToolsPlugin.getDefault()
+                               .getRefreshVariableRegistry().getRefreshVariables();
                variableForm = new ExternalToolVariableForm(label, vars);
                variableForm.createContents(parent, this);
        }
-       
 
        /**
         * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
@@ -122,52 +132,74 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
                updateRecursive(configuration);
                updateScope(configuration);
        }
+
        /**
         * Method udpateScope.
+        * 
         * @param configuration
         */
        private void updateScope(ILaunchConfiguration configuration) {
                String scope = null;
                try {
-                       scope= configuration.getAttribute(IExternalToolConstants.ATTR_REFRESH_SCOPE, (String)null);
+                       scope = configuration.getAttribute(
+                                       IExternalToolConstants.ATTR_REFRESH_SCOPE, (String) null);
                } catch (CoreException ce) {
-                       ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsRefreshTab.Exception_reading_launch_configuration_3"), ce); //$NON-NLS-1$
+                       ExternalToolsPlugin
+                                       .getDefault()
+                                       .log(
+                                                       ExternalToolsLaunchConfigurationMessages
+                                                                       .getString("ExternalToolsRefreshTab.Exception_reading_launch_configuration_3"), ce); //$NON-NLS-1$
                }
                String varName = null;
                String varValue = null;
                if (scope != null) {
-                       ToolUtil.VariableDefinition varDef = ToolUtil.extractVariableTag(scope, 0);
+                       ToolUtil.VariableDefinition varDef = ToolUtil.extractVariableTag(
+                                       scope, 0);
                        varName = varDef.name;
                        varValue = varDef.argument;
                }
                variableForm.selectVariable(varName, varValue);
        }
+
        /**
         * Method updateRecursive.
+        * 
         * @param configuration
         */
        private void updateRecursive(ILaunchConfiguration configuration) {
-               boolean recursive= true;
+               boolean recursive = true;
                try {
-                       recursive= configuration.getAttribute(IExternalToolConstants.ATTR_REFRESH_RECURSIVE, false);
+                       recursive = configuration.getAttribute(
+                                       IExternalToolConstants.ATTR_REFRESH_RECURSIVE, false);
                } catch (CoreException ce) {
-                       ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsRefreshTab.Exception_reading_launch_configuration_3"), ce); //$NON-NLS-1$
+                       ExternalToolsPlugin
+                                       .getDefault()
+                                       .log(
+                                                       ExternalToolsLaunchConfigurationMessages
+                                                                       .getString("ExternalToolsRefreshTab.Exception_reading_launch_configuration_3"), ce); //$NON-NLS-1$
                }
                recursiveField.setSelection(recursive);
        }
+
        /**
         * Method updateRefresh.
+        * 
         * @param configuration
         */
        private void updateRefresh(ILaunchConfiguration configuration) {
-               String scope= null;
+               String scope = null;
                try {
-                       scope= configuration.getAttribute(IExternalToolConstants.ATTR_REFRESH_SCOPE, (String)null);
+                       scope = configuration.getAttribute(
+                                       IExternalToolConstants.ATTR_REFRESH_SCOPE, (String) null);
                } catch (CoreException ce) {
-                       ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsRefreshTab.Exception_reading_launch_configuration_3"), ce); //$NON-NLS-1$
+                       ExternalToolsPlugin
+                                       .getDefault()
+                                       .log(
+                                                       ExternalToolsLaunchConfigurationMessages
+                                                                       .getString("ExternalToolsRefreshTab.Exception_reading_launch_configuration_3"), ce); //$NON-NLS-1$
                }
                refreshField.setSelection(scope != null);
-               updateEnabledState();           
+               updateEnabledState();
        }
 
        /**
@@ -176,21 +208,26 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
        public void performApply(ILaunchConfigurationWorkingCopy configuration) {
 
                if (refreshField.getSelection()) {
-                       configuration.setAttribute(IExternalToolConstants.ATTR_REFRESH_SCOPE, variableForm.getSelectedVariable());
+                       configuration.setAttribute(
+                                       IExternalToolConstants.ATTR_REFRESH_SCOPE, variableForm
+                                                       .getSelectedVariable());
                } else {
-                       configuration.setAttribute(IExternalToolConstants.ATTR_REFRESH_SCOPE, (String)null);
+                       configuration.setAttribute(
+                                       IExternalToolConstants.ATTR_REFRESH_SCOPE, (String) null);
                }
-               
-               setAttribute(IExternalToolConstants.ATTR_REFRESH_RECURSIVE, configuration, recursiveField.getSelection(), false);
+
+               setAttribute(IExternalToolConstants.ATTR_REFRESH_RECURSIVE,
+                               configuration, recursiveField.getSelection(), false);
        }
 
        /**
         * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
         */
        public String getName() {
-               return ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsRefreshTab.Refres&h_6"); //$NON-NLS-1$
+               return ExternalToolsLaunchConfigurationMessages
+                               .getString("ExternalToolsRefreshTab.Refres&h_6"); //$NON-NLS-1$
        }
-       
+
        /**
         * Updates the enablement state of the fields.
         */
@@ -204,6 +241,7 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
                        }
                }
        }
+
        /**
         * @see net.sourceforge.phpdt.externaltools.group.IGroupDialogPage#convertHeightHint(int)
         */
@@ -219,7 +257,8 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
        }
 
        /**
-        * @see net.sourceforge.phpdt.externaltools.group.IGroupDialogPage#setMessage(java.lang.String, int)
+        * @see net.sourceforge.phpdt.externaltools.group.IGroupDialogPage#setMessage(java.lang.String,
+        *      int)
         */
        public void setMessage(String newMessage, int newType) {
                setMessage(newMessage);
@@ -243,11 +282,13 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
                }
                return IMessageProvider.NONE;
        }
+
        /**
         * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
         */
        public Image getImage() {
-               return ExternalToolsImages.getImage(IExternalToolConstants.IMG_ACTION_REFRESH);
+               return ExternalToolsImages
+                               .getImage(IExternalToolConstants.IMG_ACTION_REFRESH);
        }
 
 }