refactory whole plugin
[phpeclipse.git] / net.sourceforge.phpeclipse.phphelp / src / net / sourceforge / phpdt / httpquery / preferences / ConfigurationComposite.java
index 023b508..7eed4fe 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
  **********************************************************************/
@@ -37,17 +37,21 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableColumn;
+
 /**
- *
+ * 
  */
 public class ConfigurationComposite extends Composite {
        protected Table table;
+
        protected TableViewer tableViewer;
 
        protected Button edit;
+
        protected Button remove;
-//     protected Button start;
-//     protected Button stop;
+
+       // protected Button start;
+       // protected Button stop;
 
        protected List selection2;
 
@@ -71,15 +75,18 @@ public class ConfigurationComposite extends Composite {
 
                Label label = new Label(this, SWT.WRAP);
                label.setText(PHPHelpPlugin.getResource("%configurationsList"));
-               label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER));
+               label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
+                               | GridData.VERTICAL_ALIGN_CENTER));
 
                label = new Label(this, SWT.NONE);
 
-               table = new Table(this, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
-               data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
+               table = new Table(this, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL
+                               | SWT.MULTI | SWT.FULL_SELECTION);
+               data = new GridData(GridData.FILL_HORIZONTAL
+                               | GridData.VERTICAL_ALIGN_FILL);
                data.widthHint = 300;
                data.heightHint = 300;
-//             WorkbenchHelp.setHelp(table, ContextIds.PREF_MONITORS);
+               // WorkbenchHelp.setHelp(table, ContextIds.PREF_MONITORS);
 
                table.setLayoutData(data);
                table.setHeaderVisible(true);
@@ -97,10 +104,10 @@ public class ConfigurationComposite extends Composite {
                colData = new ColumnWeightData(5, 30, true);
                tableLayout.addColumnData(colData);
 
-               TableColumn urlColumn = new TableColumn(table, SWT.NONE);
-               urlColumn.setText(PHPHelpPlugin.getResource("%columnUser"));
-               colData = new ColumnWeightData(5, 30, true);
-               tableLayout.addColumnData(colData);
+               // TableColumn urlColumn = new TableColumn(table, SWT.NONE);
+               // urlColumn.setText(PHPHelpPlugin.getResource("%columnUser"));
+               // colData = new ColumnWeightData(5, 30, true);
+               // tableLayout.addColumnData(colData);
 
                TableColumn localColumn = new TableColumn(table, SWT.NONE);
                localColumn.setText(PHPHelpPlugin.getResource("%columnURL"));
@@ -113,11 +120,12 @@ public class ConfigurationComposite extends Composite {
                tableViewer.setContentProvider(new ConfigurationContentProvider());
                tableViewer.setLabelProvider(new ConfigurationTableLabelProvider());
                tableViewer.setInput("root");
-               tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-                       public void selectionChanged(SelectionChangedEvent event) {
-                               setSelection(event.getSelection());
-                       }
-               });
+               tableViewer
+                               .addSelectionChangedListener(new ISelectionChangedListener() {
+                                       public void selectionChanged(SelectionChangedEvent event) {
+                                               setSelection(event.getSelection());
+                                       }
+                               });
 
                Composite buttonComp = new Composite(this, SWT.NONE);
                layout = new GridLayout();
@@ -127,10 +135,12 @@ public class ConfigurationComposite 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, PHPHelpPlugin.getResource("%add"));
+               Button add = SWTUtil.createButton(buttonComp, PHPHelpPlugin
+                               .getResource("%add"));
                add.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                                ConfigurationDialog dialog = new ConfigurationDialog(getShell());
@@ -140,27 +150,32 @@ public class ConfigurationComposite extends Composite {
 
                                List list = PHPHelpPlugin.getConfigurations();
                                Object configuration = list.get(list.size() - 1);
-                               tableViewer.setSelection(new StructuredSelection(configuration));
+                               tableViewer
+                                               .setSelection(new StructuredSelection(configuration));
                        }
                });
 
-               edit = SWTUtil.createButton(buttonComp, PHPHelpPlugin.getResource("%edit"));
+               edit = SWTUtil.createButton(buttonComp, PHPHelpPlugin
+                               .getResource("%edit"));
                edit.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                                IConfiguration monitor = (IConfiguration) getSelection().get(0);
                                IConfigurationWorkingCopy wc = monitor.getWorkingCopy();
 
-                               ConfigurationDialog dialog = new ConfigurationDialog(getShell(), wc);
+                               ConfigurationDialog dialog = new ConfigurationDialog(
+                                               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, PHPHelpPlugin.getResource("%remove"));
+               remove = SWTUtil.createButton(buttonComp, PHPHelpPlugin
+                               .getResource("%remove"));
                remove.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                                Iterator iterator = getSelection().iterator();
@@ -168,7 +183,8 @@ public class ConfigurationComposite extends Composite {
                                        IConfiguration monitor = (IConfiguration) iterator.next();
                                        try {
                                                monitor.delete();
-                                       } catch (Exception ex) { }
+                                       } catch (Exception ex) {
+                                       }
                                        tableViewer.remove(monitor);
 
                                        List list = PHPHelpPlugin.getConfigurations();