From a587137771bd87f3baa717644243a14c7e4d906d Mon Sep 17 00:00:00 2001
From: robekras <robekras>
Date: Mon, 2 Jan 2012 20:11:06 +0000
Subject: [PATCH 1/1] 1) Reintroduced some out commented methods. (Did break some preference settings)
 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.

---
 .../preferences/ApachePrefencePage.java            |    6 +-
 .../preferences/MySQLPreferencePage.java           |    6 +-
 .../PHPExternalToolsPreferencePage.java            |    6 +-
 .../preferences/XamppPrefencePage.java             |    8 +-
 .../externaltools/ExternalToolsPlugin.java         |    8 +-
 .../phpdt/internal/launching/DebuggerRunner.java   |    8 +-
 .../launching/InterpreterRunnerConfiguration.java  |   11 +
 .../launching/PHPLaunchConfigurationAttribute.java |    5 +-
 .../phpunit/preferences/PHPUnitPreferencePage.java |    7 +-
 net.sourceforge.phpeclipse.ui/plugin.properties    |   44 +
 .../preferences/CodeFormatterPreferencePage.java   | 1116 ++++++++++----------
 .../xdebug/ui/preference/XDebugPreferencePage.java |    9 +-
 net.sourceforge.phpeclipse/plugin.properties       |   34 -
 13 files changed, 656 insertions(+), 612 deletions(-)

diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/ApachePrefencePage.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/ApachePrefencePage.java
index 6cd1984..871b96a 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/ApachePrefencePage.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/ApachePrefencePage.java
@@ -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) {
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/MySQLPreferencePage.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/MySQLPreferencePage.java
index cf0c8aa..d5a662f 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/MySQLPreferencePage.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/MySQLPreferencePage.java
@@ -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) {
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java
index ec95211..e35c2d1 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java
@@ -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) {
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/XamppPrefencePage.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/XamppPrefencePage.java
index af1fefa..9968de1 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/XamppPrefencePage.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/XamppPrefencePage.java
@@ -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) {
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/ExternalToolsPlugin.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/ExternalToolsPlugin.java
index 8309b7d..fa90071 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/ExternalToolsPlugin.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/ExternalToolsPlugin.java
@@ -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
diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java
index 95938af..13c01d4 100644
--- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java
+++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java
@@ -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;
diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunnerConfiguration.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunnerConfiguration.java
index d2b83cc..12e7d2e 100644
--- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunnerConfiguration.java
+++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunnerConfiguration.java
@@ -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;
+	}
 }
diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchConfigurationAttribute.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchConfigurationAttribute.java
index f447aa1..9ab17f6 100644
--- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchConfigurationAttribute.java
+++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchConfigurationAttribute.java
@@ -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
+}
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/preferences/PHPUnitPreferencePage.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/preferences/PHPUnitPreferencePage.java
index b310b0c..8d8c1eb 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/preferences/PHPUnitPreferencePage.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/preferences/PHPUnitPreferencePage.java
@@ -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();
 	}
diff --git a/net.sourceforge.phpeclipse.ui/plugin.properties b/net.sourceforge.phpeclipse.ui/plugin.properties
index 3525d7c..d7b7c12 100644
--- a/net.sourceforge.phpeclipse.ui/plugin.properties
+++ b/net.sourceforge.phpeclipse.ui/plugin.properties
@@ -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
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java
index f7fc07f..263ef61 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java
@@ -1,558 +1,558 @@
-/*
- * (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));
-//	}
-
-}
+/*
+ * (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));
+    }
+
+}
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/preference/XDebugPreferencePage.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/preference/XDebugPreferencePage.java
index 62943f2..2aa0b32 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/preference/XDebugPreferencePage.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/preference/XDebugPreferencePage.java
@@ -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);
 	}
 
diff --git a/net.sourceforge.phpeclipse/plugin.properties b/net.sourceforge.phpeclipse/plugin.properties
index 6e8cb8c..e9f17d5 100644
--- a/net.sourceforge.phpeclipse/plugin.properties
+++ b/net.sourceforge.phpeclipse/plugin.properties
@@ -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
 
 ##########################################################################
-- 
1.7.1