1) Added missing strings for italic, underline and strike through.
[phpeclipse.git] / net.sourceforge.phpeclipse.webbrowser / src / net / sourceforge / phpeclipse / webbrowser / internal / BrowserTableComposite.java
index c8aeec5..6bab84a 100644 (file)
@@ -4,7 +4,7 @@
  * are 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
- *
+ �*
  * Contributors:
  *    IBM - Initial API and implementation
  **********************************************************************/
@@ -40,18 +40,25 @@ import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.TableItem;
 import org.eclipse.ui.PlatformUI;
+
 /**
- *
+ * 
  */
 public class BrowserTableComposite extends Composite {
        protected Table table;
+
        protected CheckboxTableViewer tableViewer;
+
        protected Button edit;
+
        protected Button remove;
+
        protected Button search;
+
        protected IWebBrowser selection;
 
        protected Label location;
+
        protected Label parameters;
 
        public BrowserTableComposite(Composite parent, int style) {
@@ -73,12 +80,15 @@ public class BrowserTableComposite extends Composite {
 
                Label label = new Label(this, SWT.NONE);
                label.setText(WebBrowserUIPlugin.getResource("%browserList"));
-               data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
+               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);
+               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);
@@ -98,27 +108,35 @@ public class BrowserTableComposite extends Composite {
 
                tableViewer.setInput("root");
 
-               // uncheck any other elements that might be checked and leave only the element checked to
-               // remain checked since one can only chose one brower at a time to be current.
+               // uncheck any other elements that might be checked and leave only the
+               // element checked to
+               // remain checked since one can only chose one brower at a time to be
+               // current.
                tableViewer.addCheckStateListener(new ICheckStateListener() {
                        public void checkStateChanged(CheckStateChangedEvent e) {
                                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.
+                               // 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.
                                Object[] obj = tableViewer.getCheckedElements();
-                          if (obj.length == 0)
-                               tableViewer.setChecked(e.getElement(), true);
+                               if (obj.length == 0)
+                                       tableViewer.setChecked(e.getElement(), true);
                        }
                });
 
-               // set a default, checked browser based on the current browser. If there is not a
+               // 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.
-               IWebBrowser browser = BrowserManager.getInstance().getCurrentWebBrowser();
+               // This will work currently until workbench shutdown, because current
+               // browser is not yet persisted.
+               IWebBrowser browser = BrowserManager.getInstance()
+                               .getCurrentWebBrowser();
                if (browser != null)
                        tableViewer.setChecked(browser, true);
                else {
@@ -127,27 +145,28 @@ public class BrowserTableComposite extends Composite {
                                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);
-                                       edit.setEnabled(true);
-                               } else if (obj instanceof IExternalWebBrowser) {
-                                       selection = (IExternalWebBrowser) obj;
-                                       remove.setEnabled(true);
-                                       edit.setEnabled(true);
-                               } else
-                                       selection = null;
-
-                               if (selection == null) {
-                                       edit.setEnabled(false);
-                                       remove.setEnabled(false);
-                               }
-                       }
-               });
+               tableViewer
+                               .addSelectionChangedListener(new ISelectionChangedListener() {
+                                       public void selectionChanged(SelectionChangedEvent event) {
+                                               Object obj = getSelection(event.getSelection());
+
+                                               if (obj instanceof IInternalWebBrowser) {
+                                                       selection = (IInternalWebBrowser) obj;
+                                                       remove.setEnabled(false);
+                                                       edit.setEnabled(true);
+                                               } else if (obj instanceof IExternalWebBrowser) {
+                                                       selection = (IExternalWebBrowser) obj;
+                                                       remove.setEnabled(true);
+                                                       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();
@@ -157,99 +176,120 @@ public class BrowserTableComposite extends Composite {
                layout.marginHeight = 0;
                layout.numColumns = 1;
                buttonComp.setLayout(layout);
-               data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_FILL);
+               data = new GridData(GridData.HORIZONTAL_ALIGN_END
+                               | GridData.VERTICAL_ALIGN_FILL);
                buttonComp.setLayoutData(data);
 
-               Button add = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin.getResource("%add"));
+               Button add = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin
+                               .getResource("%add"));
                add.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
-                               ExternalBrowserDialog dialog = new ExternalBrowserDialog(getShell());
+                               ExternalBrowserDialog dialog = new ExternalBrowserDialog(
+                                               getShell());
                                if (dialog.open() == Window.CANCEL)
                                        return;
                                tableViewer.refresh();
                        }
                });
 
-               edit = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin.getResource("%edit"));
+               edit = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin
+                               .getResource("%edit"));
                edit.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                                IWebBrowser browser2 = getSelectedWebBrowser();
 
                                if (browser2 instanceof IInternalWebBrowser) {
-                                       IInternalWebBrowserWorkingCopy wc = ((IInternalWebBrowser) browser2).getWorkingCopy();
-                                       InternalBrowserDialog dialog = new InternalBrowserDialog(getShell(), wc);
+                                       IInternalWebBrowserWorkingCopy wc = ((IInternalWebBrowser) browser2)
+                                                       .getWorkingCopy();
+                                       InternalBrowserDialog dialog = new InternalBrowserDialog(
+                                                       getShell(), wc);
                                        if (dialog.open() != Window.CANCEL) {
                                                try {
                                                        tableViewer.refresh(wc.save());
-                                               } catch (Exception ex) { }
+                                               } catch (Exception ex) {
+                                               }
                                        }
-                               }
-                               else if(browser2 instanceof IExternalWebBrowser) {
-                                       IExternalWebBrowserWorkingCopy wc = ((IExternalWebBrowser) browser2).getWorkingCopy();
-                                       ExternalBrowserDialog dialog = new ExternalBrowserDialog(getShell(), wc);
+                               } else if (browser2 instanceof IExternalWebBrowser) {
+                                       IExternalWebBrowserWorkingCopy wc = ((IExternalWebBrowser) browser2)
+                                                       .getWorkingCopy();
+                                       ExternalBrowserDialog dialog = new ExternalBrowserDialog(
+                                                       getShell(), wc);
                                        if (dialog.open() != Window.CANCEL) {
                                                try {
                                                        tableViewer.refresh(wc.save());
-                                               } catch (Exception ex) { }
+                                               } catch (Exception ex) {
+                                               }
                                        }
                                }
-                  }
+                       }
                });
                edit.setEnabled(false);
 
-               remove = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin.getResource("%remove"));
+               remove = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin
+                               .getResource("%remove"));
                remove.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                                IWebBrowser browser2 = getSelectedWebBrowser();
                                try {
-                                       if (browser2 instanceof IInternalWebBrowser){
+                                       if (browser2 instanceof IInternalWebBrowser) {
                                                remove.setEnabled(false);
                                                return; // nothing else possible to do
-                    }
-                                       else if(browser2 instanceof IExternalWebBrowser) {
+                                       } else if (browser2 instanceof IExternalWebBrowser) {
                                                remove.setEnabled(true);
-                       ((IExternalWebBrowser) browser2).delete();
+                                               ((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.
-                                               if(((IExternalWebBrowser) browser2) == BrowserManager.getInstance().getCurrentWebBrowser()){
+                                               // 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.
+                                               if (((IExternalWebBrowser) browser2) == BrowserManager
+                                                               .getInstance().getCurrentWebBrowser()) {
                                                        Object obj = tableViewer.getElementAt(0);
-                                                               if(obj != null){
-                                                                       BrowserManager.getInstance().setCurrentWebBrowser((InternalWebBrowser)obj);
-                                                                       tableViewer.setChecked(obj, true);
-                                                               }
+                                                       if (obj != null) {
+                                                               BrowserManager.getInstance()
+                                                                               .setCurrentWebBrowser(
+                                                                                               (InternalWebBrowser) obj);
+                                                               tableViewer.setChecked(obj, true);
+                                                       }
                                                }
                                        }
-                               } catch (Exception ex) { }
+                               } catch (Exception ex) {
+                               }
                        }
                });
                remove.setEnabled(false);
 
-               search = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin.getResource("%search"));
+               search = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin
+                               .getResource("%search"));
                search.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
-                               java.util.List browsersToCreate = BrowserSearcher.search(getShell());
+                               java.util.List browsersToCreate = BrowserSearcher
+                                               .search(getShell());
 
                                if (browsersToCreate == null) // cancelled
                                        return;
 
                                if (browsersToCreate.isEmpty()) { // no browsers found
-                                       WebBrowserUtil.openMessage(WebBrowserUIPlugin.getResource("%searchingNoneFound"));
+                                       WebBrowserUtil.openMessage(WebBrowserUIPlugin
+                                                       .getResource("%searchingNoneFound"));
                                        return;
                                }
 
                                Iterator iterator = browsersToCreate.iterator();
                                while (iterator.hasNext()) {
-                                       IExternalWebBrowserWorkingCopy browser2 = (IExternalWebBrowserWorkingCopy) iterator.next();
+                                       IExternalWebBrowserWorkingCopy browser2 = (IExternalWebBrowserWorkingCopy) iterator
+                                                       .next();
                                        browser2.save();
                                }
                                tableViewer.refresh();
                        }
                });
-               PlatformUI.getWorkbench().getHelpSystem().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) {