1) Fixed issue #751: Pathmap 'Edit' button enable/disable handling.
authorrobekras <robekras>
Thu, 29 Dec 2011 17:40:58 +0000 (17:40 +0000)
committerrobekras <robekras>
Thu, 29 Dec 2011 17:40:58 +0000 (17:40 +0000)
net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPPathMapTab.java

index 1df8c64..64fdb10 100644 (file)
@@ -283,16 +283,22 @@ public class PHPPathMapTab extends AbstractLaunchConfigurationTab {
         * @param event the selection change event
         */
        protected void handleTableSelectionChanged(SelectionChangedEvent event) {
-               int size = ((IStructuredSelection)event.getSelection()).size();
-               int idx = fPathMapTable.getTable().getSelectionIndex();
-               int count = fPathMapTable.getTable().getItemCount();
-               if (size==1) {
-                       fEditButton.setEnabled(idx>0);
-                       fUpButton.setEnabled(idx>0);
-                       fDownButton.setEnabled((idx>=0)&&(idx<count-1));
+               int size  = ((IStructuredSelection)event.getSelection()).size();  // Get number of selected items
+               int idx   = fPathMapTable.getTable().getSelectionIndex();         // Get the index of the selected item
+               int count = fPathMapTable.getTable().getItemCount();              // Get the number of entries within the pathmap list
+               
+               if (size == 1) {                                              // If one pathmap entry is selected
+                       fEditButton.setEnabled (idx >= 0);                        // Enable 'Edit' button if a pathmap entry is selected
+                       fUpButton.setEnabled (idx > 0);                           // Enable 'Up' button only if the selected entry is not the very first one
+                       fDownButton.setEnabled ((idx >= 0) && (idx < count-1));   // Enable 'Down' button only if the selected entry is not the very last one
+               }
+               else {                                                        // If nothing selected, or more than one entry selected
+                   fEditButton.setEnabled (false);                           // Disable 'Edit' button 
+                   fUpButton.setEnabled (false);                             // Disable 'Up' button
+                   fDownButton.setEnabled (false);                           // Disable 'Down' button
                }
                
-               fRemoveButton.setEnabled(size > 0);
+               fRemoveButton.setEnabled (size > 0);                          // Enable 'Remove' if at least on entry is selected                    
        }
        
        /**