removing deprecated package declaration
[phpeclipse.git] / net.sourceforge.phpeclipse.webbrowser / src / net / sourceforge / phpeclipse / webbrowser / internal / BrowserTableComposite.java
index aca9922..c8aeec5 100644 (file)
@@ -39,9 +39,9 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.ui.PlatformUI;
 /**
- * 
+ *
  */
 public class BrowserTableComposite extends Composite {
        protected Table table;
@@ -50,10 +50,10 @@ public class BrowserTableComposite extends Composite {
        protected Button remove;
        protected Button search;
        protected IWebBrowser selection;
-       
+
        protected Label location;
        protected Label parameters;
-       
+
        public BrowserTableComposite(Composite parent, int style) {
                super(parent, style);
                createWidgets();
@@ -70,32 +70,32 @@ public class BrowserTableComposite extends Composite {
 
                GridData data = new GridData(GridData.FILL_BOTH);
                setLayoutData(data);
-               
+
                Label label = new Label(this, SWT.NONE);
                label.setText(WebBrowserUIPlugin.getResource("%browserList"));
                data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
                data.horizontalSpan = 2;
                label.setLayoutData(data);
-               
+
                table = new Table(this, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION);
                data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
                data.widthHint = 300;
                table.setLayoutData(data);
                table.setHeaderVisible(false);
                table.setLinesVisible(false);
-               
+
                TableLayout tableLayout = new TableLayout();
                new TableColumn(table, SWT.NONE);
-               
+
                tableLayout.addColumnData(new ColumnWeightData(100));
 
                table.setLayout(tableLayout);
-               
+
                tableViewer = new CheckboxTableViewer(table);
-               
+
                tableViewer.setContentProvider(new BrowserContentProvider());
                tableViewer.setLabelProvider(new BrowserTableLabelProvider());
-       
+
                tableViewer.setInput("root");
 
                // uncheck any other elements that might be checked and leave only the element checked to
@@ -105,7 +105,7 @@ public class BrowserTableComposite extends Composite {
                                checkNewDefaultBrowser(e.getElement());
                                IWebBrowser browser = (IWebBrowser) e.getElement();
                                BrowserManager.getInstance().setCurrentWebBrowser(browser);
-                               
+
                                // if no other browsers are checked, don't allow the single one currently
                                // checked to become unchecked, and lose a current browser. That is, don't
                                // permit unchecking if no other item is checked which is supposed to be the case.
@@ -114,7 +114,7 @@ public class BrowserTableComposite extends Composite {
                                tableViewer.setChecked(e.getElement(), true);
                        }
                });
-               
+
                // set a default, checked browser based on the current browser. If there is not a
                // current browser, but the first item exists, use that instead.
                // This will work currently until workbench shutdown, because current browser is not yet persisted.
@@ -126,11 +126,11 @@ public class BrowserTableComposite extends Composite {
                        if (obj != null)
                                tableViewer.setChecked(obj, true);
                }
-               
+
                tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                        public void selectionChanged(SelectionChangedEvent event) {
                                Object obj = getSelection(event.getSelection());
-                               
+
                                if (obj instanceof IInternalWebBrowser) {
                                        selection = (IInternalWebBrowser) obj;
                                        remove.setEnabled(false);
@@ -141,14 +141,14 @@ public class BrowserTableComposite extends Composite {
                                        edit.setEnabled(true);
                                } else
                                        selection = null;
-                               
+
                                if (selection == null) {
                                        edit.setEnabled(false);
                                        remove.setEnabled(false);
                                }
                        }
                });
-               
+
                Composite buttonComp = new Composite(this, SWT.NONE);
                layout = new GridLayout();
                layout.horizontalSpacing = 0;
@@ -159,7 +159,7 @@ public class BrowserTableComposite extends Composite {
                buttonComp.setLayout(layout);
                data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_FILL);
                buttonComp.setLayoutData(data);
-               
+
                Button add = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin.getResource("%add"));
                add.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
@@ -169,7 +169,7 @@ public class BrowserTableComposite extends Composite {
                                tableViewer.refresh();
                        }
                });
-               
+
                edit = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin.getResource("%edit"));
                edit.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
@@ -183,7 +183,7 @@ public class BrowserTableComposite extends Composite {
                                                        tableViewer.refresh(wc.save());
                                                } catch (Exception ex) { }
                                        }
-                               }                               
+                               }
                                else if(browser2 instanceof IExternalWebBrowser) {
                                        IExternalWebBrowserWorkingCopy wc = ((IExternalWebBrowser) browser2).getWorkingCopy();
                                        ExternalBrowserDialog dialog = new ExternalBrowserDialog(getShell(), wc);
@@ -193,7 +193,7 @@ public class BrowserTableComposite extends Composite {
                                                } catch (Exception ex) { }
                                        }
                                }
-                  }                    
+                  }
                });
                edit.setEnabled(false);
 
@@ -205,13 +205,13 @@ public class BrowserTableComposite extends Composite {
                                        if (browser2 instanceof IInternalWebBrowser){
                                                remove.setEnabled(false);
                                                return; // nothing else possible to do
-                    } 
+                    }
                                        else if(browser2 instanceof IExternalWebBrowser) {
                                                remove.setEnabled(true);
                        ((IExternalWebBrowser) browser2).delete();
-                       
+
                                                tableViewer.remove(browser2);
-                                               
+
                                                // need here to ensure that if the item deleted was checked, ie, was
                                                // the current browser, that the new current browser will be the first in the
                                                // list, typically, the internal browser, which cannot be deleted, and be current.
@@ -227,20 +227,20 @@ public class BrowserTableComposite extends Composite {
                        }
                });
                remove.setEnabled(false);
-               
+
                search = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin.getResource("%search"));
                search.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                                java.util.List browsersToCreate = BrowserSearcher.search(getShell());
-                               
+
                                if (browsersToCreate == null) // cancelled
                                        return;
-                               
+
                                if (browsersToCreate.isEmpty()) { // no browsers found
                                        WebBrowserUtil.openMessage(WebBrowserUIPlugin.getResource("%searchingNoneFound"));
                                        return;
                                }
-                               
+
                                Iterator iterator = browsersToCreate.iterator();
                                while (iterator.hasNext()) {
                                        IExternalWebBrowserWorkingCopy browser2 = (IExternalWebBrowserWorkingCopy) iterator.next();
@@ -249,8 +249,8 @@ public class BrowserTableComposite extends Composite {
                                tableViewer.refresh();
                        }
                });
-               WorkbenchHelp.setHelp(search, ContextIds.PREF_BROWSER_EXTERNAL_SEARCH);
-               
+               PlatformUI.getWorkbench().getHelpSystem().setHelp(search, ContextIds.PREF_BROWSER_EXTERNAL_SEARCH);
+
                tableViewer.addCheckStateListener(new ICheckStateListener() {
                        public void checkStateChanged(CheckStateChangedEvent e) {
                                checkNewDefaultBrowser(e.getElement());
@@ -260,23 +260,23 @@ public class BrowserTableComposite extends Composite {
                });
                search.setEnabled(true);
        }
-       
+
        public IWebBrowser getSelectedWebBrowser() {
                return selection;
        }
-       
+
        protected Object getSelection(ISelection sel2) {
                IStructuredSelection sel = (IStructuredSelection) sel2;
                return sel.getFirstElement();
        }
-       
+
        // Uncheck all the items except the current one that was just checked
        protected void checkNewDefaultBrowser(Object browser) {
                TableItem[] children = tableViewer.getTable().getItems();
                for (int i = 0; i < children.length; i++) {
                        TableItem item = children[i];
-                       
-                       if (!(item.getData().equals(browser))) 
+
+                       if (!(item.getData().equals(browser)))
                                item.setChecked(false);
                }
        }