### Eclipse Workspace Patch 1.0
#P org.eclipse.php.core
Index: Resources/language/php5.3/SimpleXML.php
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/Resources/language/php5.3/SimpleXML.php,v
retrieving revision 1.3.4.1
diff -u -r1.3.4.1 SimpleXML.php
--- Resources/language/php5.3/SimpleXML.php	10 Aug 2010 01:33:16 -0000	1.3.4.1
+++ Resources/language/php5.3/SimpleXML.php	15 Jan 2012 03:29:55 -0000
@@ -428,7 +428,7 @@
  * </p>
  * @param is_prefix bool[optional] <p>
  * </p>
- * @return object an object of class SimpleXMLElement with
+ * @return SimpleXMLElement an object of class SimpleXMLElement with
  * properties containing the data held within the XML document. On errors, it
  * will return false.
  */
@@ -454,7 +454,7 @@
  * </p>
  * @param is_prefix bool[optional] <p>
  * </p>
- * @return object an object of class SimpleXMLElement with
+ * @return SimpleXMLElement an object of class SimpleXMLElement with
  * properties containing the data held within the xml document. On errors, it
  * will return false.
  */
Index: Resources/language/php5.3/ibm_db2.php
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/Resources/language/php5.3/ibm_db2.php,v
retrieving revision 1.3
diff -u -r1.3 ibm_db2.php
--- Resources/language/php5.3/ibm_db2.php	26 May 2010 08:33:29 -0000	1.3
+++ Resources/language/php5.3/ibm_db2.php	15 Jan 2012 03:29:56 -0000
@@ -139,7 +139,7 @@
  * from stored procedures. A non-negative value specifies the maximum size of 
  * the XML data that will be retrieved from the database. If this parameter 
  * is not used, a default of 1MB will be assumed for retrieving the XML 
- * output value from the stored procedure.?
+ * output value from the stored procedure.
  * </p>
  * @param scale int[optional] <p>
  * Specifies the scale with which the variable should be bound to the
Index: Resources/language/php5/SimpleXML.php
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/Resources/language/php5/SimpleXML.php,v
retrieving revision 1.6.4.1
diff -u -r1.6.4.1 SimpleXML.php
--- Resources/language/php5/SimpleXML.php	10 Aug 2010 01:33:15 -0000	1.6.4.1
+++ Resources/language/php5/SimpleXML.php	15 Jan 2012 03:29:54 -0000
@@ -195,7 +195,7 @@
  * </p>
  * @param is_prefix bool[optional] <p>
  * </p>
- * @return object an object of class SimpleXMLElement with
+ * @return SimpleXMLElement an object of class SimpleXMLElement with
  * properties containing the data held within the XML document. On errors, it
  * will return false.
  */
@@ -221,7 +221,7 @@
  * </p>
  * @param is_prefix bool[optional] <p>
  * </p>
- * @return object an object of class SimpleXMLElement with
+ * @return SimpleXMLElement an object of class SimpleXMLElement with
  * properties containing the data held within the xml document. On errors, it
  * will return false.
  */
Index: Resources/language/php5/ibm_db2.php
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/Resources/language/php5/ibm_db2.php,v
retrieving revision 1.4
diff -u -r1.4 ibm_db2.php
--- Resources/language/php5/ibm_db2.php	26 May 2010 08:33:17 -0000	1.4
+++ Resources/language/php5/ibm_db2.php	15 Jan 2012 03:29:55 -0000
@@ -139,7 +139,7 @@
  * from stored procedures. A non-negative value specifies the maximum size of 
  * the XML data that will be retrieved from the database. If this parameter 
  * is not used, a default of 1MB will be assumed for retrieving the XML 
- * output value from the stored procedure.?
+ * output value from the stored procedure.
  * </p>
  * @param scale int[optional] <p>
  * Specifies the scale with which the variable should be bound to the
Index: Resources/parserTools/highlighting/PHPTokenizer.jflex
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/Resources/parserTools/highlighting/PHPTokenizer.jflex,v
retrieving revision 1.7
diff -u -r1.7 PHPTokenizer.jflex
--- Resources/parserTools/highlighting/PHPTokenizer.jflex	28 Apr 2009 11:13:57 -0000	1.7
+++ Resources/parserTools/highlighting/PHPTokenizer.jflex	15 Jan 2012 03:29:57 -0000
@@ -90,7 +90,6 @@
 	private String internalContext = null;
 	
 	private final XMLParserRegionFactory fRegionFactory = new XMLParserRegionFactory();
-
 /**
  * user method 
  */
@@ -876,6 +875,17 @@
 %state ST_CDATA_END
 %state ST_XML_COMMENT
 %state ST_XML_COMMENT_END
+%state ST_PI
+%state ST_PI_WS
+%state ST_PI_CONTENT
+%state ST_XML_PI_ATTRIBUTE_NAME
+%state ST_XML_PI_EQUALS
+%state ST_XML_PI_ATTRIBUTE_VALUE
+%state ST_XML_PI_TAG_CLOSE
+%state ST_DHTML_ATTRIBUTE_NAME
+%state ST_DHTML_EQUALS
+%state ST_DHTML_ATTRIBUTE_VALUE
+%state ST_DHTML_TAG_CLOSE
 
 
 // normal tag states
@@ -920,7 +930,8 @@
 genericEndTagOpen    = <\/
 genericEmptyTagClose = \/>
 
-
+PIstart = <\?
+PIend   = \?>
 
 // [1] document ::= prolog element Misc*
 document = ({prolog} {element} {Misc}*)
@@ -972,6 +983,11 @@
 CommentEnd   = (\-\->)
 Comment = ({CommentStart}.*{CommentEnd})
 
+// [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
+//PI = (<\?{PITarget} {Char}* \?>)
+
+// [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
+//PITarget = ({Name}((X|x)(M|m)(L|l)))
 
 // [18] CDSect ::= CDStart CData CDEnd
 CDSect = ({CDStart}{CData}{CDEnd})
@@ -1280,15 +1296,16 @@
 
 //PHP MACROS
 WHITESPACE = [\n\r \t]
-PHP_START = (<\?{WHITESPACE}*)|(<\?[Pp][Hh][P|p]{WHITESPACE}+)
-PHP_END = \?>
+//PHP_START = {WHITESPACE}*(<\?{WHITESPACE}*)|(<\?[Pp][Hh][P|p]{WHITESPACE}+)
+PHP_START       = <\?[Pp][Hh][P|p]{WHITESPACE}*
+//PIend = \?>
 PHP_ASP_START=<%
 PHP_ASP_END=%>
 %%
 
 
 /* white space within a tag */
-<ST_XML_EQUALS, ST_XML_ATTRIBUTE_NAME, ST_XML_ATTRIBUTE_VALUE, ST_XML_DECLARATION, ST_XML_DOCTYPE_DECLARATION, ST_XML_ELEMENT_DECLARATION, ST_XML_ATTLIST_DECLARATION, ST_XML_DECLARATION_CLOSE, ST_XML_DOCTYPE_ID_PUBLIC, ST_XML_DOCTYPE_ID_SYSTEM, ST_XML_DOCTYPE_EXTERNAL_ID> {S}* {
+<ST_XML_EQUALS, ST_XML_ATTRIBUTE_NAME, ST_XML_ATTRIBUTE_VALUE, ST_PI, ST_XML_PI_EQUALS, ST_XML_PI_ATTRIBUTE_NAME, ST_XML_PI_ATTRIBUTE_VALUE, ST_XML_DECLARATION, ST_XML_DOCTYPE_DECLARATION, ST_XML_ELEMENT_DECLARATION, ST_XML_ATTLIST_DECLARATION, ST_XML_DECLARATION_CLOSE, ST_XML_DOCTYPE_ID_PUBLIC, ST_XML_DOCTYPE_ID_SYSTEM, ST_XML_DOCTYPE_EXTERNAL_ID> {S}* {
 	if(Debug.debugTokenizer)
 		dump("white space");//$NON-NLS-1$
         return WHITE_SPACE;
@@ -1307,13 +1324,13 @@
 
 /* VERY special cases for tags as values */
 /* quoted Php */
-<ST_XML_ATTRIBUTE_VALUE_DQUOTED> ["] {
+<ST_XML_ATTRIBUTE_VALUE_DQUOTED> [\"] {
 	return XML_TAG_ATTRIBUTE_VALUE_DQUOTE;
 }
 <ST_XML_ATTRIBUTE_VALUE_SQUOTED> ['] {
 	return XML_TAG_ATTRIBUTE_VALUE_SQUOTE;
 }
-<ST_XML_ATTRIBUTE_VALUE> ["] {
+<ST_XML_ATTRIBUTE_VALUE> [\"] {
 	fEmbeddedHint = XML_TAG_ATTRIBUTE_VALUE;
 	fEmbeddedPostState = ST_XML_ATTRIBUTE_VALUE_DQUOTED;
 	yybegin(ST_XML_ATTRIBUTE_VALUE_DQUOTED);
@@ -1340,7 +1357,7 @@
 	return PROXY_CONTEXT;
 }
 
-<ST_XML_ATTRIBUTE_VALUE_DQUOTED> ([^<"\x24\x23]|[\x24\x23][^\x7b])+ {
+<ST_XML_ATTRIBUTE_VALUE_DQUOTED> ([^<\"\x24\x23]|[\x24\x23][^\x7b])+ {
 	return XML_TAG_ATTRIBUTE_VALUE;
 }
 <ST_XML_ATTRIBUTE_VALUE_SQUOTED> ([^<'\x24\x23]|[\x24\x23][^\x7b])+ {
@@ -1515,6 +1532,59 @@
 // END NESTED XML
 
 
+{PHP_START} | {PHP_ASP_START} | {PIstart} {
+	if(Debug.debugTokenizer)
+		dump("\nprocessing instruction start");//$NON-NLS-1$
+	if ("<?".equals(yytext())
+			&& !ProjectOptions.useShortTags(project)) {
+		yybegin(ST_PI);
+		return XML_PI_OPEN;
+
+	} else {
+		// removeing trailing whitespaces for the php open
+		String phpStart = yytext();
+		int i = phpStart.length() - 1;
+		while (i >= 0
+				&& Character.isWhitespace(phpStart.charAt(i--))) {
+			yypushback(1);
+		}
+		fStateStack.push(yystate());// YYINITIAL
+		if (fStateStack.peek() == YYINITIAL) {
+			// the simple case, just a regular scriptlet out in
+			// content
+			yybegin(ST_PHP_CONTENT);
+			return PHP_OPEN;
+		} else {
+			if (yystate() == ST_XML_ATTRIBUTE_VALUE_DQUOTED)
+				fEmbeddedPostState = ST_XML_ATTRIBUTE_VALUE_DQUOTED;
+			else if (yystate() == ST_XML_ATTRIBUTE_VALUE_SQUOTED)
+				fEmbeddedPostState = ST_XML_ATTRIBUTE_VALUE_SQUOTED;
+			else if (yystate() == ST_CDATA_TEXT) {
+				fEmbeddedPostState = ST_CDATA_TEXT;
+				fEmbeddedHint = XML_CDATA_TEXT;
+			}
+			yybegin(ST_PHP_CONTENT);
+			assembleEmbeddedContainer(PHP_OPEN, PHP_CLOSE);
+			if (yystate() == ST_BLOCK_TAG_INTERNAL_SCAN) {
+				yybegin(ST_BLOCK_TAG_SCAN);
+				return BLOCK_TEXT;
+			}
+			// required help for successive embedded regions
+			if (yystate() == ST_XML_TAG_NAME) {
+				fEmbeddedHint = XML_TAG_NAME;
+				fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
+			} else if ((yystate() == ST_XML_ATTRIBUTE_NAME || yystate() == ST_XML_EQUALS)) {
+				fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
+				fEmbeddedPostState = ST_XML_EQUALS;
+			} else if (yystate() == ST_XML_ATTRIBUTE_VALUE) {
+				fEmbeddedHint = XML_TAG_ATTRIBUTE_VALUE;
+				fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
+			}
+			return PROXY_CONTEXT;
+		}
+	}
+
+}
 // XML & PHP Comments
 
 <YYINITIAL, ST_XML_TAG_NAME, ST_XML_EQUALS, ST_XML_ATTRIBUTE_NAME, ST_XML_ATTRIBUTE_VALUE, ST_XML_DECLARATION> {CommentStart} {
@@ -1551,6 +1621,8 @@
 <ST_CDATA_TEXT> .|\r|\n {
 	if(Debug.debugTokenizer)
 		dump("CDATA text");//$NON-NLS-1$
+	fEmbeddedPostState = ST_CDATA_TEXT;
+	fEmbeddedHint = XML_CDATA_TEXT;
 	String blockContext = doBlockScan("]]>", XML_CDATA_TEXT, ST_CDATA_END);//$NON-NLS-1$
 	if(blockContext == XML_CDATA_TEXT)
 		yybegin(ST_CDATA_END);
@@ -1579,6 +1651,134 @@
 	return XML_ENTITY_REFERENCE;
 }
 
+// the next four are order dependent
+<ST_PI> ((X|x)(M|m)(L|l)) {
+	if(Debug.debugTokenizer)
+		dump("XML processing instruction target");//$NON-NLS-1$
+	fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
+	fEmbeddedPostState = ST_XML_EQUALS;
+        yybegin(ST_XML_PI_ATTRIBUTE_NAME);
+        return XML_TAG_NAME;
+}
+// XML declarations
+<ST_PI> ((P|p)(H|h)(P|p)) {
+	if(Debug.debugTokenizer)
+		dump("PHP processing instruction target");//$NON-NLS-1$
+	//fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
+	//fEmbeddedPostState = ST_XML_EQUALS;
+        //yybegin(ST_XML_PI_ATTRIBUTE_NAME);
+        //return XML_TAG_NAME;
+        yybegin(ST_PHP_CONTENT);
+		return PHP_OPEN;
+}
+<ST_PI> ([iI][mM][pP][oO][rR][tT]) {
+	if(Debug.debugTokenizer)
+		dump("DHTML processing instruction target");//$NON-NLS-1$
+	fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
+	fEmbeddedPostState = ST_XML_EQUALS;
+        yybegin(ST_DHTML_ATTRIBUTE_NAME);
+        return XML_TAG_NAME;
+}
+<ST_PI> xml-stylesheet {
+	if(Debug.debugTokenizer)
+		dump("XSL processing instruction target");//$NON-NLS-1$
+	fEmbeddedPostState = ST_XML_EQUALS;
+        yybegin(ST_XML_PI_ATTRIBUTE_NAME);
+        return XML_TAG_NAME;
+}
+<ST_PI> {Name} {
+	if(Debug.debugTokenizer)
+		dump("processing instruction target");//$NON-NLS-1$
+	fEmbeddedHint = XML_CONTENT;
+        yybegin(ST_PI_WS);
+        return XML_TAG_NAME;
+}
+<ST_PI_WS> {S}+ {
+        yybegin(ST_PI_CONTENT);
+        return WHITE_SPACE;
+}
+<ST_PI, ST_PI_WS> \?> {
+	if(Debug.debugTokenizer)
+		dump("processing instruction end");//$NON-NLS-1$
+	fEmbeddedHint = UNDEFINED;
+        yybegin(YYINITIAL);
+        return XML_PI_CLOSE;
+}
+<ST_PI_CONTENT> . {
+		// block scan until close is found
+	return doScan("?>", false, false, XML_PI_CONTENT, ST_XML_PI_TAG_CLOSE, ST_XML_PI_TAG_CLOSE);
+}
+<ST_PI_CONTENT,ST_XML_PI_TAG_CLOSE> \?> {
+		// ended with nothing inside
+		fEmbeddedHint = UNDEFINED;
+        yybegin(YYINITIAL);
+        return XML_PI_CLOSE;
+}
+
+<ST_XML_PI_ATTRIBUTE_NAME, ST_XML_PI_EQUALS> {Name} {
+	if(Debug.debugTokenizer)
+		dump("XML processing instruction attribute name");//$NON-NLS-1$
+        yybegin(ST_XML_PI_EQUALS);
+        return XML_TAG_ATTRIBUTE_NAME;
+}
+<ST_XML_PI_EQUALS> {Eq} {
+	if(Debug.debugTokenizer)
+		dump("XML processing instruction '='");//$NON-NLS-1$
+	fEmbeddedHint = XML_TAG_ATTRIBUTE_VALUE;
+	fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
+        yybegin(ST_XML_PI_ATTRIBUTE_VALUE);
+        return XML_TAG_ATTRIBUTE_EQUALS;
+}
+/* the value was found, look for the next name */
+<ST_XML_PI_ATTRIBUTE_VALUE> {AttValue} {
+	if(Debug.debugTokenizer)
+		dump("XML processing instruction attribute value");//$NON-NLS-1$
+	fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
+	fEmbeddedPostState = ST_XML_EQUALS;
+        yybegin(ST_XML_PI_ATTRIBUTE_NAME);
+        return XML_TAG_ATTRIBUTE_VALUE;
+}
+/* the PI's close was found */
+<ST_XML_PI_EQUALS, ST_XML_PI_ATTRIBUTE_NAME, ST_XML_PI_ATTRIBUTE_VALUE> {PIend} {
+	if(Debug.debugTokenizer)
+		dump("XML processing instruction end");//$NON-NLS-1$
+	fEmbeddedHint = UNDEFINED;
+        yybegin(YYINITIAL);
+        return XML_PI_CLOSE;
+}
+// DHTML
+<ST_DHTML_ATTRIBUTE_NAME, ST_DHTML_EQUALS> {Name} {
+	if(Debug.debugTokenizer)
+		dump("DHTML processing instruction attribute name");//$NON-NLS-1$
+        yybegin(ST_DHTML_EQUALS);
+        return XML_TAG_ATTRIBUTE_NAME;
+}
+<ST_DHTML_EQUALS> {Eq} {
+	if(Debug.debugTokenizer)
+		dump("DHTML processing instruction '='");//$NON-NLS-1$
+	fEmbeddedHint = XML_TAG_ATTRIBUTE_VALUE;
+	fEmbeddedPostState = ST_XML_ATTRIBUTE_NAME;
+        yybegin(ST_DHTML_ATTRIBUTE_VALUE);
+        return XML_TAG_ATTRIBUTE_EQUALS;
+}
+/* the value was found, look for the next name */
+<ST_DHTML_ATTRIBUTE_VALUE> {AttValue} | ([\'\"]([^\'\"\040\011\012\015<>/]|\/+[^\'\"\040\011\012\015<>/] )* ) {
+	if(Debug.debugTokenizer)
+		dump("DHTML processing instruction attribute value");//$NON-NLS-1$
+	fEmbeddedHint = XML_TAG_ATTRIBUTE_NAME;
+	fEmbeddedPostState = ST_XML_EQUALS;
+        yybegin(ST_DHTML_ATTRIBUTE_NAME);
+        return XML_TAG_ATTRIBUTE_VALUE;
+}
+/* The DHTML PI's close was found */
+<ST_DHTML_EQUALS, ST_DHTML_ATTRIBUTE_NAME, ST_DHTML_ATTRIBUTE_VALUE> [/]*> {
+	if(Debug.debugTokenizer)
+		dump("DHTML processing instruction end");//$NON-NLS-1$
+	fEmbeddedHint = UNDEFINED;
+        yybegin(YYINITIAL);
+        return XML_PI_CLOSE;
+}
+
 // XML declarations
 
 <YYINITIAL, ST_XML_TAG_NAME, ST_XML_EQUALS, ST_XML_ATTRIBUTE_NAME, ST_XML_ATTRIBUTE_VALUE> {genericTagOpen}"!" {
@@ -1717,7 +1917,7 @@
 	}
 
 //PHP PROCESSING ACTIONS
-<YYINITIAL,ST_XML_TAG_NAME, ST_XML_EQUALS, ST_XML_ATTRIBUTE_NAME, ST_XML_ATTRIBUTE_VALUE, ST_XML_DECLARATION, ST_XML_DOCTYPE_DECLARATION, ST_XML_ELEMENT_DECLARATION, ST_XML_ATTLIST_DECLARATION, ST_XML_DECLARATION_CLOSE, ST_XML_DOCTYPE_ID_PUBLIC, ST_XML_DOCTYPE_ID_SYSTEM, ST_XML_DOCTYPE_EXTERNAL_ID, ST_XML_COMMENT, ST_XML_ATTRIBUTE_VALUE_DQUOTED, ST_XML_ATTRIBUTE_VALUE_SQUOTED, ST_CDATA_TEXT, ST_BLOCK_TAG_INTERNAL_SCAN> {PHP_START} | {PHP_ASP_START} {
+<YYINITIAL,ST_XML_TAG_NAME, ST_XML_EQUALS, ST_XML_ATTRIBUTE_NAME, ST_XML_ATTRIBUTE_VALUE, ST_XML_DECLARATION, ST_XML_DOCTYPE_DECLARATION, ST_XML_ELEMENT_DECLARATION, ST_XML_ATTLIST_DECLARATION, ST_XML_DECLARATION_CLOSE, ST_XML_DOCTYPE_ID_PUBLIC, ST_XML_DOCTYPE_ID_SYSTEM, ST_XML_DOCTYPE_EXTERNAL_ID, ST_XML_COMMENT, ST_XML_ATTRIBUTE_VALUE_DQUOTED, ST_XML_ATTRIBUTE_VALUE_SQUOTED, ST_BLOCK_TAG_INTERNAL_SCAN>{WHITESPACE}* {PHP_START} | {PHP_ASP_START} {
     if (ProjectOptions.isSupportingAspTags(project) ||yytext().charAt(1) != '%') {
 		//removeing trailing whitespaces for the php open
 		String phpStart = yytext();
@@ -1768,7 +1968,7 @@
 	return XML_TAG_OPEN;
 }
 
-<ST_PHP_CONTENT> {PHP_END} | {PHP_ASP_END} {
+<ST_PHP_CONTENT> {PIend} | {PHP_ASP_END} {
 	yybegin(fStateStack.pop());
 	return PHP_CLOSE;
 	
Index: Resources/parserTools/highlighting/php5/highlighting_scanner.jflex
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/Resources/parserTools/highlighting/php5/highlighting_scanner.jflex,v
retrieving revision 1.6.4.1
diff -u -r1.6.4.1 highlighting_scanner.jflex
--- Resources/parserTools/highlighting/php5/highlighting_scanner.jflex	27 Aug 2010 03:35:52 -0000	1.6.4.1
+++ Resources/parserTools/highlighting/php5/highlighting_scanner.jflex	15 Jan 2012 03:29:58 -0000
@@ -774,11 +774,29 @@
         return PHP_CONSTANT_ENCAPSED_STRING;
 }
 
-<ST_PHP_END_HEREDOC>{NEWLINE}{LABEL}";"?[\n\r] {
-    heredoc=null;
-    heredoc_len=0;
-    yybegin(ST_PHP_IN_SCRIPTING);
-    return PHP_HEREDOC_TAG;
+<ST_PHP_END_HEREDOC>{NEWLINE}*({ANY_CHAR}[^\n\r;])*{LABEL}";"?[\n\r] {
+	int label_len = yylength() - 1;
+	int startIndex = 0;
+	String yytext = yytext();
+	if (yytext.charAt(label_len - 1) == ';') {
+		label_len--;
+	}
+	while (yytext.charAt(startIndex) == '\r'
+			|| yytext.charAt(startIndex) == '\n') {
+		startIndex++;
+	}
+
+	if (label_len > heredoc_len
+			&& yytext.substring(startIndex, label_len).equals(
+					heredoc)) {
+		heredoc = null;
+		heredoc_len = 0;
+		yybegin(ST_PHP_IN_SCRIPTING);
+		return PHP_HEREDOC_TAG;
+	} else {
+		yybegin(ST_PHP_HEREDOC);
+		return PHP_CONSTANT_ENCAPSED_STRING;
+	}
 }
 
 <ST_PHP_DOUBLE_QUOTES,ST_PHP_BACKQUOTE,ST_PHP_HEREDOC,ST_PHP_QUOTES_AFTER_VARIABLE>"{$" {
@@ -813,7 +831,18 @@
 	return PHP_ENCAPSED_AND_WHITESPACE;
 }
 
-<ST_PHP_HEREDOC>{HEREDOC_CHARS}*({HEREDOC_NEWLINE}+({LABEL}";"?)?)? {
+<ST_PHP_HEREDOC>{HEREDOC_CHARS}*({HEREDOC_NEWLINE}+({TABS_AND_SPACES}[^\n\r])*({LABEL}";"?)?)? {
+	if(heredoc!=null&&yytext().startsWith(heredoc)){
+		String text = yytext();
+		if(heredoc_len < text.length() && (text.charAt(heredoc_len) == '\r'
+			|| text.charAt(heredoc_len) == '\n')){
+			yypushback(yylength()-heredoc_len-1);
+	        heredoc=null;
+	        heredoc_len=0;
+	        yybegin(ST_PHP_IN_SCRIPTING);
+	        return PHP_HEREDOC_TAG;
+		}
+	}
 	return PHP_ENCAPSED_AND_WHITESPACE;
 }
 
Index: Resources/parserTools/highlighting/php53/highlighting_scanner.jflex
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/Resources/parserTools/highlighting/php53/highlighting_scanner.jflex,v
retrieving revision 1.10.4.1
diff -u -r1.10.4.1 highlighting_scanner.jflex
--- Resources/parserTools/highlighting/php53/highlighting_scanner.jflex	27 Aug 2010 03:35:52 -0000	1.10.4.1
+++ Resources/parserTools/highlighting/php53/highlighting_scanner.jflex	15 Jan 2012 03:29:58 -0000
@@ -757,6 +757,7 @@
     	heredoc_len = hereOrNowDoc_len;
     	yybegin(ST_PHP_HEREDOC);
     }
+    yypushback(1);
     return PHP_HEREDOC_TAG;
 }
 
@@ -798,15 +799,45 @@
     	yypushback(heredoc_len + (yylength() - label_len));
     	
         yybegin(ST_PHP_END_HEREDOC);
+    } else {
+    	yypushback(1);
     }
     return PHP_CONSTANT_ENCAPSED_STRING;
 }
 
-<ST_PHP_END_HEREDOC>{NEWLINE}{LABEL}";"?[\n\r] {
-	heredoc = null;
-	heredoc_len = 0;
-    yybegin(ST_PHP_IN_SCRIPTING);
-    return PHP_HEREDOC_TAG;
+<ST_PHP_END_HEREDOC>{NEWLINE}*({ANY_CHAR}[^\n\r;])*{LABEL}";"?[\n\r] {
+	int label_len = yylength() - 1;
+	int startIndex = 0;
+	String yytext = yytext();
+	if (yytext.charAt(label_len - 1) == ';') {
+		label_len--;
+	}
+	while (yytext.charAt(startIndex) == '\r'
+			|| yytext.charAt(startIndex) == '\n') {
+		startIndex++;
+	}
+
+	if (label_len > heredoc_len
+			&& yytext.substring(startIndex, label_len).equals(
+					heredoc)) {
+		heredoc = null;
+		heredoc_len = 0;
+		yybegin(ST_PHP_IN_SCRIPTING);
+		return PHP_HEREDOC_TAG;
+	} else {
+		yybegin(ST_PHP_HEREDOC);
+		return PHP_CONSTANT_ENCAPSED_STRING;
+	}
+}
+
+<ST_PHP_END_HEREDOC>{NEWLINE}*{LABEL}({TABS_AND_SPACES}[^\n\r])+";"?[\n\r] {
+	yybegin(ST_PHP_HEREDOC);
+	return PHP_CONSTANT_ENCAPSED_STRING;
+}
+
+<ST_PHP_END_HEREDOC>{NEWLINE}*({TABS_AND_SPACES}[^\n\r])+{LABEL}";"?[\n\r] {
+	yybegin(ST_PHP_HEREDOC);
+	return PHP_CONSTANT_ENCAPSED_STRING;
 }
 
 <ST_PHP_NOWDOC>{LABEL}";"?[\n\r] {
@@ -890,6 +921,17 @@
 }
 
 <ST_PHP_HEREDOC>{HEREDOC_CHARS}*({HEREDOC_NEWLINE}+({LABEL}";"?)?)? {
+	if(heredoc!=null&&yytext().startsWith(heredoc)){
+		String text = yytext();
+		if(heredoc_len < text.length() && (text.charAt(heredoc_len) == '\r'
+			|| text.charAt(heredoc_len) == '\n')){
+			yypushback(yylength()-heredoc_len-1);
+	        heredoc=null;
+	        heredoc_len=0;
+	        yybegin(ST_PHP_IN_SCRIPTING);
+	        return PHP_HEREDOC_TAG;
+		}
+	}
 	return PHP_ENCAPSED_AND_WHITESPACE;
 }
 
Index: Resources/parserTools/parser/php53/ast_scanner.flex
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/Resources/parserTools/parser/php53/ast_scanner.flex,v
retrieving revision 1.11.8.1
diff -u -r1.11.8.1 ast_scanner.flex
--- Resources/parserTools/parser/php53/ast_scanner.flex	12 Aug 2010 01:21:14 -0000	1.11.8.1
+++ Resources/parserTools/parser/php53/ast_scanner.flex	15 Jan 2012 03:29:59 -0000
@@ -958,7 +958,7 @@
     	yybegin(ST_NOWDOC);
     }
     else if (hereOrNowDoc.charAt(0) == '"') {
-    	heredoc = heredoc.substring(1, heredoc_len-1);
+    	heredoc = hereOrNowDoc.substring(1, heredoc_len-1);
     	sym.value = heredoc;
     	heredoc_len -= 2;
     	yybegin(ST_HEREDOC);
Index: src/org/eclipse/php/internal/core/PHPCorePlugin.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/PHPCorePlugin.java,v
retrieving revision 1.39
diff -u -r1.39 PHPCorePlugin.java
--- src/org/eclipse/php/internal/core/PHPCorePlugin.java	27 Oct 2009 14:15:23 -0000	1.39
+++ src/org/eclipse/php/internal/core/PHPCorePlugin.java	15 Jan 2012 03:29:59 -0000
@@ -158,15 +158,18 @@
 							}
 							IScriptProject scriptProject = DLTKCore
 									.create(project);
-							IProjectFragment[] projectFragments = scriptProject
-									.getProjectFragments();
-							for (IProjectFragment projectFragment : projectFragments) {
-								ProjectIndexerManager.removeProjectFragment(
-										scriptProject, projectFragment
-												.getPath());
+							if (scriptProject.isOpen()) {
+								IProjectFragment[] projectFragments = scriptProject
+										.getProjectFragments();
+								for (IProjectFragment projectFragment : projectFragments) {
+									ProjectIndexerManager
+											.removeProjectFragment(
+													scriptProject,
+													projectFragment.getPath());
+								}
+								ProjectIndexerManager.removeProject(project
+										.getFullPath());
 							}
-							ProjectIndexerManager.removeProject(project
-									.getFullPath());
 						}
 
 						// add to index:
@@ -250,8 +253,8 @@
 		if (oldIncludePath != null) {
 			newPath.addAll(Arrays.asList(oldIncludePath));
 		}
-		scriptProject.setRawBuildpath(newPath
-				.toArray(new IBuildpathEntry[newPath.size()]),
+		scriptProject.setRawBuildpath(
+				newPath.toArray(new IBuildpathEntry[newPath.size()]),
 				new NullProgressMonitor());
 	}
 
@@ -401,8 +404,7 @@
 					.createWorkspaceScope(PHPLanguageToolkit.getDefault());
 			try {
 				if (monitor != null) {
-					monitor
-							.subTask(CoreMessages.PHPCorePlugin_initializingSearchEngine);
+					monitor.subTask(CoreMessages.PHPCorePlugin_initializingSearchEngine);
 					monitor.worked(25);
 				}
 
Index: src/org/eclipse/php/internal/core/PHPVersion.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/PHPVersion.java,v
retrieving revision 1.5
diff -u -r1.5 PHPVersion.java
--- src/org/eclipse/php/internal/core/PHPVersion.java	18 Oct 2009 09:26:07 -0000	1.5
+++ src/org/eclipse/php/internal/core/PHPVersion.java	15 Jan 2012 03:29:59 -0000
@@ -23,7 +23,7 @@
 	PHP5("php5"), //$NON-NLS-1$
 
 	/**
-	 * This 5.3 is a major version - it should be 5½.0, actually.
+	 * This 5.3 is a major version - it should be 5.0, actually.
 	 * <p>
 	 * New in this version:
 	 * <ul>
Index: src/org/eclipse/php/internal/core/ast/nodes/Bindings.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/ast/nodes/Bindings.java,v
retrieving revision 1.12
diff -u -r1.12 Bindings.java
--- src/org/eclipse/php/internal/core/ast/nodes/Bindings.java	22 Apr 2010 18:50:25 -0000	1.12
+++ src/org/eclipse/php/internal/core/ast/nodes/Bindings.java	15 Jan 2012 03:29:59 -0000
@@ -305,7 +305,7 @@
 			return method;
 		ITypeBinding superClass = type.getSuperclass();
 		if (superClass != null) {
-			method = findOverriddenMethodInHierarchy(superClass, binding);
+			method = innerFindOverriddenMethodInHierarchy(superClass, binding,processedTypes);
 			if (method != null) {
 				return method;
 			}
@@ -313,7 +313,7 @@
 		ITypeBinding[] interfaces = type.getInterfaces();
 		if (interfaces != null) {
 			for (int i = 0; i < interfaces.length; i++) {
-				method = findOverriddenMethodInHierarchy(interfaces[i], binding);
+				method = innerFindOverriddenMethodInHierarchy(interfaces[i], binding,processedTypes);
 				if (method != null)
 					return method;
 			}
Index: src/org/eclipse/php/internal/core/codeassist/strategies/AbstractClassInstantiationStrategy.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/AbstractClassInstantiationStrategy.java,v
retrieving revision 1.9
diff -u -r1.9 AbstractClassInstantiationStrategy.java
--- src/org/eclipse/php/internal/core/codeassist/strategies/AbstractClassInstantiationStrategy.java	5 May 2010 08:31:48 -0000	1.9
+++ src/org/eclipse/php/internal/core/codeassist/strategies/AbstractClassInstantiationStrategy.java	15 Jan 2012 03:29:59 -0000
@@ -68,8 +68,8 @@
 			} else {
 				// if this is context information mode,we use this,
 				// because the number of types' length is very small
-				IMethod[] ctors = FakeConstructor.getConstructors(type, type
-						.equals(enclosingClass));
+				IMethod[] ctors = FakeConstructor.getConstructors(type,
+						type.equals(enclosingClass));
 				if (ctors != null && ctors.length == 2) {
 					if (ctors[1] != null) {
 						reporter.reportMethod(ctors[1], suffix, replaceRange);
@@ -83,9 +83,19 @@
 	}
 
 	public String getSuffix(AbstractCompletionContext abstractContext) {
+		boolean insertMode = isInsertMode();
+
 		char nextChar = ' ';
 		try {
-			nextChar = abstractContext.getNextChar();
+			if (insertMode) {
+				nextChar = abstractContext.getNextChar();
+			} else {
+				SourceRange replacementRange = getReplacementRange(abstractContext);
+				nextChar = abstractContext.getDocument().getChar(
+						replacementRange.getOffset()
+								+ replacementRange.getLength());
+			}
+
 		} catch (BadLocationException e) {
 			PHPCorePlugin.log(e);
 		}
Index: src/org/eclipse/php/internal/core/codeassist/strategies/AbstractCompletionStrategy.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/AbstractCompletionStrategy.java,v
retrieving revision 1.9.4.3
diff -u -r1.9.4.3 AbstractCompletionStrategy.java
--- src/org/eclipse/php/internal/core/codeassist/strategies/AbstractCompletionStrategy.java	25 Aug 2010 02:55:48 -0000	1.9.4.3
+++ src/org/eclipse/php/internal/core/codeassist/strategies/AbstractCompletionStrategy.java	15 Jan 2012 03:29:59 -0000
@@ -15,6 +15,7 @@
 import java.util.List;
 
 import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
 import org.eclipse.dltk.core.IModelElement;
 import org.eclipse.dltk.core.IProjectFragment;
 import org.eclipse.dltk.core.IScriptProject;
@@ -199,4 +200,13 @@
 		// XXX: add language model here
 		return SearchEngine.createSearchScope(sourceModule);
 	}
+
+	protected boolean isInsertMode() {
+		Preferences preferenceStore = PHPCorePlugin.getDefault()
+				.getPluginPreferences();
+		boolean noOverwrite = preferenceStore
+				.getBoolean(PHPCoreConstants.CODEASSIST_INSERT_COMPLETION);
+		return noOverwrite;
+	}
+
 }
Index: src/org/eclipse/php/internal/core/codeassist/strategies/CatchTypeStrategy.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/CatchTypeStrategy.java,v
retrieving revision 1.1
diff -u -r1.1 CatchTypeStrategy.java
--- src/org/eclipse/php/internal/core/codeassist/strategies/CatchTypeStrategy.java	24 Sep 2009 10:58:30 -0000	1.1
+++ src/org/eclipse/php/internal/core/codeassist/strategies/CatchTypeStrategy.java	15 Jan 2012 03:29:59 -0000
@@ -12,6 +12,7 @@
 package org.eclipse.php.internal.core.codeassist.strategies;
 
 import org.eclipse.php.core.codeassist.ICompletionContext;
+import org.eclipse.php.internal.core.codeassist.ProposalExtraInfo;
 import org.eclipse.php.internal.core.codeassist.contexts.AbstractCompletionContext;
 
 /**
@@ -33,4 +34,8 @@
 	public String getSuffix(AbstractCompletionContext abstractContext) {
 		return " "; //$NON-NLS-1$
 	}
+
+	protected Object getExtraInfo() {
+		return ProposalExtraInfo.TYPE_ONLY;
+	}
 }
Index: src/org/eclipse/php/internal/core/codeassist/strategies/FunctionParameterTypeStrategy.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/FunctionParameterTypeStrategy.java,v
retrieving revision 1.5
diff -u -r1.5 FunctionParameterTypeStrategy.java
--- src/org/eclipse/php/internal/core/codeassist/strategies/FunctionParameterTypeStrategy.java	30 Jul 2009 09:12:17 -0000	1.5
+++ src/org/eclipse/php/internal/core/codeassist/strategies/FunctionParameterTypeStrategy.java	15 Jan 2012 03:29:59 -0000
@@ -12,6 +12,7 @@
 package org.eclipse.php.internal.core.codeassist.strategies;
 
 import org.eclipse.php.core.codeassist.ICompletionContext;
+import org.eclipse.php.internal.core.codeassist.ProposalExtraInfo;
 import org.eclipse.php.internal.core.codeassist.contexts.AbstractCompletionContext;
 
 /**
@@ -28,4 +29,8 @@
 	public String getSuffix(AbstractCompletionContext abstractContext) {
 		return " "; //$NON-NLS-1$
 	}
+
+	protected Object getExtraInfo() {
+		return ProposalExtraInfo.TYPE_ONLY;
+	}
 }
Index: src/org/eclipse/php/internal/core/codeassist/strategies/GlobalTypesStrategy.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/GlobalTypesStrategy.java,v
retrieving revision 1.19
diff -u -r1.19 GlobalTypesStrategy.java
--- src/org/eclipse/php/internal/core/codeassist/strategies/GlobalTypesStrategy.java	10 Jun 2010 03:35:31 -0000	1.19
+++ src/org/eclipse/php/internal/core/codeassist/strategies/GlobalTypesStrategy.java	15 Jan 2012 03:30:00 -0000
@@ -58,7 +58,8 @@
 	public SourceRange getReplacementRange(ICompletionContext context)
 			throws BadLocationException {
 		SourceRange replacementRange = super.getReplacementRange(context);
-		if (replacementRange.getLength() > 0) {
+		boolean insertMode = isInsertMode();
+		if (replacementRange.getLength() > 0 && insertMode) {
 			return new SourceRange(replacementRange.getOffset(),
 					replacementRange.getLength() - 1);
 		}
@@ -144,8 +145,8 @@
 
 				// get the class data for "self". In case of null, the self
 				// function will not be added
-				IType selfClassData = CodeAssistUtils.getSelfClassData(context
-						.getSourceModule(), context.getOffset());
+				IType selfClassData = CodeAssistUtils.getSelfClassData(
+						context.getSourceModule(), context.getOffset());
 				if (selfClassData != null) {
 					try {
 						IMethod ctor = null;
@@ -160,10 +161,10 @@
 									.getSourceRange();
 							FakeMethod ctorMethod = new FakeMethod(
 									(ModelElement) selfClassData, "self",
-									sourceRange.getOffset(), sourceRange
-											.getLength(), sourceRange
-											.getOffset(), sourceRange
-											.getLength()) {
+									sourceRange.getOffset(),
+									sourceRange.getLength(),
+									sourceRange.getOffset(),
+									sourceRange.getLength()) {
 								public boolean isConstructor()
 										throws ModelException {
 									return true;
@@ -175,12 +176,14 @@
 						} else {
 							ISourceRange sourceRange = selfClassData
 									.getSourceRange();
-							reporter.reportMethod(new FakeMethod(
-									(ModelElement) selfClassData, "self",
-									sourceRange.getOffset(), sourceRange
-											.getLength(), sourceRange
-											.getOffset(), sourceRange
-											.getLength()), "()", replaceRange);
+							reporter.reportMethod(
+									new FakeMethod(
+											(ModelElement) selfClassData,
+											"self", sourceRange.getOffset(),
+											sourceRange.getLength(),
+											sourceRange.getOffset(),
+											sourceRange.getLength()), "()",
+									replaceRange);
 						}
 					} catch (ModelException e) {
 						PHPCorePlugin.log(e);
Index: src/org/eclipse/php/internal/core/codeassist/strategies/InstanceOfStrategy.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/InstanceOfStrategy.java,v
retrieving revision 1.7
diff -u -r1.7 InstanceOfStrategy.java
--- src/org/eclipse/php/internal/core/codeassist/strategies/InstanceOfStrategy.java	30 Jul 2009 09:12:17 -0000	1.7
+++ src/org/eclipse/php/internal/core/codeassist/strategies/InstanceOfStrategy.java	15 Jan 2012 03:30:00 -0000
@@ -14,6 +14,7 @@
 import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.php.core.codeassist.ICompletionContext;
 import org.eclipse.php.internal.core.codeassist.ICompletionReporter;
+import org.eclipse.php.internal.core.codeassist.ProposalExtraInfo;
 import org.eclipse.php.internal.core.codeassist.contexts.AbstractCompletionContext;
 
 /**
@@ -38,4 +39,8 @@
 	public String getSuffix(AbstractCompletionContext abstractContext) {
 		return ""; //$NON-NLS-1$
 	}
+
+	protected Object getExtraInfo() {
+		return ProposalExtraInfo.TYPE_ONLY;
+	}
 }
Index: src/org/eclipse/php/internal/core/documentModel/dom/ElementImplForPhp.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/documentModel/dom/ElementImplForPhp.java,v
retrieving revision 1.17
diff -u -r1.17 ElementImplForPhp.java
--- src/org/eclipse/php/internal/core/documentModel/dom/ElementImplForPhp.java	23 Apr 2010 11:29:32 -0000	1.17
+++ src/org/eclipse/php/internal/core/documentModel/dom/ElementImplForPhp.java	15 Jan 2012 03:30:00 -0000
@@ -87,7 +87,7 @@
 	public INodeAdapter getExistingAdapter(Object type) {
 
 		// no validation or validation propagation for PHP tags
-		if (isPhpTag()
+		if (isPhpTag() && type instanceof Class
 				&& ValidationAdapter.class.isAssignableFrom((Class) type)) {
 			return nullValidator;
 		}
Index: src/org/eclipse/php/internal/core/includepath/IncludePathManager.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/includepath/IncludePathManager.java,v
retrieving revision 1.21.2.2
diff -u -r1.21.2.2 IncludePathManager.java
--- src/org/eclipse/php/internal/core/includepath/IncludePathManager.java	30 Jul 2010 06:21:55 -0000	1.21.2.2
+++ src/org/eclipse/php/internal/core/includepath/IncludePathManager.java	15 Jan 2012 03:30:00 -0000
@@ -241,8 +241,8 @@
 						.getEntry();
 				IPath localPath = EnvironmentPathUtils.getLocalPath(entry
 						.getPath());
-				buf.append(entry.getEntryKind()).append(';').append(
-						localPath.toString());
+				buf.append(entry.getEntryKind()).append(';')
+						.append(localPath.toString());
 			} else {
 				IResource entry = (IResource) includePath.getEntry();
 				buf.append("0;").append(entry.getFullPath().toString());
@@ -272,8 +272,8 @@
 
 	public static boolean isBuildpathAllowed(IBuildpathEntry entry) {
 		return ((entry.getEntryKind() == IBuildpathEntry.BPE_CONTAINER && !entry
-				.getPath().toString().equals(
-						LanguageModelInitializer.CONTAINER_PATH))
+				.getPath().toString()
+				.equals(LanguageModelInitializer.CONTAINER_PATH))
 				|| entry.getEntryKind() == IBuildpathEntry.BPE_LIBRARY || entry
 				.getEntryKind() == IBuildpathEntry.BPE_PROJECT);
 	}
@@ -312,8 +312,9 @@
 
 		}
 		// update the include path for this project
-		setIncludePath(project, newIncludePathEntries
-				.toArray(new IncludePath[newIncludePathEntries.size()]));
+		setIncludePath(project,
+				newIncludePathEntries
+						.toArray(new IncludePath[newIncludePathEntries.size()]));
 
 		// if it's a library, remove it also from build path
 		IScriptProject scriptProject = DLTKCore.create(project);
@@ -322,6 +323,12 @@
 			BuildPathUtils.removeEntryFromBuildPath(scriptProject,
 					buildpathEntry);
 		}
+
+		// Remove the deleted project from buildpath
+		if (buildpathEntry.getEntryKind() == IBuildpathEntry.BPE_PROJECT) {
+			BuildPathUtils.removeEntryFromBuildPath(scriptProject,
+					buildpathEntry);
+		}
 	}
 
 	/**
@@ -348,8 +355,9 @@
 			}
 		}
 		// update the include path for this project
-		setIncludePath(project, includePathEntries
-				.toArray(new IncludePath[includePathEntries.size()]));
+		setIncludePath(project,
+				includePathEntries.toArray(new IncludePath[includePathEntries
+						.size()]));
 	}
 
 	/**
@@ -379,8 +387,9 @@
 				.getInstance().getIncludePaths(project)));
 
 		// update the include path for this project
-		setIncludePath(project, includePathEntries
-				.toArray(new IncludePath[includePathEntries.size()]));
+		setIncludePath(project,
+				includePathEntries.toArray(new IncludePath[includePathEntries
+						.size()]));
 	}
 
 	/**
Index: src/org/eclipse/php/internal/core/index/PhpElementResolver.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/index/PhpElementResolver.java,v
retrieving revision 1.7.4.2
diff -u -r1.7.4.2 PhpElementResolver.java
--- src/org/eclipse/php/internal/core/index/PhpElementResolver.java	1 Aug 2010 08:29:00 -0000	1.7.4.2
+++ src/org/eclipse/php/internal/core/index/PhpElementResolver.java	15 Jan 2012 03:30:00 -0000
@@ -154,6 +154,8 @@
 	private static class IndexMethod extends SourceMethod implements
 			IPHPDocAwareElement {
 
+		private final static Pattern ARRAY_TYPE_PATTERN = Pattern
+				.compile("array\\[.*\\]");
 		private int flags;
 		private ISourceRange sourceRange;
 		private ISourceRange nameRange;
@@ -230,7 +232,11 @@
 			if (info != null) {
 				String types = info.get("r");
 				if (types != null) {
-					return types.split(",");
+					String[] returnTypes = types.split(",");
+					for (int i = 0; i < returnTypes.length; i++) {
+						returnTypes[i] = returnTypes[i].replaceAll("~", ",");
+					}
+					return returnTypes;
 				}
 			}
 			return null;
Index: src/org/eclipse/php/internal/core/index/PhpIndexingVisitor.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/index/PhpIndexingVisitor.java,v
retrieving revision 1.9.2.2
diff -u -r1.9.2.2 PhpIndexingVisitor.java
--- src/org/eclipse/php/internal/core/index/PhpIndexingVisitor.java	7 Sep 2010 06:59:41 -0000	1.9.2.2
+++ src/org/eclipse/php/internal/core/index/PhpIndexingVisitor.java	15 Jan 2012 03:30:01 -0000
@@ -144,10 +144,11 @@
 					} else if (tag.getTagKind() == PHPDocTag.RETURN) {
 						StringBuilder buf = new StringBuilder();
 						for (SimpleReference ref : tag.getReferences()) {
+							String type = ref.getName().replaceAll(",", "~");
 							if (buf.length() > 0) {
 								buf.append(',');
 							}
-							buf.append(ref.getName());
+							buf.append(type);
 						}
 						info.put("r", buf.toString());
 					}
@@ -283,13 +284,15 @@
 		}
 
 		// Add method declaration:
-		modifyDeclaration(method, new DeclarationInfo(IModelElement.METHOD,
-				modifiers, method.sourceStart(), method.sourceEnd()
+		modifyDeclaration(
+				method,
+				new DeclarationInfo(IModelElement.METHOD, modifiers, method
+						.sourceStart(), method.sourceEnd()
 						- method.sourceStart(), method.getNameStart(), method
-						.getNameEnd()
-						- method.getNameStart(), methodName,
-				metadata.length() == 0 ? null : metadata.toString(),
-				encodeDocInfo(method), fCurrentQualifier, fCurrentParent));
+						.getNameEnd() - method.getNameStart(), methodName,
+						metadata.length() == 0 ? null : metadata.toString(),
+						encodeDocInfo(method), fCurrentQualifier,
+						fCurrentParent));
 
 		for (PhpIndexingVisitorExtension visitor : extensions) {
 			visitor.visit(method);
@@ -345,14 +348,15 @@
 			}
 		}
 
-		modifyDeclaration(type, new DeclarationInfo(IModelElement.TYPE,
-				modifiers, type.sourceStart(), type.sourceEnd()
-						- type.sourceStart(), type.getNameStart(), type
-						.getNameEnd()
-						- type.getNameStart(), type.getName(), metadata
-						.length() == 0 ? null : metadata.toString(),
-				encodeDocInfo(type), isNamespace ? null : fCurrentQualifier,
-				null));
+		modifyDeclaration(
+				type,
+				new DeclarationInfo(IModelElement.TYPE, modifiers, type
+						.sourceStart(), type.sourceEnd() - type.sourceStart(),
+						type.getNameStart(), type.getNameEnd()
+								- type.getNameStart(), type.getName(), metadata
+								.length() == 0 ? null : metadata.toString(),
+						encodeDocInfo(type), isNamespace ? null
+								: fCurrentQualifier, null));
 
 		for (PhpIndexingVisitorExtension visitor : extensions) {
 			visitor.visit(type);
@@ -494,12 +498,13 @@
 	public boolean visit(FieldDeclaration decl) throws Exception {
 		// This is constant declaration:
 		int modifiers = decl.getModifiers();
-		modifyDeclaration(decl, new DeclarationInfo(IModelElement.FIELD,
-				modifiers, decl.sourceStart(), decl.sourceEnd()
-						- decl.sourceStart(), decl.getNameStart(), decl
-						.getNameEnd()
-						- decl.getNameStart(), decl.getName(), null,
-				encodeDocInfo(decl), null, null));
+		modifyDeclaration(
+				decl,
+				new DeclarationInfo(IModelElement.FIELD, modifiers, decl
+						.sourceStart(), decl.sourceEnd() - decl.sourceStart(),
+						decl.getNameStart(), decl.getNameEnd()
+								- decl.getNameStart(), decl.getName(), null,
+						encodeDocInfo(decl), null, null));
 
 		return visitGeneral(decl);
 	}
@@ -513,12 +518,13 @@
 		// This is variable declaration:
 		int modifiers = decl.getModifiers();
 
-		modifyDeclaration(decl, new DeclarationInfo(IModelElement.FIELD,
-				modifiers, decl.sourceStart(), decl.sourceEnd()
-						- decl.sourceStart(), decl.getNameStart(), decl
-						.getNameEnd()
-						- decl.getNameStart(), decl.getName(), null,
-				encodeDocInfo(decl), fCurrentQualifier, fCurrentParent));
+		modifyDeclaration(
+				decl,
+				new DeclarationInfo(IModelElement.FIELD, modifiers, decl
+						.sourceStart(), decl.sourceEnd() - decl.sourceStart(),
+						decl.getNameStart(), decl.getNameEnd()
+								- decl.getNameStart(), decl.getName(), null,
+						encodeDocInfo(decl), fCurrentQualifier, fCurrentParent));
 
 		return visitGeneral(decl);
 	}
@@ -547,9 +553,12 @@
 				argsCount = args.getChilds().size();
 			}
 
-			modifyReference(call, new ReferenceInfo(IModelElement.METHOD, call
-					.sourceStart(), call.sourceEnd() - call.sourceStart(), call
-					.getName(), Integer.toString(argsCount), null));
+			modifyReference(
+					call,
+					new ReferenceInfo(IModelElement.METHOD, call.sourceStart(),
+							call.sourceEnd() - call.sourceStart(), call
+									.getName(), Integer.toString(argsCount),
+							null));
 		}
 
 		return visitGeneral(call);
@@ -560,26 +569,30 @@
 		// information in order to access it quickly:
 		if (include.getExpr() instanceof Scalar) {
 			Scalar filePath = (Scalar) include.getExpr();
-			modifyReference(include, new ReferenceInfo(IModelElement.METHOD,
-					filePath.sourceStart(), filePath.sourceEnd()
+			modifyReference(
+					include,
+					new ReferenceInfo(IModelElement.METHOD, filePath
+							.sourceStart(), filePath.sourceEnd()
 							- filePath.sourceStart(), "include", Integer
 							.toString(1), null));
 
 			String fullPath = ASTUtils.stripQuotes(((Scalar) filePath)
 					.getValue());
-			int idx = Math.max(fullPath.lastIndexOf('/'), fullPath
-					.lastIndexOf('\\'));
+			int idx = Math.max(fullPath.lastIndexOf('/'),
+					fullPath.lastIndexOf('\\'));
 
 			String lastSegment = fullPath;
 			if (idx != -1) {
 				lastSegment = lastSegment.substring(idx + 1);
 			}
-			modifyDeclaration(include, new DeclarationInfo(
-					IModelElement.IMPORT_DECLARATION, 0, include.sourceStart(),
-					include.sourceEnd() - include.sourceStart(), filePath
-							.sourceStart(), filePath.sourceEnd()
-							- filePath.sourceStart(), lastSegment, fullPath,
-					null, null, null));
+			modifyDeclaration(
+					include,
+					new DeclarationInfo(IModelElement.IMPORT_DECLARATION, 0,
+							include.sourceStart(), include.sourceEnd()
+									- include.sourceStart(), filePath
+									.sourceStart(), filePath.sourceEnd()
+									- filePath.sourceStart(), lastSegment,
+							fullPath, null, null, null));
 		}
 
 		return visitGeneral(include);
@@ -593,11 +606,14 @@
 		}
 		ConstantReference constantName = declaration.getConstantName();
 		int offset = constantName.sourceStart();
-		int length = constantName.sourceEnd();
-		modifyDeclaration(declaration, new DeclarationInfo(IModelElement.FIELD,
-				modifiers, offset, length, offset, length, ASTUtils
-						.stripQuotes(constantName.getName()), null,
-				encodeDocInfo(declaration), fCurrentQualifier, fCurrentParent));
+		int length = constantName.sourceEnd() - constantName.sourceStart();
+		modifyDeclaration(
+				declaration,
+				new DeclarationInfo(IModelElement.FIELD, modifiers, offset,
+						length, offset, length, ASTUtils
+								.stripQuotes(constantName.getName()), null,
+						encodeDocInfo(declaration), fCurrentQualifier,
+						fCurrentParent));
 		return visitGeneral(declaration);
 	}
 
@@ -665,10 +681,10 @@
 	}
 
 	public boolean visit(TypeReference reference) throws Exception {
-		modifyReference(reference, new ReferenceInfo(IModelElement.TYPE,
-				reference.sourceStart(), reference.sourceEnd()
-						- reference.sourceStart(), reference.getName(), null,
-				null));
+		modifyReference(reference,
+				new ReferenceInfo(IModelElement.TYPE, reference.sourceStart(),
+						reference.sourceEnd() - reference.sourceStart(),
+						reference.getName(), null, null));
 		return visitGeneral(reference);
 	}
 
Index: src/org/eclipse/php/internal/core/preferences/CorePreferenceConstants.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/preferences/CorePreferenceConstants.java,v
retrieving revision 1.22.2.3
diff -u -r1.22.2.3 CorePreferenceConstants.java
--- src/org/eclipse/php/internal/core/preferences/CorePreferenceConstants.java	3 Aug 2010 09:05:03 -0000	1.22.2.3
+++ src/org/eclipse/php/internal/core/preferences/CorePreferenceConstants.java	15 Jan 2012 03:30:01 -0000
@@ -36,7 +36,7 @@
 	public static void initializeDefaultValues() {
 		IEclipsePreferences node = new DefaultScope().getNode(PHPCorePlugin.ID);
 
-		node.put(Keys.PHP_VERSION, PHPVersion.PHP5.getAlias());
+		node.put(Keys.PHP_VERSION, PHPVersion.PHP5_3.getAlias());
 		node.put(PHPCoreConstants.TASK_TAGS, PHPCoreConstants.DEFAULT_TASK_TAGS);
 		node.put(PHPCoreConstants.TASK_PRIORITIES,
 				PHPCoreConstants.DEFAULT_TASK_PRIORITIES);
Index: src/org/eclipse/php/internal/core/typeinference/ArrayDeclaration.java
===================================================================
RCS file: src/org/eclipse/php/internal/core/typeinference/ArrayDeclaration.java
diff -N src/org/eclipse/php/internal/core/typeinference/ArrayDeclaration.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/php/internal/core/typeinference/ArrayDeclaration.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,69 @@
+package org.eclipse.php.internal.core.typeinference;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.php.internal.core.compiler.ast.nodes.ArrayCreation;
+import org.eclipse.php.internal.core.compiler.ast.nodes.Assignment;
+import org.eclipse.php.internal.core.compiler.ast.nodes.GlobalStatement;
+
+/**
+ * This is a container for array declaration
+ * 
+ */
+public class ArrayDeclaration extends Declaration {
+	private LinkedList<Declaration> decls = new LinkedList<Declaration>();
+
+	public ArrayDeclaration(boolean global, ASTNode declNode) {
+		super(global, declNode);
+	}
+
+	/**
+	 * Adds possible variable declaration
+	 * 
+	 * @param declNode
+	 *            AST declaration statement node
+	 */
+	public void addDeclaration(ASTNode declNode) {
+		// add new declaration
+		if (declNode instanceof Assignment
+				&& (((Assignment) declNode).getValue() instanceof ArrayCreation)) {
+			decls.addLast(new ArrayDeclaration(
+					declNode instanceof GlobalStatement, declNode));
+
+		} else {
+			decls.addLast(new Declaration(declNode instanceof GlobalStatement,
+					declNode));
+		}
+
+	}
+
+	public List<Declaration> getDeclarations() {
+		return decls;
+	}
+
+	public int hashCode() {
+		final int prime = 31;
+		int result = super.hashCode();
+		result = prime * result + ((decls == null) ? 0 : decls.hashCode());
+		return result;
+	}
+
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (!super.equals(obj))
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		ArrayDeclaration other = (ArrayDeclaration) obj;
+		if (decls == null) {
+			if (other.decls != null)
+				return false;
+		} else if (!decls.equals(other.decls))
+			return false;
+		return true;
+	}
+
+}
Index: src/org/eclipse/php/internal/core/typeinference/DeclarationScope.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/DeclarationScope.java,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 DeclarationScope.java
--- src/org/eclipse/php/internal/core/typeinference/DeclarationScope.java	5 Sep 2010 13:03:58 -0000	1.1.2.6
+++ src/org/eclipse/php/internal/core/typeinference/DeclarationScope.java	15 Jan 2012 03:30:03 -0000
@@ -5,8 +5,7 @@
 import org.eclipse.dltk.ast.ASTNode;
 import org.eclipse.dltk.ast.statements.Statement;
 import org.eclipse.dltk.ti.IContext;
-import org.eclipse.php.internal.core.compiler.ast.nodes.GlobalStatement;
-import org.eclipse.php.internal.core.compiler.ast.nodes.IfStatement;
+import org.eclipse.php.internal.core.compiler.ast.nodes.*;
 
 /**
  * Variable declaration scope. Each scope contains mapping between variable name
@@ -101,6 +100,7 @@
 
 		int level = innerBlocks.size();
 
+		// TODO check ArrayCreation,ArrayVariableReference
 		// skip all inner conditional blocks statements, since we've reached
 		// a re-declaration here
 		while (varDecls.size() > level + 1) {
@@ -112,7 +112,19 @@
 		while (varDecls.size() < level) {
 			varDecls.addLast(null);
 		}
-
+		if (declNode instanceof Assignment
+				&& (((Assignment) declNode).getVariable() instanceof ArrayVariableReference)) {
+			int index = varDecls.size() - 1;
+			while (index >= 0) {
+				Declaration decl = varDecls.get(index);
+				if (decl instanceof ArrayDeclaration) {
+					ArrayDeclaration arrayDeclaration = (ArrayDeclaration) decl;
+					arrayDeclaration.addDeclaration(declNode);
+					return;
+				}
+				index--;
+			}
+		}
 		if (varDecls.size() > level) {
 			Declaration decl = varDecls.get(level);
 			// The case that the node is inside another node
@@ -129,17 +141,32 @@
 							// replace existing declaration with a new one
 							// (leave
 							// 'isGlobal' flag the same)
-					decl.setNode(declNode);
+					if (decl instanceof ArrayDeclaration) {
+						decl = new Declaration(
+								declNode instanceof GlobalStatement, declNode);
+						varDecls.set(level, decl);
+					} else {
+						decl.setNode(declNode);
+					}
+
 					return;
 				}
 			}
 		}
 		// add new declaration
-		varDecls.addLast(new Declaration(declNode instanceof GlobalStatement,
-				declNode));
+		if (declNode instanceof Assignment
+				&& (((Assignment) declNode).getValue() instanceof ArrayCreation)) {
+			varDecls.addLast(new ArrayDeclaration(
+					declNode instanceof GlobalStatement, declNode));
+
+		} else {
+			varDecls.addLast(new Declaration(
+					declNode instanceof GlobalStatement, declNode));
+		}
+
 	}
 
-	private boolean isInSameBlock(Statement block, ASTNode oldNode,
+	public static boolean isInSameBlock(Statement block, ASTNode oldNode,
 			ASTNode newNode) {
 		if (block instanceof IfStatement) {
 			IfStatement ifStatement = (IfStatement) block;
@@ -154,7 +181,7 @@
 		return true;
 	}
 
-	private Statement getBlock(IfStatement ifStatement, ASTNode node) {
+	private static Statement getBlock(IfStatement ifStatement, ASTNode node) {
 		Statement falseStatement = ifStatement.getFalseStatement();
 		Statement trueStatement = ifStatement.getTrueStatement();
 		if (trueStatement != null
Index: src/org/eclipse/php/internal/core/typeinference/evaluators/ArrayDeclarationGoalEvaluator.java
===================================================================
RCS file: src/org/eclipse/php/internal/core/typeinference/evaluators/ArrayDeclarationGoalEvaluator.java
diff -N src/org/eclipse/php/internal/core/typeinference/evaluators/ArrayDeclarationGoalEvaluator.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/php/internal/core/typeinference/evaluators/ArrayDeclarationGoalEvaluator.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,78 @@
+package org.eclipse.php.internal.core.typeinference.evaluators;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.ti.GoalState;
+import org.eclipse.dltk.ti.IContext;
+import org.eclipse.dltk.ti.goals.ExpressionTypeGoal;
+import org.eclipse.dltk.ti.goals.GoalEvaluator;
+import org.eclipse.dltk.ti.goals.IGoal;
+import org.eclipse.dltk.ti.types.IEvaluatedType;
+import org.eclipse.php.internal.core.compiler.ast.nodes.ArrayCreation;
+import org.eclipse.php.internal.core.compiler.ast.nodes.ArrayElement;
+import org.eclipse.php.internal.core.compiler.ast.nodes.Assignment;
+import org.eclipse.php.internal.core.compiler.ast.nodes.ForEachStatement;
+import org.eclipse.php.internal.core.typeinference.ArrayDeclaration;
+import org.eclipse.php.internal.core.typeinference.Declaration;
+import org.eclipse.php.internal.core.typeinference.PHPTypeInferenceUtils;
+import org.eclipse.php.internal.core.typeinference.goals.ArrayDeclarationGoal;
+import org.eclipse.php.internal.core.typeinference.goals.ForeachStatementGoal;
+
+public class ArrayDeclarationGoalEvaluator extends GoalEvaluator {
+
+	private List<IEvaluatedType> evaluated = new LinkedList<IEvaluatedType>();
+
+	public ArrayDeclarationGoalEvaluator(IGoal goal) {
+		super(goal);
+	}
+
+	public IGoal[] init() {
+		ArrayDeclarationGoal typedGoal = (ArrayDeclarationGoal) goal;
+
+		List<IGoal> subGoals = new LinkedList<IGoal>();
+
+		ArrayCreation arrayCreation = (ArrayCreation) ((Assignment) typedGoal
+				.getExpression().getNode()).getValue();
+
+		for (ArrayElement arrayElement : arrayCreation.getElements()) {
+			subGoals.add(new ExpressionTypeGoal(typedGoal.getContext(),
+					arrayElement.getValue()));
+		}
+		subGoals.toArray(new IGoal[subGoals.size()]);
+
+		List<Declaration> decls = typedGoal.getExpression().getDeclarations();
+
+		IContext context = goal.getContext();
+		for (int i = 0; i < decls.size(); ++i) {
+			Declaration decl = decls.get(i);
+			// TODO check ArrayCreation and its element type
+			if (decl instanceof ArrayDeclaration) {
+				ArrayDeclaration arrayDeclaration = (ArrayDeclaration) decl;
+				subGoals.add(new ArrayDeclarationGoal(context, arrayDeclaration));
+			} else {
+				ASTNode declNode = decl.getNode();
+				if (declNode instanceof ForEachStatement) {
+					subGoals.add(new ForeachStatementGoal(context,
+							((ForEachStatement) declNode).getExpression()));
+				} else {
+					subGoals.add(new ExpressionTypeGoal(context, declNode));
+				}
+			}
+		}
+
+		return subGoals.toArray(new IGoal[subGoals.size()]);
+	}
+
+	public Object produceResult() {
+		return PHPTypeInferenceUtils.combineMultiType(evaluated);
+	}
+
+	public IGoal[] subGoalDone(IGoal subgoal, Object result, GoalState state) {
+		if (state != GoalState.RECURSIVE) {
+			evaluated.add((IEvaluatedType) result);
+		}
+		return IGoal.NO_GOALS;
+	}
+}
Index: src/org/eclipse/php/internal/core/typeinference/evaluators/ArrayVariableReferenceEvaluator.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/ArrayVariableReferenceEvaluator.java,v
retrieving revision 1.5
diff -u -r1.5 ArrayVariableReferenceEvaluator.java
--- src/org/eclipse/php/internal/core/typeinference/evaluators/ArrayVariableReferenceEvaluator.java	18 Oct 2009 09:25:59 -0000	1.5
+++ src/org/eclipse/php/internal/core/typeinference/evaluators/ArrayVariableReferenceEvaluator.java	15 Jan 2012 03:30:04 -0000
@@ -11,6 +11,7 @@
  *******************************************************************************/
 package org.eclipse.php.internal.core.typeinference.evaluators;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.dltk.ast.references.VariableReference;
@@ -36,17 +37,27 @@
 		ArrayVariableReference reference = (ArrayVariableReference) typedGoal
 				.getExpression();
 		return new IGoal[] { new ExpressionTypeGoal(goal.getContext(),
-				new VariableReference(reference.sourceStart(), reference
-						.sourceEnd(), reference.getName())) };
+				new VariableReference(reference.sourceStart(),
+						reference.sourceEnd(), reference.getName())) };
 	}
 
 	public Object produceResult() {
 		return result;
 	}
 
-	@SuppressWarnings("unchecked")
 	public IGoal[] subGoalDone(IGoal subgoal, Object result, GoalState state) {
-		if (result instanceof MultiTypeType) {
+		if (result instanceof AmbiguousType) {
+			IEvaluatedType[] possibleTypes = ((AmbiguousType) result)
+					.getPossibleTypes();
+			List<IEvaluatedType> types = new ArrayList<IEvaluatedType>();
+			for (IEvaluatedType type : possibleTypes) {
+				if (type instanceof MultiTypeType) {
+					types.addAll(((MultiTypeType) type).getTypes());
+				}
+			}
+			result = new AmbiguousType(types.toArray(new IEvaluatedType[types
+					.size()]));
+		} else if (result instanceof MultiTypeType) {
 			MultiTypeType multiTypeType = (MultiTypeType) result;
 			List<IEvaluatedType> types = multiTypeType.getTypes();
 			result = new AmbiguousType(types.toArray(new IEvaluatedType[types
Index: src/org/eclipse/php/internal/core/typeinference/evaluators/DefaultPHPGoalEvaluatorFactory.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/DefaultPHPGoalEvaluatorFactory.java,v
retrieving revision 1.32
diff -u -r1.32 DefaultPHPGoalEvaluatorFactory.java
--- src/org/eclipse/php/internal/core/typeinference/evaluators/DefaultPHPGoalEvaluatorFactory.java	29 Jul 2009 14:00:22 -0000	1.32
+++ src/org/eclipse/php/internal/core/typeinference/evaluators/DefaultPHPGoalEvaluatorFactory.java	15 Jan 2012 03:30:05 -0000
@@ -59,6 +59,9 @@
 		if (goalClass == ForeachStatementGoal.class) {
 			return new ForeachStatementEvaluator(goal);
 		}
+		if (goalClass == ArrayDeclarationGoal.class) {
+			return new ArrayDeclarationGoalEvaluator(goal);
+		}
 		return null;
 	}
 
Index: src/org/eclipse/php/internal/core/typeinference/evaluators/VariableReferenceEvaluator.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/VariableReferenceEvaluator.java,v
retrieving revision 1.22.8.1
diff -u -r1.22.8.1 VariableReferenceEvaluator.java
--- src/org/eclipse/php/internal/core/typeinference/evaluators/VariableReferenceEvaluator.java	23 Aug 2010 01:56:40 -0000	1.22.8.1
+++ src/org/eclipse/php/internal/core/typeinference/evaluators/VariableReferenceEvaluator.java	15 Jan 2012 03:30:05 -0000
@@ -31,10 +31,12 @@
 import org.eclipse.dltk.ti.goals.IGoal;
 import org.eclipse.dltk.ti.types.IEvaluatedType;
 import org.eclipse.php.internal.core.compiler.ast.nodes.*;
+import org.eclipse.php.internal.core.typeinference.ArrayDeclaration;
 import org.eclipse.php.internal.core.typeinference.Declaration;
 import org.eclipse.php.internal.core.typeinference.PHPTypeInferenceUtils;
 import org.eclipse.php.internal.core.typeinference.context.FileContext;
 import org.eclipse.php.internal.core.typeinference.context.MethodContext;
+import org.eclipse.php.internal.core.typeinference.goals.ArrayDeclarationGoal;
 import org.eclipse.php.internal.core.typeinference.goals.ForeachStatementGoal;
 import org.eclipse.php.internal.core.typeinference.goals.GlobalVariableReferencesGoal;
 
@@ -92,8 +94,8 @@
 							.sourceStart()) {
 						break;
 					}
-					if (varComment.getVariableReference().getName().equals(
-							variableReference.getName())) {
+					if (varComment.getVariableReference().getName()
+							.equals(variableReference.getName())) {
 						List<IGoal> goals = new LinkedList<IGoal>();
 						for (TypeReference ref : varComment.getTypeReferences()) {
 							goals.add(new ExpressionTypeGoal(context, ref));
@@ -106,7 +108,12 @@
 				boolean mergeWithGlobalScope = false;
 				for (int i = 0; i < decls.length; ++i) {
 					Declaration decl = decls[i];
-					if (decl.getNode() instanceof GlobalStatement) {
+					// TODO check ArrayCreation and its element type
+					if (decl instanceof ArrayDeclaration) {
+						ArrayDeclaration arrayDeclaration = (ArrayDeclaration) decl;
+						subGoals.add(new ArrayDeclarationGoal(context,
+								arrayDeclaration));
+					} else if (decl.getNode() instanceof GlobalStatement) {
 						mergeWithGlobalScope = true;
 					} else {
 						ASTNode declNode = decl.getNode();
@@ -203,7 +210,8 @@
 		}
 
 		protected void postProcessGeneral(ASTNode node) {
-			if (node.sourceStart() == variableOffset) {
+			if (node.sourceStart() <= variableOffset
+					&& node.sourceEnd() >= variableOffset) {
 				variableContext = contextStack.peek();
 				variableLevel = getScope(variableContext).getInnerBlockLevel();
 			}
Index: src/org/eclipse/php/internal/core/typeinference/evaluators/phpdoc/PHPDocMethodReturnTypeEvaluator.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/phpdoc/PHPDocMethodReturnTypeEvaluator.java,v
retrieving revision 1.21.4.1
diff -u -r1.21.4.1 PHPDocMethodReturnTypeEvaluator.java
--- src/org/eclipse/php/internal/core/typeinference/evaluators/phpdoc/PHPDocMethodReturnTypeEvaluator.java	1 Aug 2010 08:29:00 -0000	1.21.4.1
+++ src/org/eclipse/php/internal/core/typeinference/evaluators/phpdoc/PHPDocMethodReturnTypeEvaluator.java	15 Jan 2012 03:30:05 -0000
@@ -13,11 +13,13 @@
 
 import java.util.LinkedList;
 import java.util.List;
+import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.eclipse.dltk.ast.references.SimpleReference;
 import org.eclipse.dltk.core.IMethod;
 import org.eclipse.dltk.core.IType;
+import org.eclipse.dltk.evaluation.types.MultiTypeType;
 import org.eclipse.dltk.ti.GoalState;
 import org.eclipse.dltk.ti.goals.IGoal;
 import org.eclipse.dltk.ti.types.IEvaluatedType;
@@ -42,6 +44,9 @@
 public class PHPDocMethodReturnTypeEvaluator extends
 		AbstractMethodReturnTypeEvaluator {
 
+	private final static Pattern ARRAY_TYPE_PATTERN = Pattern
+			.compile("array\\[.*\\]");
+
 	/**
 	 * Used for splitting the data types list of the returned tag
 	 */
@@ -65,10 +70,16 @@
 						.getReturnTypes();
 				if (typeNames != null) {
 					for (String typeName : typeNames) {
-						IEvaluatedType type = getEvaluatedType(typeName,
-								currentNamespace);
-						if (type != null) {
-							evaluated.add(type);
+						Matcher m = ARRAY_TYPE_PATTERN.matcher(typeName);
+						if (m.find()) {
+							evaluated.add(getArrayType(m.group(),
+									currentNamespace));
+						} else {
+							IEvaluatedType type = getEvaluatedType(typeName,
+									currentNamespace);
+							if (type != null) {
+								evaluated.add(type);
+							}
 						}
 					}
 				}
@@ -84,10 +95,17 @@
 								final String[] typesNames = PIPE_PATTERN
 										.split(reference.getName());
 								for (String typeName : typesNames) {
-									IEvaluatedType type = getEvaluatedType(
-											typeName, currentNamespace);
-									if (type != null) {
-										evaluated.add(type);
+									Matcher m = ARRAY_TYPE_PATTERN
+											.matcher(typeName);
+									if (m.find()) {
+										evaluated.add(getArrayType(m.group(),
+												currentNamespace));
+									} else {
+										IEvaluatedType type = getEvaluatedType(
+												typeName, currentNamespace);
+										if (type != null) {
+											evaluated.add(type);
+										}
 									}
 								}
 							}
@@ -100,6 +118,25 @@
 		return IGoal.NO_GOALS;
 	}
 
+	private MultiTypeType getArrayType(String type, IType currentNamespace) {
+		int beginIndex = type.indexOf("[") + 1;
+		int endIndex = type.lastIndexOf("]");
+		type = type.substring(beginIndex, endIndex);
+		MultiTypeType arrayType = new MultiTypeType();
+		Matcher m = ARRAY_TYPE_PATTERN.matcher(type);
+		if (m.find()) {
+			arrayType.addType(getArrayType(m.group(), currentNamespace));
+			type = m.replaceAll("");
+		}
+		String[] typeNames = type.split(",");
+		for (String name : typeNames) {
+			if (!"".equals(name)) {
+				arrayType.addType(getEvaluatedType(name, currentNamespace));
+			}
+		}
+		return arrayType;
+	}
+
 	private IEvaluatedType getEvaluatedType(String typeName,
 			IType currentNamespace) {
 		IEvaluatedType type = PHPSimpleTypes.fromString(typeName);
Index: src/org/eclipse/php/internal/core/typeinference/goals/ArrayDeclarationGoal.java
===================================================================
RCS file: src/org/eclipse/php/internal/core/typeinference/goals/ArrayDeclarationGoal.java
diff -N src/org/eclipse/php/internal/core/typeinference/goals/ArrayDeclarationGoal.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/php/internal/core/typeinference/goals/ArrayDeclarationGoal.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,53 @@
+package org.eclipse.php.internal.core.typeinference.goals;
+
+import org.eclipse.dltk.ti.IContext;
+import org.eclipse.dltk.ti.goals.AbstractTypeGoal;
+import org.eclipse.php.internal.core.typeinference.ArrayDeclaration;
+
+public class ArrayDeclarationGoal extends AbstractTypeGoal {
+
+	private final ArrayDeclaration arrayDeclaration;
+
+	public ArrayDeclarationGoal(IContext context,
+			ArrayDeclaration arrayDeclaration) {
+		super(context);
+		this.arrayDeclaration = arrayDeclaration;
+	}
+
+	public ArrayDeclaration getExpression() {
+		return arrayDeclaration;
+	}
+
+	public int hashCode() {
+		final int prime = 31;
+		int result = super.hashCode();
+		result = prime
+				* result
+				+ ((arrayDeclaration == null) ? 0 : arrayDeclaration.hashCode());
+		return result;
+	}
+
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (!super.equals(obj))
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		ArrayDeclarationGoal other = (ArrayDeclarationGoal) obj;
+		if (arrayDeclaration == null) {
+			if (other.arrayDeclaration != null)
+				return false;
+		} else if (!arrayDeclaration.equals(other.arrayDeclaration))
+			return false;
+		return true;
+	}
+
+	public String toString() {
+		return "ExpressionTypeGoal: " //$NON-NLS-1$
+				+ ((arrayDeclaration != null) ? arrayDeclaration.toString()
+						: "null") //$NON-NLS-1$
+				+ " context: " //$NON-NLS-1$
+				+ ((context != null) ? context.toString() : "null"); //$NON-NLS-1$
+	}
+}
Index: src/org/eclipse/php/internal/core/util/text/PHPTextSequenceUtilities.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/util/text/PHPTextSequenceUtilities.java,v
retrieving revision 1.25.2.2
diff -u -r1.25.2.2 PHPTextSequenceUtilities.java
--- src/org/eclipse/php/internal/core/util/text/PHPTextSequenceUtilities.java	6 Sep 2010 06:22:06 -0000	1.25.2.2
+++ src/org/eclipse/php/internal/core/util/text/PHPTextSequenceUtilities.java	15 Jan 2012 03:30:07 -0000
@@ -74,8 +74,7 @@
 		}
 		if (tRegion != null && tRegion.getType() == PHPRegionContext.PHP_CLOSE) {
 			tRegion = container.getRegionAtCharacterOffset(container
-					.getStartOffset()
-					+ tRegion.getStart() - 1);
+					.getStartOffset() + tRegion.getStart() - 1);
 		}
 
 		// This text region must be of type PhpScriptRegion:
@@ -128,8 +127,9 @@
 				}
 
 				// remove spaces from start.
-				textSequence = textSequence.subTextSequence(readForwardSpaces(
-						textSequence, 0), textSequence.length());
+				textSequence = textSequence.subTextSequence(
+						readForwardSpaces(textSequence, 0),
+						textSequence.length());
 
 				return textSequence;
 
@@ -565,6 +565,8 @@
 					if (bracketsNum == 0 && rv >= 2) {
 						if (textSequence.charAt(rv - 2) == '-') {
 							return rv - 2;
+						} else {
+							return -1;
 						}
 					}
 					break;
#P org.eclipse.php.debug.core
Index: META-INF/MANIFEST.MF
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.core/META-INF/MANIFEST.MF,v
retrieving revision 1.51.4.3
diff -u -r1.51.4.3 MANIFEST.MF
--- META-INF/MANIFEST.MF	7 Aug 2010 00:53:13 -0000	1.51.4.3
+++ META-INF/MANIFEST.MF	15 Jan 2012 03:30:09 -0000
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: PDT Core Plug-in
 Bundle-SymbolicName: org.eclipse.php.debug.core; singleton:=true
-Bundle-Version: 2.2.0.qualifier
+Bundle-Version: 2.2.1.qualifier
 Bundle-Activator: org.eclipse.php.internal.debug.core.PHPDebugPlugin
 Bundle-Localization: plugin
 Eclipse-BuddyPolicy: registered
Index: src/org/eclipse/php/internal/debug/core/launching/PHPLaunchUtilities.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/launching/PHPLaunchUtilities.java,v
retrieving revision 1.29.4.1
diff -u -r1.29.4.1 PHPLaunchUtilities.java
--- src/org/eclipse/php/internal/debug/core/launching/PHPLaunchUtilities.java	2 Sep 2010 14:24:23 -0000	1.29.4.1
+++ src/org/eclipse/php/internal/debug/core/launching/PHPLaunchUtilities.java	15 Jan 2012 03:30:10 -0000
@@ -49,11 +49,11 @@
 import org.eclipse.php.internal.debug.core.PHPDebugCoreMessages;
 import org.eclipse.php.internal.debug.core.PHPDebugPlugin;
 import org.eclipse.php.internal.debug.core.debugger.AbstractDebuggerConfiguration;
+import org.eclipse.php.internal.debug.core.model.IPHPDebugTarget;
 import org.eclipse.php.internal.debug.core.preferences.PHPDebugCorePreferenceNames;
 import org.eclipse.php.internal.debug.core.preferences.PHPDebuggersRegistry;
 import org.eclipse.php.internal.debug.core.preferences.PHPProjectPreferences;
 import org.eclipse.php.internal.debug.core.zend.communication.DebugConnectionThread;
-import org.eclipse.php.internal.debug.core.zend.model.PHPDebugTarget;
 import org.eclipse.php.internal.server.core.Server;
 import org.eclipse.php.internal.server.core.tunneling.SSHTunnel;
 import org.eclipse.php.internal.server.core.tunneling.SSHTunnelFactory;
@@ -121,8 +121,7 @@
 						}
 
 						if (shouldShowDebug) {
-							page
-									.showView("org.eclipse.debug.ui.PHPDebugOutput"); //$NON-NLS-1$
+							page.showView("org.eclipse.debug.ui.PHPDebugOutput"); //$NON-NLS-1$
 						}
 					} catch (Exception e) {
 						Logger.logException(
@@ -145,7 +144,7 @@
 			if (!launches[i].isTerminated()
 					&& ILaunchManager.DEBUG_MODE.equals(launches[i]
 							.getLaunchMode())
-					&& launches[i].getDebugTarget() instanceof PHPDebugTarget) {
+					&& launches[i].getDebugTarget() instanceof IPHPDebugTarget) {
 				return true;
 			}
 		}
@@ -188,11 +187,10 @@
 			final Display disp = Display.getDefault();
 			disp.syncExec(new Runnable() {
 				public void run() {
-					MessageDialog
-							.openInformation(
-									disp.getActiveShell(),
-									PHPDebugCoreMessages.PHPLaunchUtilities_phpLaunchTitle,
-									PHPDebugCoreMessages.PHPLaunchUtilities_activeLaunchDetected);
+					MessageDialog.openInformation(
+							disp.getActiveShell(),
+							PHPDebugCoreMessages.PHPLaunchUtilities_phpLaunchTitle,
+							PHPDebugCoreMessages.PHPLaunchUtilities_activeLaunchDetected);
 				}
 			});
 			return false;
@@ -204,14 +202,13 @@
 			public void run() {
 				// Display a dialog to notify the existence of a previous active
 				// launch.
-				MessageDialogWithToggle m = MessageDialogWithToggle
-						.openYesNoQuestion(
-								disp.getActiveShell(),
-								PHPDebugCoreMessages.PHPLaunchUtilities_confirmation,
-								PHPDebugCoreMessages.PHPLaunchUtilities_multipleLaunchesPrompt,
-								PHPDebugCoreMessages.PHPLaunchUtilities_rememberDecision,
-								false, store,
-								PreferenceConstants.ALLOW_MULTIPLE_LAUNCHES);
+				MessageDialogWithToggle m = MessageDialogWithToggle.openYesNoQuestion(
+						disp.getActiveShell(),
+						PHPDebugCoreMessages.PHPLaunchUtilities_confirmation,
+						PHPDebugCoreMessages.PHPLaunchUtilities_multipleLaunchesPrompt,
+						PHPDebugCoreMessages.PHPLaunchUtilities_rememberDecision,
+						false, store,
+						PreferenceConstants.ALLOW_MULTIPLE_LAUNCHES);
 				resultHolder.setReturnCode(m.getReturnCode());
 			}
 		});
@@ -287,11 +284,9 @@
 					.openYesNoQuestion(
 							window.getShell(),
 							PHPDebugCoreMessages.PHPLaunchUtilities_PHPPerspectiveSwitchTitle,
-							NLS
-									.bind(
-											PHPDebugCoreMessages.PHPLaunchUtilities_PHPPerspectiveSwitchMessage,
-											new String[] { perspective
-													.getLabel() }),
+							NLS.bind(
+									PHPDebugCoreMessages.PHPLaunchUtilities_PHPPerspectiveSwitchMessage,
+									new String[] { perspective.getLabel() }),
 							PHPDebugCoreMessages.PHPLaunchUtilities_rememberDecision,
 							false, store,
 							PreferenceConstants.SWITCH_BACK_TO_PHP_PERSPECTIVE);
@@ -364,31 +359,27 @@
 					// TODO - Advanced message dialog with 'don't show this
 					// again' check.
 					if (fHasContiniousLaunch) {
-						resultHolder
-								.setResult(MessageDialog
-										.openConfirm(
-												Display.getDefault()
-														.getActiveShell(),
-												PHPDebugCoreMessages.PHPLaunchUtilities_confirmation,
-												"A previous launch with 'Debug All Pages' or 'Start Debug From' attribute was identifed.\nLaunching a new session will terminate and remove the old launch, directing all future debug requests associated with it to the new launch.\nDo you wish to continue and launch a new session?")); //$NON-NLS-1$
+						resultHolder.setResult(MessageDialog
+								.openConfirm(
+										Display.getDefault().getActiveShell(),
+										PHPDebugCoreMessages.PHPLaunchUtilities_confirmation,
+										"A previous launch with 'Debug All Pages' or 'Start Debug From' attribute was identifed.\nLaunching a new session will terminate and remove the old launch, directing all future debug requests associated with it to the new launch.\nDo you wish to continue and launch a new session?")); //$NON-NLS-1$
 					} else {
 						if (newIsDebugAllPages) {
-							resultHolder
-									.setResult(MessageDialog
-											.openConfirm(
-													Display.getDefault()
-															.getActiveShell(),
-													PHPDebugCoreMessages.PHPLaunchUtilities_confirmation,
-													"The requested launch has a 'Debug All Pages' attribute.\nLaunching this type of session will terminate and remove any other previous launches.\nDo you wish to continue and launch the new session?")); //$NON-NLS-1$
+							resultHolder.setResult(MessageDialog
+									.openConfirm(
+											Display.getDefault()
+													.getActiveShell(),
+											PHPDebugCoreMessages.PHPLaunchUtilities_confirmation,
+											"The requested launch has a 'Debug All Pages' attribute.\nLaunching this type of session will terminate and remove any other previous launches.\nDo you wish to continue and launch the new session?")); //$NON-NLS-1$
 						} else {
 							// newIsStartDebugFrom == true
-							resultHolder
-									.setResult(MessageDialog
-											.openConfirm(
-													Display.getDefault()
-															.getActiveShell(),
-													PHPDebugCoreMessages.PHPLaunchUtilities_confirmation,
-													"The requested launch has a 'Start Debug From' attribute.\nLaunching this type of session will terminate and remove any other previous launches.\nDo you wish to continue and launch the new session?")); //$NON-NLS-1$
+							resultHolder.setResult(MessageDialog
+									.openConfirm(
+											Display.getDefault()
+													.getActiveShell(),
+											PHPDebugCoreMessages.PHPLaunchUtilities_confirmation,
+											"The requested launch has a 'Start Debug From' attribute.\nLaunching this type of session will terminate and remove any other previous launches.\nDo you wish to continue and launch the new session?")); //$NON-NLS-1$
 						}
 					}
 					if (resultHolder.getResult()) {
@@ -740,8 +731,8 @@
 		for (String attribute : attributesArray) {
 			try {
 				int index = attribute.indexOf('=');
-				map.put(attribute.substring(0, index), attribute
-						.substring(index + 1));
+				map.put(attribute.substring(0, index),
+						attribute.substring(index + 1));
 			} catch (Exception e) {
 				Logger.logException("Error while parsing launch attribute '"
 						+ attribute + '\'', e);
@@ -1046,10 +1037,9 @@
 		} catch (CoreException e) {
 			Logger.logException("Error obtaining an SSHTunnel instance", e);//$NON-NLS-1$
 		} catch (StorageException e) {
-			Logger
-					.logException(
-							"Error accessing the secured storage for the debug SSH tunnel",//$NON-NLS-1$
-							e);
+			Logger.logException(
+					"Error accessing the secured storage for the debug SSH tunnel",//$NON-NLS-1$
+					e);
 		}
 		return null;
 	}
@@ -1063,8 +1053,8 @@
 	public static int getDebugPort(ILaunchConfiguration launchConfiguration) {
 		try {
 			String debuggerID = launchConfiguration.getAttribute(
-					PHPDebugCorePreferenceNames.PHP_DEBUGGER_ID, PHPDebugPlugin
-							.getCurrentDebuggerId());
+					PHPDebugCorePreferenceNames.PHP_DEBUGGER_ID,
+					PHPDebugPlugin.getCurrentDebuggerId());
 			AbstractDebuggerConfiguration debuggerConfiguration = PHPDebuggersRegistry
 					.getDebuggerConfiguration(debuggerID);
 			return debuggerConfiguration.getPort();
Index: src/org/eclipse/php/internal/debug/core/pathmapper/DebugSearchEngine.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/pathmapper/DebugSearchEngine.java,v
retrieving revision 1.38.4.1
diff -u -r1.38.4.1 DebugSearchEngine.java
--- src/org/eclipse/php/internal/debug/core/pathmapper/DebugSearchEngine.java	6 Jul 2010 19:17:08 -0000	1.38.4.1
+++ src/org/eclipse/php/internal/debug/core/pathmapper/DebugSearchEngine.java	15 Jan 2012 03:30:10 -0000
@@ -205,7 +205,7 @@
 
 						// get build paths of all projects
 						IScriptProject scriptProject = DLTKCore.create(project);
-						if (scriptProject != null) {
+						if (scriptProject != null && scriptProject.isOpen()) {
 							try {
 								IBuildpathEntry[] rawBuildpath = scriptProject
 										.getRawBuildpath();
Index: src/org/eclipse/php/internal/debug/core/preferences/PHPexeItem.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/preferences/PHPexeItem.java,v
retrieving revision 1.25.4.1
diff -u -r1.25.4.1 PHPexeItem.java
--- src/org/eclipse/php/internal/debug/core/preferences/PHPexeItem.java	2 Sep 2010 14:24:23 -0000	1.25.4.1
+++ src/org/eclipse/php/internal/debug/core/preferences/PHPexeItem.java	15 Jan 2012 03:30:10 -0000
@@ -283,7 +283,8 @@
 	public String toString() {
 		StringBuilder buf = new StringBuilder(name);
 		buf.append(" [path: ").append(executable.getAbsolutePath());
-		buf.append(", config file: ").append(config.getAbsolutePath());
+		buf.append(", config file: ").append(
+				(config == null) ? "null" : config.getAbsolutePath());
 		buf.append(", sapi: ").append(sapiType);
 		buf.append("]");
 		return buf.toString();
@@ -445,8 +446,8 @@
 		}
 
 		Process p = Runtime.getRuntime().exec(cmd, envParams);
-		BufferedReader r = new BufferedReader(new InputStreamReader(p
-				.getInputStream()));
+		BufferedReader r = new BufferedReader(new InputStreamReader(
+				p.getInputStream()));
 		StringBuilder buf = new StringBuilder();
 		String l;
 		while ((l = r.readLine()) != null) {
Index: src/org/eclipse/php/internal/debug/core/preferences/PHPexes.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/preferences/PHPexes.java,v
retrieving revision 1.25.2.2
diff -u -r1.25.2.2 PHPexes.java
--- src/org/eclipse/php/internal/debug/core/preferences/PHPexes.java	6 Aug 2010 14:17:52 -0000	1.25.2.2
+++ src/org/eclipse/php/internal/debug/core/preferences/PHPexes.java	15 Jan 2012 03:30:11 -0000
@@ -305,8 +305,7 @@
 			locationsString = "";
 		}
 		final String[] phpExecutablesLocations = locationsString.length() > 0 ? locationsString
-				.split(SEPARATOR)
-				: new String[0];
+				.split(SEPARATOR) : new String[0];
 
 		// Load the item executable ini's array
 		String inisString = prefs
@@ -327,8 +326,7 @@
 			debuggersString = "";
 		}
 		final String[] debuggers = debuggersString.length() > 0 ? debuggersString
-				.split(SEPARATOR)
-				: new String[0];
+				.split(SEPARATOR) : new String[0];
 
 		// Load the PHP Versions array
 		String defaultItemForPHPVersionString = prefs
@@ -476,17 +474,16 @@
 					PHPDebugPlugin
 							.getDefault()
 							.getLog()
-							.log(
-									new Status(
-											1,
-											PHPDebugPlugin.getID(),
-											1001,
-											"PHP executable "
-													+ location
-													+ " not found neither in plugin "
-													+ pluginId
-													+ " nor in fragments attached to it",
-											null));
+							.log(new Status(
+									1,
+									PHPDebugPlugin.getID(),
+									1001,
+									"PHP executable "
+											+ location
+											+ " not found neither in plugin "
+											+ pluginId
+											+ " nor in fragments attached to it",
+									null));
 			}
 		}
 	}
@@ -664,4 +661,14 @@
 		result = list.toArray(new PHPexeItem[list.size()]);
 		return result;
 	}
+
+	public void remap() {
+		synchronized (lock) {
+			PHPexeItem[] allItems = getAllItems();
+			items.clear();
+			for (PHPexeItem item : allItems) {
+				addItem(item);
+			}
+		}
+	}
 }
Index: src/org/eclipse/php/internal/debug/core/xdebug/communication/XDebugCommunicationDaemon.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/xdebug/communication/XDebugCommunicationDaemon.java,v
retrieving revision 1.11
diff -u -r1.11 XDebugCommunicationDaemon.java
--- src/org/eclipse/php/internal/debug/core/xdebug/communication/XDebugCommunicationDaemon.java	18 Oct 2009 09:27:13 -0000	1.11
+++ src/org/eclipse/php/internal/debug/core/xdebug/communication/XDebugCommunicationDaemon.java	15 Jan 2012 03:30:11 -0000
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2011 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -23,6 +23,7 @@
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.ILaunchManager;
 import org.eclipse.debug.core.Launch;
+import org.eclipse.debug.ui.IDebugUIConstants;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.php.internal.debug.core.PHPDebugCoreMessages;
 import org.eclipse.php.internal.debug.core.PHPDebugPlugin;
@@ -194,8 +195,8 @@
 
 		if (session.getSessionId() == null && !multiSession) {
 			// non multisession web launch
-			target = new DBGpTarget(remoteLaunch, null, null, session
-					.getIdeKey(), stopAtFirstLine, null);
+			target = new DBGpTarget(remoteLaunch, null, null,
+					session.getIdeKey(), stopAtFirstLine, null);
 
 			// try to locate a relevant server definition so we can get its path
 			// mapper
@@ -254,9 +255,9 @@
 			// we are not a multisession web launch, so just add to the launch
 			remoteLaunch.addDebugTarget(target);
 			// tell the target it now has a session.
-			target.sessionReceived((DBGpBreakpointFacade) IDELayerFactory
-					.getIDELayer(), XDebugPreferenceMgr
-					.createSessionPreferences());
+			target.sessionReceived(
+					(DBGpBreakpointFacade) IDELayerFactory.getIDELayer(),
+					XDebugPreferenceMgr.createSessionPreferences());
 			// probably could do waitForInitialSession as session has already
 			// been set.
 		}
@@ -272,17 +273,15 @@
 				public void run() {
 					IWorkbenchWindow window = PlatformUI.getWorkbench()
 							.getActiveWorkbenchWindow();
-					// code the debug perspectives.
-					// org.eclipse.php.debug.ui.PHPDebugPerspective
+					// code the debug perspective.
 					// org.eclipse.debug.ui.DebugPerspective
 					// also look at the PHPLaunchUtilities
 					if (!PerspectiveManager.isCurrentPerspective(window,
-							"org.eclipse.php.debug.ui.PHPDebugPerspective")) {
+							IDebugUIConstants.ID_DEBUG_PERSPECTIVE)) {
 						if (PerspectiveManager.shouldSwitchPerspective(window,
-								"org.eclipse.php.debug.ui.PHPDebugPerspective")) {
-							PerspectiveManager
-									.switchToPerspective(window,
-											"org.eclipse.php.debug.ui.PHPDebugPerspective");
+								IDebugUIConstants.ID_DEBUG_PERSPECTIVE)) {
+							PerspectiveManager.switchToPerspective(window,
+									IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
 						}
 					}
 				}
Index: src/org/eclipse/php/internal/debug/core/xdebug/dbgp/model/DBGpStackFrame.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/xdebug/dbgp/model/DBGpStackFrame.java,v
retrieving revision 1.8.6.2
diff -u -r1.8.6.2 DBGpStackFrame.java
--- src/org/eclipse/php/internal/debug/core/xdebug/dbgp/model/DBGpStackFrame.java	30 Jul 2010 06:40:42 -0000	1.8.6.2
+++ src/org/eclipse/php/internal/debug/core/xdebug/dbgp/model/DBGpStackFrame.java	15 Jan 2012 03:30:11 -0000
@@ -11,7 +11,12 @@
  *******************************************************************************/
 package org.eclipse.php.internal.debug.core.xdebug.dbgp.model;
 
+import java.net.URI;
+import java.net.URISyntaxException;
+
 import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.debug.core.DebugException;
@@ -19,6 +24,7 @@
 import org.eclipse.debug.core.model.IStackFrame;
 import org.eclipse.debug.core.model.IThread;
 import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.php.internal.debug.core.PHPDebugPlugin;
 import org.eclipse.php.internal.debug.core.xdebug.dbgp.DBGpLogger;
 import org.eclipse.php.internal.debug.core.xdebug.dbgp.protocol.DBGpResponse;
 import org.eclipse.php.internal.debug.core.xdebug.dbgp.protocol.DBGpUtils;
@@ -55,21 +61,44 @@
 		lineNo = Integer.parseInt(line);
 		qualifiedFile = DBGpUtils.getFilenameFromURIString(DBGpResponse
 				.getAttribute(stackData, "filename")); //$NON-NLS-1$
-		qualifiedFile = ((DBGpTarget) getDebugTarget())
-				.mapToWorkspaceFileIfRequired(qualifiedFile);
 		String function = DBGpResponse.getAttribute(stackData, "where"); //$NON-NLS-1$ 
 		// check to see if the file exists in the workspace
-		IFile[] fileFound = ResourcesPlugin.getWorkspace().getRoot()
-				.findFilesForLocation(new Path(qualifiedFile));
-		if (fileFound.length > 0) {
-			IFile file = fileFound[0];
-			// get the file found in workspace and show project/file
-			String projectName = file.getProject().getName();
-			String projectRelPath = file.getProjectRelativePath().toString();
+		String mappedFile = ((DBGpTarget) getDebugTarget())
+				.mapToWorkspaceFileIfRequired(qualifiedFile);
+		qualifiedFile = mappedFile;
+		IResource resource = ResourcesPlugin.getWorkspace().getRoot()
+				.findMember(new Path(mappedFile));
+		if (resource != null) {
+			String projectName = resource.getProject().getName();
+			String projectRelPath = resource.getProjectRelativePath()
+					.toString();
 			fileName = projectName + "/" + projectRelPath;
 		} else {
-			// fileName = null;
-			fileName = qualifiedFile;
+			IFile[] fileFound = new IFile[0];
+			try {
+				fileFound = ResourcesPlugin
+						.getWorkspace()
+						.getRoot()
+						.findFilesForLocationURI(
+								new URI("file:///" + qualifiedFile));
+			} catch (URISyntaxException e) {
+				PHPDebugPlugin.log(e);
+			}
+			for (IFile file : fileFound) {
+				IProject project = file.getProject();
+				if (project.isAccessible()
+				/* && project.getNature(PHPNature.ID) != null */) {
+					// get the file found in workspace and show project/file
+					String projectName = file.getProject().getName();
+					String projectRelPath = file.getProjectRelativePath()
+							.toString();
+					fileName = projectName + "/" + projectRelPath;
+					break;
+				}
+			}
+			if (fileName == null) {
+				fileName = qualifiedFile;
+			}
 		}
 		name = fileName + "." + function + " : lineno " + lineNo;
 	}
Index: src/org/eclipse/php/internal/debug/core/xdebug/dbgp/model/DBGpTarget.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/xdebug/dbgp/model/DBGpTarget.java,v
retrieving revision 1.33.4.3
diff -u -r1.33.4.3 DBGpTarget.java
--- src/org/eclipse/php/internal/debug/core/xdebug/dbgp/model/DBGpTarget.java	30 Jul 2010 06:42:29 -0000	1.33.4.3
+++ src/org/eclipse/php/internal/debug/core/xdebug/dbgp/model/DBGpTarget.java	15 Jan 2012 03:30:12 -0000
@@ -14,6 +14,8 @@
 import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.LinkedList;
+import java.util.List;
 import java.util.StringTokenizer;
 import java.util.Vector;
 
@@ -22,7 +24,11 @@
 import org.eclipse.debug.core.*;
 import org.eclipse.debug.core.model.*;
 import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.ui.AbstractDebugView;
+import org.eclipse.debug.ui.IDebugUIConstants;
 import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.php.internal.debug.core.IPHPDebugConstants;
 import org.eclipse.php.internal.debug.core.PHPDebugCoreMessages;
 import org.eclipse.php.internal.debug.core.PHPDebugPlugin;
@@ -43,7 +49,10 @@
 import org.eclipse.php.internal.debug.core.xdebug.dbgp.session.DBGpSessionHandler;
 import org.eclipse.php.internal.debug.core.xdebug.dbgp.session.IDBGpSessionListener;
 import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.browser.IWebBrowser;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -1331,6 +1340,12 @@
 		}
 		String fullName = var.getFullName();
 		String stackLevel = var.getStackLevel();
+		if (stackLevel.equals("-1")) {
+			try {
+				stackLevel = getStackLevel(var);
+			} catch (DebugException e) {
+			}
+		}
 		String args = "-n " + fullName + " -d " + stackLevel + " -l " + encoded.length() + " -- " + encoded; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
 		try {
 			if (var.getReferenceTypeName().equals(DBGpVariable.PHP_STRING)) {
@@ -1603,7 +1618,7 @@
 				// changed as RSE resources return null for RawLocation.
 				IPath t = file.getRawLocation();
 				if (t != null) {
-					mappedFile = t.toString();
+					// mappedFile = t.toString();
 				} else {
 					mappedFile = file.getFullPath().toOSString();
 				}
@@ -2342,4 +2357,86 @@
 		boolean isWaiting = (STATE_STARTED_SESSION_WAIT == targetState);
 		return isWaiting;
 	}
+
+	/**
+	 * get real stacklevel
+	 * 
+	 * @return stack level string
+	 * @throws DebugException
+	 */
+	private String getStackLevel(IVariable var) throws DebugException {
+		String stackLevel = "-1";
+		// search variable object in stackframes
+		int level = findStackLevel(var);
+		if (level >= 0) {
+			stackLevel = String.valueOf(level);
+		} else {
+			// get current selected stackframe in Debug view
+			DBGpStackFrame stackFrame = getCurrentStackFrame();
+			if (stackFrame != null) {
+				stackLevel = stackFrame.getStackLevel();
+			}
+		}
+		return stackLevel;
+	}
+
+	private DBGpStackFrame getCurrentStackFrame() {
+		final DBGpStackFrame[] currentStackFrame = new DBGpStackFrame[1];
+		Display.getDefault().syncExec(new Runnable() {
+			public void run() {
+				IWorkbenchWindow window = PlatformUI.getWorkbench()
+						.getActiveWorkbenchWindow();
+				if (window == null) {
+					return;
+				}
+				IWorkbenchPage page = window.getActivePage();
+				if (page == null) {
+					return;
+				}
+				AbstractDebugView view = (AbstractDebugView) page
+						.findView(IDebugUIConstants.ID_DEBUG_VIEW);
+				if (view == null) {
+					return;
+				}
+				ISelection selection = view.getViewer().getSelection();
+				if (selection instanceof TreeSelection) {
+					Object element = ((TreeSelection) selection)
+							.getFirstElement();
+					if (element instanceof DBGpStackFrame) {
+						currentStackFrame[0] = (DBGpStackFrame) element;
+					}
+				}
+			}
+		});
+		return currentStackFrame[0];
+	}
+
+	private int findStackLevel(IVariable var) throws DebugException {
+		for (int i = stackFrames.length - 1; i >= 0; i--) {
+			List<IVariable> list = new LinkedList<IVariable>();
+			for (IVariable variable : stackFrames[i].getVariables()) {
+				if (findVariable(variable, var, list)) {
+					return i;
+				}
+			}
+		}
+		return -1; // not found
+	}
+
+	private boolean findVariable(IVariable var, IVariable target,
+			List<IVariable> list) throws DebugException {
+		if (var.equals(target)) {
+			return true;
+		}
+		list.add(var);
+		IValue value = var.getValue();
+		for (IVariable child : value.getVariables()) {
+			if (!child.getName().equals("GLOBALS") && !list.contains(child)) {
+				if (findVariable(child, target, list)) {
+					return true;
+				}
+			}
+		}
+		return false;
+	}
 }
Index: src/org/eclipse/php/internal/debug/core/zend/debugger/DefaultExpressionsManager.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/debugger/DefaultExpressionsManager.java,v
retrieving revision 1.5
diff -u -r1.5 DefaultExpressionsManager.java
--- src/org/eclipse/php/internal/debug/core/zend/debugger/DefaultExpressionsManager.java	18 Oct 2009 09:27:08 -0000	1.5
+++ src/org/eclipse/php/internal/debug/core/zend/debugger/DefaultExpressionsManager.java	15 Jan 2012 03:30:12 -0000
@@ -234,5 +234,23 @@
 		byte[] value = getExpressionValue(expression, depth);
 		expression.setValue(expressionValueDeserializer.deserializer(
 				expression, value));
+
+		if (expression instanceof StackVariable) {
+		} else {
+			String[] name = expression.getName();
+			for (int i = 0; i < name.length; i++) {
+				StringBuffer key = new StringBuffer();
+				for (int j = 0; j <= i; j++) {
+					key.append(name[j]).append(" ");
+				}
+				if (hashResultDepthOne.containsKey(key.toString())) {
+					hashResultDepthOne.remove(key.toString());
+				}
+				if (depth == 0
+						&& hashResultDepthZero.containsKey(key.toString())) {
+					hashResultDepthZero.remove(key.toString());
+				}
+			}
+		}
 	}
 }
\ No newline at end of file
Index: src/org/eclipse/php/internal/debug/core/zend/debugger/ExpressionsValueDeserializer.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/debugger/ExpressionsValueDeserializer.java,v
retrieving revision 1.5
diff -u -r1.5 ExpressionsValueDeserializer.java
--- src/org/eclipse/php/internal/debug/core/zend/debugger/ExpressionsValueDeserializer.java	16 Feb 2010 10:19:25 -0000	1.5
+++ src/org/eclipse/php/internal/debug/core/zend/debugger/ExpressionsValueDeserializer.java	15 Jan 2012 03:30:12 -0000
@@ -125,8 +125,11 @@
 			String name;
 			if (type == 'i') {
 				name = Integer.toString(reader.readInt());
-			} else {
+			} else if (type == 's') {
 				name = reader.readString();
+			} else {
+				// fall back when type is invalid
+				return ExpressionValue.NULL_VALUE;
 			}
 			if (expression == null) {
 				variableNodes[i] = createDefaultVariable(name);
@@ -158,10 +161,12 @@
 			String name;
 			if (type == 'i') {
 				name = Integer.toString(reader.readInt());
-			} else {
+			} else if (type == 's') {
 				name = reader.readString();
+			} else {
+				// fall back when type is invalid
+				return ExpressionValue.NULL_VALUE;
 			}
-
 			if (expression == null) {
 				expressionNodes[i] = createDefaultVariable(name);
 			} else {
Index: src/org/eclipse/php/internal/debug/core/zend/debugger/ProcessCrashDetector.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/debugger/ProcessCrashDetector.java,v
retrieving revision 1.11.6.1
diff -u -r1.11.6.1 ProcessCrashDetector.java
--- src/org/eclipse/php/internal/debug/core/zend/debugger/ProcessCrashDetector.java	23 Aug 2010 08:49:30 -0000	1.11.6.1
+++ src/org/eclipse/php/internal/debug/core/zend/debugger/ProcessCrashDetector.java	15 Jan 2012 03:30:13 -0000
@@ -11,10 +11,29 @@
  *******************************************************************************/
 package org.eclipse.php.internal.debug.core.zend.debugger;
 
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.eclipse.core.runtime.CoreException;
 import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
 import org.eclipse.debug.core.model.IDebugTarget;
 import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
+import org.eclipse.debug.internal.ui.views.console.ProcessConsole;
+import org.eclipse.php.internal.debug.core.IPHPDebugConstants;
 import org.eclipse.php.internal.debug.core.launching.PHPProcess;
+import org.eclipse.php.internal.debug.core.preferences.PHPDebugCorePreferenceNames;
+import org.eclipse.php.internal.debug.core.zend.communication.DebuggerCommunicationDaemon;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleListener;
+import org.eclipse.ui.console.IOConsoleOutputStream;
 
 /**
  * A process crash detector is a {@link Runnable} that hooks a PHP process error
@@ -27,10 +46,11 @@
  * @author shalom
  * @since PDT 1.0.1
  */
-public class ProcessCrashDetector implements Runnable {
+public class ProcessCrashDetector implements Runnable, IConsoleListener {
 
 	private ILaunch launch;
 	private Process process;
+	private ProcessConsole console;
 
 	/**
 	 * Constructs a process detector on a given {@link Process}.
@@ -52,6 +72,31 @@
 	 */
 	public void run() {
 		try {
+			boolean streamerReqd = false;
+			try {
+				ILaunchConfiguration config = launch.getLaunchConfiguration();
+				if (config.getAttribute(
+						PHPDebugCorePreferenceNames.PHP_DEBUGGER_ID, "")
+						.equals(DebuggerCommunicationDaemon.ZEND_DEBUGGER_ID)) {
+					streamerReqd = config.getAttribute(
+							IPHPDebugConstants.RUN_WITH_DEBUG_INFO, true)
+							|| launch.getLaunchMode().equals(
+									ILaunchManager.DEBUG_MODE);
+				}
+			} catch (CoreException e) {
+			}
+			if (streamerReqd) {
+				StreamGobbler errorGobbler = new StreamGobbler(
+						process.getErrorStream(), true);
+				StreamGobbler inputGobbler = new StreamGobbler(
+						process.getInputStream(), false);
+
+				ConsolePlugin.getDefault().getConsoleManager()
+						.addConsoleListener(this);
+
+				errorGobbler.start();
+				inputGobbler.start();
+			}
 
 			int exitValue = process.waitFor();
 			IDebugTarget debugTarget = launch.getDebugTarget();
@@ -64,8 +109,74 @@
 
 		} catch (Throwable t) {
 		} finally {
+			ConsolePlugin.getDefault().getConsoleManager()
+					.removeConsoleListener(this);
+		}
+	}
+
+	class StreamGobbler extends Thread {
+		InputStream is;
+		StringBuilder buf;
+		boolean isError;
+		private IOConsoleOutputStream os;
+
+		StreamGobbler(InputStream is, boolean isError) {
+			this.is = is;
+			this.buf = new StringBuilder();
+			this.isError = isError;
+		}
 
+		public void run() {
+			try {
+				InputStreamReader isr = new InputStreamReader(is);
+				BufferedReader br = new BufferedReader(isr);
+
+				String line;
+				while ((line = br.readLine()) != null) {
+					if (!isError) {
+						continue;
+					}
+					if (console != null) {
+						if (os == null) {
+							os = console.newOutputStream();
+							if (isError) {
+								Display.getDefault().syncExec(new Runnable() {
+									public void run() {
+										os.setColor(DebugUIPlugin
+												.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_SYS_ERR_COLOR));
+									}
+								});
+							}
+						}
+						os.write(buf.toString());
+						os.write(line + '\n');
+						buf.delete(0, buf.length());
+					} else {
+						buf.append(line).append('\n');
+					}
+				}
+			} catch (IOException ioe) {
+				// PHPDebugPlugin.log(ioe);
+			} finally {
+				if (os != null) {
+					try {
+						os.close();
+					} catch (IOException e) {
+						// PHPDebugPlugin.log(e);
+					}
+				}
+			}
 		}
 	}
 
+	public void consolesAdded(IConsole[] consoles) {
+		for (IConsole console : consoles) {
+			if (console instanceof ProcessConsole) {
+				this.console = (ProcessConsole) console;
+			}
+		}
+	}
+
+	public void consolesRemoved(IConsole[] consoles) {
+	}
 }
\ No newline at end of file
Index: src/org/eclipse/php/internal/debug/core/zend/debugger/handlers/StartProcessFileNotificationHandler.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/debugger/handlers/StartProcessFileNotificationHandler.java,v
retrieving revision 1.23.2.2
diff -u -r1.23.2.2 StartProcessFileNotificationHandler.java
--- src/org/eclipse/php/internal/debug/core/zend/debugger/handlers/StartProcessFileNotificationHandler.java	30 Jun 2010 12:55:00 -0000	1.23.2.2
+++ src/org/eclipse/php/internal/debug/core/zend/debugger/handlers/StartProcessFileNotificationHandler.java	15 Jan 2012 03:30:13 -0000
@@ -11,12 +11,12 @@
  *******************************************************************************/
 package org.eclipse.php.internal.debug.core.zend.debugger.handlers;
 
+import java.io.File;
+import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.*;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
@@ -24,10 +24,13 @@
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchManager;
 import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.dltk.core.IBuildpathEntry;
 import org.eclipse.dltk.core.environment.EnvironmentPathUtils;
 import org.eclipse.php.debug.core.debugger.handlers.IDebugMessageHandler;
 import org.eclipse.php.debug.core.debugger.messages.IDebugMessage;
 import org.eclipse.php.debug.core.debugger.parameters.IDebugParametersKeys;
+import org.eclipse.php.internal.core.includepath.IncludePath;
+import org.eclipse.php.internal.core.includepath.IncludePathManager;
 import org.eclipse.php.internal.debug.core.IPHPDebugConstants;
 import org.eclipse.php.internal.debug.core.PHPDebugPlugin;
 import org.eclipse.php.internal.debug.core.model.PHPConditionalBreakpoint;
@@ -146,6 +149,9 @@
 	protected IBreakpoint[] findBreakpoints(String localPath,
 			PHPDebugTarget debugTarget) {
 
+		IFile[] files = null;
+		boolean findFiles = false;
+
 		IBreakpointManager breakpointManager = debugTarget
 				.getBreakpointManager();
 		if (!breakpointManager.isEnabled()) {
@@ -161,42 +167,101 @@
 			IResource resource = ResourcesPlugin.getWorkspace().getRoot()
 					.findMember(localPath);
 
-			if (resource != null) {
-				if (bp.getMarker().getResource().equals(resource)) {
-					l.add(bp);
-				}
-			} else {
-				try {
-					String secondaryId = (String) bp
-							.getMarker()
-							.getAttribute(
-									StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY);
-					if (secondaryId != null) {
-
-						IPath path = Path.fromPortableString(secondaryId);
-						if ((path.getDevice() == null)
-								&& (path.toString()
-										.startsWith("org.eclipse.dltk"))) {
-							String fullPathString = path.toString();
-							String absolutePath = fullPathString
-									.substring(fullPathString.indexOf(':') + 1);
-							path = Path.fromPortableString(absolutePath);
-						} else {
-							path = EnvironmentPathUtils.getLocalPath(path);
-						}
+			// if (resource != null) {
+			if (bp.getMarker().getResource().equals(resource)) {
+				l.add(bp);
+				continue;
+			}
+			// } else {
+			try {
+				String secondaryId = (String) bp
+						.getMarker()
+						.getAttribute(
+								StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY);
+				if (secondaryId != null) {
+
+					IPath path = Path.fromPortableString(secondaryId);
+					if ((path.getDevice() == null)
+							&& (path.toString().startsWith("org.eclipse.dltk"))) {
+						String fullPathString = path.toString();
+						String absolutePath = fullPathString
+								.substring(fullPathString.indexOf(':') + 1);
+						path = Path.fromPortableString(absolutePath);
+					} else {
+						path = EnvironmentPathUtils.getLocalPath(path);
+					}
 
-						secondaryId = path.toString();
-						if (VirtualPath.isAbsolute(localPath)
-								&& new VirtualPath(localPath)
-										.equals(new VirtualPath(secondaryId))) {
-							l.add(bp);
+					secondaryId = path.toString();
+					if (VirtualPath.isAbsolute(localPath)
+							&& (new VirtualPath(localPath)
+									.equals(new VirtualPath(secondaryId)))
+							|| resource != null
+							&& secondaryId.equals(resource.getLocation()
+									.toString())) {
+						l.add(bp);
+					} else {
+						// for Linked resource
+						IResource bpResource = bp.getMarker().getResource();
+						if (isIncluded(bpResource.getProject(),
+								debugTarget.getProject(),
+								new ArrayList<IProject>())) {
+							if (!findFiles) {
+								files = ResourcesPlugin
+										.getWorkspace()
+										.getRoot()
+										.findFilesForLocationURI(
+												new File(localPath).toURI());
+								findFiles = true;
+							}
+							if (files != null) {
+								IPath bpPath = bpResource.getFullPath();
+								for (IFile file : files) {
+									if (bpPath.equals(file.getFullPath())) {
+										l.add(bp);
+										break;
+									}
+								}
+							}
 						}
 					}
-				} catch (Exception e) {
-					PHPDebugPlugin.log(e);
 				}
+			} catch (Exception e) {
+				PHPDebugPlugin.log(e);
 			}
+			// }
 		}
 		return l.toArray(new IBreakpoint[l.size()]);
 	}
+
+	private boolean isIncluded(IProject project, IProject target,
+			List<IProject> list) {
+		if (list.contains(target)) {
+			return false;
+		}
+		list.add(target);
+		IncludePath[] includePaths = IncludePathManager.getInstance()
+				.getIncludePaths(target);
+		for (IncludePath includePath : includePaths) {
+			IProject p = includePath.getProject();
+			if (includePath.isBuildpath()) {
+				IBuildpathEntry entry = (IBuildpathEntry) includePath
+						.getEntry();
+				if (entry.getEntryKind() == IBuildpathEntry.BPE_PROJECT) {
+					p = ResourcesPlugin.getWorkspace().getRoot()
+							.findMember(entry.getPath()).getProject();
+				}
+			}
+			if (p != null) {
+				if (p.equals(project)) {
+					return true;
+				}
+				if (!p.equals(target)) {
+					if (isIncluded(project, p, list)) {
+						return true;
+					}
+				}
+			}
+		}
+		return false;
+	}
 }
Index: src/org/eclipse/php/internal/debug/core/zend/model/PHPDebugTarget.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/model/PHPDebugTarget.java,v
retrieving revision 1.40.2.3
diff -u -r1.40.2.3 PHPDebugTarget.java
--- src/org/eclipse/php/internal/debug/core/zend/model/PHPDebugTarget.java	12 Aug 2010 11:29:22 -0000	1.40.2.3
+++ src/org/eclipse/php/internal/debug/core/zend/model/PHPDebugTarget.java	15 Jan 2012 03:30:13 -0000
@@ -1130,7 +1130,14 @@
 	}
 
 	public boolean supportsStepFilters() {
-		return isStepFiltersEnabled;
+		return isAvailable();
+	}
+
+	/*
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget
+	 */
+	public boolean isAvailable() {
+		return !(isTerminated() || isDisconnected());
 	}
 
 	/**
#P org.eclipse.php.debug.ui
Index: META-INF/MANIFEST.MF
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.ui/META-INF/MANIFEST.MF,v
retrieving revision 1.47.4.1
diff -u -r1.47.4.1 MANIFEST.MF
--- META-INF/MANIFEST.MF	12 Jul 2010 04:45:28 -0000	1.47.4.1
+++ META-INF/MANIFEST.MF	15 Jan 2012 03:30:16 -0000
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: PDT Debug UI Plug-in
 Bundle-SymbolicName: org.eclipse.php.debug.ui; singleton:=true
-Bundle-Version: 2.2.0.qualifier
+Bundle-Version: 2.2.1.qualifier
 Bundle-Activator: org.eclipse.php.internal.debug.ui.PHPDebugUIPlugin
 Bundle-Localization: plugin
 Require-Bundle: org.eclipse.ui,
Index: src/org/eclipse/php/internal/debug/ui/PHPDebugUIPlugin.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/PHPDebugUIPlugin.java,v
retrieving revision 1.26.2.1
diff -u -r1.26.2.1 PHPDebugUIPlugin.java
--- src/org/eclipse/php/internal/debug/ui/PHPDebugUIPlugin.java	12 Jul 2010 04:45:28 -0000	1.26.2.1
+++ src/org/eclipse/php/internal/debug/ui/PHPDebugUIPlugin.java	15 Jan 2012 03:30:17 -0000
@@ -39,7 +39,6 @@
 import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.php.internal.debug.core.IPHPDebugConstants;
 import org.eclipse.php.internal.debug.core.PHPDebugPlugin;
-import org.eclipse.php.internal.debug.core.launching.PHPLaunch;
 import org.eclipse.php.internal.debug.core.launching.PHPLaunchUtilities;
 import org.eclipse.php.internal.debug.core.model.IPHPDebugTarget;
 import org.eclipse.php.internal.debug.ui.actions.EvaluationContextManager;
@@ -91,15 +90,15 @@
 		// the user to return to the PHP perspective when all the debug sessions
 		// where terminated.
 		finishDebugLaunchListener = new TerminateDebugLaunchListener();
-		DebugPlugin.getDefault().getLaunchManager().addLaunchListener(
-				finishDebugLaunchListener);
+		DebugPlugin.getDefault().getLaunchManager()
+				.addLaunchListener(finishDebugLaunchListener);
 
 		// Install the FirstSelectionDebugLaunchListener, which is responsible
 		// of selecting the
 		// new launch in the LaunchView.
 		firstSelectionDebugLaunchListener = new FirstSelectionDebugLaunchListener();
-		DebugPlugin.getDefault().getLaunchManager().addLaunchListener(
-				firstSelectionDebugLaunchListener);
+		DebugPlugin.getDefault().getLaunchManager()
+				.addLaunchListener(firstSelectionDebugLaunchListener);
 
 		// Register the PHPDebugElementAdapterFactory.
 		// To make sure we are the first adapter factory for the IVariable
@@ -134,13 +133,13 @@
 
 		// Uninstall the debug event listener.
 		if (finishDebugLaunchListener != null) {
-			DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(
-					finishDebugLaunchListener);
+			DebugPlugin.getDefault().getLaunchManager()
+					.removeLaunchListener(finishDebugLaunchListener);
 		}
 		// Uninstall the debug event listener.
 		if (firstSelectionDebugLaunchListener != null) {
-			DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(
-					firstSelectionDebugLaunchListener);
+			DebugPlugin.getDefault().getLaunchManager()
+					.removeLaunchListener(firstSelectionDebugLaunchListener);
 		}
 
 		plugin = null;
@@ -235,8 +234,8 @@
 							page.showView(viewID);
 						} catch (PartInitException e) {
 							ErrorDialog.openError(window.getShell(),
-									PHPDebugUIMessages.ShowView_errorTitle, e
-											.getMessage(), e.getStatus());
+									PHPDebugUIMessages.ShowView_errorTitle,
+									e.getMessage(), e.getStatus());
 						}
 					} else {
 						// page.bringToTop(part);
@@ -423,7 +422,7 @@
 		public void launchesTerminated(ILaunch[] launches) {
 			boolean isPHPLaunch = false;
 			for (ILaunch launch : launches) {
-				if (launch instanceof PHPLaunch) {
+				if (launch.getDebugTarget() instanceof IPHPDebugTarget) {
 					isPHPLaunch = true;
 					break;
 				}
Index: src/org/eclipse/php/internal/debug/ui/breakpoint/PHPToggleBreakpointsTargetFactory.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/breakpoint/PHPToggleBreakpointsTargetFactory.java,v
retrieving revision 1.2
diff -u -r1.2 PHPToggleBreakpointsTargetFactory.java
--- src/org/eclipse/php/internal/debug/ui/breakpoint/PHPToggleBreakpointsTargetFactory.java	18 Oct 2009 09:27:43 -0000	1.2
+++ src/org/eclipse/php/internal/debug/ui/breakpoint/PHPToggleBreakpointsTargetFactory.java	15 Jan 2012 03:30:17 -0000
@@ -33,7 +33,7 @@
 
 	public String getDefaultToggleTarget(IWorkbenchPart part,
 			ISelection selection) {
-		return null;
+		return ID;
 	}
 
 	public String getToggleTargetDescription(String targetID) {
Index: src/org/eclipse/php/internal/debug/ui/breakpoint/provider/DefaultPHPBreakpointProvider.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/breakpoint/provider/DefaultPHPBreakpointProvider.java,v
retrieving revision 1.3
diff -u -r1.3 DefaultPHPBreakpointProvider.java
--- src/org/eclipse/php/internal/debug/ui/breakpoint/provider/DefaultPHPBreakpointProvider.java	1 Jun 2010 01:23:00 -0000	1.3
+++ src/org/eclipse/php/internal/debug/ui/breakpoint/provider/DefaultPHPBreakpointProvider.java	15 Jan 2012 03:30:17 -0000
@@ -82,7 +82,11 @@
 			// Calculate secondary ID
 			String secondaryId = null;
 			if (input instanceof IFileEditorInput) {
-
+				IFileEditorInput fileEditorInput = (IFileEditorInput) input;
+				if (fileEditorInput.getFile().isLinked()) {
+					secondaryId = fileEditorInput.getFile().getRawLocation()
+							.toString();
+				}
 			} else if (input instanceof IURIEditorInput
 					|| (input instanceof NonExistingPHPFileEditorInput)) {
 
@@ -108,8 +112,7 @@
 
 			if (secondaryId != null) {
 				attributes
-						.put(
-								StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY,
+						.put(StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY,
 								secondaryId);
 			}
 
@@ -214,8 +217,8 @@
 							linePart = idoc.get(startOffset,
 									partitions[i].getLength()).trim();
 							if (Pattern.matches(".*[a-zA-Z0-0_]+.*", linePart)
-									&& !linePart.trim().toLowerCase().equals(
-											"<?php")) {
+									&& !linePart.trim().toLowerCase()
+											.equals("<?php")) {
 								result = startOffset;
 								break;
 							}
@@ -223,8 +226,7 @@
 					}
 					++editorLineNumber;
 				} while ((!phpPartitionVisited || PHPStructuredTextPartitioner
-						.isPHPPartitionType(partitionType))
-						&& result == -1);
+						.isPHPPartitionType(partitionType)) && result == -1);
 			} catch (BadLocationException e) {
 				result = -1;
 			}
Index: src/org/eclipse/php/internal/debug/ui/hovers/PHPDebugTextHover.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/hovers/PHPDebugTextHover.java,v
retrieving revision 1.15
diff -u -r1.15 PHPDebugTextHover.java
--- src/org/eclipse/php/internal/debug/ui/hovers/PHPDebugTextHover.java	10 Feb 2010 15:30:34 -0000	1.15
+++ src/org/eclipse/php/internal/debug/ui/hovers/PHPDebugTextHover.java	15 Jan 2012 03:30:17 -0000
@@ -209,7 +209,9 @@
 		}
 
 		if (value != null) {
-			value.replaceAll("\t", "    ");
+			value = value.replaceAll("\t", "    ").replaceAll("&", "&amp;")
+					.replaceAll("<", "&lt;").replaceAll(">", "&gt;")
+					.replaceAll("\n", "<br>");
 		}
 
 		return value;
Index: src/org/eclipse/php/internal/debug/ui/hovers/XDebugTextHover.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/hovers/XDebugTextHover.java,v
retrieving revision 1.7
diff -u -r1.7 XDebugTextHover.java
--- src/org/eclipse/php/internal/debug/ui/hovers/XDebugTextHover.java	18 Oct 2009 09:27:41 -0000	1.7
+++ src/org/eclipse/php/internal/debug/ui/hovers/XDebugTextHover.java	15 Jan 2012 03:30:17 -0000
@@ -125,7 +125,9 @@
 		}
 
 		if (value != null) {
-			value.replaceAll("\t", "    "); //$NON-NLS-1$ //$NON-NLS-2$
+			value = value.replaceAll("\t", "    ").replaceAll("&", "&amp;")
+					.replaceAll("<", "&lt;").replaceAll(">", "&gt;")
+					.replaceAll("\n", "<br>");
 		}
 
 		return value;
@@ -157,7 +159,9 @@
 		}
 
 		if (value != null) {
-			value.replaceAll("\t", "    "); //$NON-NLS-1$ //$NON-NLS-2$
+			value = value.replaceAll("\t", "    ").replaceAll("&", "&amp;")
+					.replaceAll("<", "&lt;").replaceAll(">", "&gt;")
+					.replaceAll("\n", "<br>");
 		}
 		return value;
 	}
Index: src/org/eclipse/php/internal/debug/ui/pathmapper/messages.properties
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/pathmapper/messages.properties,v
retrieving revision 1.2
diff -u -r1.2 messages.properties
--- src/org/eclipse/php/internal/debug/ui/pathmapper/messages.properties	26 Mar 2010 07:52:06 -0000	1.2
+++ src/org/eclipse/php/internal/debug/ui/pathmapper/messages.properties	15 Jan 2012 03:30:17 -0000
@@ -1,5 +1,5 @@
-PathMapperEntryDialog_0=Edit Path Mapping
-PathMapperEntryDialog_1=Add new Path Mapping
+PathMapperEntryDialog_0=Edit Path Map
+PathMapperEntryDialog_1=Add new Path Map
 PathMapperEntryDialog_10=Path on server is illegal or not absolute\!
 PathMapperEntryDialog_11=Path in workspace must not be empty\!
 PathMapperEntryDialog_12=Path ''{0}'' doesn't exist in workspace\!
@@ -13,6 +13,6 @@
 PathMapperEntryDialog_4=&Browse
 PathMapperEntryDialog_5=Path in &File System
 PathMapperEntryDialog_6=&Browse
-PathMapperEntryDialog_7=Edit server path mapping.
-PathMapperEntryDialog_8=Add new server path mapping.
+PathMapperEntryDialog_7=Edit server path map.
+PathMapperEntryDialog_8=Add new server path map.
 PathMapperEntryDialog_9=Path on server must not be empty\!
Index: src/org/eclipse/php/internal/debug/ui/preferences/PHPDebugPreferencesBlock.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/preferences/PHPDebugPreferencesBlock.java,v
retrieving revision 1.11.4.1
diff -u -r1.11.4.1 PHPDebugPreferencesBlock.java
--- src/org/eclipse/php/internal/debug/ui/preferences/PHPDebugPreferencesBlock.java	25 Aug 2010 07:00:57 -0000	1.11.4.1
+++ src/org/eclipse/php/internal/debug/ui/preferences/PHPDebugPreferencesBlock.java	15 Jan 2012 03:30:17 -0000
@@ -21,9 +21,9 @@
 
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
+import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.core.runtime.preferences.IScopeContext;
 import org.eclipse.jface.dialogs.IPageChangedListener;
@@ -56,7 +56,8 @@
  * 
  * @author Shalom Gibly
  */
-public class PHPDebugPreferencesBlock extends AbstractPHPPreferencePageBlock {
+public class PHPDebugPreferencesBlock extends AbstractPHPPreferencePageBlock
+		implements IPropertyChangeListener {
 
 	private static final String UNRESOLVED_PHP_VERSION = "Unresolved PHP Version"; //$NON-NLS-1$
 	private static final String DEBUGGERS_PAGE_ID = "org.eclipse.php.debug.ui.installedDebuggersPage"; //$NON-NLS-1$
@@ -84,6 +85,8 @@
 
 	public PHPDebugPreferencesBlock(boolean isPropertyPage) {
 		this.isPropertyPage = !isPropertyPage;
+		PHPProjectPreferences.getModelPreferences().addPropertyChangeListener(
+				this);
 	}
 
 	public void setCompositeAddon(Composite parent) {
@@ -224,6 +227,8 @@
 	}
 
 	public boolean performOK(boolean isProjectSpecific) {
+		PHPProjectPreferences.getModelPreferences()
+				.removePropertyChangeListener(this);
 		savePreferences(isProjectSpecific);
 		return true;
 	}
@@ -233,6 +238,8 @@
 	}
 
 	public boolean performCancel() {
+		PHPProjectPreferences.getModelPreferences()
+				.removePropertyChangeListener(this);
 		return true;
 	}
 
@@ -715,4 +722,14 @@
 		this.pageValidator = pageValidator;
 	}
 
+	public void propertyChange(PropertyChangeEvent event) {
+		String prop = event.getProperty();
+		if (prop.equals(PHPDebugCorePreferenceNames.INSTALLED_PHP_DEBUGGERS)
+				|| prop.equals(PHPDebugCorePreferenceNames.INSTALLED_PHP_NAMES)) {
+			String debuggerID = getSelectedDebuggerId();
+			PHPexeItem[] items = PHPexes.getInstance().getItems(debuggerID);
+			loadPHPExes(fDefaultPHPExe, items);
+		}
+	}
+
 }
Index: src/org/eclipse/php/internal/debug/ui/preferences/phps/InstalledPHPsBlock.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/preferences/phps/InstalledPHPsBlock.java,v
retrieving revision 1.13
diff -u -r1.13 InstalledPHPsBlock.java
--- src/org/eclipse/php/internal/debug/ui/preferences/phps/InstalledPHPsBlock.java	18 Oct 2009 09:27:42 -0000	1.13
+++ src/org/eclipse/php/internal/debug/ui/preferences/phps/InstalledPHPsBlock.java	15 Jan 2012 03:30:18 -0000
@@ -441,19 +441,25 @@
 		if (phpExe == null) {
 			return;
 		}
-		PHPexeItem phpExeToEdit = new PHPexeItem(phpExe.getName(), phpExe
-				.getExecutable(), phpExe.getINILocation(), phpExe
-				.getDebuggerID(), phpExe.isEditable());
+		PHPexeItem phpExeToEdit = new PHPexeItem(phpExe.getName(),
+				phpExe.getExecutable(), phpExe.getINILocation(),
+				phpExe.getDebuggerID(), phpExe.isEditable());
 		PHPExeEditDialog dialog = new PHPExeEditDialog(getShell(),
 				phpExeToEdit, phpExes.getAllItems());
 		dialog.setTitle(PHPDebugUIMessages.InstalledPHPsBlock_8);
 		if (dialog.open() != Window.OK) {
 			return;
 		}
+		boolean mustRemap = !phpExeToEdit.getDebuggerID().equals(
+				phpExe.getDebuggerID())
+				|| !phpExeToEdit.getName().equals(phpExeToEdit.getName());
 		phpExe.setName(phpExeToEdit.getName());
 		phpExe.setExecutable(phpExeToEdit.getExecutable());
 		phpExe.setINILocation(phpExeToEdit.getINILocation());
 		phpExe.setDebuggerID(phpExeToEdit.getDebuggerID());
+		if (mustRemap) {
+			phpExes.remap();
+		}
 
 		fPHPExeList.refresh();
 		commitChanges();
@@ -697,7 +703,7 @@
 		final Set<File> exstingLocations = new HashSet<File>();
 		Iterator<PHPexeItem> iter = fPHPexes.iterator();
 		while (iter.hasNext())
-			exstingLocations.add(iter.next().getExecutable().getParentFile());
+			exstingLocations.add(iter.next().getExecutable());
 
 		// search
 		final File rootDir = new File(path);
@@ -737,8 +743,9 @@
 				String nameCopy = new String(phpExe.getName());
 				int i = 1;
 				while (isDuplicateName(nameCopy)) {
-					nameCopy = phpExe.getName() + '[' + i++ + ']';
+					nameCopy = phpExe.getName() + " [" + i++ + "]";
 				}
+				phpExe.setName(nameCopy);
 				// Since the search for PHP exe option does not 'know' the
 				// debugger id it should assign to the PHPexeItem,
 				// we call for PHPexes.getDefaultDebuggerId() - which can also
@@ -771,9 +778,11 @@
 
 		// Search the root directory
 		if (!ignore.contains(directory)) {
-			final File foundExe = findPHPExecutable(directory);
-			if (foundExe != null)
-				found.add(foundExe);
+			final List<File> foundExe = findPHPExecutable(directory);
+			if (foundExe != null && !foundExe.isEmpty()) {
+				foundExe.removeAll(ignore);
+				found.addAll(foundExe);
+			}
 		}
 
 		final String[] names = directory.list();
@@ -796,9 +805,10 @@
 				if (!ignore.contains(file)) {
 					if (monitor.isCanceled())
 						return;
-					final File foundExe = findPHPExecutable(file);
-					if (foundExe != null) {
-						found.add(foundExe);
+					final List<File> foundExe = findPHPExecutable(file);
+					if (foundExe != null && !foundExe.isEmpty()) {
+						foundExe.removeAll(ignore);
+						found.addAll(foundExe);
 						ignore.add(file);
 					}
 					subDirs.add(file);
@@ -822,18 +832,19 @@
 	 *            A directory that might hold a PHP executable.
 	 * @return A PHP executable file.
 	 */
-	private static File findPHPExecutable(File phpLocation) {
+	private static List<File> findPHPExecutable(File phpLocation) {
 
 		// Try each candidate in order. The first one found wins. Thus, the
 		// order
 		// of fgCandidateJavaLocations is significant.
+		List<File> fileList = new ArrayList<File>();
 		for (String element : PHP_CANDIDATE_BIN) {
 			File javaFile = new File(phpLocation, element);
 			if (javaFile.exists() && !javaFile.isDirectory()) {
-				return javaFile;
+				fileList.add(javaFile);
 			}
 		}
-		return null;
+		return fileList;
 	}
 
 	/**
@@ -865,7 +876,9 @@
 				if (e1 instanceof PHPexeItem && e2 instanceof PHPexeItem) {
 					final PHPexeItem left = (PHPexeItem) e1;
 					final PHPexeItem right = (PHPexeItem) e2;
-					return left.getExecutable().getAbsolutePath()
+					return left
+							.getExecutable()
+							.getAbsolutePath()
 							.compareToIgnoreCase(
 									right.getExecutable().getAbsolutePath());
 				}
Index: src/org/eclipse/php/internal/debug/ui/preferences/phps/PHPInterpreterExecutionPreferencePage.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/preferences/phps/PHPInterpreterExecutionPreferencePage.java,v
retrieving revision 1.2.4.1
diff -u -r1.2.4.1 PHPInterpreterExecutionPreferencePage.java
--- src/org/eclipse/php/internal/debug/ui/preferences/phps/PHPInterpreterExecutionPreferencePage.java	30 Jul 2010 06:46:47 -0000	1.2.4.1
+++ src/org/eclipse/php/internal/debug/ui/preferences/phps/PHPInterpreterExecutionPreferencePage.java	15 Jan 2012 03:30:18 -0000
@@ -13,6 +13,7 @@
 
 import org.eclipse.core.runtime.Preferences;
 import org.eclipse.php.internal.debug.core.preferences.PHPProjectPreferences;
+import org.eclipse.php.internal.ui.IPHPHelpContextIds;
 import org.eclipse.php.internal.ui.PHPUiPlugin;
 import org.eclipse.php.internal.ui.preferences.AbstractPreferencePage;
 import org.eclipse.swt.SWT;
@@ -22,6 +23,7 @@
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.PlatformUI;
 
 public class PHPInterpreterExecutionPreferencePage extends
 		AbstractPreferencePage implements IWorkbenchPreferencePage {
@@ -74,12 +76,17 @@
 		control.setLayoutData(data);
 
 		applyDialogFont(ancestor);
-		// TODO: fix help
-		// PlatformUI.getWorkbench().getHelpSystem().setHelp(ancestor,
-		// IPHPHelpContextIds.PHP_EXECUTABLES_PREFERENCES);
+
 		return ancestor;
 	}
 
+	@Override
+	public void createControl(Composite parent) {
+		super.createControl(parent);
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
+				IPHPHelpContextIds.PHPEXE_ENV_PREFERENCES);
+	}
+
 	/*
 	 * (non-Javadoc)
 	 * 
Index: src/org/eclipse/php/internal/debug/ui/views/DebugOutputView.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/views/DebugOutputView.java,v
retrieving revision 1.11.6.2
diff -u -r1.11.6.2 DebugOutputView.java
--- src/org/eclipse/php/internal/debug/ui/views/DebugOutputView.java	30 Jul 2010 06:48:28 -0000	1.11.6.2
+++ src/org/eclipse/php/internal/debug/ui/views/DebugOutputView.java	15 Jan 2012 03:30:18 -0000
@@ -23,17 +23,25 @@
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.IToolBarManager;
 import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.php.internal.debug.core.model.DebugOutput;
 import org.eclipse.php.internal.debug.core.model.IPHPDebugTarget;
 import org.eclipse.php.internal.ui.IPHPHelpContextIds;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.ISelectionListener;
 import org.eclipse.ui.IWorkbenchActionConstants;
 import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.internal.editors.text.EditorsPlugin;
 import org.eclipse.ui.progress.UIJob;
+import org.eclipse.ui.texteditor.AbstractTextEditor;
 import org.eclipse.wst.html.core.internal.encoding.HTMLDocumentLoader;
 import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML;
 import org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument;
@@ -73,6 +81,8 @@
 				.addSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
 		getSite().setSelectionProvider(fSourceViewer.getSelectionProvider());
 
+		setBackgroundColor();
+
 		terminateListener = new IDebugEventSetListener() {
 			IPHPDebugTarget target;
 
@@ -107,6 +117,63 @@
 		return fSourceViewer;
 	}
 
+	private void setBackgroundColor() {
+		IPreferenceStore store = EditorsPlugin.getDefault()
+				.getPreferenceStore();
+
+		fSourceViewer.getTextWidget().setBackground(getBackgroundColor(store));
+		IPropertyChangeListener listener = new IPropertyChangeListener() {
+
+			public void propertyChange(PropertyChangeEvent event) {
+				IPreferenceStore store = EditorsPlugin.getDefault()
+						.getPreferenceStore();
+				String prop = event.getProperty();
+				if (prop.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)
+						|| prop.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND)) {
+					fSourceViewer.getTextWidget().setBackground(
+							getBackgroundColor(store));
+				}
+
+			}
+		};
+		store.addPropertyChangeListener(listener);
+
+	}
+
+	/**
+	 * Get background color
+	 * 
+	 * @return background color
+	 */
+	private Color getBackgroundColor(IPreferenceStore store) {
+		String useDefault = store
+				.getString(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT);
+
+		Color dflt = Display.getDefault().getSystemColor(
+				SWT.COLOR_LIST_BACKGROUND);
+
+		if ("true".equalsIgnoreCase(useDefault)) {
+			return dflt;
+		}
+
+		String bgColor = store
+				.getString(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
+		if (bgColor == null || bgColor.equals("")) {
+			return dflt;
+		}
+
+		String[] rgb = bgColor.split(",");
+		RGB color;
+		try {
+			color = new RGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]),
+					Integer.parseInt(rgb[2]));
+		} catch (Throwable ex) {
+			return dflt;
+		}
+
+		return new Color(Display.getDefault(), color);
+	}
+
 	/*
 	 * (non-Javadoc)
 	 * 
#P org.eclipse.php.server.core
Index: META-INF/MANIFEST.MF
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.server.core/META-INF/MANIFEST.MF,v
retrieving revision 1.33
diff -u -r1.33 MANIFEST.MF
--- META-INF/MANIFEST.MF	10 Nov 2009 08:49:13 -0000	1.33
+++ META-INF/MANIFEST.MF	15 Jan 2012 03:30:20 -0000
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: PDT Server Core Plug-in
 Bundle-SymbolicName: org.eclipse.php.server.core;singleton:=true
-Bundle-Version: 2.2.0.qualifier
+Bundle-Version: 2.2.1.qualifier
 Bundle-Activator: org.eclipse.php.internal.server.core.Activator
 Bundle-Vendor: Eclipse.org
 Bundle-Localization: plugin
Index: src/org/eclipse/php/internal/server/core/manager/ServersManager.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.server.core/src/org/eclipse/php/internal/server/core/manager/ServersManager.java,v
retrieving revision 1.13.4.1
diff -u -r1.13.4.1 ServersManager.java
--- src/org/eclipse/php/internal/server/core/manager/ServersManager.java	25 Aug 2010 07:01:09 -0000	1.13.4.1
+++ src/org/eclipse/php/internal/server/core/manager/ServersManager.java	15 Jan 2012 03:30:21 -0000
@@ -17,10 +17,14 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.Iterator;
 
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Preferences;
 import org.eclipse.core.runtime.preferences.DefaultScope;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.core.runtime.preferences.IScopeContext;
@@ -108,14 +112,24 @@
 		if (server == null) {
 			return;
 		}
+
 		ServersManager manager = getInstance();
-		Server oldValue = (Server) manager.servers
-				.put(server.getName(), server);
+		Server oldValue = ServersManager.getServer(server);
+		if (server != oldValue) {
+			manager.servers.remove(oldValue.getName());
+			oldValue.removePropertyChangeListener(manager);
+			ServerManagerEvent event = new ServerManagerEvent(
+					ServerManagerEvent.MANAGER_EVENT_REMOVED, oldValue);
+			manager.fireEvent(event);
+		}
+		oldValue = (Server) manager.servers.put(server.getName(), server);
 		if (oldValue != null) {
 			oldValue.removePropertyChangeListener(manager);
 			ServerManagerEvent event = new ServerManagerEvent(
 					ServerManagerEvent.MANAGER_EVENT_REMOVED, oldValue);
 			manager.fireEvent(event);
+		} else {
+
 		}
 		ServerManagerEvent event = new ServerManagerEvent(
 				ServerManagerEvent.MANAGER_EVENT_ADDED, server);
@@ -143,12 +157,12 @@
 		ServersManager manager = ServersManager.getInstance();
 		Server removedServer = (Server) manager.servers.remove(serverName);
 		Server workspaceDefault = getDefaultServer(null);
-		if (workspaceDefault == null) {
-			// Should not happen
-			Logger.log(IStatus.ERROR,
-					"There is no defined default server for the workspace.");
-			return null;
-		}
+		// if (workspaceDefault == null) {
+		// // Should not happen
+		// Logger.log(IStatus.ERROR,
+		// "There is no defined default server for the workspace.");
+		// return null;
+		// }
 		if (removedServer == null) {
 			// if the name is not existing, just quit.
 			return null;
@@ -197,6 +211,18 @@
 		return (Server) manager.servers.get(serverName);
 	}
 
+	public static Server getServer(Server oldServer) {
+		ServersManager manager = getInstance();
+		for (Iterator iterator = manager.servers.values().iterator(); iterator
+				.hasNext();) {
+			Server server = (Server) iterator.next();
+			if (server.getBaseURL().equals(oldServer.getBaseURL())) {
+				return server;
+			}
+		}
+		return oldServer;
+	}
+
 	/**
 	 * Returns all the Servers that are managed by this manager.
 	 * 
@@ -273,6 +299,7 @@
 				// project server (can be the same).
 				try {
 					server = createServer(Default_Server_Name, BASE_URL);
+
 				} catch (MalformedURLException e) {
 					// safe server creation
 				}
@@ -353,6 +380,7 @@
 	public static Server createServer(String name, String baseURL)
 			throws MalformedURLException {
 		Server server = new Server(name, "localhost", baseURL, "");
+		server = ServersManager.getServer(server);
 		addServer(server);
 		return server;
 	}
#P org.eclipse.php.server.ui
Index: META-INF/MANIFEST.MF
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.server.ui/META-INF/MANIFEST.MF,v
retrieving revision 1.35
diff -u -r1.35 MANIFEST.MF
--- META-INF/MANIFEST.MF	10 Nov 2009 08:49:01 -0000	1.35
+++ META-INF/MANIFEST.MF	15 Jan 2012 03:30:22 -0000
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: PDT Server UI Plug-in
 Bundle-SymbolicName: org.eclipse.php.server.ui;singleton:=true
-Bundle-Version: 2.2.0.qualifier
+Bundle-Version: 2.2.1.qualifier
 Bundle-Activator: org.eclipse.php.internal.server.ui.Activator
 Bundle-Vendor: Eclipse.org
 Bundle-Localization: plugin
Index: src/org/eclipse/php/internal/server/PHPServerUIMessages.properties
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.server.ui/src/org/eclipse/php/internal/server/PHPServerUIMessages.properties,v
retrieving revision 1.20.8.1
diff -u -r1.20.8.1 PHPServerUIMessages.properties
--- src/org/eclipse/php/internal/server/PHPServerUIMessages.properties	25 Aug 2010 07:00:51 -0000	1.20.8.1
+++ src/org/eclipse/php/internal/server/PHPServerUIMessages.properties	15 Jan 2012 03:30:22 -0000
@@ -42,11 +42,18 @@
 ServerTab.file_project_doesNotExist=File does not exist
 ServerCompositeFragment.specifyInformation=Specify the Server Information
 ServerCompositeFragment.enterValidURL=Please enter a valid Server URL (<protocol>://<server url>[:<port>])  
+ServerCompositeFragment.serverURLEmpty=Server URL is empty.
 ServerCompositeFragment.editServer=Edit Server
 ServerCompositeFragment.configureServer=Configure a PHP Server
 ServerCompositeFragment.missingServerName=Missing Server Name
 ServerCompositeFragment.duplicateServerName=Duplicate Server Name
+ServerCompositeFragment.duplicateServerUrl=Duplicate Server Url
 ServerCompositeFragment.enterDocumentRootURL=Enter the URL that points to the document root of this server
+ServerCompositeFragment.serverProperties=Server Properties
+ServerCompositeFragment.localWebRoot=Local Web Root:
+ServerCompositeFragment.baseURL=Base URL:
+ServerCompositeFragment.browse=Browse
+ServerCompositeFragment.webrootNotExists=The web server document root is not a valid directory on file system.
 DefaultDebugServerConnectionTest_theURLCouldNotBeFound=The file ''{0}/dummy.php'', which is required by the Zend Debugger, could not be found.\nPlease verify that the Zend Debugger is properly installed on the server and that the ''dummy.php''\nis located in your Web server''s document root (e.g Apache''s /htdocs folder)
 DefaultDebugServerConnectionTest_testingConnectivity=Testing Connectivity...
 DefaultDebugServerConnectionTest_testingCommunication=Testing communication with client host/IP: ''{0}''...
Index: src/org/eclipse/php/internal/server/ui/ServerCompositeFragment.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.server.ui/src/org/eclipse/php/internal/server/ui/ServerCompositeFragment.java,v
retrieving revision 1.6.2.2
diff -u -r1.6.2.2 ServerCompositeFragment.java
--- src/org/eclipse/php/internal/server/ui/ServerCompositeFragment.java	3 Sep 2010 14:54:35 -0000	1.6.2.2
+++ src/org/eclipse/php/internal/server/ui/ServerCompositeFragment.java	15 Jan 2012 03:30:23 -0000
@@ -14,6 +14,7 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 
+import org.eclipse.core.runtime.Path;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IMessageProvider;
 import org.eclipse.php.internal.server.PHPServerUIMessages;
@@ -24,7 +25,8 @@
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.*;
@@ -39,6 +41,7 @@
 	protected Combo combo;
 	private ValuesCache originalValuesCache = new ValuesCache();
 	private ValuesCache modifiedValuesCache;
+	private Text webroot;
 
 	/**
 	 * ServerCompositeFragment
@@ -127,6 +130,7 @@
 		originalValuesCache.url = server.getBaseURL();
 		originalValuesCache.serverName = server.getName();
 		originalValuesCache.host = server.getHost();
+		originalValuesCache.webroot = server.getDocumentRoot();
 		// Clone the cache
 		modifiedValuesCache = new ValuesCache(originalValuesCache);
 
@@ -157,7 +161,9 @@
 		} else {
 			name.setText(""); //$NON-NLS-1$
 		}
-
+		if (originalValuesCache.webroot != null) {
+			webroot.setText(originalValuesCache.webroot);
+		}
 		String baseURL = originalValuesCache.url;
 		if (!baseURL.equals("")) { //$NON-NLS-1$
 			url.setText(baseURL);
@@ -204,21 +210,16 @@
 
 		setMessage(getDescription(), IMessageProvider.NONE);
 
-		String serverName = modifiedValuesCache.serverName;
-		if (serverName == null || serverName.trim().equals("")) { //$NON-NLS-1$
-			setMessage(
-					PHPServerUIMessages
-							.getString("ServerCompositeFragment.missingServerName"), IMessageProvider.ERROR); //$NON-NLS-1$
-		} else {
-			boolean ok = checkServerName(serverName);
+		String urlStr = url.getText();
+		if (urlStr != null && !urlStr.trim().equals("")) {
+			boolean ok = checkServerUrl(urlStr);
 			if (!ok) {
 				setMessage(
 						PHPServerUIMessages
-								.getString("ServerCompositeFragment.duplicateServerName"), IMessageProvider.ERROR); //$NON-NLS-1$
+								.getString("ServerCompositeFragment.duplicateServerUrl"), IMessageProvider.ERROR); //$NON-NLS-1$
 			}
 		}
 
-		String urlStr = url.getText();
 		try {
 			URL url = new URL(urlStr);
 			if (url.getPath() != null && url.getPath().length() != 0) {
@@ -239,6 +240,11 @@
 		try {
 			URL baseURL = new URL(urlStr);
 			String host = baseURL.getHost();
+			if (host.trim().length() == 0) {
+				setMessage(
+						PHPServerUIMessages
+								.getString("ServerCompositeFragment.serverURLEmpty"), IMessageProvider.ERROR); //$NON-NLS-1$
+			}
 			int port = baseURL.getPort();
 
 			// workingCopy.setHost(host);
@@ -251,6 +257,27 @@
 							.getString("ServerCompositeFragment.enterValidURL"), IMessageProvider.ERROR); //$NON-NLS-1$
 			return;
 		}
+
+		String serverName = modifiedValuesCache.serverName;
+		if (serverName == null || serverName.trim().equals("")) { //$NON-NLS-1$
+			setMessage(
+					PHPServerUIMessages
+							.getString("ServerCompositeFragment.missingServerName"), IMessageProvider.ERROR); //$NON-NLS-1$
+		} else {
+			boolean ok = checkServerName(serverName);
+			if (!ok) {
+				setMessage(
+						PHPServerUIMessages
+								.getString("ServerCompositeFragment.duplicateServerName"), IMessageProvider.ERROR); //$NON-NLS-1$
+			}
+		}
+		String webrootStr = webroot.getText().trim();
+		if (webrootStr.length() != 0 && !new Path(webrootStr).toFile().exists()) {
+			setMessage(
+					PHPServerUIMessages
+							.getString("ServerCompositeFragment.webrootNotExists"), IMessageProvider.ERROR);//$NON-NLS-1$
+		}
+
 		controlHandler.update();
 	}
 
@@ -261,19 +288,25 @@
 	}
 
 	protected void createURLGroup(Composite parent) {
-		Font font = parent.getFont();
-		Group urlGroup = new Group(parent, SWT.NONE);
-		GridLayout layout = new GridLayout();
-		layout.numColumns = 1;
-		urlGroup.setLayout(layout);
-		urlGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-		urlGroup.setFont(font);
-		urlGroup.setText(PHPServerUIMessages
-				.getString("ServerCompositeFragment.enterDocumentRootURL")); //$NON-NLS-1$
 
-		url = new Text(urlGroup, SWT.BORDER);
+		Group group = new Group(parent, SWT.NONE);
+		group.setFont(parent.getFont());
+		GridLayout layout = new GridLayout(3, false);
+		group.setLayout(layout);
 		GridData data = new GridData(GridData.FILL_HORIZONTAL);
-		url.setLayoutData(data);
+		group.setLayoutData(data);
+		group.setText(PHPServerUIMessages
+				.getString("ServerCompositeFragment.serverProperties"));
+
+		Label urlLabel = new Label(group, SWT.None);
+		urlLabel.setText(PHPServerUIMessages
+				.getString("ServerCompositeFragment.baseURL"));
+
+		url = new Text(group, SWT.BORDER);
+		GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
+		layoutData.horizontalSpan = 2;
+		url.setLayoutData(layoutData);
+
 		url.addModifyListener(new ModifyListener() {
 			public void modifyText(ModifyEvent e) {
 				if (getServer() != null) {
@@ -284,6 +317,44 @@
 				validate();
 			}
 		});
+
+		Label labelRoot = new Label(group, SWT.None);
+		labelRoot.setText(PHPServerUIMessages
+				.getString("ServerCompositeFragment.localWebRoot"));
+		labelRoot.setLayoutData(new GridData());
+
+		webroot = new Text(group, SWT.BORDER);
+		webroot.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+		webroot.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				if (getServer() != null) {
+					String webrootStr = webroot.getText();
+					// server.setBaseURL(urlStr);
+					modifiedValuesCache.webroot = webrootStr;
+				}
+				validate();
+			}
+		});
+
+		Button browseButton = new Button(group, SWT.PUSH);
+		browseButton.setText(PHPServerUIMessages
+				.getString("ServerCompositeFragment.browse"));
+
+		browseButton.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+				DirectoryDialog dialog = new DirectoryDialog(getShell());
+				if (!"".equals(webroot.getText())) { //$NON-NLS-1$
+					String initialDir = webroot.getText();
+					dialog.setFilterPath(initialDir);
+				}
+				String result = dialog.open();
+				if (result != null)
+					webroot.setText(result.toString());
+			}
+
+		});
+
 	}
 
 	private boolean checkServerName(String name) {
@@ -304,6 +375,27 @@
 		return true;
 	}
 
+	private boolean checkServerUrl(String url) {
+		url = url.trim();
+		if (originalValuesCache.serverName != null
+				&& originalValuesCache.serverName.trim().length() > 0) {
+			if (url.equals(originalValuesCache.url)) {
+				return true;
+			}
+		}
+		Server[] allServers = ServersManager.getServers();
+
+		if (allServers != null) {
+			int size = allServers.length;
+			for (int i = 0; i < size; i++) {
+				Server server = allServers[i];
+				if (url.equals(server.getBaseURL()))
+					return false;
+			}
+		}
+		return true;
+	}
+
 	/**
 	 * Saves the IServerWorkingCopy.
 	 */
@@ -324,6 +416,7 @@
 			}
 			server.setHost(modifiedValuesCache.host);
 			server.setName(modifiedValuesCache.serverName);
+			server.setDocumentRoot(modifiedValuesCache.webroot);
 			if (originalValuesCache.serverName != null
 					&& !originalValuesCache.serverName.equals("") && //$NON-NLS-1$
 					!originalValuesCache.serverName
@@ -369,6 +462,7 @@
 
 	// A class used as a local original IServerWorkingCopy values cache.
 	private class ValuesCache {
+		String webroot;
 		String serverName;
 		String url;
 		String host;
@@ -382,6 +476,7 @@
 			this.url = cache.url;
 			this.port = cache.port;
 			this.host = cache.host;
+			this.webroot = cache.webroot;
 		}
 	}
 }
\ No newline at end of file
Index: src/org/eclipse/php/internal/server/ui/ServerLaunchConfigurationTab.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.server.ui/src/org/eclipse/php/internal/server/ui/ServerLaunchConfigurationTab.java,v
retrieving revision 1.20.6.1
diff -u -r1.20.6.1 ServerLaunchConfigurationTab.java
--- src/org/eclipse/php/internal/server/ui/ServerLaunchConfigurationTab.java	25 Aug 2010 07:00:51 -0000	1.20.6.1
+++ src/org/eclipse/php/internal/server/ui/ServerLaunchConfigurationTab.java	15 Jan 2012 03:30:23 -0000
@@ -694,6 +694,10 @@
 		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
 		IResource resource = root.findMember(fileName);
 
+		if (resource == null) {
+			return fileName;
+		}
+
 		basePath = getBasePath(resource.getProject());
 		if (basePath == null && resource.getProject() != null)
 			basePath = resource.getProject().getName();
@@ -701,9 +705,6 @@
 			basePath = "";
 		}
 
-		if (resource == null) {
-			return fileName;
-		}
 		int type = resource.getType();
 		if (type == IResource.FILE || type == IResource.FOLDER) {
 
#P org.eclipse.php.ui
Index: plugin.properties
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/plugin.properties,v
retrieving revision 1.69
diff -u -r1.69 plugin.properties
--- plugin.properties	13 May 2010 06:49:56 -0000	1.69
+++ plugin.properties	15 Jan 2012 03:30:26 -0000
@@ -928,4 +928,11 @@
 extension-point.name.9 = Wizard and Composite Fragments
 extension-point.name.10 = PHP Action Delegator
 extension-point.name.11 = PHP Formatter Processor
-extension-point.name.12 = PHP Formatter Preferences Block
\ No newline at end of file
+extension-point.name.12 = PHP Formatter Preferences Block
+
+command.toggle.comment.name=Toggle Comment
+command.toggle.comment.description=Toggle Comment
+command.add.block.comment.name=Add Block Comment
+command.add.block.comment.description=Add Block Comment
+command.remove.block.comment.name=Remove Block Comment
+command.remove.block.comment.description=Remove Block Comment
Index: plugin.xml
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/plugin.xml,v
retrieving revision 1.255.2.4
diff -u -r1.255.2.4 plugin.xml
--- plugin.xml	6 Aug 2010 06:13:51 -0000	1.255.2.4
+++ plugin.xml	15 Jan 2012 03:30:27 -0000
@@ -560,10 +560,6 @@
 	</extension>
 
 	<extension point="org.eclipse.ui.actionSetPartAssociations">
-		<actionSetPartAssociation
-			targetID="org.eclipse.ui.edit.text.actionSet.presentation">
-			<part id="org.eclipse.php.ui.explorer" />
-		</actionSetPartAssociation>
 		<actionSetPartAssociation targetID="org.eclipse.php.ui.A_OpenActionSet">
 			<part id="org.eclipse.php.ui.explorer" />
 			<part id="org.eclipse.php.editor" />
@@ -611,7 +607,7 @@
 		</handler>
 		<!-- overriding WST's Handlers with the same 'commanId' -->
 		<handler class="org.eclipse.php.internal.ui.actions.ToggleCommentHandler"
-			commandId="org.eclipse.wst.sse.ui.toggle.comment">
+			commandId="org.eclipse.php.ui.toggle.comment">
 			<activeWhen>
 				<reference definitionId="org.eclipse.php.ui.phpContentType.definition" />
 			</activeWhen>
@@ -620,7 +616,7 @@
 			</enabledWhen>
 		</handler>
 		<handler class="org.eclipse.php.internal.ui.actions.AddBlockCommentHandler"
-			commandId="org.eclipse.wst.sse.ui.add.block.comment">
+			commandId="org.eclipse.php.ui.add.block.comment">
 			<activeWhen>
 				<reference definitionId="org.eclipse.php.ui.phpContentType.definition" />
 			</activeWhen>
@@ -630,7 +626,7 @@
 		</handler>
 		<handler
 			class="org.eclipse.php.internal.ui.actions.RemoveBlockCommentHandler"
-			commandId="org.eclipse.wst.sse.ui.remove.block.comment">
+			commandId="org.eclipse.php.ui.remove.block.comment">
 			<activeWhen>
 				<reference definitionId="org.eclipse.php.ui.phpContentType.definition" />
 			</activeWhen>
@@ -909,7 +905,7 @@
 		</menuContribution>
 		
 		  <menuContribution locationURI="menu:sourceMenuId?after=sourceBegin">
-			<command commandId="org.eclipse.wst.sse.ui.toggle.comment"
+			<command commandId="org.eclipse.php.ui.toggle.comment"
 			         id="ToggleComment"
 			         mnemonic="%command.toggle.comment.mnemonic"
 			         style="push">
@@ -917,7 +913,7 @@
 					<reference definitionId="org.eclipse.php.ui.phpContentType.definition"/>
 				</visibleWhen>
 			</command>
-			<command commandId="org.eclipse.wst.sse.ui.add.block.comment"
+			<command commandId="org.eclipse.php.ui.add.block.comment"
 			         id="AddBlockComment"
 			         mnemonic="%command.add.block.comment.mnemonic"
 			         style="push">
@@ -925,7 +921,7 @@
 					<reference definitionId="org.eclipse.php.ui.phpContentType.definition"/>
 				</visibleWhen>
 			</command>
-			<command commandId="org.eclipse.wst.sse.ui.remove.block.comment"
+			<command commandId="org.eclipse.php.ui.remove.block.comment"
 			         id="RemoveBlockComment"
 			         mnemonic="%command.remove.block.comment.mnemonic"
 			         style="push">
@@ -937,17 +933,17 @@
 		
 		<menuContribution
 	           locationURI="popup:sourcePopupMenuId?after=sourceBegin">
-				<command commandId="org.eclipse.wst.sse.ui.toggle.comment" id="ToggleComment" style="push">
+				<command commandId="org.eclipse.php.ui.toggle.comment" id="ToggleComment" style="push">
 					<visibleWhen checkEnabled="false">
 						<reference definitionId="org.eclipse.php.ui.phpContentType.definition"></reference>
 					</visibleWhen>
 				</command>
-				<command commandId="org.eclipse.wst.sse.ui.add.block.comment" id="AddBlockComment" style="push">
+				<command commandId="org.eclipse.php.ui.add.block.comment" id="AddBlockComment" style="push">
 					<visibleWhen checkEnabled="false">
 						<reference definitionId="org.eclipse.php.ui.phpContentType.definition"></reference>
 					</visibleWhen>
 				</command>
-				<command commandId="org.eclipse.wst.sse.ui.remove.block.comment" id="RemoveBlockComment" style="push">
+				<command commandId="org.eclipse.php.ui.remove.block.comment" id="RemoveBlockComment" style="push">
 					<visibleWhen checkEnabled="false">
 						<reference definitionId="org.eclipse.php.ui.phpContentType.definition"></reference>
 					</visibleWhen>
@@ -1084,13 +1080,18 @@
 			M3=ALT, M4=CTRL
 		-->
 		<key sequence="M1+/" contextId="org.eclipse.php.ui.phpEditorScope"
-			commandId="org.eclipse.wst.sse.ui.toggle.comment" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" />
+			commandId="org.eclipse.php.ui.toggle.comment" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" />
 		<key sequence="M1+7" contextId="org.eclipse.php.ui.phpEditorScope"
-			commandId="org.eclipse.wst.sse.ui.toggle.comment" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" />
+			commandId="org.eclipse.php.ui.toggle.comment" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" />
 		<key platform="gtk" sequence="ESC CTRL+C" contextId="org.eclipse.php.ui.phpEditorScope"
-			commandId="org.eclipse.wst.sse.ui.toggle.comment" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" />
+			commandId="org.eclipse.php.ui.toggle.comment" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" />
 		<key sequence="M1+O" contextId="org.eclipse.php.ui.phpEditorScope"
 			commandId="org.eclipse.dltk.ui.edit.text.script.show.outline" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" />
+		<!-- addendum -->
+		<key sequence="M1+M2+/" contextId="org.eclipse.php.ui.phpEditorScope"
+			commandId="org.eclipse.php.ui.add.block.comment" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" />
+		<key sequence="M1+M2+\" contextId="org.eclipse.php.ui.phpEditorScope"
+			commandId="org.eclipse.php.ui.remove.block.comment" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" />
 		<!-- source -->
 		<key sequence="M1+M2+J" contextId="org.eclipse.php.ui.phpEditorScope"
 			commandId="org.eclipse.php.ui.edit.text.add.description" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" />
@@ -1796,19 +1797,6 @@
          </selection>
       </wizard>
    </extension>
-    <extension point="org.eclipse.wst.sse.ui.semanticHighlighting">
-        <highlighting
-        class="org.eclipse.php.internal.ui.editor.highlighters.StaticFieldHighlighting"
-        target="org.eclipse.php.core.phpsource">
-        </highlighting>
-    </extension>
-    
-    <extension point="org.eclipse.wst.sse.ui.semanticHighlighting">
-        <highlighting
-        class="org.eclipse.php.internal.ui.editor.highlighters.StaticMethodHighlighting"
-        target="org.eclipse.php.core.phpsource">
-        </highlighting>
-    </extension>
 
     <extension point="org.eclipse.wst.sse.ui.semanticHighlighting">
         <highlighting
@@ -1882,10 +1870,25 @@
 
     <extension point="org.eclipse.wst.sse.ui.semanticHighlighting">
         <highlighting
+        class="org.eclipse.php.internal.ui.editor.highlighters.StaticFieldHighlighting"
+        target="org.eclipse.php.core.phpsource">
+        </highlighting>
+    </extension>
+    
+    <extension point="org.eclipse.wst.sse.ui.semanticHighlighting">
+        <highlighting
+        class="org.eclipse.php.internal.ui.editor.highlighters.StaticMethodHighlighting"
+        target="org.eclipse.php.core.phpsource">
+        </highlighting>
+    </extension>
+
+    <extension point="org.eclipse.wst.sse.ui.semanticHighlighting">
+        <highlighting
             class="org.eclipse.php.internal.ui.editor.highlighters.DeprecatedHighlighting"
             target="org.eclipse.php.core.phpsource">
         </highlighting>
     </extension>
+
     <extension
           id="commentTemplateProposalCategory"
           name="%extension.name.0"
@@ -2016,4 +2019,29 @@
 			language="org.eclipse.php.core.PHPNature"
 			class="org.eclipse.php.internal.ui.provider.PHPModelContentProvider"/>
 	</extension>
+ <extension
+       point="org.eclipse.ui.commands">
+	<!-- Source commands -->
+	<command
+		defaultHandler="org.eclipse.php.internal.ui.actions.ToggleCommentHandler"
+		name="%command.toggle.comment.name"
+		description="%command.toggle.comment.description"
+		categoryId="org.eclipse.ui.category.edit"
+		id="org.eclipse.php.ui.toggle.comment">
+	</command>
+	<command
+		defaultHandler="org.eclipse.php.internal.ui.actions.AddBlockCommentHandler"
+		name="%command.add.block.comment.name"
+		description="%command.add.block.comment.description"
+		categoryId="org.eclipse.ui.category.edit"
+		id="org.eclipse.php.ui.add.block.comment">
+	</command>
+	<command
+		defaultHandler="org.eclipse.php.internal.ui.actions.RemoveBlockCommentHandler"
+		name="%command.remove.block.comment.name"
+		description="%command.remove.block.comment.description"
+		categoryId="org.eclipse.ui.category.edit"
+		id="org.eclipse.php.ui.remove.block.comment">
+	</command>
+ </extension>
 </plugin>
Index: src/org/eclipse/php/internal/ui/IPHPHelpContextIds.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/IPHPHelpContextIds.java,v
retrieving revision 1.11
diff -u -r1.11 IPHPHelpContextIds.java
--- src/org/eclipse/php/internal/ui/IPHPHelpContextIds.java	29 Aug 2009 14:10:24 -0000	1.11
+++ src/org/eclipse/php/internal/ui/IPHPHelpContextIds.java	15 Jan 2012 03:30:28 -0000
@@ -175,6 +175,9 @@
 	public static final String PHARPACKAGER_WIZARD_PAGE = PREFIX
 			+ "phar_packager_wizard_page_context"; //$NON-NLS-1$ [html/Keymap.htm]
 
+	public static final String PHPEXE_ENV_PREFERENCES = PREFIX
+			+ "execution_environments_preferences"; //$NON-NLS-1$ [html/Keymap.htm]
+
 	public static final String PHAR_FILE_IMPORT_WIZARD_PAGE = PREFIX
 			+ "phar_file_import_wizard_page";
 }
\ No newline at end of file
Index: src/org/eclipse/php/internal/ui/actions/CommentHandler.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/actions/CommentHandler.java,v
retrieving revision 1.8.4.1
diff -u -r1.8.4.1 CommentHandler.java
--- src/org/eclipse/php/internal/ui/actions/CommentHandler.java	3 Aug 2010 06:00:27 -0000	1.8.4.1
+++ src/org/eclipse/php/internal/ui/actions/CommentHandler.java	15 Jan 2012 03:30:28 -0000
@@ -163,10 +163,11 @@
 							SINGLE_LINE_COMMENT);
 				}
 			}
-			document.replace(document.getLineOffset(selectionStartLine),
+			document.replace(
+					document.getLineOffset(selectionStartLine),
 					document.getLineOffset(selectionEndLine)
-							- document.getLineOffset(selectionStartLine), sb
-							.toString());
+							- document.getLineOffset(selectionStartLine),
+					sb.toString());
 		} catch (BadLocationException e) {
 			Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
 		}
@@ -176,19 +177,20 @@
 			int selectionStartLine, int selectionEndLine) {
 		StringBuffer sb = new StringBuffer();
 		try {
-			for (int i = selectionStartLine; i < selectionEndLine; i++) {
+			for (int i = selectionStartLine; i <= selectionEndLine; i++) {
 				if (document.getLineLength(i) > 0) {
-					int openCommentOffset = document.getLineOffset(i);
-					int nextLineOffset = document.getLineOffset(i + 1);
-					sb.append(document.get(openCommentOffset,
-							nextLineOffset - openCommentOffset).substring(2));
+					int offset = document.getLineOffset(i);
+					int length = document.getLineLength(i);
+					sb.append(document.get(offset, length).replaceFirst(
+							"^(\\s*)" + SINGLE_LINE_COMMENT, "$1"));
 				}
 			}
-			document.replace(document.getLineOffset(selectionStartLine),
+			document.replace(
+					document.getLineOffset(selectionStartLine),
 					document.getLineOffset(selectionEndLine)
-							+ SINGLE_LINE_COMMENT.length()
-							- document.getLineOffset(selectionStartLine), sb
-							.toString());
+							+ document.getLineLength(selectionEndLine)
+							- document.getLineOffset(selectionStartLine),
+					sb.toString());
 		} catch (BadLocationException e) {
 			Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
 		}
Index: src/org/eclipse/php/internal/ui/actions/PHPExplorerActionGroup.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/actions/PHPExplorerActionGroup.java,v
retrieving revision 1.1
diff -u -r1.1 PHPExplorerActionGroup.java
--- src/org/eclipse/php/internal/ui/actions/PHPExplorerActionGroup.java	3 Jun 2010 02:05:03 -0000	1.1
+++ src/org/eclipse/php/internal/ui/actions/PHPExplorerActionGroup.java	15 Jan 2012 03:30:28 -0000
@@ -15,6 +15,7 @@
 package org.eclipse.php.internal.ui.actions;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import org.eclipse.dltk.internal.ui.actions.CCPActionGroup;
 import org.eclipse.dltk.internal.ui.actions.refactoring.RefactorActionGroup;
@@ -49,6 +50,29 @@
 
 	public PHPExplorerActionGroup(ScriptExplorerPart part) {
 		super(part);
+		removeWrongWorkingSetFilter(part);
+	}
+
+	/**
+	 * bug 329194: Changing working set show blank explorer. Now there are two
+	 * working set filters,and the second is not updated when change working
+	 * set.So remove the second one.
+	 * 
+	 * @param part
+	 */
+	private void removeWrongWorkingSetFilter(ScriptExplorerPart part) {
+		ViewerFilter filter = super.getWorkingSetActionGroup().getFilterGroup()
+				.getWorkingSetFilter();
+		ViewerFilter[] filters = part.getTreeViewer().getFilters();
+		List<ViewerFilter> filterList = new ArrayList<ViewerFilter>();
+		for (int i = 0; i < filters.length; i++) {
+			ViewerFilter viewerFilter = filters[i];
+			if (viewerFilter != filter) {
+				filterList.add(viewerFilter);
+			}
+		}
+		part.getTreeViewer().setFilters(
+				filterList.toArray(new ViewerFilter[filterList.size()]));
 	}
 
 	/*
@@ -178,12 +202,12 @@
 					TreePath[] paths = ((ITreeSelection) selection)
 							.getPathsFor(element);
 					for (int i = 0; i < paths.length; i++) {
-						viewer.setExpandedState(paths[i], !viewer
-								.getExpandedState(paths[i]));
+						viewer.setExpandedState(paths[i],
+								!viewer.getExpandedState(paths[i]));
 					}
 				} else {
-					viewer.setExpandedState(element, !viewer
-							.getExpandedState(element));
+					viewer.setExpandedState(element,
+							!viewer.getExpandedState(element));
 				}
 			}
 		} else {
@@ -198,8 +222,8 @@
 	 */
 	private boolean doubleClickGoesInto() {
 		return PreferenceConstants.DOUBLE_CLICK_GOES_INTO.equals(DLTKUIPlugin
-				.getDefault().getPreferenceStore().getString(
-						PreferenceConstants.DOUBLE_CLICK));
+				.getDefault().getPreferenceStore()
+				.getString(PreferenceConstants.DOUBLE_CLICK));
 	}
 
 	public ViewActionGroup getWorkingSetActionGroup() {
Index: src/org/eclipse/php/internal/ui/autoEdit/IndentLineAutoEditStrategy.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/autoEdit/IndentLineAutoEditStrategy.java,v
retrieving revision 1.12
diff -u -r1.12 IndentLineAutoEditStrategy.java
--- src/org/eclipse/php/internal/ui/autoEdit/IndentLineAutoEditStrategy.java	18 Oct 2009 09:28:26 -0000	1.12
+++ src/org/eclipse/php/internal/ui/autoEdit/IndentLineAutoEditStrategy.java	15 Jan 2012 03:30:28 -0000
@@ -154,7 +154,8 @@
 			final StringBuffer result, final int lineNumber,
 			final DocumentCommand command) throws BadLocationException {
 		final int forOffset = command.offset;
-		final IRegion lineInfo = document.getLineInformation(lineNumber);
+		final IRegion lineInfo = document.getLineInformation(document
+				.getLineOfOffset(forOffset + command.length));
 		// read the rest of the line
 		final String lineText = document.get(forOffset + command.length,
 				lineInfo.getOffset() + lineInfo.getLength()
Index: src/org/eclipse/php/internal/ui/editor/PHPStructuredEditor.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/PHPStructuredEditor.java,v
retrieving revision 1.144.2.6
diff -u -r1.144.2.6 PHPStructuredEditor.java
--- src/org/eclipse/php/internal/ui/editor/PHPStructuredEditor.java	27 Sep 2010 06:42:26 -0000	1.144.2.6
+++ src/org/eclipse/php/internal/ui/editor/PHPStructuredEditor.java	15 Jan 2012 03:30:30 -0000
@@ -77,6 +77,7 @@
 import org.eclipse.php.internal.core.search.IOccurrencesFinder;
 import org.eclipse.php.internal.core.search.IOccurrencesFinder.OccurrenceLocation;
 import org.eclipse.php.internal.core.search.OccurrencesFinderFactory;
+import org.eclipse.php.internal.ui.IPHPHelpContextIds;
 import org.eclipse.php.internal.ui.Logger;
 import org.eclipse.php.internal.ui.PHPUIMessages;
 import org.eclipse.php.internal.ui.PHPUiPlugin;
@@ -119,6 +120,7 @@
 import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionContainer;
 import org.eclipse.wst.sse.ui.StructuredTextEditor;
 import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
+import org.eclipse.wst.sse.ui.internal.StorageModelProvider;
 import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
 import org.eclipse.wst.sse.ui.internal.actions.ActionDefinitionIds;
 import org.eclipse.wst.sse.ui.internal.contentassist.StructuredContentAssistant;
@@ -923,8 +925,8 @@
 					return Status.CANCEL_STATUS;
 
 				OccurrenceLocation location = fLocations[i];
-				Position position = new Position(location.getOffset(), location
-						.getLength());
+				Position position = new Position(location.getOffset(),
+						location.getLength());
 
 				String description = location.getDescription();
 				String annotationType = (location.getFlags() == IOccurrencesFinder.F_WRITE_OCCURRENCE) ? "org.eclipse.php.ui.occurrences.write" : "org.eclipse.php.ui.occurrences"; //$NON-NLS-1$ //$NON-NLS-2$
@@ -941,8 +943,8 @@
 					// ruler
 					@Override
 					public void paint(GC gc, Canvas canvas, Rectangle r) {
-						ImageUtilities.drawImage(PHPUiPlugin
-								.getImageDescriptorRegistry().get(
+						ImageUtilities.drawImage(
+								PHPUiPlugin.getImageDescriptorRegistry().get(
 										PHPPluginImages.DESC_OBJS_OCCURRENCES),
 								gc, canvas, r, SWT.CENTER, SWT.TOP);
 					}
@@ -963,8 +965,8 @@
 					removeOccurrenceAnnotations();
 					for (Map.Entry<Annotation, Position> entry : annotationMap
 							.entrySet()) {
-						annotationModel.addAnnotation(entry.getKey(), entry
-								.getValue());
+						annotationModel.addAnnotation(entry.getKey(),
+								entry.getValue());
 					}
 				}
 				fOccurrenceAnnotations = annotationMap.keySet().toArray(
@@ -1056,8 +1058,8 @@
 						for (IStructuredDocumentRegion element : sdRegions) {
 							Iterator regionsIt = element.getRegions()
 									.iterator();
-							reparseRegion(doc, regionsIt, element
-									.getStartOffset());
+							reparseRegion(doc, regionsIt,
+									element.getStartOffset());
 						}
 						PHPStructuredTextViewer textViewer = (PHPStructuredTextViewer) getTextViewer();
 						textViewer.reconcile();
@@ -1105,8 +1107,7 @@
 													false, null));
 							contentAssistant
 									.setAutoActivationDelay(preferencesService
-											.getInt(
-													PHPCorePlugin.ID,
+											.getInt(PHPCorePlugin.ID,
 													PHPCoreConstants.CODEASSIST_AUTOACTIVATION_DELAY,
 													0, null));
 							contentAssistant
@@ -1174,9 +1175,11 @@
 		 */
 		boolean foldingEnabled = PHPUiPlugin.getDefault().getPreferenceStore()
 				.getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
-		SSEUIPlugin.getDefault().getPreferenceStore().setValue(
-				AbstractStructuredFoldingStrategy.FOLDING_ENABLED,
-				foldingEnabled);
+		SSEUIPlugin
+				.getDefault()
+				.getPreferenceStore()
+				.setValue(AbstractStructuredFoldingStrategy.FOLDING_ENABLED,
+						foldingEnabled);
 		setDocumentProvider(DLTKUIPlugin.getDocumentProvider());
 	}
 
@@ -2024,11 +2027,11 @@
 		markAsCursorDependentAction(
 				IScriptEditorActionDefinitionIds.OPEN_HIERARCHY, true);
 
-		ResourceAction resAction = new TextOperationAction(DLTKEditorMessages
-				.getBundleForConstructedKeys(),
+		ResourceAction resAction = new TextOperationAction(
+				DLTKEditorMessages.getBundleForConstructedKeys(),
 				"ShowPHPDoc.", this, ISourceViewer.INFORMATION, true); //$NON-NLS-1$
-		resAction = new InformationDispatchAction(DLTKEditorMessages
-				.getBundleForConstructedKeys(),
+		resAction = new InformationDispatchAction(
+				DLTKEditorMessages.getBundleForConstructedKeys(),
 				"ShowPHPDoc.", (TextOperationAction) resAction); //$NON-NLS-1$
 		resAction
 				.setActionDefinitionId(IPHPEditorActionDefinitionIds.SHOW_PHPDOC);
@@ -2283,7 +2286,7 @@
 		fEditorSelectionChangedListener.install(getSelectionProvider());
 		PlatformUI.getWorkbench().addWindowListener(fActivationListener);
 
-		setHelpContextId("editor_preferences");//$NON-NLS-1$
+		setHelpContextId(IPHPHelpContextIds.EDITOR_PREFERENCES);//$NON-NLS-1$
 	}
 
 	private void refreshViewer() {
@@ -2712,8 +2715,8 @@
 							ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
 				}
 			} else
-				sourceViewer.setTextHover(configuration.getTextHover(
-						sourceViewer, t), t);
+				sourceViewer.setTextHover(
+						configuration.getTextHover(sourceViewer, t), t);
 		}
 	}
 
@@ -2754,6 +2757,16 @@
 				return provider;
 			}
 		}
+		if (getEditorInput() instanceof RefactorableFileEditorInput) {
+			return super.getDocumentProvider();
+		}
+		if (getEditorInput() instanceof IStorageEditorInput) {
+			IDocumentProvider provider = StorageModelProvider.getInstance();
+			if (provider != null) {
+				return provider;
+			}
+		}
+
 		return super.getDocumentProvider();
 	}
 
@@ -2780,8 +2793,8 @@
 	public void aboutToBeReconciled() {
 
 		// Notify AST provider
-		PHPUiPlugin.getDefault().getASTProvider().aboutToBeReconciled(
-				(ISourceModule) getModelElement());
+		PHPUiPlugin.getDefault().getASTProvider()
+				.aboutToBeReconciled((ISourceModule) getModelElement());
 
 		// Notify listeners
 		Object[] listeners = fReconcilingListeners.getListeners();
@@ -2960,8 +2973,8 @@
 
 		OccurrenceLocation[] locations = null;
 
-		ASTNode selectedNode = NodeFinder.perform(astRoot, selection
-				.getOffset(), selection.getLength());
+		ASTNode selectedNode = NodeFinder.perform(astRoot,
+				selection.getOffset(), selection.getLength());
 
 		if (locations == null && fMarkExceptions) {
 			// TODO : Implement Me!
Index: src/org/eclipse/php/internal/ui/editor/SemanticHighlightingManager.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/SemanticHighlightingManager.java,v
retrieving revision 1.6
diff -u -r1.6 SemanticHighlightingManager.java
--- src/org/eclipse/php/internal/ui/editor/SemanticHighlightingManager.java	30 Nov 2009 13:39:21 -0000	1.6
+++ src/org/eclipse/php/internal/ui/editor/SemanticHighlightingManager.java	15 Jan 2012 03:30:30 -0000
@@ -28,7 +28,7 @@
 
 	private List<AbstractSemanticHighlighting> rules = new LinkedList<AbstractSemanticHighlighting>();
 
-	private Map<String, AbstractSemanticHighlighting> highlightings = new HashMap<String, AbstractSemanticHighlighting>();
+	private Map<String, AbstractSemanticHighlighting> highlightings = new LinkedHashMap<String, AbstractSemanticHighlighting>();
 
 	public synchronized static SemanticHighlightingManager getInstance() {
 		if (instance == null) {
@@ -99,18 +99,18 @@
 		for (AbstractSemanticHighlighting rule : semanticHighlightings) {
 			rule.initDefaultPreferences();
 			SemanticHighlightingStyle style = rule.getStyle();
-			setDefaultAndFireEvent(store, rule.getColorPreferenceKey(), style
-					.getDefaultTextColor());
-			store.setDefault(rule.getBoldPreferenceKey(), style
-					.isBoldByDefault());
-			store.setDefault(rule.getItalicPreferenceKey(), style
-					.isItalicByDefault());
-			store.setDefault(rule.getStrikethroughPreferenceKey(), style
-					.isStrikethroughByDefault());
-			store.setDefault(rule.getUnderlinePreferenceKey(), style
-					.isUnderlineByDefault());
-			store.setDefault(rule.getEnabledPreferenceKey(), style
-					.isEnabledByDefault());
+			setDefaultAndFireEvent(store, rule.getColorPreferenceKey(),
+					style.getDefaultTextColor());
+			store.setDefault(rule.getBoldPreferenceKey(),
+					style.isBoldByDefault());
+			store.setDefault(rule.getItalicPreferenceKey(),
+					style.isItalicByDefault());
+			store.setDefault(rule.getStrikethroughPreferenceKey(),
+					style.isStrikethroughByDefault());
+			store.setDefault(rule.getUnderlinePreferenceKey(),
+					style.isUnderlineByDefault());
+			store.setDefault(rule.getEnabledPreferenceKey(),
+					style.isEnabledByDefault());
 		}
 		return this;
 	}
Index: src/org/eclipse/php/internal/ui/editor/configuration/PHPStructuredPresentationReconciler.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/configuration/PHPStructuredPresentationReconciler.java,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 PHPStructuredPresentationReconciler.java
--- src/org/eclipse/php/internal/ui/editor/configuration/PHPStructuredPresentationReconciler.java	1 Oct 2010 08:09:22 -0000	1.1.2.5
+++ src/org/eclipse/php/internal/ui/editor/configuration/PHPStructuredPresentationReconciler.java	15 Jan 2012 03:30:30 -0000
@@ -28,7 +28,8 @@
 				ITypedRegion r = wholePartitions[i];
 				if (wholePartitions[i].getType().equals(
 						originalRegion.getType())) {
-					jumpto = getFollowingCSS(wholePartitions, i);
+					jumpto = getFollowingCSS(wholePartitions, i,
+							originalRegion.getType());
 					r = new SimpleStructuredTypedRegion(r.getOffset(),
 							wholePartitions[jumpto].getOffset()
 									+ wholePartitions[jumpto].getLength()
@@ -70,6 +71,7 @@
 					document, getDocumentPartitioning(), damage.getOffset(),
 					validLength, false);
 
+			if (containSpecialType(partitions)) {
 			// when modify editor content the damage region is not equal to
 			// document's region,so we need to adjust the damage region's start
 			// and length
@@ -97,21 +99,18 @@
 
 			}
 
-			Set<StyleRange> fRangeSet = new HashSet<StyleRange>();
+			List<StyleRange> fRangeSet = new LinkedList<StyleRange>();
 
 			int jumpto = -1;
 			for (int i = 0; i < partitions.length; i++) {
 				ITypedRegion r = partitions[i];
-				// IPresentationRepairer repairer = getRepairer(r.getType());
-				// if (repairer != null)
-				// repairer.createPresentation(presentation, r);
-				if (r.getType().equals(CSS_STYLE)) {
+				if (fTypeSet.contains(r.getType())) {
 					if (i > jumpto) {
-						jumpto = getFollowingCSS(partitions, i);
+						jumpto = getFollowingCSS(partitions, i, r.getType());
 						r = new SimpleStructuredTypedRegion(r.getOffset(),
 								partitions[jumpto].getOffset()
 										+ partitions[jumpto].getLength()
-										- r.getOffset(), CSS_STYLE);
+										- r.getOffset(), r.getType());
 						IPresentationRepairer repairer = getRepairer(r
 								.getType());
 						if (repairer != null) {
@@ -223,6 +222,9 @@
 
 				}
 			}
+			if (fRangeSet.isEmpty()) {
+				return null;
+			}
 			List<StyleRange> fRanges = new ArrayList<StyleRange>();
 			for (Iterator iterator = fRangeSet.iterator(); iterator.hasNext();) {
 				StyleRange styleRange = (StyleRange) iterator.next();
@@ -264,6 +266,15 @@
 
 			}
 			return presentation;
+			 } else {
+			 for (int i = 0; i < partitions.length; i++) {
+			 ITypedRegion r = partitions[i];
+			 IPresentationRepairer repairer = getRepairer(r.getType());
+			 if (repairer != null)
+			 repairer.createPresentation(presentation, r);
+			 }
+			 return presentation;
+			 }
 
 		} catch (BadLocationException x) {
 			/* ignored in platform PresentationReconciler, too */
@@ -271,6 +282,16 @@
 		return null;
 	}
 
+	private boolean containSpecialType(ITypedRegion[] partitions) {
+		for (int i = 0; i < partitions.length; i++) {
+			ITypedRegion r = partitions[i];
+			if (fTypeSet.contains(r.getType())) {
+				return true;
+			}
+		}
+		return false;
+	}
+
 	private void addStyleRange(TextPresentation presentation,
 			StyleRange styleRange) {
 		if (styleRange.length > 0) {
@@ -312,14 +333,14 @@
 	// return null;
 	// }
 
-	private int getFollowingCSS(ITypedRegion[] partitions, int i) {
+	private int getFollowingCSS(ITypedRegion[] partitions, int i, String type) {
 		int result = i;
 		i++;
 		for (; i < partitions.length; i = i + 2) {
 			if (i + 1 < partitions.length
 					&& partitions[i].getType().equals(
 							PHPPartitionTypes.PHP_DEFAULT)
-					&& partitions[i + 1].getType().equals(CSS_STYLE)) {
+					&& partitions[i + 1].getType().equals(type)) {
 				result = result + 2;
 			} else {
 				break;
Index: src/org/eclipse/php/internal/ui/editor/highlighter/AbstractSemanticHighlighting.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighter/AbstractSemanticHighlighting.java,v
retrieving revision 1.2.4.9
diff -u -r1.2.4.9 AbstractSemanticHighlighting.java
--- src/org/eclipse/php/internal/ui/editor/highlighter/AbstractSemanticHighlighting.java	1 Oct 2010 09:03:19 -0000	1.2.4.9
+++ src/org/eclipse/php/internal/ui/editor/highlighter/AbstractSemanticHighlighting.java	15 Jan 2012 03:30:30 -0000
@@ -101,7 +101,7 @@
 		return new Position[0];
 	}
 
-	protected Program getProgram(IStructuredDocumentRegion region) {
+	protected Program getProgram(final IStructuredDocumentRegion region) {
 		// resolve current sourceModule
 		PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
 			public void run() {
@@ -111,7 +111,8 @@
 					if (editor instanceof PHPStructuredEditor) {
 						PHPStructuredEditor phpStructuredEditor = (PHPStructuredEditor) editor;
 						if (phpStructuredEditor.getTextViewer() != null
-								&& phpStructuredEditor != null) {
+								&& phpStructuredEditor.getDocument().equals(
+										region.getParentDocument())) {
 							sourceModule = (ISourceModule) phpStructuredEditor
 									.getModelElement();
 						}
Index: src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java,v
retrieving revision 1.2.4.3
diff -u -r1.2.4.3 DeprecatedHighlighting.java
--- src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java	9 Jul 2010 06:03:38 -0000	1.2.4.3
+++ src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java	15 Jan 2012 03:30:31 -0000
@@ -90,15 +90,20 @@
 				IModelAccessCache cache = funcInv.getAST().getBindingResolver()
 						.getModelAccessCache();
 				if (cache != null) {
-					Collection<IMethod> functions = cache.getGlobalFunctions(
-							getSourceModule(),
-							ModelUtils.getFunctionName(funcInv
-									.getFunctionName()), null);
-					if (functions != null) {
-						for (IMethod function : functions) {
-							if (ModelUtils.isDeprecated(function)) {
-								highlight(funcInv.getFunctionName());
-								break;
+					String functionName = ModelUtils.getFunctionName(funcInv
+							.getFunctionName());
+					// functionName will be null if the function call looks like
+					// ${func}(&$this),the ${func} is type of ReflectionVariable
+					if (functionName != null) {
+						Collection<IMethod> functions = cache
+								.getGlobalFunctions(getSourceModule(),
+										functionName, null);
+						if (functions != null) {
+							for (IMethod function : functions) {
+								if (ModelUtils.isDeprecated(function)) {
+									highlight(funcInv.getFunctionName());
+									break;
+								}
 							}
 						}
 					}
@@ -120,7 +125,7 @@
 
 	@Override
 	public int getPriority() {
-		return 12;
+		return 120;
 	}
 
 	public String getDisplayName() {
Index: src/org/eclipse/php/internal/ui/editor/highlighters/StaticFieldHighlighting.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/StaticFieldHighlighting.java,v
retrieving revision 1.2
diff -u -r1.2 StaticFieldHighlighting.java
--- src/org/eclipse/php/internal/ui/editor/highlighters/StaticFieldHighlighting.java	6 Dec 2009 16:35:33 -0000	1.2
+++ src/org/eclipse/php/internal/ui/editor/highlighters/StaticFieldHighlighting.java	15 Jan 2012 03:30:31 -0000
@@ -67,14 +67,15 @@
 	}
 
 	@Override
+	public int getPriority() {
+		return 110;
+	}
+
+	@Override
 	public void initDefaultPreferences() {
 		getStyle().setItalicByDefault(true).setDefaultTextColor(0, 0, 192);
 	}
 
-	/*
-	 * @Override public int getPriority() { return 100; }
-	 */
-
 	public String getDisplayName() {
 		return "Static fields";
 	}
Index: src/org/eclipse/php/internal/ui/editor/hover/PHPDocumentationHover.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/hover/PHPDocumentationHover.java,v
retrieving revision 1.8.2.3
diff -u -r1.8.2.3 PHPDocumentationHover.java
--- src/org/eclipse/php/internal/ui/editor/hover/PHPDocumentationHover.java	12 Sep 2010 21:59:56 -0000	1.8.2.3
+++ src/org/eclipse/php/internal/ui/editor/hover/PHPDocumentationHover.java	15 Jan 2012 03:30:31 -0000
@@ -36,9 +36,10 @@
 import org.eclipse.php.internal.core.ast.nodes.*;
 import org.eclipse.php.internal.core.corext.dom.NodeFinder;
 import org.eclipse.php.internal.ui.PHPUiPlugin;
-import org.eclipse.php.internal.ui.documentation.PHPElementLinks;
 import org.eclipse.php.internal.ui.documentation.PHPDocumentationContentAccess;
+import org.eclipse.php.internal.ui.documentation.PHPElementLinks;
 import org.eclipse.php.internal.ui.util.Messages;
+import org.eclipse.php.internal.ui.util.OpenBrowserUtil;
 import org.eclipse.php.ui.editor.SharedASTProvider;
 import org.eclipse.php.ui.editor.hover.IHoverMessageDecorator;
 import org.eclipse.php.ui.editor.hover.IPHPTextHover;
@@ -139,8 +140,7 @@
 
 			if (current != null && current.getNext() != null) {
 				setToolTipText(Messages
-						.format(
-								PHPHoverMessages.JavadocHover_forward_toElement_toolTip,
+						.format(PHPHoverMessages.JavadocHover_forward_toElement_toolTip,
 								BasicElementLabels.getJavaElementName(current
 										.getNext().getInputName())));
 				setEnabled(true);
@@ -177,8 +177,8 @@
 
 			try {
 				// FIXME: add hover location to editor navigation history?
-				IEditorPart editor = EditorUtility.openInEditor(infoInput
-						.getElement(), true);
+				IEditorPart editor = EditorUtility.openInEditor(
+						infoInput.getElement(), true);
 				EditorUtility.revealInEditor(editor, infoInput.getElement());
 			} catch (PartInitException e) {
 				PHPUiPlugin.log(e);
@@ -450,7 +450,7 @@
 						// hide, rather than dispose
 
 						// open external links in real browser:
-						//OpenBrowserUtil.open(url, display, ""); //$NON-NLS-1$
+						OpenBrowserUtil.open(url, display); //$NON-NLS-1$
 
 						return true;
 					}
@@ -561,8 +561,8 @@
 				if (curr instanceof IMember
 						|| curr.getElementType() == IModelElement.FIELD) {
 					// FIXME: provide links
-					HTMLPrinter.addBullet(buffer, getInfoText(curr,
-							constantValue, false));
+					HTMLPrinter.addBullet(buffer,
+							getInfoText(curr, constantValue, false));
 					hasContents = true;
 				}
 				HTMLPrinter.endBulletList(buffer);
@@ -573,8 +573,8 @@
 			element = elements[0];
 			if (element instanceof IMember) {
 				IMember member = (IMember) element;
-				HTMLPrinter.addSmallHeader(buffer, getInfoText(member,
-						constantValue, true));
+				HTMLPrinter.addSmallHeader(buffer,
+						getInfoText(member, constantValue, true));
 				Reader reader = null;
 				try {
 					reader = getHTMLContent(member);
@@ -587,8 +587,8 @@
 				hasContents = true;
 
 			} else if (element.getElementType() == IModelElement.FIELD) {
-				HTMLPrinter.addSmallHeader(buffer, getInfoText(element,
-						constantValue, true));
+				HTMLPrinter.addSmallHeader(buffer,
+						getInfoText(element, constantValue, true));
 				hasContents = true;
 			}
 			leadingImageWidth = 20;
@@ -762,8 +762,8 @@
 		if (styleSheetURL != null) {
 			BufferedReader reader = null;
 			try {
-				reader = new BufferedReader(new InputStreamReader(styleSheetURL
-						.openStream()));
+				reader = new BufferedReader(new InputStreamReader(
+						styleSheetURL.openStream()));
 				StringBuffer buffer = new StringBuffer(1500);
 				String line = reader.readLine();
 				while (line != null) {
Index: src/org/eclipse/php/internal/ui/explorer/PHPExplorerContentProvider.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/explorer/PHPExplorerContentProvider.java,v
retrieving revision 1.34.2.1
diff -u -r1.34.2.1 PHPExplorerContentProvider.java
--- src/org/eclipse/php/internal/ui/explorer/PHPExplorerContentProvider.java	3 Aug 2010 06:00:28 -0000	1.34.2.1
+++ src/org/eclipse/php/internal/ui/explorer/PHPExplorerContentProvider.java	15 Jan 2012 03:30:31 -0000
@@ -221,8 +221,7 @@
 									&& ((BuildPathContainer) modelElement)
 											.getBuildpathEntry()
 											.getPath()
-											.equals(
-													LanguageModelInitializer.LANGUAGE_CONTAINER_PATH)) {
+											.equals(LanguageModelInitializer.LANGUAGE_CONTAINER_PATH)) {
 								returnChlidren.add(modelElement);
 							}
 						}
@@ -446,6 +445,15 @@
 			return true;
 		}
 
+		@Override
+		public IProjectFragment[] getProjectFragments() {
+			try {
+				return super.getScriptProject().getProjectFragments();
+			} catch (ModelException e) {
+			}
+			return new IProjectFragment[0];
+		}
+
 		private PHPExplorerContentProvider getOuterType() {
 			return PHPExplorerContentProvider.this;
 		}
Index: src/org/eclipse/php/internal/ui/folding/StructuredTextFoldingProviderPHP.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/folding/StructuredTextFoldingProviderPHP.java,v
retrieving revision 1.27.2.4
diff -u -r1.27.2.4 StructuredTextFoldingProviderPHP.java
--- src/org/eclipse/php/internal/ui/folding/StructuredTextFoldingProviderPHP.java	30 Jul 2010 07:01:10 -0000	1.27.2.4
+++ src/org/eclipse/php/internal/ui/folding/StructuredTextFoldingProviderPHP.java	15 Jan 2012 03:30:32 -0000
@@ -469,6 +469,9 @@
 			if (ast == null)
 				return false; // can't compute
 
+			if (!(ast.getResource() instanceof IFile)) {
+				return false;
+			}
 			final IFile resource = (IFile) ast.getResource();
 
 			IDocument document = getDocument();
@@ -1846,8 +1849,8 @@
 	 * #collapseElements(org.eclipse.jdt.core.IModelElement[])
 	 */
 	public final void collapseElements(IModelElement[] elements) {
-		Set<IModelElement> set = new HashSet<IModelElement>(Arrays
-				.asList(elements));
+		Set<IModelElement> set = new HashSet<IModelElement>(
+				Arrays.asList(elements));
 		modifyFiltered(new PhpElementSetFilter(set, false), false);
 	}
 
@@ -1857,8 +1860,8 @@
 	 * #expandElements(org.eclipse.jdt.core.IModelElement[])
 	 */
 	public final void expandElements(IModelElement[] elements) {
-		Set<IModelElement> set = new HashSet<IModelElement>(Arrays
-				.asList(elements));
+		Set<IModelElement> set = new HashSet<IModelElement>(
+				Arrays.asList(elements));
 		modifyFiltered(new PhpElementSetFilter(set, true), true);
 	}
 
@@ -1897,8 +1900,8 @@
 			}
 		}
 
-		model.modifyAnnotations(null, null, modified
-				.toArray(new Annotation[modified.size()]));
+		model.modifyAnnotations(null, null,
+				modified.toArray(new Annotation[modified.size()]));
 	}
 
 	/*
Index: src/org/eclipse/php/internal/ui/preferences/NewPHPManualSiteDialog.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/preferences/NewPHPManualSiteDialog.java,v
retrieving revision 1.13.6.1
diff -u -r1.13.6.1 NewPHPManualSiteDialog.java
--- src/org/eclipse/php/internal/ui/preferences/NewPHPManualSiteDialog.java	3 Aug 2010 06:00:25 -0000	1.13.6.1
+++ src/org/eclipse/php/internal/ui/preferences/NewPHPManualSiteDialog.java	15 Jan 2012 03:30:33 -0000
@@ -426,11 +426,14 @@
 		try {
 			FileReader r = new FileReader(chmFile);
 			try {
-				r.read(buf);
-
-				Matcher m = LANG_DETECT_PATTERN.matcher(new String(buf));
-				if (m.find()) {
-					suffix.append(m.group(1));
+				int size = r.read(buf);
+				while (size > 0) {
+					Matcher m = LANG_DETECT_PATTERN.matcher(new String(buf));
+					if (m.find()) {
+						suffix.append(m.group(1));
+						break;
+					}
+					size = r.read(buf);
 				}
 			} finally {
 				r.close();
Index: src/org/eclipse/php/internal/ui/preferences/PHPSyntaxColoringPage.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/preferences/PHPSyntaxColoringPage.java,v
retrieving revision 1.10.4.3
diff -u -r1.10.4.3 PHPSyntaxColoringPage.java
--- src/org/eclipse/php/internal/ui/preferences/PHPSyntaxColoringPage.java	3 Aug 2010 06:00:25 -0000	1.10.4.3
+++ src/org/eclipse/php/internal/ui/preferences/PHPSyntaxColoringPage.java	15 Jan 2012 03:30:34 -0000
@@ -188,8 +188,8 @@
 				.getFirstStructuredDocumentRegion();
 		while (documentRegion != null) {
 			final Collection<StyleRange> holdResults = new ArrayList<StyleRange>();
-			fStyleProvider.prepareTextRegions(documentRegion, 0, documentRegion
-					.getEnd(), holdResults);
+			fStyleProvider.prepareTextRegions(documentRegion, 0,
+					documentRegion.getEnd(), holdResults);
 
 			for (Iterator<StyleRange> iter = holdResults.iterator(); iter
 					.hasNext();) {
@@ -225,9 +225,9 @@
 	}
 
 	private StyleRange createStyleRange(TextAttribute attr, Position position) {
-		StyleRange result = new StyleRange(position.getOffset(), position
-				.getLength(), attr.getForeground(), attr.getBackground(), attr
-				.getStyle());
+		StyleRange result = new StyleRange(position.getOffset(),
+				position.getLength(), attr.getForeground(),
+				attr.getBackground(), attr.getStyle());
 		if ((attr.getStyle() & TextAttribute.UNDERLINE) != 0) {
 			result.underline = true;
 			result.fontStyle &= ~TextAttribute.UNDERLINE;
@@ -275,8 +275,11 @@
 		fDefaultBackground = parent.getDisplay().getSystemColor(
 				SWT.COLOR_LIST_BACKGROUND);
 		Composite pageComponent = createComposite(parent, 2);
-		PlatformUI.getWorkbench().getHelpSystem().setHelp(pageComponent,
-				IPHPHelpContextIds.SYNTAX_COLORING_PREFERENCES);
+		PlatformUI
+				.getWorkbench()
+				.getHelpSystem()
+				.setHelp(pageComponent,
+						IPHPHelpContextIds.SYNTAX_COLORING_PREFERENCES);
 
 		Link link = new Link(pageComponent, SWT.WRAP);
 		link.setText(SSEUIMessages.SyntaxColoring_Link);
@@ -401,8 +404,11 @@
 
 		top.setWeights(new int[] { 2, 1 });
 		editor.setWeights(new int[] { 1, 1 });
-		PlatformUI.getWorkbench().getHelpSystem().setHelp(pageComponent,
-				IPHPHelpContextIds.SYNTAX_COLORING_PREFERENCES);
+		PlatformUI
+				.getWorkbench()
+				.getHelpSystem()
+				.setHelp(pageComponent,
+						IPHPHelpContextIds.SYNTAX_COLORING_PREFERENCES);
 
 		fStylesViewer.setInput(getStylePreferenceKeys());
 
@@ -435,8 +441,8 @@
 					if (SemanticHighlightingManager.getInstance()
 							.getSemanticHighlightings().containsKey(namedStyle)) {
 						AbstractSemanticHighlighting semanticHighlighting = SemanticHighlightingManager
-								.getInstance().getSemanticHighlightings().get(
-										namedStyle);
+								.getInstance().getSemanticHighlightings()
+								.get(namedStyle);
 						String oldValue = getOverlayStore().getString(
 								semanticHighlighting.getColorPreferenceKey());
 						String newValue = ColorHelper
@@ -520,8 +526,8 @@
 				if (SemanticHighlightingManager.getInstance()
 						.getSemanticHighlightings().containsKey(namedStyle)) {
 					AbstractSemanticHighlighting semanticHighlighting = SemanticHighlightingManager
-							.getInstance().getSemanticHighlightings().get(
-									namedStyle);
+							.getInstance().getSemanticHighlightings()
+							.get(namedStyle);
 					String oldValue = getOverlayStore().getString(
 							semanticHighlighting.getBoldPreferenceKey());
 					String newValue = String.valueOf(fBold.getSelection());
@@ -565,8 +571,8 @@
 				if (SemanticHighlightingManager.getInstance()
 						.getSemanticHighlightings().containsKey(namedStyle)) {
 					AbstractSemanticHighlighting semanticHighlightingType = SemanticHighlightingManager
-							.getInstance().getSemanticHighlightings().get(
-									namedStyle);
+							.getInstance().getSemanticHighlightings()
+							.get(namedStyle);
 					String oldValue = getOverlayStore().getString(
 							semanticHighlightingType.getItalicPreferenceKey());
 					String newValue = String.valueOf(fItalic.getSelection());
@@ -609,8 +615,8 @@
 				if (SemanticHighlightingManager.getInstance()
 						.getSemanticHighlightings().containsKey(namedStyle)) {
 					AbstractSemanticHighlighting semanticHighlighting = SemanticHighlightingManager
-							.getInstance().getSemanticHighlightings().get(
-									namedStyle);
+							.getInstance().getSemanticHighlightings()
+							.get(namedStyle);
 					String oldValue = getOverlayStore().getString(
 							semanticHighlighting
 									.getStrikethroughPreferenceKey());
@@ -656,8 +662,8 @@
 				if (SemanticHighlightingManager.getInstance()
 						.getSemanticHighlightings().containsKey(namedStyle)) {
 					AbstractSemanticHighlighting semanticHighlighting = SemanticHighlightingManager
-							.getInstance().getSemanticHighlightings().get(
-									namedStyle);
+							.getInstance().getSemanticHighlightings()
+							.get(namedStyle);
 					String oldValue = getOverlayStore().getString(
 							semanticHighlighting.getUnderlinePreferenceKey());
 					String newValue = String.valueOf(fUnderline.getSelection());
@@ -700,8 +706,8 @@
 				if (SemanticHighlightingManager.getInstance()
 						.getSemanticHighlightings().containsKey(namedStyle)) {
 					AbstractSemanticHighlighting semanticHighlighting = SemanticHighlightingManager
-							.getInstance().getSemanticHighlightings().get(
-									namedStyle);
+							.getInstance().getSemanticHighlightings()
+							.get(namedStyle);
 					getOverlayStore().setToDefault(
 							semanticHighlighting.getBoldPreferenceKey());
 					getOverlayStore().setToDefault(
@@ -745,6 +751,8 @@
 					switchEnablement(enablement);
 					getOverlayStore().setValue(
 							semantic.getEnabledPreferenceKey(), enablement);
+					applyStyles();
+					fText.redraw();
 
 				} else if (getStylePreferenceKeys().contains(namedStyle)) {
 					boolean enablement = fEnabler.getSelection();
@@ -753,6 +761,8 @@
 							PreferenceConstants
 									.getEnabledPreferenceKey(namedStyle),
 							enablement);
+					applyStyles();
+					fText.redraw();
 				}
 			}
 
@@ -843,8 +853,8 @@
 				else if (SemanticHighlightingManager.getInstance()
 						.getSemanticHighlightings().containsKey(element)) {
 					AbstractSemanticHighlighting semanticHighlighting = SemanticHighlightingManager
-							.getInstance().getSemanticHighlightings().get(
-									element);
+							.getInstance().getSemanticHighlightings()
+							.get(element);
 					return semanticHighlighting.getDisplayName();
 				}
 				return super.getText(element);
@@ -901,8 +911,8 @@
 			if (SemanticHighlightingManager.getInstance()
 					.getSemanticHighlightings().containsKey(namedStyle)) {
 				AbstractSemanticHighlighting semanticHighlightingType = SemanticHighlightingManager
-						.getInstance().getSemanticHighlightings().get(
-								namedStyle);
+						.getInstance().getSemanticHighlightings()
+						.get(namedStyle);
 
 				int fontModifier = SWT.NORMAL;
 				boolean on = getOverlayStore().getBoolean(
@@ -929,8 +939,9 @@
 				String color = getOverlayStore().getString(
 						semanticHighlightingType.getColorPreferenceKey());
 				RGB foreground = ColorHelper.toRGB(color);
-				ta = new TextAttribute((foreground != null) ? EditorUtility
-						.getColor(foreground) : null, null, fontModifier);
+				ta = new TextAttribute(
+						(foreground != null) ? EditorUtility.getColor(foreground)
+								: null, null, fontModifier);
 				return ta;
 			}
 
@@ -966,8 +977,9 @@
 						fontModifier = fontModifier | TextAttribute.UNDERLINE;
 				}
 
-				ta = new TextAttribute((foreground != null) ? EditorUtility
-						.getColor(foreground) : null,
+				ta = new TextAttribute(
+						(foreground != null) ? EditorUtility.getColor(foreground)
+								: null,
 						(background != null) ? EditorUtility
 								.getColor(background) : null, fontModifier);
 			}
@@ -1294,7 +1306,7 @@
 						return DeprecatedHighlighting.class.getName();
 					}
 				});
-
+				Collections.sort(highlightings);
 				for (Iterator iterator = highlightings.iterator(); iterator
 						.hasNext();) {
 					AbstractSemanticHighlighting abstractSemanticHighlighting = (AbstractSemanticHighlighting) iterator
@@ -1559,16 +1571,16 @@
 			if (getBoolean(store, highlighting.getUnderlinePreferenceKey()))
 				style |= TextAttribute.UNDERLINE;
 
-			String rgbString = getString(store, highlighting
-					.getColorPreferenceKey());
+			String rgbString = getString(store,
+					highlighting.getColorPreferenceKey());
 			Color color = null;
 
 			if (rgbString != null)
 				color = EditorUtility.getColor(ColorHelper.toRGB(rgbString));
 			attribute = new TextAttribute(color, null, style);
 
-			boolean isEnabled = getBoolean(store, highlighting
-					.getEnabledPreferenceKey());
+			boolean isEnabled = getBoolean(store,
+					highlighting.getEnabledPreferenceKey());
 			highlightingStyle = new HighlightingStyle(attribute, isEnabled);
 		}
 		return highlightingStyle;
@@ -1747,8 +1759,7 @@
 			highlighting.setTextAttribute(new TextAttribute(oldAttr
 					.getForeground(), oldAttr.getBackground(),
 					eventValue ? oldAttr.getStyle() | styleAttribute : oldAttr
-							.getStyle()
-							& ~styleAttribute));
+							.getStyle() & ~styleAttribute));
 	}
 
 }
Index: src/org/eclipse/php/internal/ui/preferences/PreferenceConstants.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/preferences/PreferenceConstants.java,v
retrieving revision 1.51.2.3
diff -u -r1.51.2.3 PreferenceConstants.java
--- src/org/eclipse/php/internal/ui/preferences/PreferenceConstants.java	18 Aug 2010 03:16:40 -0000	1.51.2.3
+++ src/org/eclipse/php/internal/ui/preferences/PreferenceConstants.java	15 Jan 2012 03:30:34 -0000
@@ -258,8 +258,7 @@
 	 * </p>
 	 */
 	public static final String EDITOR_TASK_DEFAULT_COLOR = ColorHelper
-			.getColorString(124, 165, 213)
-			+ " | | true"; //$NON-NLS-1$
+			.getColorString(124, 165, 213) + " | | true"; //$NON-NLS-1$
 
 	/**
 	 * A named preference that controls if correction indicators are shown in
@@ -356,8 +355,7 @@
 	 * @return Foo
 	 */
 	public static final String EDITOR_PHPDOC_DEFAULT_COLOR = ColorHelper
-			.getColorString(127, 159, 191)
-			+ " | | true"; //$NON-NLS-1$
+			.getColorString(127, 159, 191) + " | | true"; //$NON-NLS-1$
 
 	/**
 	 * A named preference that holds the color for the PHP string
@@ -1150,7 +1148,7 @@
 		store.setDefault(getEnabledPreferenceKey(EDITOR_TASK_COLOR), true);
 		// PHP options
 		store.setDefault(PHPCoreConstants.PHP_OPTIONS_PHP_VERSION,
-				PHPVersion.PHP5.toString());
+				PHPVersion.PHP5_3.toString());
 		store.setDefault(PHPCoreConstants.PHP_OPTIONS_PHP_ROOT_CONTEXT, ""); //$NON-NLS-1$
 
 		// Smart home/end
Index: src/org/eclipse/php/internal/ui/preferences/includepath/PHPProjectsWorkbookPage.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/preferences/includepath/PHPProjectsWorkbookPage.java,v
retrieving revision 1.6
diff -u -r1.6 PHPProjectsWorkbookPage.java
--- src/org/eclipse/php/internal/ui/preferences/includepath/PHPProjectsWorkbookPage.java	2 Apr 2010 09:53:52 -0000	1.6
+++ src/org/eclipse/php/internal/ui/preferences/includepath/PHPProjectsWorkbookPage.java	15 Jan 2012 03:30:34 -0000
@@ -270,6 +270,20 @@
 				attrib.getParent().setAttribute(key, value);
 				selElements.remove(i);
 			}
+			// Remove the deleted project from buildpath
+			else if (elem instanceof BPListElement) {
+				BPListElement bpListElement = (BPListElement) elem;
+				IBuildpathEntry buildpathEntry = bpListElement
+						.getBuildpathEntry();
+				if (buildpathEntry.getEntryKind() == IBuildpathEntry.BPE_PROJECT) {
+					try {
+						BuildPathUtils.removeEntryFromBuildPath(
+								bpListElement.getScriptProject(),
+								buildpathEntry);
+					} catch (ModelException e) {
+					}
+				}
+			}
 		}
 		if (selElements.isEmpty()) {
 			fProjectsList.refresh();
@@ -368,8 +382,8 @@
 				selElement, fCurrJProject, fPageContainer != null);
 		int res = dialog.open();
 		if (res == Window.OK || res == AccessRulesDialog.SWITCH_PAGE) {
-			selElement.setAttribute(BPListElement.ACCESSRULES, dialog
-					.getAccessRules());
+			selElement.setAttribute(BPListElement.ACCESSRULES,
+					dialog.getAccessRules());
 			selElement.setAttribute(BPListElement.COMBINE_ACCESSRULES,
 					new Boolean(dialog.doCombineAccessRules()));
 			fProjectsList.refresh();
@@ -427,8 +441,7 @@
 					new ArrayContentProvider(),
 					labelProvider,
 					NewWizardMessages.ProjectsWorkbookPage_chooseProjects_message);
-			dialog
-					.setTitle(NewWizardMessages.ProjectsWorkbookPage_chooseProjects_title);
+			dialog.setTitle(NewWizardMessages.ProjectsWorkbookPage_chooseProjects_title);
 			dialog.setHelpAvailable(false);
 			if (dialog.open() == Window.OK) {
 				Object[] result = dialog.getResult();
@@ -436,8 +449,8 @@
 				for (int i = 0; i < result.length; i++) {
 					IScriptProject curr = (IScriptProject) result[i];
 					cpElements[i] = new BPListElement(fCurrJProject,
-							IBuildpathEntry.BPE_PROJECT, curr.getPath(), curr
-									.getResource(), false);
+							IBuildpathEntry.BPE_PROJECT, curr.getPath(),
+							curr.getResource(), false);
 				}
 				return cpElements;
 			}
Index: src/org/eclipse/php/internal/ui/projectoutlineview/ProjectOutlineGroups.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/projectoutlineview/ProjectOutlineGroups.java,v
retrieving revision 1.13.2.1
diff -u -r1.13.2.1 ProjectOutlineGroups.java
--- src/org/eclipse/php/internal/ui/projectoutlineview/ProjectOutlineGroups.java	3 Aug 2010 06:00:29 -0000	1.13.2.1
+++ src/org/eclipse/php/internal/ui/projectoutlineview/ProjectOutlineGroups.java	15 Jan 2012 03:30:35 -0000
@@ -154,7 +154,7 @@
 			case GROUP_CONSTANTS:
 				IField[] findFields = PhpModelAccess.getDefault().findFields(
 						null, MatchRule.PREFIX,
-						Modifiers.AccConstant | Modifiers.AccGlobal, 0, scope,
+						Modifiers.AccConstant, 0, scope,
 						null);
 				if (findFields != null) {
 					childrenList.addAll(Arrays.asList(findFields));
Index: src/org/eclipse/php/internal/ui/util/OpenBrowserUtil.java
===================================================================
RCS file: src/org/eclipse/php/internal/ui/util/OpenBrowserUtil.java
diff -N src/org/eclipse/php/internal/ui/util/OpenBrowserUtil.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/php/internal/ui/util/OpenBrowserUtil.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,86 @@
+package org.eclipse.php.internal.ui.util;
+
+import java.net.URL;
+
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.browser.IWebBrowser;
+import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
+
+public class OpenBrowserUtil {
+
+	/**
+	 * Opens the given url in the browser as choosen in the preferences.
+	 * 
+	 * @param url
+	 *            the URL
+	 * @param display
+	 *            the display
+	 * @since 3.6
+	 */
+	public static void open(final URL url, Display display) {
+		display.syncExec(new Runnable() {
+			public void run() {
+				internalOpen(url, false);
+			}
+		});
+	}
+
+	/**
+	 * Opens the given URL in an external browser.
+	 * 
+	 * @param url
+	 *            the URL
+	 * @param display
+	 *            the display
+	 * @since 3.6
+	 */
+	public static void openExternal(final URL url, Display display) {
+		display.syncExec(new Runnable() {
+			public void run() {
+				internalOpen(url, true);
+			}
+		});
+	}
+
+	private static void internalOpen(final URL url,
+			final boolean useExternalBrowser) {
+		BusyIndicator.showWhile(null, new Runnable() {
+			public void run() {
+				URL helpSystemUrl = PlatformUI.getWorkbench().getHelpSystem()
+						.resolve(url.toExternalForm(), true);
+				try {
+					IWorkbenchBrowserSupport browserSupport = PlatformUI
+							.getWorkbench().getBrowserSupport();
+					IWebBrowser browser;
+					if (useExternalBrowser)
+						browser = browserSupport.getExternalBrowser();
+					else
+						browser = browserSupport.createBrowser(null);
+					browser.openURL(helpSystemUrl);
+				} catch (PartInitException ex) {
+					// XXX: show dialog?
+					//										PHPUiPlugin.logErrorStatus("Opening Javadoc failed", ex.getStatus()); //$NON-NLS-1$
+				}
+			}
+		});
+	}
+
+	/**
+	 * DO NOT REMOVE, used in a product.
+	 * 
+	 * @param url
+	 *            the URL
+	 * @param display
+	 *            the display
+	 * @param title
+	 *            the title
+	 * @deprecated As of 3.6, replaced by {@link #open(URL, Display)}
+	 */
+	public static void open(final URL url, Display display, String title) {
+		open(url, display);
+	}
+
+}
Index: src/org/eclipse/php/internal/ui/wizards/DetectGroup.java
===================================================================
RCS file: src/org/eclipse/php/internal/ui/wizards/DetectGroup.java
diff -N src/org/eclipse/php/internal/ui/wizards/DetectGroup.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/php/internal/ui/wizards/DetectGroup.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,134 @@
+package org.eclipse.php.internal.ui.wizards;
+
+import java.util.Observable;
+import java.util.Observer;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.dltk.core.DLTKCore;
+import org.eclipse.dltk.core.environment.IEnvironment;
+import org.eclipse.dltk.core.environment.IFileHandle;
+import org.eclipse.dltk.internal.ui.wizards.NewWizardMessages;
+import org.eclipse.dltk.ui.DLTKUIPlugin;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+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.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+
+/**
+ * Show a warning when the project location contains files.
+ */
+public class DetectGroup extends Observable implements Observer,
+		SelectionListener {
+	private final Link fHintText;
+	private Label fIcon;
+	private boolean fDetect;
+	private LocationGroup fPHPLocationGroup;
+	private NameGroup fGroupName;
+
+	public DetectGroup(Composite parent, LocationGroup locationGroup,
+			NameGroup nameGroup) {
+		this.fPHPLocationGroup = locationGroup;
+		this.fGroupName = nameGroup;
+
+		Composite composite = new Composite(parent, SWT.None);
+		composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
+		GridLayout layout = new GridLayout(2, false);
+		layout.horizontalSpacing = 10;
+		composite.setLayout(layout);
+
+		fIcon = new Label(composite, SWT.LEFT);
+		fIcon.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
+		GridData gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
+		fIcon.setLayoutData(gridData);
+		fIcon.setVisible(false);
+
+		fHintText = new Link(composite, SWT.WRAP);
+		fHintText.setFont(composite.getFont());
+		gridData = new GridData(GridData.FILL, SWT.FILL, true, true);
+		gridData.widthHint = 520;
+		fHintText.setLayoutData(gridData);
+		fHintText
+				.setText(NewWizardMessages.ScriptProjectWizardFirstPage_DetectGroup_message);
+		fHintText.setVisible(false);
+	}
+
+	private boolean isValidProjectName(String name) {
+		if (name.length() == 0) {
+			return false;
+		}
+		final IWorkspace workspace = DLTKUIPlugin.getWorkspace();
+		return workspace.validateName(name, IResource.PROJECT).isOK()
+				&& workspace.getRoot().findMember(name) == null;
+	}
+
+	public void update(Observable o, Object arg) {
+		if (o instanceof LocationGroup) {
+			boolean oldDetectState = fDetect;
+			IPath location = fPHPLocationGroup.getLocation();
+			if (fPHPLocationGroup.isInWorkspace()) {
+				if (!isValidProjectName(fGroupName.getName())) {
+					fDetect = false;
+				} else {
+					IEnvironment environment = fPHPLocationGroup
+							.getEnvironment();
+					final IFileHandle directory = environment.getFile(location
+							.append(fGroupName.getName()));
+					fDetect = directory.isDirectory();
+				}
+			} else {
+				IEnvironment environment = fPHPLocationGroup.getEnvironment();
+				if (location.toPortableString().length() > 0) {
+					final IFileHandle directory = environment.getFile(location);
+					fDetect = directory.isDirectory()
+							&& directory.getPath().toFile().exists();
+				}
+			}
+			if (oldDetectState != fDetect) {
+				setChanged();
+				notifyObservers();
+				if (fDetect) {
+					fHintText.setVisible(true);
+					fIcon.setVisible(true);
+				} else {
+					fHintText.setVisible(false);
+					fIcon.setVisible(false);
+				}
+
+			}
+		}
+	}
+
+	public boolean mustDetect() {
+		return fDetect;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse
+	 * .swt.events.SelectionEvent)
+	 */
+	public void widgetSelected(SelectionEvent e) {
+		widgetDefaultSelected(e);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org
+	 * .eclipse.swt.events.SelectionEvent)
+	 */
+	public void widgetDefaultSelected(SelectionEvent e) {
+		if (DLTKCore.DEBUG) {
+			System.err.println("DetectGroup show compilancePreferencePage..."); //$NON-NLS-1$
+		}
+
+	}
+}
\ No newline at end of file
Index: src/org/eclipse/php/internal/ui/wizards/LocationGroup.java
===================================================================
RCS file: src/org/eclipse/php/internal/ui/wizards/LocationGroup.java
diff -N src/org/eclipse/php/internal/ui/wizards/LocationGroup.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/php/internal/ui/wizards/LocationGroup.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,254 @@
+package org.eclipse.php.internal.ui.wizards;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Observable;
+import java.util.Observer;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.dltk.core.environment.EnvironmentManager;
+import org.eclipse.dltk.core.environment.IEnvironment;
+import org.eclipse.dltk.core.internal.environment.LocalEnvironment;
+import org.eclipse.dltk.internal.ui.wizards.NewWizardMessages;
+import org.eclipse.dltk.internal.ui.wizards.dialogfields.*;
+import org.eclipse.dltk.ui.DLTKUIPlugin;
+import org.eclipse.dltk.ui.environment.IEnvironmentUI;
+import org.eclipse.php.internal.server.core.Server;
+import org.eclipse.php.internal.server.core.manager.ServersManager;
+import org.eclipse.php.internal.ui.PHPUIMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Request a location. Fires an event whenever the checkbox or the location
+ * field is changed, regardless of whether the change originates from the user
+ * or has been invoked programmatically.
+ */
+public class LocationGroup extends Observable implements Observer,
+		IStringButtonAdapter, IDialogFieldListener {
+	protected final SelectionButtonDialogField fWorkspaceRadio;
+	protected final SelectionButtonDialogField fExternalRadio;
+	protected final StringButtonDialogField fLocation;
+	// protected final ComboDialogField fEnvironment;
+	private IEnvironment[] environments;
+
+	private String fPreviousExternalLocation;
+	private int localEnv;
+	protected SelectionButtonDialogField fLocalServerRadio;
+	protected ComboDialogField fSeverLocationList;
+	private String[] docRootArray;
+	private NameGroup fNameGroup;
+	private Shell shell;
+
+	private static final String DIALOGSTORE_LAST_EXTERNAL_LOC = DLTKUIPlugin.PLUGIN_ID
+			+ ".last.external.project"; //$NON-NLS-1$
+
+	public LocationGroup(Composite composite, NameGroup nameGroup, Shell shell) {
+		this.fNameGroup = nameGroup;
+		this.shell = shell;
+
+		final int numColumns = 3;
+		final Group group = new Group(composite, SWT.None);
+		group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		group.setLayout(new GridLayout(numColumns, false));
+		group.setText(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_title);
+		fWorkspaceRadio = new SelectionButtonDialogField(SWT.RADIO);
+		fWorkspaceRadio.setDialogFieldListener(this);
+		fWorkspaceRadio
+				.setLabelText(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_workspace_desc);
+		fExternalRadio = new SelectionButtonDialogField(SWT.RADIO);
+		fExternalRadio.setDialogFieldListener(this);
+		fExternalRadio
+				.setLabelText(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_external_desc);
+		fLocation = new StringButtonDialogField(this);
+		fLocation.setDialogFieldListener(this);
+		fLocation
+				.setLabelText(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_locationLabel_desc);
+		fLocation
+				.setButtonLabel(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_browseButton_desc);
+		// fExternalRadio.attachDialogField(fLocation);
+		fWorkspaceRadio.setSelection(true);
+		fExternalRadio.setSelection(false);
+		fPreviousExternalLocation = ""; //$NON-NLS-1$
+		fWorkspaceRadio.doFillIntoGrid(group, numColumns);
+		fExternalRadio.doFillIntoGrid(group, numColumns);
+		fLocation.doFillIntoGrid(group, numColumns);
+		LayoutUtil.setHorizontalGrabbing(fLocation.getTextControl(null));
+		fExternalRadio.attachDialogFields(new DialogField[] { fLocation });
+
+		environments = EnvironmentManager.getEnvironments();
+		String[] items = new String[environments.length];
+		localEnv = 0;
+		for (int i = 0; i < items.length; i++) {
+			items[i] = environments[i].getName();
+			if (environments[i].isLocal()) {
+				localEnv = i;
+			}
+		}
+
+		createLocalServersGroup(group, numColumns);
+
+	}
+
+	/**
+	 * check if any of the server can provide local doc root.
+	 * 
+	 * @param group
+	 * @param numColumns
+	 */
+	protected void createLocalServersGroup(final Group group,
+			final int numColumns) {
+		Server[] servers = ServersManager.getServers();
+		List<String> docRoots = new ArrayList<String>();
+		for (int i = 0; i < servers.length; i++) {
+			String docRoot = servers[i].getDocumentRoot();
+			if (docRoot != null && !"".equals(docRoot.trim())) { //$NON-NLS-1$
+				docRoots.add(docRoot);
+			}
+		}
+
+		if (docRoots.size() > 0) {
+			fLocalServerRadio = new SelectionButtonDialogField(SWT.RADIO);
+			fLocalServerRadio.setDialogFieldListener(this);
+			fLocalServerRadio
+					.setLabelText(PHPUIMessages.PHPProjectWizardFirstPage_localServerLabel); //$NON-NLS-1$
+			fLocalServerRadio.setSelection(false);
+			fLocalServerRadio.doFillIntoGrid(group, numColumns);
+			fSeverLocationList = new ComboDialogField(SWT.READ_ONLY);
+			fSeverLocationList
+					.setLabelText(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_locationLabel_desc);
+			fSeverLocationList.doFillIntoGrid(group, numColumns);
+			fSeverLocationList.setEnabled(false);
+			docRootArray = new String[docRoots.size()];
+			docRoots.toArray(docRootArray);
+			fSeverLocationList.setItems(docRootArray);
+			fSeverLocationList.selectItem(0);
+			fLocalServerRadio.attachDialogField(fSeverLocationList);
+			fWorkspaceRadio.setSelection(false);
+			fLocalServerRadio.setSelection(true);
+		} else {
+			createNoLocalServersFound(group, numColumns);
+		}
+	}
+
+	/**
+	 * add proper GUI if there's no preconfigured local server
+	 * 
+	 * @param group
+	 * @param numColumns
+	 */
+	protected void createNoLocalServersFound(Group group, int numColumns) {
+		// empty
+	}
+
+	public boolean isInLocalServer() {
+		return fLocalServerRadio != null && fLocalServerRadio.isSelected();
+	}
+
+	protected void fireEvent() {
+		setChanged();
+		notifyObservers();
+	}
+
+	protected String getDefaultPath(String name) {
+		IEnvironment environment = this.getEnvironment();
+		if (environment != null && environment.isLocal()) {
+			final IPath path = Platform.getLocation().append(name);
+			return path.toOSString();
+		} else {
+			return ""; //$NON-NLS-1$
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
+	 */
+	public void update(Observable o, Object arg) {
+		if (isInWorkspace()) {
+			fLocation.setText(getDefaultPath(fNameGroup.getName()));
+		}
+		if (docRootArray != null && docRootArray.length > 0) {
+			int index = fSeverLocationList.getSelectionIndex();
+			String[] items = getDocItems(docRootArray);
+			fSeverLocationList.setItems(items);
+			fSeverLocationList.selectItem(index);
+		}
+
+		fireEvent();
+	}
+
+	private String[] getDocItems(String[] docRootArray) {
+		String[] items = new String[docRootArray.length];
+		for (int i = 0; i < docRootArray.length; i++) {
+			items[i] = docRootArray[i] + File.separator + fNameGroup.getName(); //$NON-NLS-1$
+		}
+		return items;
+	}
+
+	public IPath getLocation() {
+		if (isInWorkspace()) {
+			return Platform.getLocation();
+		}
+		if (isInLocalServer()) {
+			return new Path(fSeverLocationList.getText());
+		}
+		return new Path(fLocation.getText().trim());
+	}
+
+	public boolean isInWorkspace() {
+		return fWorkspaceRadio.isSelected();
+	}
+
+	public IEnvironment getEnvironment() {
+		if (fWorkspaceRadio.isSelected()) {
+			return EnvironmentManager
+					.getEnvironmentById(LocalEnvironment.ENVIRONMENT_ID);
+		}
+		// return environments[fEnvironment.getSelectionIndex()];
+		return environments[localEnv];
+	}
+
+	public void changeControlPressed(DialogField field) {
+		IEnvironment environment = getEnvironment();
+		IEnvironmentUI environmentUI = (IEnvironmentUI) environment
+				.getAdapter(IEnvironmentUI.class);
+		if (environmentUI != null) {
+			String selectedDirectory = environmentUI.selectFolder(shell);
+
+			if (selectedDirectory != null) {
+				fLocation.setText(selectedDirectory);
+				DLTKUIPlugin.getDefault().getDialogSettings()
+						.put(DIALOGSTORE_LAST_EXTERNAL_LOC, selectedDirectory);
+			}
+		}
+	}
+
+	public void dialogFieldChanged(DialogField field) {
+		if (field == fWorkspaceRadio) {
+			final boolean checked = fWorkspaceRadio.isSelected();
+			if (checked) {
+				fPreviousExternalLocation = fLocation.getText();
+				fLocation.setText(getDefaultPath(fNameGroup.getName()));
+			} else {
+				IEnvironment environment = this.getEnvironment();
+				if (environment != null && environment.isLocal()) {
+					fLocation.setText(fPreviousExternalLocation);
+				} else {
+					fLocation.setText(""); //$NON-NLS-1$
+				}
+			}
+		}
+
+		fireEvent();
+	}
+
+}
\ No newline at end of file
Index: src/org/eclipse/php/internal/ui/wizards/NameGroup.java
===================================================================
RCS file: src/org/eclipse/php/internal/ui/wizards/NameGroup.java
diff -N src/org/eclipse/php/internal/ui/wizards/NameGroup.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/php/internal/ui/wizards/NameGroup.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,60 @@
+package org.eclipse.php.internal.ui.wizards;
+
+import java.util.Observable;
+
+import org.eclipse.dltk.internal.ui.wizards.NewWizardMessages;
+import org.eclipse.dltk.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.dltk.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.eclipse.dltk.internal.ui.wizards.dialogfields.LayoutUtil;
+import org.eclipse.dltk.internal.ui.wizards.dialogfields.StringDialogField;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Request a project name. Fires an event whenever the text field is changed,
+ * regardless of its content.
+ */
+public final class NameGroup extends Observable implements IDialogFieldListener {
+	protected final StringDialogField fNameField;
+	private Shell shell;
+
+	public NameGroup(Composite composite, String initialName, Shell shell) {
+		this.shell = shell;
+		final Composite nameComposite = new Composite(composite, SWT.NONE);
+		nameComposite.setFont(composite.getFont());
+		nameComposite.setLayout(new GridLayout(2, false));
+		nameComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		// text field for project name
+		fNameField = new StringDialogField();
+		fNameField
+				.setLabelText(NewWizardMessages.ScriptProjectWizardFirstPage_NameGroup_label_text);
+		fNameField.setDialogFieldListener(this);
+		setName(initialName);
+		fNameField.doFillIntoGrid(nameComposite, 2);
+		LayoutUtil.setHorizontalGrabbing(fNameField.getTextControl(null));
+	}
+
+	protected void fireEvent() {
+		setChanged();
+		notifyObservers();
+	}
+
+	public String getName() {
+		return fNameField.getText().trim();
+	}
+
+	public void postSetFocus() {
+		fNameField.postSetFocusOnDialogField(shell.getDisplay());
+	}
+
+	public void setName(String name) {
+		fNameField.setText(name);
+	}
+
+	public void dialogFieldChanged(DialogField field) {
+		fireEvent();
+	}
+}
Index: src/org/eclipse/php/internal/ui/wizards/PHPFileCreationWizard.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/wizards/PHPFileCreationWizard.java,v
retrieving revision 1.19.4.3
diff -u -r1.19.4.3 PHPFileCreationWizard.java
--- src/org/eclipse/php/internal/ui/wizards/PHPFileCreationWizard.java	17 Aug 2010 05:49:22 -0000	1.19.4.3
+++ src/org/eclipse/php/internal/ui/wizards/PHPFileCreationWizard.java	15 Jan 2012 03:30:37 -0000
@@ -11,9 +11,7 @@
  *******************************************************************************/
 package org.eclipse.php.internal.ui.wizards;
 
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
 import java.lang.reflect.InvocationTargetException;
 
 import org.eclipse.core.resources.*;
@@ -194,8 +192,39 @@
 				contents = contents.replaceAll("(\n\r?|\r\n?)", lineSeparator); //$NON-NLS-1$
 			}
 
+			// Handle encoding other than system encoding
+			InputStream stream = null;
+			String charset = null;
+			if (file.exists()) {
+				charset = file.getCharset(true);
+			} else {
+				charset = container.getDefaultCharset(true);
+			}
+			if (charset != null && charset.length() > 0) {
+				ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+				OutputStreamWriter writer = null;
+				try {
+					writer = new OutputStreamWriter(bytes, charset);
+					writer.write(contents);
+					writer.close();
+					stream = new ByteArrayInputStream(bytes.toByteArray());
+				} catch (IOException e) {
+					Logger.logException(e);
+				} finally {
+					if (writer != null) {
+						try {
+							writer.close();
+						} catch(IOException e) {
+						}
+					}
+				}
+			}
+			if (stream == null) {
+				stream = openContentStream(contents);
+			}
+
 			try {
-				InputStream stream = openContentStream(contents);
+				// InputStream stream = openContentStream(contents);
 				if (file.exists()) {
 					file.setContents(stream, true, true, monitor);
 				} else {
Index: src/org/eclipse/php/internal/ui/wizards/PHPProjectWizardFirstPage.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/wizards/PHPProjectWizardFirstPage.java,v
retrieving revision 1.33.2.4
diff -u -r1.33.2.4 PHPProjectWizardFirstPage.java
--- src/org/eclipse/php/internal/ui/wizards/PHPProjectWizardFirstPage.java	9 Aug 2010 08:44:31 -0000	1.33.2.4
+++ src/org/eclipse/php/internal/ui/wizards/PHPProjectWizardFirstPage.java	15 Jan 2012 03:30:38 -0000
@@ -13,19 +13,17 @@
 
 import java.io.File;
 import java.net.URI;
-import java.util.*;
-import java.util.List;
+import java.util.Map;
+import java.util.Observable;
+import java.util.Observer;
 
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspace;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.*;
-import org.eclipse.dltk.core.DLTKCore;
 import org.eclipse.dltk.core.environment.EnvironmentManager;
 import org.eclipse.dltk.core.environment.IEnvironment;
-import org.eclipse.dltk.core.environment.IFileHandle;
-import org.eclipse.dltk.core.internal.environment.LocalEnvironment;
 import org.eclipse.dltk.internal.ui.wizards.NewWizardMessages;
 import org.eclipse.dltk.internal.ui.wizards.dialogfields.*;
 import org.eclipse.dltk.ui.DLTKUIPlugin;
@@ -34,8 +32,7 @@
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.php.internal.server.core.Server;
-import org.eclipse.php.internal.server.core.manager.ServersManager;
+import org.eclipse.php.internal.core.PHPVersion;
 import org.eclipse.php.internal.ui.IPHPHelpContextIds;
 import org.eclipse.php.internal.ui.PHPUIMessages;
 import org.eclipse.php.internal.ui.PHPUiPlugin;
@@ -83,8 +80,8 @@
 		composite.setLayout(initGridLayout(new GridLayout(1, false), false));
 		composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
 		// create UI elements
-		fNameGroup = new NameGroup(composite, fInitialName);
-		fPHPLocationGroup = new LocationGroup(composite);
+		fNameGroup = new NameGroup(composite, fInitialName, getShell());
+		fPHPLocationGroup = new LocationGroup(composite, fNameGroup, getShell());
 
 		CompositeData data = new CompositeData();
 		data.setParetnt(composite);
@@ -97,7 +94,7 @@
 		fLayoutGroup = new LayoutGroup(composite);
 		fJavaScriptSupportGroup = new JavaScriptSupportGroup(composite, this);
 
-		fDetectGroup = new DetectGroup(composite);
+		fDetectGroup = new DetectGroup(composite, fPHPLocationGroup, fNameGroup);
 
 		// establish connections
 		fNameGroup.addObserver(fPHPLocationGroup);
@@ -122,8 +119,8 @@
 	}
 
 	protected void setHelpContext(Composite parent) {
-		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
-				IPHPHelpContextIds.CREATING_PHP_PROJECTS);
+		PlatformUI.getWorkbench().getHelpSystem()
+				.setHelp(parent, IPHPHelpContextIds.CREATING_PHP_PROJECTS);
 	}
 
 	public URI getLocationURI() {
@@ -147,8 +144,8 @@
 	 * @return the new project resource handle
 	 */
 	public IProject getProjectHandle() {
-		return ResourcesPlugin.getWorkspace().getRoot().getProject(
-				fNameGroup.getName());
+		return ResourcesPlugin.getWorkspace().getRoot()
+				.getProject(fNameGroup.getName());
 	}
 
 	public String getProjectName() {
@@ -193,162 +190,6 @@
 	}
 
 	/**
-	 * Show a warning when the project location contains files.
-	 */
-	protected final class DetectGroup extends Observable implements Observer,
-			SelectionListener {
-		private final Link fHintText;
-		private Label fIcon;
-		private boolean fDetect;
-
-		public DetectGroup(Composite parent) {
-
-			Composite composite = new Composite(parent, SWT.NONE);
-			composite
-					.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-			GridLayout layout = new GridLayout(2, false);
-			layout.horizontalSpacing = 10;
-			composite.setLayout(layout);
-
-			fIcon = new Label(composite, SWT.LEFT);
-			fIcon.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
-			GridData gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
-			fIcon.setLayoutData(gridData);
-			fIcon.setVisible(false);
-
-			fHintText = new Link(composite, SWT.WRAP);
-			fHintText.setFont(composite.getFont());
-			gridData = new GridData(GridData.FILL, SWT.FILL, true, true);
-			gridData.widthHint = convertWidthInCharsToPixels(50);
-			gridData.heightHint = convertHeightInCharsToPixels(3);
-			fHintText.setLayoutData(gridData);
-		}
-
-		private boolean isValidProjectName(String name) {
-			if (name.length() == 0) {
-				return false;
-			}
-			final IWorkspace workspace = DLTKUIPlugin.getWorkspace();
-			return workspace.validateName(name, IResource.PROJECT).isOK()
-					&& workspace.getRoot().findMember(name) == null;
-		}
-
-		public void update(Observable o, Object arg) {
-			if (o instanceof LocationGroup) {
-				boolean oldDetectState = fDetect;
-				IPath location = fPHPLocationGroup.getLocation();
-				if (fPHPLocationGroup.isInWorkspace()) {
-					if (!isValidProjectName(getProjectName())) {
-						fDetect = false;
-					} else {
-						IEnvironment environment = fPHPLocationGroup
-								.getEnvironment();
-						final IFileHandle directory = environment
-								.getFile(location.append(getProjectName()));
-						fDetect = directory.isDirectory();
-					}
-				} else {
-					IEnvironment environment = fPHPLocationGroup
-							.getEnvironment();
-					if (location.toPortableString().length() > 0) {
-						final IFileHandle directory = environment
-								.getFile(location);
-						fDetect = directory.isDirectory();
-					}
-				}
-				if (oldDetectState != fDetect) {
-					setChanged();
-					notifyObservers();
-					if (fDetect) {
-						fHintText.setVisible(true);
-						fHintText
-								.setText(NewWizardMessages.ScriptProjectWizardFirstPage_DetectGroup_message);
-					} else {
-						fHintText.setVisible(false);
-					}
-
-				}
-			}
-		}
-
-		public boolean mustDetect() {
-			return fDetect;
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see
-		 * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse
-		 * .swt.events.SelectionEvent)
-		 */
-		public void widgetSelected(SelectionEvent e) {
-			widgetDefaultSelected(e);
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see
-		 * org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org
-		 * .eclipse.swt.events.SelectionEvent)
-		 */
-		public void widgetDefaultSelected(SelectionEvent e) {
-			if (DLTKCore.DEBUG) {
-				System.err
-						.println("DetectGroup show compilancePreferencePage..."); //$NON-NLS-1$
-			}
-
-		}
-	}
-
-	/**
-	 * Request a project name. Fires an event whenever the text field is
-	 * changed, regardless of its content.
-	 */
-	public final class NameGroup extends Observable implements
-			IDialogFieldListener {
-		protected final StringDialogField fNameField;
-
-		public NameGroup(Composite composite, String initialName) {
-			final Composite nameComposite = new Composite(composite, SWT.NONE);
-			nameComposite.setFont(composite.getFont());
-			nameComposite.setLayout(initGridLayout(new GridLayout(2, false),
-					true));
-			nameComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-			// text field for project name
-			fNameField = new StringDialogField();
-			fNameField
-					.setLabelText(NewWizardMessages.ScriptProjectWizardFirstPage_NameGroup_label_text);
-			fNameField.setDialogFieldListener(this);
-			setName(initialName);
-			fNameField.doFillIntoGrid(nameComposite, 2);
-			LayoutUtil.setHorizontalGrabbing(fNameField.getTextControl(null));
-		}
-
-		protected void fireEvent() {
-			setChanged();
-			notifyObservers();
-		}
-
-		public String getName() {
-			return fNameField.getText().trim();
-		}
-
-		public void postSetFocus() {
-			fNameField.postSetFocusOnDialogField(getShell().getDisplay());
-		}
-
-		public void setName(String name) {
-			fNameField.setText(name);
-		}
-
-		public void dialogFieldChanged(DialogField field) {
-			fireEvent();
-		}
-	}
-
-	/**
 	 * Validate this page and show appropriate warnings and error
 	 * NewWizardMessages.
 	 */
@@ -425,11 +266,18 @@
 				if (EnvironmentManager.isLocal(environment)) {
 					final IStatus locationStatus = workspace
 							.validateProjectLocation(handle, projectPath);
+					File file = projectPath.toFile();
 					if (!locationStatus.isOK()) {
 						setErrorMessage(locationStatus.getMessage());
 						setPageComplete(false);
 						return;
 					}
+
+					if (!canCreate(projectPath.toFile())) {
+						setErrorMessage(NewWizardMessages.ScriptProjectWizardFirstPage_Message_invalidDirectory);
+						setPageComplete(false);
+						return;
+					}
 				}
 			}
 
@@ -450,6 +298,16 @@
 		}
 	}
 
+	private boolean canCreate(File file) {
+		while (!file.exists()) {
+			file = file.getParentFile();
+			if (file == null)
+				return false;
+		}
+
+		return file.canWrite();
+	}
+
 	/**
 	 * GUI for controlling whether a new PHP project should include JavaScript
 	 * support or not
@@ -463,8 +321,8 @@
 		protected Button fEnableJavaScriptSupport;
 
 		public boolean shouldSupportJavaScript() {
-			return PHPUiPlugin.getDefault().getPreferenceStore().getBoolean(
-					(PreferenceConstants.JavaScriptSupportEnable));
+			return PHPUiPlugin.getDefault().getPreferenceStore()
+					.getBoolean((PreferenceConstants.JavaScriptSupportEnable));
 		}
 
 		public JavaScriptSupportGroup(Composite composite,
@@ -485,8 +343,8 @@
 					SWT.CENTER, false, false));
 			fEnableJavaScriptSupport.addSelectionListener(this);
 			fEnableJavaScriptSupport.setSelection(PHPUiPlugin.getDefault()
-					.getPreferenceStore().getBoolean(
-							(PreferenceConstants.JavaScriptSupportEnable)));
+					.getPreferenceStore()
+					.getBoolean((PreferenceConstants.JavaScriptSupportEnable)));
 		}
 
 		public void widgetDefaultSelected(SelectionEvent e) {
@@ -631,220 +489,12 @@
 	 * field is changed, regardless of whether the change originates from the
 	 * user or has been invoked programmatically.
 	 */
-	public class LocationGroup extends Observable implements Observer,
-			IStringButtonAdapter, IDialogFieldListener {
-		protected final SelectionButtonDialogField fWorkspaceRadio;
-		protected final SelectionButtonDialogField fExternalRadio;
-		protected final StringButtonDialogField fLocation;
-		// protected final ComboDialogField fEnvironment;
-		private IEnvironment[] environments;
-
-		private String fPreviousExternalLocation;
-		private int localEnv;
-		protected SelectionButtonDialogField fLocalServerRadio;
-		protected ComboDialogField fSeverLocationList;
-		private String[] docRootArray;
-
-		private static final String DIALOGSTORE_LAST_EXTERNAL_LOC = DLTKUIPlugin.PLUGIN_ID
-				+ ".last.external.project"; //$NON-NLS-1$
-
-		public LocationGroup(Composite composite) {
-			final int numColumns = 3;
-			final Group group = new Group(composite, SWT.None);
-			group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-			group.setLayout(initGridLayout(new GridLayout(numColumns, false),
-					true));
-			group.setText(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_title);
-			fWorkspaceRadio = new SelectionButtonDialogField(SWT.RADIO);
-			fWorkspaceRadio.setDialogFieldListener(this);
-			fWorkspaceRadio
-					.setLabelText(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_workspace_desc);
-			fExternalRadio = new SelectionButtonDialogField(SWT.RADIO);
-			fExternalRadio.setDialogFieldListener(this);
-			fExternalRadio
-					.setLabelText(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_external_desc);
-			fLocation = new StringButtonDialogField(this);
-			fLocation.setDialogFieldListener(this);
-			fLocation
-					.setLabelText(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_locationLabel_desc);
-			fLocation
-					.setButtonLabel(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_browseButton_desc);
-			// fExternalRadio.attachDialogField(fLocation);
-			fWorkspaceRadio.setSelection(true);
-			fExternalRadio.setSelection(false);
-			fPreviousExternalLocation = ""; //$NON-NLS-1$
-			fWorkspaceRadio.doFillIntoGrid(group, numColumns);
-			fExternalRadio.doFillIntoGrid(group, numColumns);
-			fLocation.doFillIntoGrid(group, numColumns);
-			LayoutUtil.setHorizontalGrabbing(fLocation.getTextControl(null));
-			fExternalRadio.attachDialogFields(new DialogField[] { fLocation });
-
-			environments = EnvironmentManager.getEnvironments();
-			String[] items = new String[environments.length];
-			localEnv = 0;
-			for (int i = 0; i < items.length; i++) {
-				items[i] = environments[i].getName();
-				if (environments[i].isLocal()) {
-					localEnv = i;
-				}
-			}
-
-			// check if any of the server can provide local doc root.
-
-			Server[] servers = ServersManager.getServers();
-			List<String> docRoots = new ArrayList<String>();
-			for (int i = 0; i < servers.length; i++) {
-				String docRoot = servers[i].getDocumentRoot();
-				String isLocal = servers[i].getAttribute(Server.LOCALSERVER,
-						null);
-				if (isLocal != null && docRoot != null
-						&& !"".equals(docRoot.trim())) { //$NON-NLS-1$
-					docRoots.add(docRoot);
-				}
-			}
-
-			if (docRoots.size() > 0) {
-				fLocalServerRadio = new SelectionButtonDialogField(SWT.RADIO);
-				fLocalServerRadio.setDialogFieldListener(this);
-				fLocalServerRadio
-						.setLabelText(PHPUIMessages.PHPProjectWizardFirstPage_localServerLabel); //$NON-NLS-1$
-				fLocalServerRadio.setSelection(false);
-				fLocalServerRadio.doFillIntoGrid(group, numColumns);
-				fSeverLocationList = new ComboDialogField(SWT.READ_ONLY);
-				fSeverLocationList
-						.setLabelText(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_locationLabel_desc);
-				fSeverLocationList.doFillIntoGrid(group, numColumns);
-				fSeverLocationList.setEnabled(false);
-				docRootArray = new String[docRoots.size()];
-				docRoots.toArray(docRootArray);
-				fSeverLocationList.setItems(docRootArray);
-				fSeverLocationList.selectItem(0);
-				fLocalServerRadio.attachDialogField(fSeverLocationList);
-				fWorkspaceRadio.setSelection(false);
-				fLocalServerRadio.setSelection(true);
-			}
-
-		}
-
-		public boolean isInLocalServer() {
-			return fLocalServerRadio != null && fLocalServerRadio.isSelected();
-		}
-
-		protected void fireEvent() {
-			setChanged();
-			notifyObservers();
-		}
-
-		protected String getDefaultPath(String name) {
-			IEnvironment environment = this.getEnvironment();
-			if (environment != null && environment.isLocal()) {
-				final IPath path = Platform.getLocation().append(name);
-				return path.toOSString();
-			} else {
-				return ""; //$NON-NLS-1$
-			}
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.util.Observer#update(java.util.Observable,
-		 * java.lang.Object)
-		 */
-		public void update(Observable o, Object arg) {
-			if (isInWorkspace()) {
-				fLocation.setText(getDefaultPath(fNameGroup.getName()));
-			}
-			if (docRootArray != null && docRootArray.length > 0) {
-				int index = fSeverLocationList.getSelectionIndex();
-				String[] items = getDocItems(docRootArray);
-				fSeverLocationList.setItems(items);
-				fSeverLocationList.selectItem(index);
-			}
-
-			fireEvent();
-		}
-
-		private String[] getDocItems(String[] docRootArray) {
-			String[] items = new String[docRootArray.length];
-			for (int i = 0; i < docRootArray.length; i++) {
-				items[i] = docRootArray[i] + File.separator
-						+ fNameGroup.getName(); //$NON-NLS-1$
-			}
-			return items;
-		}
-
-		public IPath getLocation() {
-			if (isInWorkspace()) {
-				return Platform.getLocation();
-			}
-			if (isInLocalServer()) {
-				return new Path(fSeverLocationList.getText());
-			}
-			return new Path(fLocation.getText().trim());
-		}
-
-		public boolean isInWorkspace() {
-			return fWorkspaceRadio.isSelected();
-		}
-
-		public IEnvironment getEnvironment() {
-			if (fWorkspaceRadio.isSelected()) {
-				return EnvironmentManager
-						.getEnvironmentById(LocalEnvironment.ENVIRONMENT_ID);
-			}
-			// return environments[fEnvironment.getSelectionIndex()];
-			return environments[localEnv];
-		}
-
-		public void changeControlPressed(DialogField field) {
-			IEnvironment environment = getEnvironment();
-			IEnvironmentUI environmentUI = (IEnvironmentUI) environment
-					.getAdapter(IEnvironmentUI.class);
-			if (environmentUI != null) {
-				String selectedDirectory = environmentUI
-						.selectFolder(getShell());
-
-				if (selectedDirectory != null) {
-					fLocation.setText(selectedDirectory);
-					DLTKUIPlugin.getDefault().getDialogSettings().put(
-							DIALOGSTORE_LAST_EXTERNAL_LOC, selectedDirectory);
-				}
-			}
-		}
-
-		public void dialogFieldChanged(DialogField field) {
-			if (field == fWorkspaceRadio) {
-				final boolean checked = fWorkspaceRadio.isSelected();
-				if (checked) {
-					fPreviousExternalLocation = fLocation.getText();
-					fLocation.setText(getDefaultPath(fNameGroup.getName()));
-				} else {
-					IEnvironment environment = this.getEnvironment();
-					if (environment != null && environment.isLocal()) {
-						fLocation.setText(fPreviousExternalLocation);
-					} else {
-						fLocation.setText(""); //$NON-NLS-1$
-					}
-				}
-			}
-
-			fireEvent();
-		}
-
-	}
-
-	/**
-	 * Request a location. Fires an event whenever the checkbox or the location
-	 * field is changed, regardless of whether the change originates from the
-	 * user or has been invoked programmatically.
-	 */
 	public class VersionGroup extends Observable implements Observer,
 			IStringButtonAdapter, IDialogFieldListener, SelectionListener {
-		protected final SelectionButtonDialogField fDefaultValues;
+		public final SelectionButtonDialogField fDefaultValues;
 		protected final SelectionButtonDialogField fCustomValues;
 
-		protected PHPVersionConfigurationBlock fConfigurationBlock;
+		public PHPVersionConfigurationBlock fConfigurationBlock;
 
 		private static final String DIALOGSTORE_LAST_EXTERNAL_LOC = DLTKUIPlugin.PLUGIN_ID
 				+ ".last.external.project"; //$NON-NLS-1$
@@ -924,8 +574,11 @@
 
 				if (selectedDirectory != null) {
 					// fLocation.setText(selectedDirectory);
-					DLTKUIPlugin.getDefault().getDialogSettings().put(
-							DIALOGSTORE_LAST_EXTERNAL_LOC, selectedDirectory);
+					DLTKUIPlugin
+							.getDefault()
+							.getDialogSettings()
+							.put(DIALOGSTORE_LAST_EXTERNAL_LOC,
+									selectedDirectory);
 				}
 			}
 		}
@@ -984,10 +637,36 @@
 		Display.getDefault().asyncExec(new Runnable() {
 
 			public void run() {
-				PHPUiPlugin.getDefault().getPreferenceStore().setValue(
-						(PreferenceConstants.JavaScriptSupportEnable),
-						fJavaScriptSupportGroup.getSelection());
+				PHPUiPlugin
+						.getDefault()
+						.getPreferenceStore()
+						.setValue(
+								(PreferenceConstants.JavaScriptSupportEnable),
+								fJavaScriptSupportGroup.getSelection());
 			}
 		});
 	}
+
+	public boolean shouldSupportJavaScript() {
+
+		return fJavaScriptSupportGroup != null
+				&& fJavaScriptSupportGroup.shouldSupportJavaScript();
+	}
+
+	public boolean isDefaultVersionSelected() {
+		return fVersionGroup != null
+				&& fVersionGroup.fDefaultValues.isSelected();
+	}
+
+	public boolean getUseAspTagsValue() {
+		return fVersionGroup != null
+				&& fVersionGroup.fConfigurationBlock.getUseAspTagsValue();
+	}
+
+	public PHPVersion getPHPVersionValue() {
+		if (fVersionGroup != null) {
+			return fVersionGroup.fConfigurationBlock.getPHPVersionValue();
+		}
+		return null;
+	}
 }
Index: src/org/eclipse/php/internal/ui/wizards/PHPProjectWizardSecondPage.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/wizards/PHPProjectWizardSecondPage.java,v
retrieving revision 1.21
diff -u -r1.21 PHPProjectWizardSecondPage.java
--- src/org/eclipse/php/internal/ui/wizards/PHPProjectWizardSecondPage.java	19 Oct 2009 12:59:32 -0000	1.21
+++ src/org/eclipse/php/internal/ui/wizards/PHPProjectWizardSecondPage.java	15 Jan 2012 03:30:38 -0000
@@ -49,6 +49,7 @@
 import org.eclipse.php.internal.ui.preferences.PreferenceConstants;
 import org.eclipse.php.internal.ui.preferences.includepath.PHPIncludePathsBlock;
 import org.eclipse.php.internal.ui.util.BusyIndicatorRunnableContext;
+import org.eclipse.php.ui.util.PHPProjectUtils;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.ui.PlatformUI;
@@ -165,10 +166,9 @@
 			monitor = new NullProgressMonitor();
 		}
 		try {
-			monitor
-					.beginTask(
-							NewWizardMessages.ScriptProjectWizardSecondPage_operation_initialize,
-							70);
+			monitor.beginTask(
+					NewWizardMessages.ScriptProjectWizardSecondPage_operation_initialize,
+					70);
 			if (monitor.isCanceled()) {
 				throw new OperationCanceledException();
 			}
@@ -179,8 +179,8 @@
 					URI rootLocation = ResourcesPlugin.getWorkspace().getRoot()
 							.getLocationURI();
 					realLocation = new URI(rootLocation.getScheme(), null, Path
-							.fromPortableString(rootLocation.getPath()).append(
-									getProject().getName()).toString(), null);
+							.fromPortableString(rootLocation.getPath())
+							.append(getProject().getName()).toString(), null);
 				} catch (URISyntaxException e) {
 					Assert.isTrue(false, "Can't happen"); //$NON-NLS-1$
 				}
@@ -211,10 +211,10 @@
 				// need to create sub-folders and set special build/include
 				// paths
 				IPreferenceStore store = getPreferenceStore();
-				IPath srcPath = new Path(store
-						.getString(PreferenceConstants.SRCBIN_SRCNAME));
-				IPath binPath = new Path(store
-						.getString(PreferenceConstants.SRCBIN_BINNAME));
+				IPath srcPath = new Path(
+						store.getString(PreferenceConstants.SRCBIN_SRCNAME));
+				IPath binPath = new Path(
+						store.getString(PreferenceConstants.SRCBIN_BINNAME));
 
 				if (srcPath.segmentCount() > 0) {
 					IFolder folder = getProject().getFolder(srcPath);
@@ -303,8 +303,12 @@
 	}
 
 	protected void setHelpContext(Control control) {
-		PlatformUI.getWorkbench().getHelpSystem().setHelp(control,
-				IPHPHelpContextIds.ADDING_ELEMENTS_TO_A_PROJECT_S_INCLUDE_PATH);
+		PlatformUI
+				.getWorkbench()
+				.getHelpSystem()
+				.setHelp(
+						control,
+						IPHPHelpContextIds.ADDING_ELEMENTS_TO_A_PROJECT_S_INCLUDE_PATH);
 	}
 
 	/**
@@ -349,10 +353,9 @@
 		}
 
 		int nSteps = 6;
-		monitor
-				.beginTask(
-						NewWizardMessages.ScriptCapabilityConfigurationPage_op_desc_Script,
-						nSteps);
+		monitor.beginTask(
+				NewWizardMessages.ScriptCapabilityConfigurationPage_op_desc_Script,
+				nSteps);
 
 		try {
 			IProject project = getProject();
@@ -464,10 +467,9 @@
 					IStatus.ERROR,
 					DLTKUIPlugin.PLUGIN_ID,
 					IStatus.ERROR,
-					Messages
-							.format(
-									NewWizardMessages.ScriptProjectWizardSecondPage_problem_backup,
-									name), e);
+					Messages.format(
+							NewWizardMessages.ScriptProjectWizardSecondPage_problem_backup,
+							name), e);
 			throw new CoreException(status);
 		}
 	}
@@ -511,10 +513,9 @@
 	public void performFinish(IProgressMonitor monitor) throws CoreException,
 			InterruptedException {
 		try {
-			monitor
-					.beginTask(
-							NewWizardMessages.ScriptProjectWizardSecondPage_operation_create,
-							3);
+			monitor.beginTask(
+					NewWizardMessages.ScriptProjectWizardSecondPage_operation_create,
+					3);
 			if (getProject() == null || !getProject().exists()) {
 				updateProject(new SubProgressMonitor(monitor, 1));
 			}
@@ -584,10 +585,9 @@
 		if (monitor == null || noProgressMonitor) {
 			monitor = new NullProgressMonitor();
 		}
-		monitor
-				.beginTask(
-						NewWizardMessages.ScriptProjectWizardSecondPage_operation_remove,
-						3);
+		monitor.beginTask(
+				NewWizardMessages.ScriptProjectWizardSecondPage_operation_remove,
+				3);
 		try {
 			try {
 				URI projLoc = getProject().getLocationURI();
@@ -632,7 +632,7 @@
 	 */
 	public void createProject(IProject project, URI locationURI,
 			IProgressMonitor monitor) throws CoreException {
-		BuildpathsBlock.createProject(project, locationURI, monitor);
+		PHPProjectUtils.createProjectAt(project, locationURI, monitor);
 	}
 
 	/**
Index: src/org/eclipse/php/internal/ui/workingset/PhpWorkingSetPage.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/workingset/PhpWorkingSetPage.java,v
retrieving revision 1.3
diff -u -r1.3 PhpWorkingSetPage.java
--- src/org/eclipse/php/internal/ui/workingset/PhpWorkingSetPage.java	14 Dec 2009 04:49:51 -0000	1.3
+++ src/org/eclipse/php/internal/ui/workingset/PhpWorkingSetPage.java	15 Jan 2012 03:30:38 -0000
@@ -151,8 +151,8 @@
 					BusyIndicator.showWhile(getShell().getDisplay(),
 							new Runnable() {
 								public void run() {
-									setSubtreeChecked(element, fTree
-											.getChecked(element), false);
+									setSubtreeChecked(element,
+											fTree.getChecked(element), false);
 								}
 							});
 			}
@@ -174,8 +174,12 @@
 				.setToolTipText(WorkingSetMessages.PhpWorkingSetPage_selectAll_toolTip);
 		selectAllButton.addSelectionListener(new SelectionAdapter() {
 			public void widgetSelected(SelectionEvent selectionEvent) {
-				fTree.setCheckedElements(fTreeContentProvider.getElements(fTree
-						.getInput()));
+				Object[] elements = fTreeContentProvider.getElements(fTree
+						.getInput());
+				fTree.setCheckedElements(elements);
+				for (Object parent : elements) {
+					setSubtreeChecked(parent, true, true);
+				}
 				validateInput();
 			}
 		});
Index: src/org/eclipse/php/ui/util/PHPProjectUtils.java
===================================================================
RCS file: src/org/eclipse/php/ui/util/PHPProjectUtils.java
diff -N src/org/eclipse/php/ui/util/PHPProjectUtils.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/php/ui/util/PHPProjectUtils.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,42 @@
+package org.eclipse.php.ui.util;
+
+import java.net.URI;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.dltk.internal.ui.wizards.NewWizardMessages;
+
+public class PHPProjectUtils {
+	public static void createProjectAt(IProject project, URI locationURI,
+			IProgressMonitor monitor) throws CoreException {
+		if (monitor == null) {
+			monitor = new NullProgressMonitor();
+		}
+		monitor.beginTask(
+				NewWizardMessages.BuildPathsBlock_operationdesc_project, 10);
+		// create the project
+		try {
+			if (!project.exists()) {
+				IProjectDescription desc = project.getWorkspace()
+						.newProjectDescription(project.getName());
+				if (locationURI != null
+						&& ResourcesPlugin.getWorkspace().getRoot()
+								.getLocationURI().equals(locationURI)) {
+					locationURI = null;
+				}
+				desc.setLocationURI(locationURI);
+				project.create(desc, monitor);
+			}
+			if (!project.isOpen()) {
+				project.open(monitor);
+			}
+		} finally {
+			// not null
+			monitor.done();
+		}
+	}
+}
Index: templates/phpdefault-templates.xml
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/templates/phpdefault-templates.xml,v
retrieving revision 1.28.2.2
diff -u -r1.28.2.2 phpdefault-templates.xml
--- templates/phpdefault-templates.xml	27 Jul 2010 10:20:00 -0000	1.28.2.2
+++ templates/phpdefault-templates.xml	15 Jan 2012 03:30:41 -0000
@@ -391,7 +391,7 @@
 	description="%description.phpdoc.author"
 	id="org.eclipse.php.ui.editor.templates.phpdoc.author"
 	context="phpcomment"
-	enabled="true">@author ${user}
-</template>
+	enabled="true">@author ${user}</template>
+
 </templates>
 
