1) Reintroduced some out commented methods. (Did break some preference settings)
authorrobekras <robekras>
Mon, 2 Jan 2012 20:11:06 +0000 (20:11 +0000)
committerrobekras <robekras>
Mon, 2 Jan 2012 20:11:06 +0000 (20:11 +0000)
2) Pointer checking.
3) Moved some text from net.sourceforge.phpeclipse/plugin.properties to net.sourceforge.phpeclipse.ui/plugin.properties. Don't know why, it's working in debug mode, but not at runtime. So moved the text.

13 files changed:
net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/ApachePrefencePage.java
net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/MySQLPreferencePage.java
net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java
net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/XamppPrefencePage.java
net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/ExternalToolsPlugin.java
net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java
net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunnerConfiguration.java
net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchConfigurationAttribute.java
net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/preferences/PHPUnitPreferencePage.java
net.sourceforge.phpeclipse.ui/plugin.properties
net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java
net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/preference/XDebugPreferencePage.java
net.sourceforge.phpeclipse/plugin.properties

index 6cd1984..871b96a 100644 (file)
@@ -38,8 +38,10 @@ public class ApachePrefencePage extends PreferencePage implements
 
        public ApachePrefencePage() {
                super();
-               setPreferenceStore(ExternalToolsPlugin.getDefault()
-                               .getPreferenceStore());
+               
+               if (ExternalToolsPlugin.getDefault () != null) {
+                 setPreferenceStore (ExternalToolsPlugin.getDefault().getPreferenceStore());
+               }
        }
 
        protected Control createContents(Composite parent) {
index cf0c8aa..d5a662f 100644 (file)
@@ -26,8 +26,10 @@ public class MySQLPreferencePage extends PreferencePage implements
 
        public MySQLPreferencePage() {
                super();
-               setPreferenceStore(ExternalToolsPlugin.getDefault()
-                               .getPreferenceStore());
+
+        if (ExternalToolsPlugin.getDefault () != null) {
+            setPreferenceStore (ExternalToolsPlugin.getDefault().getPreferenceStore());
+        }
        }
 
        protected Control createContents(Composite parent) {
index ec95211..e35c2d1 100644 (file)
@@ -23,8 +23,10 @@ public class PHPExternalToolsPreferencePage extends PreferencePage implements
 
        public PHPExternalToolsPreferencePage() {
                super();
-               setPreferenceStore(ExternalToolsPlugin.getDefault()
-                               .getPreferenceStore());
+               
+        if (ExternalToolsPlugin.getDefault () != null) {
+            setPreferenceStore (ExternalToolsPlugin.getDefault().getPreferenceStore());
+        }
        }
 
        public void init(IWorkbench workbench) {
index af1fefa..9968de1 100644 (file)
@@ -1,8 +1,10 @@
 package net.sourceforge.phpdt.externaltools.preferences;
 
 import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin;
+// import net.sourceforge.phpeclipse.xdebug.core.XDebugCorePlugin;
 
 import org.eclipse.jface.preference.FileFieldEditor;
+import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.preference.PreferencePage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
@@ -21,8 +23,10 @@ public class XamppPrefencePage extends PreferencePage implements
 
        public XamppPrefencePage() {
                super();
-               setPreferenceStore(ExternalToolsPlugin.getDefault()
-                               .getPreferenceStore());
+               
+        if (ExternalToolsPlugin.getDefault () != null) {
+            setPreferenceStore (ExternalToolsPlugin.getDefault().getPreferenceStore());
+        }
        }
 
        protected Control createContents(Composite parent) {
index 8309b7d..fa90071 100644 (file)
@@ -97,10 +97,10 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin {
        /**
         * This version is recommended for eclipse3.0 and above
         */
-//     public ExternalToolsPlugin() {
-//             super();
-//             plugin = this;
-//     }
+       public ExternalToolsPlugin() {
+               super();
+               plugin = this;
+       }
 
        /**
         * Returns the default instance of the receiver. This represents the runtime
index 95938af..13c01d4 100644 (file)
@@ -28,9 +28,11 @@ public class DebuggerRunner extends InterpreterRunner {
                        ILaunch launch) {
                //String[] env;
                //String name, value;
-               PHPDBGProxy newPHPDBGProxy = new PHPDBGProxy(configuration
-                               .useRemoteDebugger(), configuration.getRemoteSourcePath(),
-                               configuration.usePathTranslation(), configuration.getPathMap());
+               PHPDBGProxy newPHPDBGProxy = new PHPDBGProxy (configuration.useRemoteDebugger(),
+                                                                     configuration.getRemoteSourcePath(),
+                                                                     configuration.usePathTranslation(),
+                                                                     configuration.getPathMap(),
+                                                                     configuration.useRelaunchOnScriptTermination());
                //int pos;
 
                IProcess process = null;
index d2b83cc..12e7d2e 100644 (file)
@@ -219,4 +219,15 @@ public class InterpreterRunnerConfiguration {
                return false;
        }
 
+       public boolean useRelaunchOnScriptTermination() {
+               try {
+                       return configuration
+                                       .getAttribute(
+                                                       PHPLaunchConfigurationAttribute.RELAUNCH_ON_SCRIPT_TERMINATION,
+                                                       false);
+               } catch (CoreException e) {
+                       PHPLaunchingPlugin.log(e);
+               }
+               return false;
+       }
 }
index f447aa1..9ab17f6 100644 (file)
@@ -48,5 +48,8 @@ public interface PHPLaunchConfigurationAttribute {
        static final String OPEN_DBGSESSION_IN_EXTERNAL_BROWSER = PHPLaunchingPlugin.PLUGIN_ID
                        + ".OPEN_DBGSESSION_IN_EXTERNAL_BROWSER";
 
+       static final String RELAUNCH_ON_SCRIPT_TERMINATION = PHPLaunchingPlugin.PLUGIN_ID
+                       + ".RELAUNCH_ON_SCRIPT_TERMINATION";
+
        static final String FILE_MAP = PHPLaunchingPlugin.PLUGIN_ID + ".FILE_MAP";
-}
\ No newline at end of file
+}
index b310b0c..8d8c1eb 100644 (file)
@@ -8,6 +8,7 @@
 
 package net.sourceforge.phpeclipse.phpunit.preferences;
 
+//import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin;
 import net.sourceforge.phpeclipse.phpunit.PHPUnitPlugin;
 
 import org.eclipse.jface.preference.DirectoryFieldEditor;
@@ -34,7 +35,11 @@ public class PHPUnitPreferencePage extends FieldEditorPreferencePage implements
 
        public PHPUnitPreferencePage() {
                super(GRID);
-               setPreferenceStore(PHPUnitPlugin.getDefault().getPreferenceStore());
+               
+        if (PHPUnitPlugin.getDefault () != null) {
+            setPreferenceStore (PHPUnitPlugin.getDefault().getPreferenceStore());
+        }
+        
                setDescription("Please browse for the folder containing the PHPUnit files (among them: \"phpunit.php\" and \"socketTestResult.php\"). If you don't have it, please download the latest version from http://sourceforge.net/projects/phpunit/ first. ");
                //initializeDefaults();
        }
index 3525d7c..d7b7c12 100644 (file)
@@ -17,8 +17,52 @@ providerName= PHPEclipse project team
 preferencePageName = PHPeclipse
 viewCategoryName = PHPeclipse
 
+perspectivePHP.name=PHP
+newWizardCategory.name=PHP
+newWizardPHPProject.name=PHP Project
+newWizardPHPFile.name=PHP File
+newWizardHTMLFile.name=HTML file
+
+OpenActionSet.label=Open Declaration/Include
+OpenDeclaration=Open Declaration/Include
+ExportWizards.Obfuscator = Obfuscate PHP Project to File system
+ExportWizards.ObfuscatorDescription = Obfuscate PHP resources to the local file system
+
+compilerPageName=PHP Parser
+todoPageName=PHP Task Tags
+
+phpEditorName=PHP Editor
+
+sourceHover= Source
+sourceHoverDescription= Shows the source of the selected element.
+sequentialHover= Combined Hover
+sequentialHoverDescription= Tries the hovers in the sequence listed in the table below this one and uses the one which fits best for the selected element and the current context.
+annotationHover= Annotation Description
+annotationHoverDescription= Shows the description of the selected annotation.
+problemHover= Problem Description
+problemHoverDescription= Shows the description of the selected problem.
+
+
+category.source.name=PHP Source
+category.source.description= PHP Source Actions
+
+context.editingPHPSource.name= Editing PHP Source
+context.editingPHPSource.description= Editing PHP Source Context
+
+
+javaDocumentFactory=PHP Document Factory
+javaDocumentSetupParticipant=PHP Document Setup Participant
 
 templates.contextType.xml=xml
 templates.contextType.html=html
 templates.contextType.smarty=smarty
 templates.contextType.javascript=javascript
+
+
+compilerOptionsPrefName= PHP Parser
+todoTaskPrefName= Task Tags
+templatePageName= Templates
+spellingPrefName= Spelling
+codeAssistPageName= Code Assist
+editorPageName= Editor
+editorMarkOccurrencesPage= Mark Occurrences
index f7fc07f..263ef61 100644 (file)
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package net.sourceforge.phpdt.internal.ui.preferences;
-
-//import java.io.BufferedReader;
-//import java.io.IOException;
-//import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Hashtable;
-
-import net.sourceforge.phpdt.core.ICodeFormatter;
-import net.sourceforge.phpdt.core.JavaCore;
-import net.sourceforge.phpdt.core.ToolFactory;
-import net.sourceforge.phpdt.internal.ui.PHPUIMessages;
-//import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;
-//import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
-import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout;
-//import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import net.sourceforge.phpeclipse.ui.WebUI;
-
-//import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.preference.PreferencePage;
-//import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.swt.SWT;
-//import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-//import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-/*
- * The page for setting code formatter options
- */
-public class CodeFormatterPreferencePage extends PreferencePage implements
-               IWorkbenchPreferencePage {
-
-       // Preference store keys, see PHPCore.getOptions
-       private static final String PREF_NEWLINE_OPENING_BRACES = JavaCore.FORMATTER_NEWLINE_OPENING_BRACE;
-
-       private static final String PREF_NEWLINE_CONTROL_STATEMENT = JavaCore.FORMATTER_NEWLINE_CONTROL;
-
-       private static final String PREF_NEWLINE_CLEAR_ALL = JavaCore.FORMATTER_CLEAR_BLANK_LINES;
-
-       // private static final String PREF_NEWLINE_ELSE_IF=
-       // PHPCore.FORMATTER_NEWLINE_ELSE_IF;
-       private static final String PREF_NEWLINE_EMPTY_BLOCK = JavaCore.FORMATTER_NEWLINE_EMPTY_BLOCK;
-
-       private static final String PREF_LINE_SPLIT = JavaCore.FORMATTER_LINE_SPLIT;
-
-       private static final String PREF_STYLE_COMPACT_ASSIGNEMENT = JavaCore.FORMATTER_COMPACT_ASSIGNMENT;
-
-       private static final String PREF_STYLE_COMPACT_STRING_CONCATENATION = JavaCore.FORMATTER_COMPACT_STRING_CONCATENATION;
-
-       private static final String PREF_STYLE_COMPACT_ARRAYS = JavaCore.FORMATTER_COMPACT_ARRAYS;
-       
-       private static final String PREF_TAB_CHAR = JavaCore.FORMATTER_TAB_CHAR;
-
-       private static final String PREF_TAB_SIZE = JavaCore.FORMATTER_TAB_SIZE;
-
-       // values
-       private static final String INSERT = JavaCore.INSERT;
-
-       private static final String DO_NOT_INSERT = JavaCore.DO_NOT_INSERT;
-
-       private static final String COMPACT = JavaCore.COMPACT;
-
-       private static final String NORMAL = JavaCore.NORMAL;
-
-       private static final String TAB = JavaCore.TAB;
-
-       private static final String SPACE = JavaCore.SPACE;
-
-       private static final String CLEAR_ALL = JavaCore.CLEAR_ALL;
-
-       private static final String PRESERVE_ONE = JavaCore.PRESERVE_ONE;
-
-       private static String[] getAllKeys() {
-               return new String[] { PREF_NEWLINE_OPENING_BRACES,
-                               PREF_NEWLINE_CONTROL_STATEMENT, PREF_NEWLINE_CLEAR_ALL,
-                               // PREF_NEWLINE_ELSE_IF,
-                               PREF_NEWLINE_EMPTY_BLOCK, PREF_LINE_SPLIT,
-                               PREF_STYLE_COMPACT_ASSIGNEMENT, PREF_STYLE_COMPACT_STRING_CONCATENATION,
-                               PREF_STYLE_COMPACT_ARRAYS,
-                               PREF_TAB_CHAR, PREF_TAB_SIZE };
-       }
-
-       /**
-        * Gets the currently configured tab size
-        * 
-        * @deprecated Inline to avoid reference to preference page
-        */
-       public static int getTabSize() {
-               String string = (String) JavaCore.getOptions().get(PREF_TAB_SIZE);
-               return getPositiveIntValue(string, 4);
-       }
-
-       /**
-        * Gets the current compating assignement configuration
-        * 
-        * @deprecated Inline to avoid reference to preference page
-        */
-//     public static boolean isCompactingAssignment() {
-//             return COMPACT.equals(JavaCore.getOptions().get(
-//                             PREF_STYLE_COMPACT_ASSIGNEMENT));
-//     }
-
-       /**
-        * Gets the current compating assignement configuration
-        * 
-        * @deprecated Inline to avoid reference to preference page
-        */
-//     public static boolean useSpaces() {
-//             return SPACE.equals(JavaCore.getOptions().get(PREF_TAB_CHAR));
-//     }
-
-       private static int getPositiveIntValue(String string, int dflt) {
-               try {
-                       int i = Integer.parseInt(string);
-                       if (i >= 0) {
-                               return i;
-                       }
-               } catch (NumberFormatException e) {
-               }
-               return dflt;
-       }
-
-       private static class ControlData {
-               private String fKey;
-
-               private String[] fValues;
-
-               public ControlData(String key, String[] values) {
-                       fKey = key;
-                       fValues = values;
-               }
-
-               public String getKey() {
-                       return fKey;
-               }
-
-               public String getValue(boolean selection) {
-                       int index = selection ? 0 : 1;
-                       return fValues[index];
-               }
-
-               public String getValue(int index) {
-                       return fValues[index];
-               }
-
-               public int getSelection(String value) {
-                       for (int i = 0; i < fValues.length; i++) {
-                               if (value.equals(fValues[i])) {
-                                       return i;
-                               }
-                       }
-                       throw new IllegalArgumentException();
-               }
-       }
-
-       private Hashtable fWorkingValues;
-
-       private ArrayList fCheckBoxes;
-
-       private ArrayList fTextBoxes;
-
-       private SelectionListener fButtonSelectionListener;
-
-       private ModifyListener fTextModifyListener;
-
-       private String fPreviewText;
-
-       private IDocument fPreviewDocument;
-
-       private Text fTabSizeTextBox;
-
-       // private SourceViewer fSourceViewer;
-
-//     public CodeFormatterPreferencePage() {
-//             setPreferenceStore(WebUI.getDefault().getPreferenceStore());
-//             setDescription(PHPUIMessages
-//                             .getString("CodeFormatterPreferencePage.description")); //$NON-NLS-1$
-//
-//             fWorkingValues = JavaCore.getOptions();
-//             fCheckBoxes = new ArrayList();
-//             fTextBoxes = new ArrayList();
-//
-//             fButtonSelectionListener = new SelectionListener() {
-//                     public void widgetDefaultSelected(SelectionEvent e) {
-//                     }
-//
-//                     public void widgetSelected(SelectionEvent e) {
-//                             if (!e.widget.isDisposed()) {
-//                                     controlChanged((Button) e.widget);
-//                             }
-//                     }
-//             };
-//
-//             fTextModifyListener = new ModifyListener() {
-//                     public void modifyText(ModifyEvent e) {
-//                             if (!e.widget.isDisposed()) {
-//                                     textChanged((Text) e.widget);
-//                             }
-//                     }
-//             };
-//
-//             fPreviewDocument = new Document();
-//             fPreviewText = loadPreviewFile("CodeFormatterPreviewCode.txt"); //$NON-NLS-1$   
-//     }
-
-       /*
-        * @see IWorkbenchPreferencePage#init()
-        */
-       public void init(IWorkbench workbench) {
-       }
-
-       /*
-        * @see PreferencePage#createControl(Composite)
-        */
-       public void createControl(Composite parent) {
-               super.createControl(parent);
-               // WorkbenchHelp.setHelp(getControl(),
-               // IJavaHelpContextIds.CODEFORMATTER_PREFERENCE_PAGE);
-       }
-
-       /*
-        * @see PreferencePage#createContents(Composite)
-        */
-       protected Control createContents(Composite parent) {
-
-               GridLayout layout = new GridLayout();
-               layout.marginHeight = 0;
-               layout.marginWidth = 0;
-
-               Composite composite = new Composite(parent, SWT.NONE);
-               composite.setLayout(layout);
-
-               TabFolder folder = new TabFolder(composite, SWT.NONE);
-               folder.setLayout(new TabFolderLayout());
-               folder.setLayoutData(new GridData(GridData.FILL_BOTH));
-
-               String[] insertNotInsert = new String[] { INSERT, DO_NOT_INSERT };
-
-               layout = new GridLayout();
-               layout.numColumns = 2;
-
-               Composite newlineComposite = new Composite(folder, SWT.NULL);
-               newlineComposite.setLayout(layout);
-
-               String label = PHPUIMessages
-                               .getString("CodeFormatterPreferencePage.newline_opening_braces.label"); //$NON-NLS-1$
-               addCheckBox(newlineComposite, label, PREF_NEWLINE_OPENING_BRACES,
-                               insertNotInsert);
-
-               label = PHPUIMessages
-                               .getString("CodeFormatterPreferencePage.newline_control_statement.label"); //$NON-NLS-1$
-               addCheckBox(newlineComposite, label, PREF_NEWLINE_CONTROL_STATEMENT,
-                               insertNotInsert);
-
-               label = PHPUIMessages
-                               .getString("CodeFormatterPreferencePage.newline_clear_lines"); //$NON-NLS-1$
-               addCheckBox(newlineComposite, label, PREF_NEWLINE_CLEAR_ALL,
-                               new String[] { CLEAR_ALL, PRESERVE_ONE });
-
-               // label=
-               // PHPUIMessages.getString("CodeFormatterPreferencePage.newline_else_if.label");
-               // //$NON-NLS-1$
-               // addCheckBox(newlineComposite, label, PREF_NEWLINE_ELSE_IF,
-               // insertNotInsert);
-
-               label = PHPUIMessages
-                               .getString("CodeFormatterPreferencePage.newline_empty_block.label"); //$NON-NLS-1$
-               addCheckBox(newlineComposite, label, PREF_NEWLINE_EMPTY_BLOCK,
-                               insertNotInsert);
-
-               layout = new GridLayout();
-               layout.numColumns = 2;
-
-               Composite lineSplittingComposite = new Composite(folder, SWT.NULL);
-               lineSplittingComposite.setLayout(layout);
-
-               label = PHPUIMessages
-                               .getString("CodeFormatterPreferencePage.split_line.label"); //$NON-NLS-1$
-               addTextField(lineSplittingComposite, label, PREF_LINE_SPLIT);
-
-               layout = new GridLayout();
-               layout.numColumns = 2;
-
-               Composite styleComposite = new Composite(folder, SWT.NULL);
-               styleComposite.setLayout(layout);
-
-               label = PHPUIMessages
-                               .getString("CodeFormatterPreferencePage.style_compact_assignement.label"); //$NON-NLS-1$
-               addCheckBox(styleComposite, label, PREF_STYLE_COMPACT_ASSIGNEMENT,
-                               new String[] { COMPACT, NORMAL });
-               
-               label = PHPUIMessages
-               .getString("CodeFormatterPreferencePage.style_compact_string_concatenation.label"); //$NON-NLS-1$
-               addCheckBox(styleComposite, label, PREF_STYLE_COMPACT_STRING_CONCATENATION,
-               new String[] { COMPACT, NORMAL });
-               
-               label = PHPUIMessages
-               .getString("CodeFormatterPreferencePage.style_compact_arrays.label"); //$NON-NLS-1$
-               addCheckBox(styleComposite, label, PREF_STYLE_COMPACT_ARRAYS,
-               new String[] { COMPACT, NORMAL });              
-
-               label = PHPUIMessages
-                               .getString("CodeFormatterPreferencePage.tab_char.label"); //$NON-NLS-1$
-               addCheckBox(styleComposite, label, PREF_TAB_CHAR, new String[] { TAB,
-                               SPACE });
-
-               label = PHPUIMessages
-                               .getString("CodeFormatterPreferencePage.tab_size.label"); //$NON-NLS-1$
-               fTabSizeTextBox = addTextField(styleComposite, label, PREF_TAB_SIZE);
-
-               TabItem item = new TabItem(folder, SWT.NONE);
-               item.setText(PHPUIMessages
-                               .getString("CodeFormatterPreferencePage.tab.newline.tabtitle")); //$NON-NLS-1$
-               item.setControl(newlineComposite);
-
-               item = new TabItem(folder, SWT.NONE);
-               item
-                               .setText(PHPUIMessages
-                                               .getString("CodeFormatterPreferencePage.tab.linesplit.tabtitle")); //$NON-NLS-1$
-               item.setControl(lineSplittingComposite);
-
-               item = new TabItem(folder, SWT.NONE);
-               item.setText(PHPUIMessages
-                               .getString("CodeFormatterPreferencePage.tab.style.tabtitle")); //$NON-NLS-1$
-               item.setControl(styleComposite);
-
-               // fSourceViewer= createPreview(parent);
-
-               updatePreview();
-
-               return composite;
-       }
-
-       // private SourceViewer createPreview(Composite parent) {
-       // SourceViewer previewViewer= new SourceViewer(parent, null, SWT.V_SCROLL |
-       // SWT.H_SCROLL | SWT.BORDER);
-       // JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
-       // previewViewer.configure(new PHPSourceViewerConfiguration(tools, null));
-       // previewViewer.getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
-       // previewViewer.getTextWidget().setTabs(getPositiveIntValue((String)
-       // fWorkingValues.get(PREF_TAB_SIZE), 0));
-       // previewViewer.setEditable(false);
-       // previewViewer.setDocument(fPreviewDocument);
-       // Control control= previewViewer.getControl();
-       // GridData gdata= new GridData(GridData.FILL_BOTH);
-       // gdata.widthHint= convertWidthInCharsToPixels(30);
-       // gdata.heightHint= convertHeightInCharsToPixels(5);
-       // control.setLayoutData(gdata);
-       // return previewViewer;
-       // }
-
-       private Button addCheckBox(Composite parent, String label, String key,
-                       String[] values) {
-               ControlData data = new ControlData(key, values);
-
-               GridData gd = new GridData(GridData.FILL_HORIZONTAL);
-               gd.horizontalSpan = 2;
-
-               Button checkBox = new Button(parent, SWT.CHECK);
-               checkBox.setText(label);
-               checkBox.setData(data);
-               checkBox.setLayoutData(gd);
-
-               String currValue = (String) fWorkingValues.get(key);
-               checkBox.setSelection(data.getSelection(currValue) == 0);
-               checkBox.addSelectionListener(fButtonSelectionListener);
-
-               fCheckBoxes.add(checkBox);
-               return checkBox;
-       }
-
-       private Text addTextField(Composite parent, String label, String key) {
-               Label labelControl = new Label(parent, SWT.NONE);
-               labelControl.setText(label);
-               labelControl.setLayoutData(new GridData());
-
-               Text textBox = new Text(parent, SWT.BORDER | SWT.SINGLE);
-               textBox.setData(key);
-               textBox.setLayoutData(new GridData());
-
-               String currValue = (String) fWorkingValues.get(key);
-               textBox.setText(String.valueOf(getPositiveIntValue(currValue, 1)));
-               textBox.setTextLimit(3);
-               textBox.addModifyListener(fTextModifyListener);
-
-               GridData gd = new GridData();
-               gd.widthHint = convertWidthInCharsToPixels(5);
-               textBox.setLayoutData(gd);
-
-               fTextBoxes.add(textBox);
-               return textBox;
-       }
-
-//     private void controlChanged(Button button) {
-//             ControlData data = (ControlData) button.getData();
-//             boolean selection = button.getSelection();
-//             String newValue = data.getValue(selection);
-//             fWorkingValues.put(data.getKey(), newValue);
-//             updatePreview();
-//
-//             if (PREF_TAB_CHAR.equals(data.getKey())) {
-//                     updateStatus(new StatusInfo());
-//                     if (selection) {
-//                             fTabSizeTextBox.setText((String) fWorkingValues
-//                                             .get(PREF_TAB_SIZE));
-//                     }
-//             }
-//     }
-
-//     private void textChanged(Text textControl) {
-//             String key = (String) textControl.getData();
-//             String number = textControl.getText();
-//             IStatus status = validatePositiveNumber(number);
-//             if (!status.matches(IStatus.ERROR)) {
-//                     fWorkingValues.put(key, number);
-//             }
-//             // if (PREF_TAB_SIZE.equals(key)) {
-//             // fSourceViewer.getTextWidget().setTabs(getPositiveIntValue(number,
-//             // 0));
-//             // }
-//             updateStatus(status);
-//             updatePreview();
-//     }
-
-       /*
-        * @see IPreferencePage#performOk()
-        */
-       public boolean performOk() {
-               String[] allKeys = getAllKeys();
-               // preserve other options
-               // store in JCore
-               Hashtable actualOptions = JavaCore.getOptions();
-               for (int i = 0; i < allKeys.length; i++) {
-                       String key = allKeys[i];
-                       String val = (String) fWorkingValues.get(key);
-                       actualOptions.put(key, val);
-               }
-               JavaCore.setOptions(actualOptions);
-               WebUI.getDefault().savePluginPreferences();
-               return super.performOk();
-       }
-
-       /*
-        * @see PreferencePage#performDefaults()
-        */
-       protected void performDefaults() {
-               fWorkingValues = JavaCore.getDefaultOptions();
-               updateControls();
-               super.performDefaults();
-       }
-
-//     private String loadPreviewFile(String filename) {
-//             String separator = System.getProperty("line.separator"); //$NON-NLS-1$
-//             StringBuffer btxt = new StringBuffer(512);
-//             BufferedReader rin = null;
-//             try {
-//                     rin = new BufferedReader(new InputStreamReader(getClass()
-//                                     .getResourceAsStream(filename)));
-//                     String line;
-//                     while ((line = rin.readLine()) != null) {
-//                             btxt.append(line);
-//                             btxt.append(separator);
-//                     }
-//             } catch (IOException io) {
-//                     WebUI.log(io);
-//             } finally {
-//                     if (rin != null) {
-//                             try {
-//                                     rin.close();
-//                             } catch (IOException e) {
-//                             }
-//                     }
-//             }
-//             return btxt.toString();
-//     }
-
-       private void updatePreview() {
-               ICodeFormatter formatter = ToolFactory
-                               .createDefaultCodeFormatter(fWorkingValues);
-               fPreviewDocument.set(formatter.format(fPreviewText, 0, null, "\n")); //$NON-NLS-1$
-       }
-
-       private void updateControls() {
-               // update the UI
-               for (int i = fCheckBoxes.size() - 1; i >= 0; i--) {
-                       Button curr = (Button) fCheckBoxes.get(i);
-                       ControlData data = (ControlData) curr.getData();
-
-                       String currValue = (String) fWorkingValues.get(data.getKey());
-                       curr.setSelection(data.getSelection(currValue) == 0);
-               }
-               for (int i = fTextBoxes.size() - 1; i >= 0; i--) {
-                       Text curr = (Text) fTextBoxes.get(i);
-                       String key = (String) curr.getData();
-                       String currValue = (String) fWorkingValues.get(key);
-                       curr.setText(currValue);
-               }
-       }
-
-//     private IStatus validatePositiveNumber(String number) {
-//             StatusInfo status = new StatusInfo();
-//             if (number.length() == 0) {
-//                     status.setError(PHPUIMessages
-//                                     .getString("CodeFormatterPreferencePage.empty_input")); //$NON-NLS-1$
-//             } else {
-//                     try {
-//                             int value = Integer.parseInt(number);
-//                             if (value < 0) {
-//                                     status
-//                                                     .setError(PHPUIMessages
-//                                                                     .getFormattedString(
-//                                                                                     "CodeFormatterPreferencePage.invalid_input", number)); //$NON-NLS-1$
-//                             }
-//                     } catch (NumberFormatException e) {
-//                             status.setError(PHPUIMessages.getFormattedString(
-//                                             "CodeFormatterPreferencePage.invalid_input", number)); //$NON-NLS-1$
-//                     }
-//             }
-//             return status;
-//     }
-
-//     private void updateStatus(IStatus status) {
-//             if (!status.matches(IStatus.ERROR)) {
-//                     // look if there are more severe errors
-//                     for (int i = 0; i < fTextBoxes.size(); i++) {
-//                             Text curr = (Text) fTextBoxes.get(i);
-//                             if (!(curr == fTabSizeTextBox && usesTabs())) {
-//                                     IStatus currStatus = validatePositiveNumber(curr.getText());
-//                                     status = StatusUtil.getMoreSevere(currStatus, status);
-//                             }
-//                     }
-//             }
-//             setValid(!status.matches(IStatus.ERROR));
-//             StatusUtil.applyToStatusLine(this, status);
-//     }
-
-//     private boolean usesTabs() {
-//             return TAB.equals(fWorkingValues.get(PREF_TAB_CHAR));
-//     }
-
-}
+/*\r
+ * (c) Copyright IBM Corp. 2000, 2001.\r
+ * All Rights Reserved.\r
+ */\r
+package net.sourceforge.phpdt.internal.ui.preferences;\r
+\r
+import java.io.BufferedReader;\r
+import java.io.IOException;\r
+import java.io.InputStreamReader;\r
+import java.util.ArrayList;\r
+import java.util.Hashtable;\r
+\r
+import net.sourceforge.phpdt.core.ICodeFormatter;\r
+import net.sourceforge.phpdt.core.JavaCore;\r
+import net.sourceforge.phpdt.core.ToolFactory;\r
+import net.sourceforge.phpdt.internal.ui.PHPUIMessages;\r
+import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;\r
+import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;\r
+import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout;\r
+//import net.sourceforge.phpeclipse.PHPeclipsePlugin;\r
+import net.sourceforge.phpeclipse.ui.WebUI;\r
+\r
+import org.eclipse.core.runtime.IStatus;\r
+import org.eclipse.jface.preference.PreferencePage;\r
+import org.eclipse.jface.text.Document;\r
+import org.eclipse.jface.text.IDocument;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.events.ModifyEvent;\r
+import org.eclipse.swt.events.ModifyListener;\r
+import org.eclipse.swt.events.SelectionEvent;\r
+import org.eclipse.swt.events.SelectionListener;\r
+import org.eclipse.swt.layout.GridData;\r
+import org.eclipse.swt.layout.GridLayout;\r
+import org.eclipse.swt.widgets.Button;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.eclipse.swt.widgets.Label;\r
+import org.eclipse.swt.widgets.TabFolder;\r
+import org.eclipse.swt.widgets.TabItem;\r
+import org.eclipse.swt.widgets.Text;\r
+import org.eclipse.ui.IWorkbench;\r
+import org.eclipse.ui.IWorkbenchPreferencePage;\r
+\r
+/*\r
+ * The page for setting code formatter options\r
+ */\r
+public class CodeFormatterPreferencePage extends PreferencePage implements\r
+        IWorkbenchPreferencePage {\r
+\r
+    // Preference store keys, see PHPCore.getOptions\r
+    private static final String PREF_NEWLINE_OPENING_BRACES = JavaCore.FORMATTER_NEWLINE_OPENING_BRACE;\r
+\r
+    private static final String PREF_NEWLINE_CONTROL_STATEMENT = JavaCore.FORMATTER_NEWLINE_CONTROL;\r
+\r
+    private static final String PREF_NEWLINE_CLEAR_ALL = JavaCore.FORMATTER_CLEAR_BLANK_LINES;\r
+\r
+    // private static final String PREF_NEWLINE_ELSE_IF=\r
+    // PHPCore.FORMATTER_NEWLINE_ELSE_IF;\r
+    private static final String PREF_NEWLINE_EMPTY_BLOCK = JavaCore.FORMATTER_NEWLINE_EMPTY_BLOCK;\r
+\r
+    private static final String PREF_LINE_SPLIT = JavaCore.FORMATTER_LINE_SPLIT;\r
+\r
+    private static final String PREF_STYLE_COMPACT_ASSIGNEMENT = JavaCore.FORMATTER_COMPACT_ASSIGNMENT;\r
+\r
+    private static final String PREF_STYLE_COMPACT_STRING_CONCATENATION = JavaCore.FORMATTER_COMPACT_STRING_CONCATENATION;\r
+\r
+    private static final String PREF_STYLE_COMPACT_ARRAYS = JavaCore.FORMATTER_COMPACT_ARRAYS;\r
+    \r
+    private static final String PREF_TAB_CHAR = JavaCore.FORMATTER_TAB_CHAR;\r
+\r
+    private static final String PREF_TAB_SIZE = JavaCore.FORMATTER_TAB_SIZE;\r
+\r
+    // values\r
+    private static final String INSERT = JavaCore.INSERT;\r
+\r
+    private static final String DO_NOT_INSERT = JavaCore.DO_NOT_INSERT;\r
+\r
+    private static final String COMPACT = JavaCore.COMPACT;\r
+\r
+    private static final String NORMAL = JavaCore.NORMAL;\r
+\r
+    private static final String TAB = JavaCore.TAB;\r
+\r
+    private static final String SPACE = JavaCore.SPACE;\r
+\r
+    private static final String CLEAR_ALL = JavaCore.CLEAR_ALL;\r
+\r
+    private static final String PRESERVE_ONE = JavaCore.PRESERVE_ONE;\r
+\r
+    private static String[] getAllKeys() {\r
+        return new String[] { PREF_NEWLINE_OPENING_BRACES,\r
+                PREF_NEWLINE_CONTROL_STATEMENT, PREF_NEWLINE_CLEAR_ALL,\r
+                // PREF_NEWLINE_ELSE_IF,\r
+                PREF_NEWLINE_EMPTY_BLOCK, PREF_LINE_SPLIT,\r
+                PREF_STYLE_COMPACT_ASSIGNEMENT, PREF_STYLE_COMPACT_STRING_CONCATENATION,\r
+                PREF_STYLE_COMPACT_ARRAYS,\r
+                PREF_TAB_CHAR, PREF_TAB_SIZE };\r
+    }\r
+\r
+    /**\r
+     * Gets the currently configured tab size\r
+     * \r
+     * @deprecated Inline to avoid reference to preference page\r
+     */\r
+    public static int getTabSize() {\r
+        String string = (String) JavaCore.getOptions().get(PREF_TAB_SIZE);\r
+        return getPositiveIntValue(string, 4);\r
+    }\r
+\r
+    /**\r
+     * Gets the current compating assignement configuration\r
+     * \r
+     * @deprecated Inline to avoid reference to preference page\r
+     */\r
+    public static boolean isCompactingAssignment() {\r
+        return COMPACT.equals(JavaCore.getOptions().get(\r
+                PREF_STYLE_COMPACT_ASSIGNEMENT));\r
+    }\r
+\r
+    /**\r
+     * Gets the current compating assignement configuration\r
+     * \r
+     * @deprecated Inline to avoid reference to preference page\r
+     */\r
+    public static boolean useSpaces() {\r
+        return SPACE.equals(JavaCore.getOptions().get(PREF_TAB_CHAR));\r
+    }\r
+\r
+    private static int getPositiveIntValue(String string, int dflt) {\r
+        try {\r
+            int i = Integer.parseInt(string);\r
+            if (i >= 0) {\r
+                return i;\r
+            }\r
+        } catch (NumberFormatException e) {\r
+        }\r
+        return dflt;\r
+    }\r
+\r
+    private static class ControlData {\r
+        private String fKey;\r
+\r
+        private String[] fValues;\r
+\r
+        public ControlData(String key, String[] values) {\r
+            fKey = key;\r
+            fValues = values;\r
+        }\r
+\r
+        public String getKey() {\r
+            return fKey;\r
+        }\r
+\r
+        public String getValue(boolean selection) {\r
+            int index = selection ? 0 : 1;\r
+            return fValues[index];\r
+        }\r
+\r
+        public String getValue(int index) {\r
+            return fValues[index];\r
+        }\r
+\r
+        public int getSelection(String value) {\r
+            for (int i = 0; i < fValues.length; i++) {\r
+                if (value.equals(fValues[i])) {\r
+                    return i;\r
+                }\r
+            }\r
+            throw new IllegalArgumentException();\r
+        }\r
+    }\r
+\r
+    private Hashtable fWorkingValues;\r
+\r
+    private ArrayList fCheckBoxes;\r
+\r
+    private ArrayList fTextBoxes;\r
+\r
+    private SelectionListener fButtonSelectionListener;\r
+\r
+    private ModifyListener fTextModifyListener;\r
+\r
+    private String fPreviewText;\r
+\r
+    private IDocument fPreviewDocument;\r
+\r
+    private Text fTabSizeTextBox;\r
+\r
+    // private SourceViewer fSourceViewer;\r
+\r
+    public CodeFormatterPreferencePage() {\r
+        setPreferenceStore(WebUI.getDefault().getPreferenceStore());\r
+        setDescription(PHPUIMessages\r
+                .getString("CodeFormatterPreferencePage.description")); //$NON-NLS-1$\r
+\r
+        fWorkingValues = JavaCore.getOptions();\r
+        fCheckBoxes = new ArrayList();\r
+        fTextBoxes = new ArrayList();\r
+\r
+        fButtonSelectionListener = new SelectionListener() {\r
+            public void widgetDefaultSelected(SelectionEvent e) {\r
+            }\r
+\r
+            public void widgetSelected(SelectionEvent e) {\r
+                if (!e.widget.isDisposed()) {\r
+                    controlChanged((Button) e.widget);\r
+                }\r
+            }\r
+        };\r
+\r
+        fTextModifyListener = new ModifyListener() {\r
+            public void modifyText(ModifyEvent e) {\r
+                if (!e.widget.isDisposed()) {\r
+                    textChanged((Text) e.widget);\r
+                }\r
+            }\r
+        };\r
+\r
+        fPreviewDocument = new Document();\r
+        fPreviewText = loadPreviewFile("CodeFormatterPreviewCode.txt"); //$NON-NLS-1$   \r
+    }\r
+\r
+    /*\r
+     * @see IWorkbenchPreferencePage#init()\r
+     */\r
+    public void init(IWorkbench workbench) {\r
+    }\r
+\r
+    /*\r
+     * @see PreferencePage#createControl(Composite)\r
+     */\r
+    public void createControl(Composite parent) {\r
+        super.createControl(parent);\r
+        // WorkbenchHelp.setHelp(getControl(),\r
+        // IJavaHelpContextIds.CODEFORMATTER_PREFERENCE_PAGE);\r
+    }\r
+\r
+    /*\r
+     * @see PreferencePage#createContents(Composite)\r
+     */\r
+    protected Control createContents(Composite parent) {\r
+\r
+        GridLayout layout = new GridLayout();\r
+        layout.marginHeight = 0;\r
+        layout.marginWidth = 0;\r
+\r
+        Composite composite = new Composite(parent, SWT.NONE);\r
+        composite.setLayout(layout);\r
+\r
+        TabFolder folder = new TabFolder(composite, SWT.NONE);\r
+        folder.setLayout(new TabFolderLayout());\r
+        folder.setLayoutData(new GridData(GridData.FILL_BOTH));\r
+\r
+        String[] insertNotInsert = new String[] { INSERT, DO_NOT_INSERT };\r
+\r
+        layout = new GridLayout();\r
+        layout.numColumns = 2;\r
+\r
+        Composite newlineComposite = new Composite(folder, SWT.NULL);\r
+        newlineComposite.setLayout(layout);\r
+\r
+        String label = PHPUIMessages\r
+                .getString("CodeFormatterPreferencePage.newline_opening_braces.label"); //$NON-NLS-1$\r
+        addCheckBox(newlineComposite, label, PREF_NEWLINE_OPENING_BRACES,\r
+                insertNotInsert);\r
+\r
+        label = PHPUIMessages\r
+                .getString("CodeFormatterPreferencePage.newline_control_statement.label"); //$NON-NLS-1$\r
+        addCheckBox(newlineComposite, label, PREF_NEWLINE_CONTROL_STATEMENT,\r
+                insertNotInsert);\r
+\r
+        label = PHPUIMessages\r
+                .getString("CodeFormatterPreferencePage.newline_clear_lines"); //$NON-NLS-1$\r
+        addCheckBox(newlineComposite, label, PREF_NEWLINE_CLEAR_ALL,\r
+                new String[] { CLEAR_ALL, PRESERVE_ONE });\r
+\r
+        // label=\r
+        // PHPUIMessages.getString("CodeFormatterPreferencePage.newline_else_if.label");\r
+        // //$NON-NLS-1$\r
+        // addCheckBox(newlineComposite, label, PREF_NEWLINE_ELSE_IF,\r
+        // insertNotInsert);\r
+\r
+        label = PHPUIMessages\r
+                .getString("CodeFormatterPreferencePage.newline_empty_block.label"); //$NON-NLS-1$\r
+        addCheckBox(newlineComposite, label, PREF_NEWLINE_EMPTY_BLOCK,\r
+                insertNotInsert);\r
+\r
+        layout = new GridLayout();\r
+        layout.numColumns = 2;\r
+\r
+        Composite lineSplittingComposite = new Composite(folder, SWT.NULL);\r
+        lineSplittingComposite.setLayout(layout);\r
+\r
+        label = PHPUIMessages\r
+                .getString("CodeFormatterPreferencePage.split_line.label"); //$NON-NLS-1$\r
+        addTextField(lineSplittingComposite, label, PREF_LINE_SPLIT);\r
+\r
+        layout = new GridLayout();\r
+        layout.numColumns = 2;\r
+\r
+        Composite styleComposite = new Composite(folder, SWT.NULL);\r
+        styleComposite.setLayout(layout);\r
+\r
+        label = PHPUIMessages\r
+                .getString("CodeFormatterPreferencePage.style_compact_assignement.label"); //$NON-NLS-1$\r
+        addCheckBox(styleComposite, label, PREF_STYLE_COMPACT_ASSIGNEMENT,\r
+                new String[] { COMPACT, NORMAL });\r
+        \r
+        label = PHPUIMessages\r
+        .getString("CodeFormatterPreferencePage.style_compact_string_concatenation.label"); //$NON-NLS-1$\r
+        addCheckBox(styleComposite, label, PREF_STYLE_COMPACT_STRING_CONCATENATION,\r
+        new String[] { COMPACT, NORMAL });\r
+        \r
+        label = PHPUIMessages\r
+        .getString("CodeFormatterPreferencePage.style_compact_arrays.label"); //$NON-NLS-1$\r
+        addCheckBox(styleComposite, label, PREF_STYLE_COMPACT_ARRAYS,\r
+        new String[] { COMPACT, NORMAL });      \r
+\r
+        label = PHPUIMessages\r
+                .getString("CodeFormatterPreferencePage.tab_char.label"); //$NON-NLS-1$\r
+        addCheckBox(styleComposite, label, PREF_TAB_CHAR, new String[] { TAB,\r
+                SPACE });\r
+\r
+        label = PHPUIMessages\r
+                .getString("CodeFormatterPreferencePage.tab_size.label"); //$NON-NLS-1$\r
+        fTabSizeTextBox = addTextField(styleComposite, label, PREF_TAB_SIZE);\r
+\r
+        TabItem item = new TabItem(folder, SWT.NONE);\r
+        item.setText(PHPUIMessages\r
+                .getString("CodeFormatterPreferencePage.tab.newline.tabtitle")); //$NON-NLS-1$\r
+        item.setControl(newlineComposite);\r
+\r
+        item = new TabItem(folder, SWT.NONE);\r
+        item\r
+                .setText(PHPUIMessages\r
+                        .getString("CodeFormatterPreferencePage.tab.linesplit.tabtitle")); //$NON-NLS-1$\r
+        item.setControl(lineSplittingComposite);\r
+\r
+        item = new TabItem(folder, SWT.NONE);\r
+        item.setText(PHPUIMessages\r
+                .getString("CodeFormatterPreferencePage.tab.style.tabtitle")); //$NON-NLS-1$\r
+        item.setControl(styleComposite);\r
+\r
+        // fSourceViewer= createPreview(parent);\r
+\r
+        updatePreview();\r
+\r
+        return composite;\r
+    }\r
+\r
+    // private SourceViewer createPreview(Composite parent) {\r
+    // SourceViewer previewViewer= new SourceViewer(parent, null, SWT.V_SCROLL |\r
+    // SWT.H_SCROLL | SWT.BORDER);\r
+    // JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();\r
+    // previewViewer.configure(new PHPSourceViewerConfiguration(tools, null));\r
+    // previewViewer.getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));\r
+    // previewViewer.getTextWidget().setTabs(getPositiveIntValue((String)\r
+    // fWorkingValues.get(PREF_TAB_SIZE), 0));\r
+    // previewViewer.setEditable(false);\r
+    // previewViewer.setDocument(fPreviewDocument);\r
+    // Control control= previewViewer.getControl();\r
+    // GridData gdata= new GridData(GridData.FILL_BOTH);\r
+    // gdata.widthHint= convertWidthInCharsToPixels(30);\r
+    // gdata.heightHint= convertHeightInCharsToPixels(5);\r
+    // control.setLayoutData(gdata);\r
+    // return previewViewer;\r
+    // }\r
+\r
+    private Button addCheckBox(Composite parent, String label, String key,\r
+            String[] values) {\r
+        ControlData data = new ControlData(key, values);\r
+\r
+        GridData gd = new GridData(GridData.FILL_HORIZONTAL);\r
+        gd.horizontalSpan = 2;\r
+\r
+        Button checkBox = new Button(parent, SWT.CHECK);\r
+        checkBox.setText(label);\r
+        checkBox.setData(data);\r
+        checkBox.setLayoutData(gd);\r
+\r
+        String currValue = (String) fWorkingValues.get(key);\r
+        checkBox.setSelection(data.getSelection(currValue) == 0);\r
+        checkBox.addSelectionListener(fButtonSelectionListener);\r
+\r
+        fCheckBoxes.add(checkBox);\r
+        return checkBox;\r
+    }\r
+\r
+    private Text addTextField(Composite parent, String label, String key) {\r
+        Label labelControl = new Label(parent, SWT.NONE);\r
+        labelControl.setText(label);\r
+        labelControl.setLayoutData(new GridData());\r
+\r
+        Text textBox = new Text(parent, SWT.BORDER | SWT.SINGLE);\r
+        textBox.setData(key);\r
+        textBox.setLayoutData(new GridData());\r
+\r
+        String currValue = (String) fWorkingValues.get(key);\r
+        textBox.setText(String.valueOf(getPositiveIntValue(currValue, 1)));\r
+        textBox.setTextLimit(3);\r
+        textBox.addModifyListener(fTextModifyListener);\r
+\r
+        GridData gd = new GridData();\r
+        gd.widthHint = convertWidthInCharsToPixels(5);\r
+        textBox.setLayoutData(gd);\r
+\r
+        fTextBoxes.add(textBox);\r
+        return textBox;\r
+    }\r
+\r
+    private void controlChanged(Button button) {\r
+        ControlData data = (ControlData) button.getData();\r
+        boolean selection = button.getSelection();\r
+        String newValue = data.getValue(selection);\r
+        fWorkingValues.put(data.getKey(), newValue);\r
+        updatePreview();\r
+\r
+        if (PREF_TAB_CHAR.equals(data.getKey())) {\r
+            updateStatus(new StatusInfo());\r
+            if (selection) {\r
+                fTabSizeTextBox.setText((String) fWorkingValues\r
+                        .get(PREF_TAB_SIZE));\r
+            }\r
+        }\r
+    }\r
+\r
+    private void textChanged(Text textControl) {\r
+        String key = (String) textControl.getData();\r
+        String number = textControl.getText();\r
+        IStatus status = validatePositiveNumber(number);\r
+        if (!status.matches(IStatus.ERROR)) {\r
+            fWorkingValues.put(key, number);\r
+        }\r
+        // if (PREF_TAB_SIZE.equals(key)) {\r
+        // fSourceViewer.getTextWidget().setTabs(getPositiveIntValue(number,\r
+        // 0));\r
+        // }\r
+        updateStatus(status);\r
+        updatePreview();\r
+    }\r
+\r
+    /*\r
+     * @see IPreferencePage#performOk()\r
+     */\r
+    public boolean performOk() {\r
+        String[] allKeys = getAllKeys();\r
+        // preserve other options\r
+        // store in JCore\r
+        Hashtable actualOptions = JavaCore.getOptions();\r
+        for (int i = 0; i < allKeys.length; i++) {\r
+            String key = allKeys[i];\r
+            String val = (String) fWorkingValues.get(key);\r
+            actualOptions.put(key, val);\r
+        }\r
+        JavaCore.setOptions(actualOptions);\r
+        WebUI.getDefault().savePluginPreferences();\r
+        return super.performOk();\r
+    }\r
+\r
+    /*\r
+     * @see PreferencePage#performDefaults()\r
+     */\r
+    protected void performDefaults() {\r
+        fWorkingValues = JavaCore.getDefaultOptions();\r
+        updateControls();\r
+        super.performDefaults();\r
+    }\r
+\r
+    private String loadPreviewFile(String filename) {\r
+        String separator = System.getProperty("line.separator"); //$NON-NLS-1$\r
+        StringBuffer btxt = new StringBuffer(512);\r
+        BufferedReader rin = null;\r
+        try {\r
+            rin = new BufferedReader(new InputStreamReader(getClass()\r
+                    .getResourceAsStream(filename)));\r
+            String line;\r
+            while ((line = rin.readLine()) != null) {\r
+                btxt.append(line);\r
+                btxt.append(separator);\r
+            }\r
+        } catch (IOException io) {\r
+            WebUI.log(io);\r
+        } finally {\r
+            if (rin != null) {\r
+                try {\r
+                    rin.close();\r
+                } catch (IOException e) {\r
+                }\r
+            }\r
+        }\r
+        return btxt.toString();\r
+    }\r
+\r
+    private void updatePreview() {\r
+        ICodeFormatter formatter = ToolFactory\r
+                .createDefaultCodeFormatter(fWorkingValues);\r
+        fPreviewDocument.set(formatter.format(fPreviewText, 0, null, "\n")); //$NON-NLS-1$\r
+    }\r
+\r
+    private void updateControls() {\r
+        // update the UI\r
+        for (int i = fCheckBoxes.size() - 1; i >= 0; i--) {\r
+            Button curr = (Button) fCheckBoxes.get(i);\r
+            ControlData data = (ControlData) curr.getData();\r
+\r
+            String currValue = (String) fWorkingValues.get(data.getKey());\r
+            curr.setSelection(data.getSelection(currValue) == 0);\r
+        }\r
+        for (int i = fTextBoxes.size() - 1; i >= 0; i--) {\r
+            Text curr = (Text) fTextBoxes.get(i);\r
+            String key = (String) curr.getData();\r
+            String currValue = (String) fWorkingValues.get(key);\r
+            curr.setText(currValue);\r
+        }\r
+    }\r
+\r
+    private IStatus validatePositiveNumber(String number) {\r
+        StatusInfo status = new StatusInfo();\r
+        if (number.length() == 0) {\r
+            status.setError(PHPUIMessages\r
+                    .getString("CodeFormatterPreferencePage.empty_input")); //$NON-NLS-1$\r
+        } else {\r
+            try {\r
+                int value = Integer.parseInt(number);\r
+                if (value < 0) {\r
+                    status\r
+                            .setError(PHPUIMessages\r
+                                    .getFormattedString(\r
+                                            "CodeFormatterPreferencePage.invalid_input", number)); //$NON-NLS-1$\r
+                }\r
+            } catch (NumberFormatException e) {\r
+                status.setError(PHPUIMessages.getFormattedString(\r
+                        "CodeFormatterPreferencePage.invalid_input", number)); //$NON-NLS-1$\r
+            }\r
+        }\r
+        return status;\r
+    }\r
+\r
+    private void updateStatus(IStatus status) {\r
+        if (!status.matches(IStatus.ERROR)) {\r
+            // look if there are more severe errors\r
+            for (int i = 0; i < fTextBoxes.size(); i++) {\r
+                Text curr = (Text) fTextBoxes.get(i);\r
+                if (!(curr == fTabSizeTextBox && usesTabs())) {\r
+                    IStatus currStatus = validatePositiveNumber(curr.getText());\r
+                    status = StatusUtil.getMoreSevere(currStatus, status);\r
+                }\r
+            }\r
+        }\r
+        setValid(!status.matches(IStatus.ERROR));\r
+        StatusUtil.applyToStatusLine(this, status);\r
+    }\r
+\r
+    private boolean usesTabs() {\r
+        return TAB.equals(fWorkingValues.get(PREF_TAB_CHAR));\r
+    }\r
+\r
+}\r
index 62943f2..2aa0b32 100644 (file)
@@ -26,9 +26,12 @@ public class XDebugPreferencePage extends FieldEditorPreferencePage implements
                IPreferenceStore store =
                        XDebugCorePlugin.getDefault().getPreferenceStore();
                store.setDefault(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE,IXDebugPreferenceConstants.DEFAULT_DEBUGPORT);
-               // get the default form the externalToolsPlugin 
-               String interpreter=ExternalToolsPlugin.getDefault().getPreferenceStore().getString(ExternalToolsPlugin.PHP_RUN_PREF);
-               store.setDefault(IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE,interpreter);
+               // get the default from the externalToolsPlugin
+               
+               if (ExternalToolsPlugin.getDefault () != null) {
+                   String interpreter = ExternalToolsPlugin.getDefault ().getPreferenceStore().getString(ExternalToolsPlugin.PHP_RUN_PREF);
+               store.setDefault(IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE,interpreter);
+               }
                setPreferenceStore(store);
        }
 
index 6e8cb8c..e9f17d5 100644 (file)
@@ -13,40 +13,19 @@ phpSourceName=PHP Source File
 viewCategoryName = PHPeclipse
 phpEditorTextHoversName=PHP Editor Text Hovers
 
-perspectivePHP.name=PHP
 perspectiveHTML.name=HTML
 viewPHPResources.name=PHP Resources
 
-newWizardCategory.name=PHP
-newWizardPHPProject.name=PHP Project
-newWizardPHPFile.name=PHP File
-newWizardHTMLFile.name=HTML file
 NewPHPClass.label= Class
 NewPHPClass.description=Create a PHP class
 
-OpenActionSet.label=Open Declaration/Include
 OpenActionSet.description=Open a PHP Declaration or Include
-OpenDeclaration=Open Declaration/Include
-ExportWizards.Obfuscator = Obfuscate PHP Project to File system
-ExportWizards.ObfuscatorDescription = Obfuscate PHP resources to the local file system
 
 propertyPagePHPProject.name=PHP Project Properties
 
-compilerPageName=PHP Parser
-todoPageName=PHP Task Tags
-
-compilerOptionsPrefName= PHP Parser
-todoTaskPrefName= Task Tags
-templatePageName= Templates
-spellingPrefName= Spelling
-codeAssistPageName= Code Assist
-editorPageName= Editor
-editorMarkOccurrencesPage= Mark Occurrences
-
 #
 # Extension point names
 #
-phpEditorName=PHP Editor
 phpConsoleView=PHP Console
 phpFileExtension=php
 php3FileExtension=php3
@@ -60,13 +39,6 @@ htmFileExtension=htm
 xmlFileExtension=xml
 tplFileExtension=tpl
 
-javaDocumentFactory=PHP Document Factory
-javaDocumentSetupParticipant=PHP Document Setup Participant
-
-sourceHover= Source
-sourceHoverDescription= Shows the source of the selected element.
-javadocHover= PHPdoc
-javadocHoverDescription= Shows the PHPdoc of the selected element.
 sequentialHover= Best Match
 sequentialHoverDescription= Shows the hover which fits best for the selected element and the current context.
 annotationHover= Annotation
@@ -163,12 +135,6 @@ problemHoverDescription= Shows the description of the selected problem.
 # Action Definitions
 ##########################################################################
 
-category.source.name=PHP Source
-category.source.description= PHP Source Actions
-
-context.editingPHPSource.name= Editing PHP Source
-context.editingPHPSource.description= Editing PHP Source Context
-
 scope.javaEditor.name=PHP Editor
 
 ##########################################################################