replaced a lot of deprecated code; if someone runs into a commit conflict afterwards...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / filters / CustomFiltersDialog.java
index 7a3fa53..3c20939 100644 (file)
@@ -1,10 +1,10 @@
 /*******************************************************************************
  * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials 
+ * All rights reserved. This program and the accompanying materials
  * 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 Corporation - initial API and implementation
  *******************************************************************************/
@@ -19,19 +19,8 @@ import java.util.Set;
 import java.util.Stack;
 import java.util.StringTokenizer;
 
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
+import net.sourceforge.phpdt.internal.ui.IJavaHelpContextIds;
+import net.sourceforge.phpdt.internal.ui.util.SWTUtil;
 
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.util.Assert;
@@ -45,12 +34,21 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
-
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-import net.sourceforge.phpdt.internal.ui.IJavaHelpContextIds;
-import net.sourceforge.phpdt.internal.ui.util.SWTUtil;
 
 public class CustomFiltersDialog extends SelectionDialog {
 
@@ -69,10 +67,10 @@ public class CustomFiltersDialog extends SelectionDialog {
 
        private Stack fFilterDescriptorChangeHistory;
 
-       
+
        /**
         * Creates a dialog to customize Java element filters.
-        * 
+        *
         * @param shell the parent shell
         * @param viewId the id of the view
         * @param enablePatterns <code>true</code> if pattern filters are enabled
@@ -105,14 +103,14 @@ public class CustomFiltersDialog extends SelectionDialog {
                setTitle(FilterMessages.getString("CustomFiltersDialog.title"));  //$NON-NLS-1$
                setMessage(FilterMessages.getString("CustomFiltersDialog.filterList.label")); //$NON-NLS-1$
                super.configureShell(shell);
-               WorkbenchHelp.setHelp(shell, IJavaHelpContextIds.CUSTOM_FILTERS_DIALOG);
+               PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IJavaHelpContextIds.CUSTOM_FILTERS_DIALOG);
        }
 
        /**
         * Overrides method in Dialog
-        * 
+        *
         * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
-        */     
+        */
        protected Control createDialogArea(Composite parent) {
                initializeDialogUnits(parent);
                // create a composite with standard margins and spacing
@@ -126,12 +124,12 @@ public class CustomFiltersDialog extends SelectionDialog {
                composite.setLayoutData(new GridData(GridData.FILL_BOTH));
                composite.setFont(parent.getFont());
                Composite group= composite;
-               
+
                // Checkbox
                fEnableUserDefinedPatterns= new Button(group, SWT.CHECK);
                fEnableUserDefinedPatterns.setFocus();
                fEnableUserDefinedPatterns.setText(FilterMessages.getString("CustomFiltersDialog.enableUserDefinedPattern")); //$NON-NLS-1$
-               
+
                // Pattern      field
                fUserDefinedPatterns= new Text(group, SWT.SINGLE | SWT.BORDER);
                GridData  data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
@@ -161,18 +159,18 @@ public class CustomFiltersDialog extends SelectionDialog {
                // Filters provided by extension point
                if (fBuiltInFilters.length > 0)
                        createCheckBoxList(group);
-                               
-               applyDialogFont(parent);                
+
+               applyDialogFont(parent);
                return parent;
        }
 
        private void createCheckBoxList(Composite parent) {
                // Filler
                new Label(parent, SWT.NONE);
-               
+
                Label info= new Label(parent, SWT.LEFT);
                info.setText(FilterMessages.getString("CustomFiltersDialog.filterList.label"));  //$NON-NLS-1$
-               
+
                fCheckBoxList= CheckboxTableViewer.newCheckList(parent, SWT.BORDER);
                GridData data= new GridData(GridData.FILL_BOTH);
                data.heightHint= fCheckBoxList.getTable().getItemHeight() * 10;
@@ -183,7 +181,7 @@ public class CustomFiltersDialog extends SelectionDialog {
 
                fCheckBoxList.setInput(fBuiltInFilters);
                setInitialSelections(getEnabledFilterDescriptors());
-               
+
                List initialSelection= getInitialElementSelections();
                if (initialSelection != null && !initialSelection.isEmpty())
                        checkInitialSelections();
@@ -277,9 +275,9 @@ public class CustomFiltersDialog extends SelectionDialog {
                }
                super.okPressed();
        }
-       
+
        private ILabelProvider createLabelPrivder() {
-               return 
+               return
                        new LabelProvider() {
                                public Image getImage(Object element) {
                                        return null;
@@ -294,7 +292,7 @@ public class CustomFiltersDialog extends SelectionDialog {
        }
 
        // ---------- result handling ----------
-       
+
        protected void setResult(List newResult) {
                super.setResult(newResult);
                if (fUserDefinedPatterns.getText().length() > 0) {
@@ -303,7 +301,7 @@ public class CustomFiltersDialog extends SelectionDialog {
                } else {
                        fEnablePatterns= false;
                        fPatterns= new String[0];
-               }                       
+               }
        }
 
 
@@ -331,7 +329,7 @@ public class CustomFiltersDialog extends SelectionDialog {
        public boolean areUserDefinedPatternsEnabled() {
                return fEnablePatterns;
        }
-       
+
        /**
         * @return a stack with the filter descriptor check history
         * @since 3.0
@@ -379,7 +377,7 @@ public class CustomFiltersDialog extends SelectionDialog {
                }
                return (String[])result.toArray(new String[result.size()]);
        }
-       
+
        private static void addPattern(List list, String pattern) {
                if (list.isEmpty())
                        list.add(pattern);
@@ -404,7 +402,7 @@ public class CustomFiltersDialog extends SelectionDialog {
                }
                return strBuf.toString();
        }
-       
+
        private static String escapeSeparator(String pattern, String separator) {
                int length= pattern.length();
                StringBuffer buf= new StringBuffer(length);
@@ -415,6 +413,6 @@ public class CustomFiltersDialog extends SelectionDialog {
                        buf.append(ch);
                }
                return buf.toString();
-               
+
        }
 }