### Eclipse Workspace Patch 1.0
#P org.eclipse.php.core
Index: META-INF/MANIFEST.MF
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/META-INF/MANIFEST.MF,v
retrieving revision 1.99
diff -u -r1.99 MANIFEST.MF
--- META-INF/MANIFEST.MF	16 Dec 2010 13:26:14 -0000	1.99
+++ META-INF/MANIFEST.MF	10 Aug 2012 02:56:38 -0000
@@ -1,7 +1,7 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.eclipse.php.core;singleton=true
-Bundle-Version: 3.0.0.qualifier
+Bundle-Version: 3.0.0.v20120221
 Bundle-Name: PDT Core Plug-in
 Bundle-Activator: org.eclipse.php.internal.core.PHPCorePlugin
 Require-Bundle: org.eclipse.core.runtime,
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.8
diff -u -r1.8 PHPTokenizer.jflex
--- Resources/parserTools/highlighting/PHPTokenizer.jflex	3 Aug 2010 07:03:40 -0000	1.8
+++ Resources/parserTools/highlighting/PHPTokenizer.jflex	10 Aug 2012 02:56:40 -0000
@@ -570,7 +570,7 @@
 	 * user method
 	 */
 	private boolean isNestable(String tagName) {
-		return true;
+		return false; //workaround. true is for jsp
 	}
 
 /**
@@ -1297,7 +1297,7 @@
 //PHP MACROS
 WHITESPACE = [\n\r \t]
 //PHP_START = {WHITESPACE}*(<\?{WHITESPACE}*)|(<\?[Pp][Hh][P|p]{WHITESPACE}+)
-PHP_START       = <\?[Pp][Hh][P|p]{WHITESPACE}*
+PHP_START       = <\?[Pp][Hh][P|p]{WHITESPACE}+
 //PIend = \?>
 PHP_ASP_START=<%
 PHP_ASP_END=%>
@@ -1540,6 +1540,12 @@
 		yybegin(ST_PI);
 		return XML_PI_OPEN;
 
+	} else if ("<%".equals(yytext())
+			&& !ProjectOptions.isSupportingAspTags(project)) {
+		yypushback(1);
+		yybegin(ST_XML_TAG_NAME);
+		return XML_TAG_OPEN;
+
 	} else {
 		// removeing trailing whitespaces for the php open
 		String phpStart = yytext();
@@ -1660,17 +1666,6 @@
         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$
@@ -1917,7 +1912,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_BLOCK_TAG_INTERNAL_SCAN>{WHITESPACE}* {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> {PHP_START} | {PHP_ASP_START} {
     if (ProjectOptions.isSupportingAspTags(project) ||yytext().charAt(1) != '%') {
 		//removeing trailing whitespaces for the php open
 		String phpStart = yytext();
@@ -2005,5 +2000,3 @@
 		dump("LINE FEED");//$NON-NLS-1$
 	return WHITE_SPACE;
 }
-
-
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.12
diff -u -r1.12 ast_scanner.flex
--- Resources/parserTools/parser/php53/ast_scanner.flex	3 Aug 2010 07:03:40 -0000	1.12
+++ Resources/parserTools/parser/php53/ast_scanner.flex	10 Aug 2012 02:56:40 -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/codeassist/contexts/AbstractCompletionContext.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/AbstractCompletionContext.java,v
retrieving revision 1.21
diff -u -r1.21 AbstractCompletionContext.java
--- src/org/eclipse/php/internal/core/codeassist/contexts/AbstractCompletionContext.java	7 Sep 2010 06:05:06 -0000	1.21
+++ src/org/eclipse/php/internal/core/codeassist/contexts/AbstractCompletionContext.java	10 Aug 2012 02:56:40 -0000
@@ -228,6 +228,22 @@
 
 		int internalOffset = offset - regionCollection.getStartOffset()
 				- phpScriptRegion.getStart() - 1;
+		if (internalOffset < 0) {
+			// workaround to avoid BadLocationException
+			// when offset is just next to PHP_OPEN
+			if (ProjectOptions.useShortTags(sourceModule)) {
+				ITextRegion region = regionCollection
+						.getRegionAtCharacterOffset(offset - 1);
+				if (region != null
+						&& region.getType().equals(PHPRegionContext.PHP_OPEN)
+						&& region.getTextLength() < 5) {
+					// allow CA next to short_open_tag
+					return PHPPartitionTypes.PHP_DEFAULT;
+				}
+			}
+			// don't allow CA next to php open tag
+			return null;
+		}
 		String partitionType = phpScriptRegion.getPartition(internalOffset);
 
 		// if we are at the begining of multi-line comment or docBlock then we
@@ -503,7 +519,7 @@
 	public ITextRegion getPHPToken(int offset) throws BadLocationException {
 		return phpScriptRegion.getPhpToken(offset
 				- regionCollection.getStartOffset()
-				- phpScriptRegion.getStart() - 1);
+				- phpScriptRegion.getStart() /* - 1 XXX */);
 	}
 
 	/**
@@ -594,16 +610,18 @@
 	 */
 	public String getNextWord() throws BadLocationException {
 		ITextRegion nextPHPToken = getNextPHPToken();
-		return document.get(regionCollection.getStartOffset()
-				+ phpScriptRegion.getStart() + nextPHPToken.getStart(),
-				nextPHPToken.getTextLength());
+		return document
+				.get(regionCollection.getStartOffset()
+						+ phpScriptRegion.getStart() + nextPHPToken.getStart(),
+						nextPHPToken.getTextLength());
 	}
 
 	public String getNextWord(int times) throws BadLocationException {
 		ITextRegion nextPHPToken = getNextPHPToken(times);
-		return document.get(regionCollection.getStartOffset()
-				+ phpScriptRegion.getStart() + nextPHPToken.getStart(),
-				nextPHPToken.getTextLength());
+		return document
+				.get(regionCollection.getStartOffset()
+						+ phpScriptRegion.getStart() + nextPHPToken.getStart(),
+						nextPHPToken.getTextLength());
 	}
 
 	/**
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.15
diff -u -r1.15 AbstractCompletionStrategy.java
--- src/org/eclipse/php/internal/core/codeassist/strategies/AbstractCompletionStrategy.java	24 Mar 2011 01:12:02 -0000	1.15
+++ src/org/eclipse/php/internal/core/codeassist/strategies/AbstractCompletionStrategy.java	10 Aug 2012 02:56:41 -0000
@@ -77,13 +77,6 @@
 		AbstractCompletionContext completionContext = (AbstractCompletionContext) context;
 
 		int length = completionContext.getPrefix().length();
-		// see PHPTextSequenceUtilities line 134
-		if (completionContext.getOffset() - 1 >= 0
-				&& completionContext.getDocument().getChar(
-						completionContext.getOffset() - 1) == '(') {
-			length++;
-		}
-
 		int start = completionContext.getOffset() - length;
 		int prefixEnd = completionContext.getPrefixEnd();
 
@@ -101,12 +94,6 @@
 		AbstractCompletionContext completionContext = (AbstractCompletionContext) context;
 
 		int length = completionContext.getPrefix().length();
-		// see PHPTextSequenceUtilities line 134
-		if (completionContext.getOffset() - 1 >= 0
-				&& completionContext.getDocument().getChar(
-						completionContext.getOffset() - 1) == '(') {
-			length++;
-		}
 		int start = completionContext.getOffset() - length;
 		int prefixEnd = completionContext.getPrefixEnd();
 
Index: src/org/eclipse/php/internal/core/format/CommentIndentationStrategy.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/format/CommentIndentationStrategy.java,v
retrieving revision 1.7
diff -u -r1.7 CommentIndentationStrategy.java
--- src/org/eclipse/php/internal/core/format/CommentIndentationStrategy.java	4 Sep 2009 09:23:34 -0000	1.7
+++ src/org/eclipse/php/internal/core/format/CommentIndentationStrategy.java	10 Aug 2012 02:56:41 -0000
@@ -73,6 +73,11 @@
 			// addition
 			result.append(blanks);
 			result.append(" "); //$NON-NLS-1$
+		} else if (tRegion.getType() == PHPRegionTypes.PHP_COMMENT
+				|| tRegion.getType() == PHPRegionTypes.PHPDOC_COMMENT) {
+			final String blanks = FormatterUtils.getLineBlanks(document,
+					previousLine);
+			result.append(blanks);
 		} else {
 			super.placeMatchingBlanks(document, result, lineNumber, forOffset);
 		}
Index: src/org/eclipse/php/internal/core/format/DefaultIndentationStrategy.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/format/DefaultIndentationStrategy.java,v
retrieving revision 1.13
diff -u -r1.13 DefaultIndentationStrategy.java
--- src/org/eclipse/php/internal/core/format/DefaultIndentationStrategy.java	26 Oct 2010 07:00:09 -0000	1.13
+++ src/org/eclipse/php/internal/core/format/DefaultIndentationStrategy.java	10 Aug 2012 02:56:41 -0000
@@ -464,6 +464,9 @@
 							return true;
 						currentOffset = regionStart + token.getStart() - 1;
 					}
+				} else if (tokenType == PHPRegionTypes.PHP_TOKEN
+						&& document.getChar(regionStart + token.getStart()) == '(') {
+					return true;
 				}
 			}
 		} catch (final BadLocationException e) {
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.22
diff -u -r1.22 IncludePathManager.java
--- src/org/eclipse/php/internal/core/includepath/IncludePathManager.java	24 Jun 2010 05:17:38 -0000	1.22
+++ src/org/eclipse/php/internal/core/includepath/IncludePathManager.java	10 Aug 2012 02:56:41 -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,10 +272,10 @@
 
 	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);
+					.getEntryKind() == IBuildpathEntry.BPE_PROJECT);
 	}
 
 	/**
@@ -312,15 +312,23 @@
 
 		}
 		// 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);
-		if ((buildpathEntry.getEntryKind() == IBuildpathEntry.BPE_LIBRARY || buildpathEntry
-				.getEntryKind() == IBuildpathEntry.BPE_CONTAINER)) {
+		// if ((buildpathEntry.getEntryKind() == IBuildpathEntry.BPE_LIBRARY
+		// || buildpathEntry.getEntryKind() == IBuildpathEntry.BPE_CONTAINER)) {
+		// BuildPathUtils.removeEntryFromBuildPath(scriptProject,buildpathEntry);
+		// }
+		switch (buildpathEntry.getEntryKind()) {
+		case IBuildpathEntry.BPE_LIBRARY:
+		case IBuildpathEntry.BPE_CONTAINER:
+		case IBuildpathEntry.BPE_PROJECT:
 			BuildPathUtils.removeEntryFromBuildPath(scriptProject,
 					buildpathEntry);
+			break;
 		}
 	}
 
@@ -348,8 +356,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 +388,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/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.13
diff -u -r1.13 PhpIndexingVisitor.java
--- src/org/eclipse/php/internal/core/index/PhpIndexingVisitor.java	24 Mar 2011 01:12:02 -0000	1.13
+++ src/org/eclipse/php/internal/core/index/PhpIndexingVisitor.java	10 Aug 2012 02:56:42 -0000
@@ -606,7 +606,7 @@
 		}
 		ConstantReference constantName = declaration.getConstantName();
 		int offset = constantName.sourceStart();
-		int length = constantName.sourceEnd();
+		int length = constantName.sourceEnd() - offset;
 		modifyDeclaration(
 				declaration,
 				new DeclarationInfo(IModelElement.FIELD, modifiers, offset,
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.25
diff -u -r1.25 VariableReferenceEvaluator.java
--- src/org/eclipse/php/internal/core/typeinference/evaluators/VariableReferenceEvaluator.java	30 Nov 2010 10:27:54 -0000	1.25
+++ src/org/eclipse/php/internal/core/typeinference/evaluators/VariableReferenceEvaluator.java	10 Aug 2012 02:56:42 -0000
@@ -89,19 +89,31 @@
 
 				List<VarComment> varComments = ((PHPModuleDeclaration) rootNode)
 						.getVarComments();
+
+				// workarounf for bug#366926
+				VarComment candidate = null;
 				for (VarComment varComment : varComments) {
+					if (varComment.sourceStart() < localScopeNode.sourceStart()) {
+						continue;
+					}
+					if (varComment.sourceStart() >= localScopeNode.sourceEnd()) {
+						break;
+					}
 					if (varComment.sourceStart() > variableReference
 							.sourceStart()) {
 						break;
 					}
-					if (varComment.getVariableReference().getName().equals(
-							variableReference.getName())) {
-						List<IGoal> goals = new LinkedList<IGoal>();
-						for (TypeReference ref : varComment.getTypeReferences()) {
-							goals.add(new ExpressionTypeGoal(context, ref));
-						}
-						return (IGoal[]) goals.toArray(new IGoal[goals.size()]);
+					if (varComment.getVariableReference().getName()
+							.equals(variableReference.getName())) {
+						candidate = varComment;
+					}
+				}
+				if (candidate != null) {
+					List<IGoal> goals = new LinkedList<IGoal>();
+					for (TypeReference ref : candidate.getTypeReferences()) {
+						goals.add(new ExpressionTypeGoal(context, ref));
 					}
+					return (IGoal[]) goals.toArray(new IGoal[goals.size()]);
 				}
 
 				Declaration[] decls = varDecSearcher.getDeclarations();
#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.54
diff -u -r1.54 MANIFEST.MF
--- META-INF/MANIFEST.MF	16 Dec 2010 13:26:01 -0000	1.54
+++ META-INF/MANIFEST.MF	10 Aug 2012 02:56:44 -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: 3.0.0.qualifier
+Bundle-Version: 3.0.0.v20120114
 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.30
diff -u -r1.30 PHPLaunchUtilities.java
--- src/org/eclipse/php/internal/debug/core/launching/PHPLaunchUtilities.java	2 Sep 2010 14:36:46 -0000	1.30
+++ src/org/eclipse/php/internal/debug/core/launching/PHPLaunchUtilities.java	10 Aug 2012 02:56:45 -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);
@@ -903,7 +894,7 @@
 				: "off";
 
 		List<String> cmdLineList = new LinkedList<String>();
-		cmdLineList.addAll(Arrays.asList(new String[] { phpExe, "-n", "-c",
+		cmdLineList.addAll(Arrays.asList(new String[] { phpExe, "-c",
 				phpConfigDir, "-d", "asp_tags=" + aspTags, scriptPath }));
 		if (args != null) {
 			cmdLineList.addAll(Arrays.asList(args));
@@ -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/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.26
diff -u -r1.26 PHPexeItem.java
--- src/org/eclipse/php/internal/debug/core/preferences/PHPexeItem.java	2 Sep 2010 14:36:46 -0000	1.26
+++ src/org/eclipse/php/internal/debug/core/preferences/PHPexeItem.java	10 Aug 2012 02:56:45 -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.27
diff -u -r1.27 PHPexes.java
--- src/org/eclipse/php/internal/debug/core/preferences/PHPexes.java	6 Aug 2010 14:16:36 -0000	1.27
+++ src/org/eclipse/php/internal/debug/core/preferences/PHPexes.java	10 Aug 2012 02:56:45 -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/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.39
diff -u -r1.39 DBGpTarget.java
--- src/org/eclipse/php/internal/debug/core/xdebug/dbgp/model/DBGpTarget.java	28 Apr 2011 05:00:54 -0000	1.39
+++ src/org/eclipse/php/internal/debug/core/xdebug/dbgp/model/DBGpTarget.java	10 Aug 2012 02:56:46 -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.core.phar.PharPath;
 import org.eclipse.php.internal.debug.core.IPHPDebugConstants;
 import org.eclipse.php.internal.debug.core.PHPDebugCoreMessages;
@@ -44,7 +50,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;
@@ -1335,6 +1344,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)) {
@@ -1616,7 +1631,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();
 				}
@@ -2355,4 +2370,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/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.26
diff -u -r1.26 StartProcessFileNotificationHandler.java
--- src/org/eclipse/php/internal/debug/core/zend/debugger/handlers/StartProcessFileNotificationHandler.java	24 Mar 2011 01:09:45 -0000	1.26
+++ src/org/eclipse/php/internal/debug/core/zend/debugger/handlers/StartProcessFileNotificationHandler.java	10 Aug 2012 02:56:46 -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()) {
@@ -193,6 +199,30 @@
 							&& 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) {
@@ -202,4 +232,36 @@
 		}
 		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/ContextManager.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/model/ContextManager.java,v
retrieving revision 1.22
diff -u -r1.22 ContextManager.java
--- src/org/eclipse/php/internal/debug/core/zend/model/ContextManager.java	21 Apr 2011 06:10:06 -0000	1.22
+++ src/org/eclipse/php/internal/debug/core/zend/model/ContextManager.java	10 Aug 2012 02:56:47 -0000
@@ -168,7 +168,8 @@
 			resolvedFile = fTarget.getLastFileName();
 		}
 		frames[0] = new PHPStackFrame(thread, fTarget.getLastFileName(),
-				resolvedFile, (layers.length == 1) ? "" : frames[1].getName(),
+				resolvedFile, (layers.length == 1) ? ""
+						: layers[layers.length - 1].getCalledFunctionName(),
 				fTarget.getLastStop(), frameCt, getLocalVariables());
 
 		return frames;
Index: src/org/eclipse/php/internal/debug/core/zend/model/PHPValue.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/model/PHPValue.java,v
retrieving revision 1.7
diff -u -r1.7 PHPValue.java
--- src/org/eclipse/php/internal/debug/core/zend/model/PHPValue.java	11 Feb 2010 12:49:36 -0000	1.7
+++ src/org/eclipse/php/internal/debug/core/zend/model/PHPValue.java	10 Aug 2012 02:56:47 -0000
@@ -64,7 +64,7 @@
 	}
 
 	public String getValue() throws DebugException {
-		return (String) (fValue.getValue());
+		return (String) (fValue.getValue() == null ? "null" : fValue.getValue());
 	}
 
 	/*
@@ -111,8 +111,11 @@
 		fChildren = null;
 		Expression[] children = value.getChildren();
 		if (children != null) {
+			ExpressionsManager expressionsManager = ((PHPDebugTarget) getDebugTarget())
+					.getExpressionManager();
 			fChildren = new PHPVariable[children.length];
 			for (int i = 0; i < children.length; i++) {
+				expressionsManager.update(children[i], 1);
 				fChildren[i] = new PHPVariable(
 						(PHPDebugTarget) getDebugTarget(), children[i], fGlobal);
 			}
#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.50
diff -u -r1.50 MANIFEST.MF
--- META-INF/MANIFEST.MF	16 Dec 2010 13:25:52 -0000	1.50
+++ META-INF/MANIFEST.MF	10 Aug 2012 02:56:49 -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: 3.0.0.qualifier
+Bundle-Version: 3.0.0.v20120212
 Bundle-Activator: org.eclipse.php.internal.debug.ui.PHPDebugUIPlugin
 Bundle-Localization: plugin
 Require-Bundle: org.eclipse.ui,
Index: plugin.xml
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.ui/plugin.xml,v
retrieving revision 1.71
diff -u -r1.71 plugin.xml
--- plugin.xml	10 Jan 2011 13:00:50 -0000	1.71
+++ plugin.xml	10 Aug 2012 02:56:49 -0000
@@ -55,6 +55,11 @@
             contextId="org.eclipse.php.debug.ui.xdebug"
             commandId="org.eclipse.php.debug.ui.commands.Inspect"
             schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+		<key
+            sequence="M1+M2+I"
+            contextId="org.eclipse.ui.contexts.dialog"
+            commandId="org.eclipse.php.debug.ui.commands.Inspect"
+            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
 	</extension>
 	
 	<extension point="org.eclipse.ui.contexts">
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.28
diff -u -r1.28 PHPDebugUIPlugin.java
--- src/org/eclipse/php/internal/debug/ui/PHPDebugUIPlugin.java	10 Jan 2011 13:00:51 -0000	1.28
+++ src/org/eclipse/php/internal/debug/ui/PHPDebugUIPlugin.java	10 Aug 2012 02:56:50 -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;
@@ -93,15 +92,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
@@ -136,13 +135,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;
@@ -237,8 +236,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);
@@ -425,7 +424,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/actions/PopupInspectAction.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/actions/PopupInspectAction.java,v
retrieving revision 1.5
diff -u -r1.5 PopupInspectAction.java
--- src/org/eclipse/php/internal/debug/ui/actions/PopupInspectAction.java	24 Mar 2011 01:10:10 -0000	1.5
+++ src/org/eclipse/php/internal/debug/ui/actions/PopupInspectAction.java	10 Aug 2012 02:56:50 -0000
@@ -36,13 +36,10 @@
 import org.eclipse.swt.custom.StyledText;
 import org.eclipse.swt.graphics.GC;
 import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.*;
-import org.eclipse.ui.contexts.IContextActivation;
-import org.eclipse.ui.contexts.IContextService;
 import org.eclipse.ui.texteditor.ITextEditor;
 
 /**
@@ -214,19 +211,19 @@
 		}
 		DebugPopup displayPopup = new InspectPopupDialog(getShell(),
 				getPopupAnchor(textWidget), ACTION_DEFININITION_ID, expression) {
-			IContextActivation contextActivation;
+			// IContextActivation contextActivation;
 
-			@Override
-			protected Control createDialogArea(Composite parent) {
-				Control result = super.createDialogArea(parent);
-				if (fTextEditor != null) {
-					IContextService contextService = (IContextService) fTextEditor
-							.getSite().getService(IContextService.class);
-					contextActivation = contextService
-							.activateContext("org.eclipse.php.debug.ui.xdebug");
-				}
-				return result;
-			}
+			// @Override
+			// protected Control createDialogArea(Composite parent) {
+			// Control result = super.createDialogArea(parent);
+			// if (fTextEditor != null) {
+			// IContextService contextService = (IContextService) fTextEditor
+			// .getSite().getService(IContextService.class);
+			// contextActivation = contextService
+			// .activateContext("org.eclipse.php.debug.ui.xdebug");
+			// }
+			// return result;
+			// }
 
 			public boolean close() {
 				boolean returnValue = super.close();
@@ -251,6 +248,11 @@
 	protected void run() {
 		// eval in context of object or stack frame
 		final String expression = getObjectContext();
+		if (expression == null || expression.trim().equals("")) {
+			if (fTextEditor == null) {
+				return;
+			}
+		}
 		final IStackFrame stackFrame = getStackFrameContext();
 		if (stackFrame == null) {
 			return;
Index: src/org/eclipse/php/internal/debug/ui/launching/PHPExecutableLaunchTab.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExecutableLaunchTab.java,v
retrieving revision 1.38
diff -u -r1.38 PHPExecutableLaunchTab.java
--- src/org/eclipse/php/internal/debug/ui/launching/PHPExecutableLaunchTab.java	9 Aug 2010 15:18:14 -0000	1.38
+++ src/org/eclipse/php/internal/debug/ui/launching/PHPExecutableLaunchTab.java	10 Aug 2012 02:56:50 -0000
@@ -422,6 +422,8 @@
 					(String) null);
 			if (path != null) {
 				phpsComboBlock.setPath(Path.fromPortableString(path));
+			} else {
+				phpsComboBlock.setPath(null);
 			}
 		} catch (CoreException e) {
 		}
@@ -549,6 +551,9 @@
 			configuration.setAttribute(IPHPDebugConstants.ATTR_FILE_FULL_PATH,
 					debugFileTextField.getData().toString());
 		}
+		IResource res = ResourcesPlugin.getWorkspace().getRoot()
+				.findMember(arguments);
+		configuration.setMappedResources(new IResource[] { res });
 		final boolean debugInfo = enableDebugInfoOption ? runWithDebugInfo != null
 				&& runWithDebugInfo.getSelection()
 				: true;
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.12
diff -u -r1.12 PHPDebugPreferencesBlock.java
--- src/org/eclipse/php/internal/debug/ui/preferences/PHPDebugPreferencesBlock.java	25 Aug 2010 07:01:49 -0000	1.12
+++ src/org/eclipse/php/internal/debug/ui/preferences/PHPDebugPreferencesBlock.java	10 Aug 2012 02:56:51 -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;
 	}
 
@@ -380,8 +387,9 @@
 	private URL generateBaseURL(Server server, IPath basePath)
 			throws MalformedURLException {
 
-		IPath path = new Path(server.getRootURL().toString());
-		URL generatedBaseURL = new URL(path.append(basePath).toString());
+		URL root = server.getRootURL();
+		URL generatedBaseURL = new URL(root.getProtocol(), root.getHost(),
+				root.getPort(), basePath.toString());
 		return generatedBaseURL;
 	}
 
@@ -715,4 +723,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.16
diff -u -r1.16 InstalledPHPsBlock.java
--- src/org/eclipse/php/internal/debug/ui/preferences/phps/InstalledPHPsBlock.java	15 Apr 2011 06:38:05 -0000	1.16
+++ src/org/eclipse/php/internal/debug/ui/preferences/phps/InstalledPHPsBlock.java	10 Aug 2012 02:56:51 -0000
@@ -451,11 +451,17 @@
 		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());
 		phpExe.setSapiType(phpExeToEdit.getSapiType());
+		if (mustRemap) {
+			phpExes.remap();
+		}
 
 		fPHPExeList.refresh();
 		commitChanges();
Index: src/org/eclipse/php/internal/debug/ui/preferences/phps/NewPHPsComboBlock.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/preferences/phps/NewPHPsComboBlock.java,v
retrieving revision 1.5
diff -u -r1.5 NewPHPsComboBlock.java
--- src/org/eclipse/php/internal/debug/ui/preferences/phps/NewPHPsComboBlock.java	20 Aug 2010 03:53:05 -0000	1.5
+++ src/org/eclipse/php/internal/debug/ui/preferences/phps/NewPHPsComboBlock.java	10 Aug 2012 02:56:52 -0000
@@ -819,6 +819,9 @@
 
 	private PHPexeItem getPHPexe(IProject project) {
 		if (fSpecificButton.getSelection() && !phpExecutables.isEmpty()) {
+			if (fExecutablesCombo.getSelectionIndex() < 0) {
+				return null;
+			}
 			return phpExecutables.get(fExecutablesCombo.getSelectionIndex());
 		} else if (fEnvironmentsButton.getSelection()) {
 			return PHPDebugPlugin.getPHPexeItem(PHPVersion
@@ -843,7 +846,8 @@
 	 * @return The debugger's id.
 	 */
 	public String getSelectedDebuggerId() {
-		if (fSpecificButton.getSelection() && !phpExecutables.isEmpty()) {
+		if (fSpecificButton.getSelection() && !phpExecutables.isEmpty()
+				&& fExecutablesCombo.getSelectionIndex() > -1) {
 			return phpExecutables.get(fExecutablesCombo.getSelectionIndex())
 					.getDebuggerID();
 		} else if (fEnvironmentsButton.getSelection()) {
#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.37
diff -u -r1.37 MANIFEST.MF
--- META-INF/MANIFEST.MF	16 Dec 2010 13:25:58 -0000	1.37
+++ META-INF/MANIFEST.MF	10 Aug 2012 02:56:53 -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: 3.0.0.qualifier
+Bundle-Version: 3.0.0.v20120127
 Bundle-Activator: org.eclipse.php.internal.server.ui.Activator
 Bundle-Vendor: Eclipse.org
 Bundle-Localization: plugin
Index: src/org/eclipse/php/internal/server/ui/Activator.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.server.ui/src/org/eclipse/php/internal/server/ui/Activator.java,v
retrieving revision 1.5
diff -u -r1.5 Activator.java
--- src/org/eclipse/php/internal/server/ui/Activator.java	18 Oct 2009 09:25:34 -0000	1.5
+++ src/org/eclipse/php/internal/server/ui/Activator.java	10 Aug 2012 02:56:53 -0000
@@ -59,16 +59,15 @@
 		workbench.getDisplay().asyncExec(new Runnable() {
 			public void run() {
 				IWorkbenchWindow iww = workbench.getActiveWorkbenchWindow();
-				if (iww == null) {
-					System.out.println();
-				}
-				ISelectionService iss = iww.getSelectionService();
+				if (iww != null) {
+					ISelectionService iss = iww.getSelectionService();
 
-				ISelection s = iss.getSelection();
-				if (s instanceof IStructuredSelection)
-					currentSelection = ((IStructuredSelection) s);
+					ISelection s = iss.getSelection();
+					if (s instanceof IStructuredSelection)
+						currentSelection = ((IStructuredSelection) s);
 
-				iss.addSelectionListener(Activator.this);
+					iss.addSelectionListener(Activator.this);
+				}
 			}
 
 		});
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.22
diff -u -r1.22 ServerLaunchConfigurationTab.java
--- src/org/eclipse/php/internal/server/ui/ServerLaunchConfigurationTab.java	13 Oct 2010 08:31:46 -0000	1.22
+++ src/org/eclipse/php/internal/server/ui/ServerLaunchConfigurationTab.java	10 Aug 2012 02:56:54 -0000
@@ -12,6 +12,8 @@
 package org.eclipse.php.internal.server.ui;
 
 import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.*;
 import java.util.List;
@@ -515,7 +517,7 @@
 		fFile.setText(fName);
 
 		if (autoGeneratedURL.getSelection()) {
-			updateURLComponents(computeURL(formatFileName(fName)));
+			updateURLComponents(encodeURL(computeURL(formatFileName(fName))));
 		}
 	}
 
@@ -525,7 +527,6 @@
 
 	protected void updateURLComponents(String urlStr) {
 		try {
-			String basePath = this.basePath;
 			URL url = new URL(urlStr);
 			String port = url.getPort() == -1 ? "" : ":" + url.getPort();
 			fURLHost.setText(url.getProtocol()
@@ -625,7 +626,7 @@
 
 			if (isAutoGeneratedURL) {
 				autoGeneratedURL.setSelection(true);
-				String computedURL = computeURL(formatFileName(fileName));
+				String computedURL = encodeURL(computeURL(formatFileName(fileName)));
 				fURLLabel.setEnabled(false);
 				updateURLComponents(computedURL);
 				fURLPath.setEnabled(false);
@@ -688,6 +689,21 @@
 		return url.toString();
 	}
 
+	protected String encodeURL(String urlString) {
+		try {
+			URL url = new URL(urlString);
+			URI uri = new URI(url.getProtocol(), url.getUserInfo(),
+					url.getHost(), url.getPort(), url.getPath(),
+					url.getQuery(), url.getRef());
+			return uri.toASCIIString();
+		} catch (MalformedURLException e) {
+			Logger.logException(e);
+		} catch (URISyntaxException e) {
+			Logger.logException(e);
+		}
+		return urlString;
+	}
+
 	private String formatFileName(String fileName) {
 		String formatFile = null;
 
@@ -704,10 +720,12 @@
 		else if (basePath == null && resource.getProject() == null) {
 			basePath = "";
 		}
+		if (basePath.equals("/")) {
+			basePath = "";
+		}
 
 		int type = resource.getType();
 		if (type == IResource.FILE || type == IResource.FOLDER) {
-
 			formatFile = basePath + "/"
 					+ resource.getFullPath().removeFirstSegments(1).toString();
 		} else {
@@ -726,10 +744,11 @@
 		String file;
 		if (autoGeneratedURL.getSelection()) {
 			file = formatFileName(fFile.getText());
+			updateURLComponents(encodeURL(computeURL(file)));
 		} else {
 			file = fURLPath.getText();
+			updateURLComponents(computeURL(file));
 		}
-		updateURLComponents(computeURL(file));
 	}
 
 	protected void initializeServerControl(ILaunchConfiguration configuration) {
@@ -850,6 +869,9 @@
 				autoGeneratedURL.getSelection());
 		configuration.setAttribute(IDebugParametersKeys.FIRST_LINE_BREAKPOINT,
 				breakOnFirstLine.getSelection());
+		IResource res = ResourcesPlugin.getWorkspace().getRoot()
+				.findMember(fileName);
+		configuration.setMappedResources(new IResource[] { res });
 
 		boolean autoGenerateURL = autoGeneratedURL.getSelection();
 		fURLLabel.setEnabled(!autoGenerateURL);
Index: src/org/eclipse/php/internal/server/ui/launching/PHPWebPageLaunchShortcut.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.server.ui/src/org/eclipse/php/internal/server/ui/launching/PHPWebPageLaunchShortcut.java,v
retrieving revision 1.15
diff -u -r1.15 PHPWebPageLaunchShortcut.java
--- src/org/eclipse/php/internal/server/ui/launching/PHPWebPageLaunchShortcut.java	25 Aug 2010 07:01:54 -0000	1.15
+++ src/org/eclipse/php/internal/server/ui/launching/PHPWebPageLaunchShortcut.java	10 Aug 2012 02:56:54 -0000
@@ -12,6 +12,8 @@
 package org.eclipse.php.internal.server.ui.launching;
 
 import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 
 import org.eclipse.core.resources.IFile;
@@ -273,6 +275,8 @@
 				URL = resolvedUrl.toString();
 			} catch (MalformedURLException e) {
 				// safe as resolved URL is server.getBaseURL()
+			} catch (URISyntaxException e) {
+				Logger.logException(e);
 			}
 		}
 
@@ -318,9 +322,10 @@
 	}
 
 	private static URL constractURL(IProject project, String serverURL,
-			Path path) throws MalformedURLException {
+			Path path) throws MalformedURLException, URISyntaxException {
 
-		IPath url = new Path(serverURL);
+		URL server = new URL(serverURL);
+		IPath url = new Path("/" + server.getPath());
 
 		String basePath = getProjectsBasePath(project);
 		boolean removeFirstSegment = true;
@@ -333,8 +338,11 @@
 			url = url.append(path.removeFirstSegments(1));
 		else
 			url = url.append(path);
-		return new URL(url.toString());
 
+		URI uri = new URI(server.getProtocol(), server.getUserInfo(),
+				server.getHost(), server.getPort(), url.toString(),
+				server.getQuery(), server.getRef());
+		return uri.toURL();
 	}
 
 	private static String getProjectsBasePath(IProject project) {
#P org.eclipse.php.ui
Index: META-INF/MANIFEST.MF
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/META-INF/MANIFEST.MF,v
retrieving revision 1.95
diff -u -r1.95 MANIFEST.MF
--- META-INF/MANIFEST.MF	16 Dec 2010 13:26:27 -0000	1.95
+++ META-INF/MANIFEST.MF	10 Aug 2012 02:56:59 -0000
@@ -1,13 +1,13 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.eclipse.php.ui; singleton:=true
-Bundle-Version: 3.0.0.qualifier
+Bundle-Version: 3.0.0.v20120810
 Bundle-Name: %Bundle-Name.1
 Bundle-Activator: org.eclipse.php.internal.ui.PHPUiPlugin
 Bundle-Localization: plugin
 Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.core.filesystem,
- org.eclipse.compare,
+ org.eclipse.compare;bundle-version="3.5.203",
  org.eclipse.search,
  org.eclipse.jface.text,
  org.eclipse.debug.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	10 Aug 2012 02:56:57 -0000
@@ -897,8 +897,10 @@
 action.label.5 = Format
 command.mnemonic = A
 menu.label.0 = Refactor
-command.description = ActionDefinition.renameElement.description
-command.name = ActionDefinition.renameElement.name
+#command.description = ActionDefinition.renameElement.description
+#command.name = ActionDefinition.renameElement.name
+ActionDefinition.moveElement.name = Move - Refactoring
+ActionDefinition.moveElement.description = Move the selected element to a new location
 menu.label.1 = Refactor
 action.label.6 = Rename...
 action.label.7 = Move...
@@ -928,4 +930,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.263
diff -u -r1.263 plugin.xml
--- plugin.xml	26 Apr 2011 07:23:52 -0000	1.263
+++ plugin.xml	10 Aug 2012 02:56:59 -0000
@@ -611,7 +611,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 +620,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 +630,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 +909,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 +917,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 +925,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 +937,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>
@@ -1032,8 +1032,8 @@
 		<command name="%ActionDefinition.renameElement.name"
 			description="%ActionDefinition.renameElement.description" categoryId="org.eclipse.php.ui.category.refactoring"
 			id="org.eclipse.php.ui.edit.text.rename.element" />
-		<command name="%command.name"
-			description="%command.description" categoryId="org.eclipse.php.ui.category.refactoring"
+		<command name="%ActionDefinition.moveElement.name"
+			description="%ActionDefinition.moveElement.description" categoryId="org.eclipse.php.ui.category.refactoring"
 			id="org.eclipse.php.ui.edit.text.move.element" />
 		<command name="%command.openFunctionsManual.name" description="%command.openFunctionsManual.description"
 			categoryId="org.eclipse.php.ui.category.source" id="org.eclipse.php.ui.edit.text.php.open.manual" />
@@ -1084,34 +1084,43 @@
 			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" />
+		<!-- addition -->
+		<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" />
 
 		<!-- refactoring -->
+		<!-- copied from rev. 1.268 -->
 		<key commandId="org.eclipse.php.ui.edit.text.rename.element"
-			contextId="org.eclipse.php.ui.contexts.window" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+			contextId="org.eclipse.php.ui.contexts.window"
+			schemeId="org.eclipse.php.ui.scheme"
 			sequence="M2+M3+R" />
 		<key commandId="org.eclipse.php.ui.edit.text.rename.element"
-			contextId="org.eclipse.php.ui.phpEditorScope" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+			contextId="org.eclipse.php.ui.phpEditorScope"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
 			sequence="M2+M3+R">
 		</key>
-		<key platform="carbon" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
-			sequence="M2+M3+R" />
 		<key commandId="org.eclipse.php.ui.edit.text.rename.element"
 			contextId="org.eclipse.php.ui.contexts.window" platform="carbon"
-			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" sequence="COMMAND+ALT+R" />
+			schemeId="org.eclipse.php.ui.scheme"
+			sequence="COMMAND+ALT+R" />
 		<key commandId="org.eclipse.php.ui.edit.text.rename.element"
 			contextId="org.eclipse.php.ui.phpEditorScope" platform="carbon"
-			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" sequence="COMMAND+ALT+R">
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+			sequence="COMMAND+ALT+R">
 		</key>
+		<!-- rev. 1.268 -->
 		<key commandId="org.eclipse.php.ui.edit.text.move.element"
 			contextId="org.eclipse.php.ui.contexts.window" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
 			sequence="M2+M3+V" />
@@ -1208,6 +1217,13 @@
 		<key platform="carbon" sequence="COMMAND+ALT+O"
 			contextId="org.eclipse.php.ui.phpEditorScope" commandId="org.eclipse.php.ui.edit.text.toggleMarkOccurrences"
 			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" />
+		<!-- copied from rev. 1.268 -->
+		<scheme
+			id="org.eclipse.php.ui.scheme"
+			name="name"
+			parentId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</scheme>
+		<!-- rev. 1.268 -->
 	</extension>
 	<extension point="org.eclipse.ui.preferencePages">
 		<page class="org.eclipse.php.internal.ui.preferences.PHPBasePreferencePage"
@@ -2101,5 +2117,30 @@
              </allowablePartitionTypes>
           </contentType>
        </lineCommentingStrategy>
-    </extension> 
+    </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/PHPUIMessages.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/PHPUIMessages.java,v
retrieving revision 1.32
diff -u -r1.32 PHPUIMessages.java
--- src/org/eclipse/php/internal/ui/PHPUIMessages.java	13 Apr 2011 06:34:52 -0000	1.32
+++ src/org/eclipse/php/internal/ui/PHPUIMessages.java	10 Aug 2012 02:57:00 -0000
@@ -111,6 +111,7 @@
 	public static String PasteSourceReferencesFromClipboardAction_paste1;
 	public static String IncludePathContainerDefaultPage_path_error_alreadyexists;
 	public static String DefaultPHPFoldingPreferenceBlock_PHPdoc;
+	public static String DefaultPHPFoldingPreferenceBlock_header_comments;
 	public static String PHPTemplateStore_error_message_nameEmpty;
 	public static String PHPBasePreferencePage_description;
 	public static String ColorPage_PHPDOCComment;
@@ -965,6 +966,8 @@
 	public static String CodeAssistPreferencePage_showVariablesFromOtherFiles;
 	public static String OpenAction_declaration_label;
 	public static String CodeTemplateBlock_templates_edit_button;
+	public static String typingPage_smartPaste_title;
+	public static String PHPEditorPreferencePage_typing_smartPaste;
 	static {
 		NLS.initializeMessages(BUNDLE_NAME, PHPUIMessages.class);
 	}
Index: src/org/eclipse/php/internal/ui/PHPUIMessages.properties
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/PHPUIMessages.properties,v
retrieving revision 1.109
diff -u -r1.109 PHPUIMessages.properties
--- src/org/eclipse/php/internal/ui/PHPUIMessages.properties	13 Apr 2011 06:34:52 -0000	1.109
+++ src/org/eclipse/php/internal/ui/PHPUIMessages.properties	10 Aug 2012 02:57:01 -0000
@@ -290,6 +290,7 @@
 DefaultPHPFoldingPreferenceBlock_includes= &Includes
 DefaultPHPFoldingPreferenceBlock_functions= &Functions
 DefaultPHPFoldingPreferenceBlock_PHPdoc= &PHPDoc
+DefaultPHPFoldingPreferenceBlock_header_comments= &Header PHPDoc
 
 EmptyPHPFoldingPreferenceBlock_emptyCaption=
 
@@ -311,7 +312,7 @@
 CodeAssistPreferencePage_showVariablesFromOtherFiles=Show variables from other files
 CodeAssistPreferencePage_insertFullyQualifiedNameForNamespace=Insert full qualified name for use statement
 CodeAssistPreferencePage_fillParameterNamesOnMethodCompletion=I&nsert parameter names
-CodeAssistPreferencePage_showStub=Show Stub
+#CodeAssistPreferencePage_showStub=Show Stub
 CoreUtility_buildall_taskname=Build all...
 CoreUtility_buildproject_taskname=Build project ''{0}''...
 CoreUtility_job_title=Rebuilding
@@ -1289,4 +1290,7 @@
 IncludePath_RemoveEntryFromIncludePathMessage=Would you also like to remove the selected entrie(s) from the Include Path?
 IncludePath_AddEntryTitle=Add Entries
 IncludePath_AddEntryToBuildPathMessage=Would you also like to add the selected entrie(s) to the Build Path?
-IncludePath_AddEntryToIncludePathMessage=Would you also like to add the selected entrie(s) to the Include Path?
\ No newline at end of file
+IncludePath_AddEntryToIncludePathMessage=Would you also like to add the selected entrie(s) to the Include Path?
+
+typingPage_smartPaste_title=When pasting
+PHPEditorPreferencePage_typing_smartPaste=Adjust &indentation
Index: src/org/eclipse/php/internal/ui/actions/AddDescriptionAction.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/actions/AddDescriptionAction.java,v
retrieving revision 1.25
diff -u -r1.25 AddDescriptionAction.java
--- src/org/eclipse/php/internal/ui/actions/AddDescriptionAction.java	4 Aug 2010 04:55:17 -0000	1.25
+++ src/org/eclipse/php/internal/ui/actions/AddDescriptionAction.java	10 Aug 2012 02:57:01 -0000
@@ -237,8 +237,7 @@
 			String lineDelim) {
 		String delimPlusIndent = lineDelim + indentation;
 		String indentedPattern = originalPattern.replaceAll(lineDelim,
-				delimPlusIndent)
-				+ delimPlusIndent;
+				delimPlusIndent) + delimPlusIndent;
 
 		return indentedPattern;
 	}
@@ -251,8 +250,8 @@
 	private String createTypeComment(IType type, String lineDelimiter)
 			throws CoreException {
 
-		return CodeGeneration.getTypeComment(type.getScriptProject(), type
-				.getTypeQualifiedName(), /* typeParameterNames */null,
+		return CodeGeneration.getTypeComment(type.getScriptProject(),
+				type.getTypeQualifiedName(), /* typeParameterNames */null,
 				lineDelimiter);
 	}
 
@@ -287,11 +286,11 @@
 	 * @return String to be used as leading indentation
 	 * @throws CoreException
 	 */
-	public String createPHPScopeFileDocBlock(IScriptProject scriptProject) {
+	public String createPHPScopeFileDocBlock(ISourceModule sourceModule) {
 		String fileComment;
 		try {
-			fileComment = CodeGeneration.getFileComment(scriptProject,
-					lineDelim);
+			fileComment = CodeGeneration
+					.getFileComment(sourceModule, lineDelim);
 		} catch (CoreException e) {
 			Logger.logException(e);
 			fileComment = createDefaultComment(lineDelim);
@@ -399,8 +398,7 @@
 						&& region.getType() == PHPRegionContext.PHP_CONTENT) {
 					phpScriptRegion = (IPhpScriptRegion) region;
 					try {
-						docBlock = CodeGeneration.getFileComment(data
-								.getScriptProject(), null);
+						docBlock = CodeGeneration.getFileComment(data, null);
 					} catch (CoreException e) {
 						Logger.logException(
 								"Generating default phpdoc comment", e);
@@ -415,8 +413,7 @@
 				if (region != null) {
 					phpScriptRegion = null;
 					textRegion = (ITextRegion) region;
-					docBlock = createPHPScopeFileDocBlock(data
-							.getScriptProject());
+					docBlock = createPHPScopeFileDocBlock(data);
 					break;
 				}
 			}
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.9
diff -u -r1.9 CommentHandler.java
--- src/org/eclipse/php/internal/ui/actions/CommentHandler.java	3 Aug 2010 09:20:58 -0000	1.9
+++ src/org/eclipse/php/internal/ui/actions/CommentHandler.java	10 Aug 2012 02:57:01 -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/autoEdit/CurlyOpenAutoEditStrategy.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/autoEdit/CurlyOpenAutoEditStrategy.java,v
retrieving revision 1.7
diff -u -r1.7 CurlyOpenAutoEditStrategy.java
--- src/org/eclipse/php/internal/ui/autoEdit/CurlyOpenAutoEditStrategy.java	18 Oct 2009 09:28:25 -0000	1.7
+++ src/org/eclipse/php/internal/ui/autoEdit/CurlyOpenAutoEditStrategy.java	10 Aug 2012 02:57:01 -0000
@@ -25,6 +25,11 @@
 
 	public void customizeDocumentCommand(IDocument document,
 			DocumentCommand command) {
+
+		if (!PHPAutoIndentStrategy.isSmartMode()) {
+			return;
+		}
+
 		if (command.text != null && command.text.endsWith("{")) { //$NON-NLS-1$
 			autoIndentBeforeCurlyOpen((IStructuredDocument) document, command);
 		}
@@ -52,9 +57,9 @@
 			}
 			int lineNumber = document.getLineOfOffset(startOffset);
 
-			if (isBlanks(document, startlineInfo.getOffset(), endlineInfo
-					.getOffset()
-					+ endlineInfo.getLength(), startOffset)) {
+			if (isBlanks(document, startlineInfo.getOffset(),
+					endlineInfo.getOffset() + endlineInfo.getLength(),
+					startOffset)) {
 				placeMatchingBlanks(document, helpBuffer, lineNumber,
 						startOffset);
 				int endSelection = command.offset + command.length;
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	10 Aug 2012 02:57:01 -0000
@@ -11,13 +11,23 @@
  *******************************************************************************/
 package org.eclipse.php.internal.ui.autoEdit;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.eclipse.jface.text.*;
 import org.eclipse.php.internal.core.documentModel.partitioner.PHPPartitionTypes;
+import org.eclipse.php.internal.core.documentModel.provisional.contenttype.ContentTypeIdForPHP;
 import org.eclipse.php.internal.core.format.DefaultIndentationStrategy;
 import org.eclipse.php.internal.core.format.FormatterUtils;
 import org.eclipse.php.internal.core.format.IIndentationStrategy;
+import org.eclipse.php.internal.core.format.PhpFormatter;
 import org.eclipse.php.internal.ui.Logger;
+import org.eclipse.php.internal.ui.PHPUiPlugin;
+import org.eclipse.php.internal.ui.preferences.PreferenceConstants;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
 import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
 
 /**
  * @author guy.g
@@ -55,6 +65,44 @@
 							.autoEditAfterNewLine(document, command, helpBuffer);
 			}
 
+			if (!(command.text.equals("\r\n") //
+					|| command.text.equals("\n") || command.text.equals("\r"))) {
+				// paste something
+				if (command.text.endsWith("\r") || command.text.endsWith("\n")) {
+					// paste line block
+					IRegion info = document.getLineInformation(document
+							.getLineOfOffset(command.offset + command.length));
+					int offset = info.getOffset();
+					int length = info.getLength();
+					String text = document.get(offset, length);
+					int i;
+					for (i = 0; i < length
+							&& (text.charAt(i) == ' ' || text.charAt(i) == '\t'); i++) {
+					}
+					if (command.offset + command.length < offset + i) {
+						command.length = offset + i - command.offset;
+					}
+					command.text = helpBuffer.toString();
+					if (PHPUiPlugin.getDefault().getPreferenceStore()
+							.getBoolean(PreferenceConstants.EDITOR_SMART_PASTE)) {
+						smartPaste(document, command);
+					}
+					document.replace(command.offset, command.length,
+							command.text);
+					// moving the caret position
+					futureCaretPosition = command.offset
+							+ command.text.length();
+					command.length = 0;
+					command.text = ""; //$NON-NLS-1$
+					command.offset = futureCaretPosition;
+					document.getUndoManager().disableUndoManagement();
+					document.replace(command.offset, command.length,
+							command.text);
+					document.getUndoManager().enableUndoManagement();
+					return;
+				}
+			}
+
 			final IRegion lineInfo = document.getLineInformation(lineNumber);
 
 			final int startOffset = lineInfo.getOffset();
@@ -169,4 +217,68 @@
 				forOffset);
 	}
 
+	/*
+	 * Copied and modified from
+	 * org.eclipse.php.internal.ui.autoEdit.PHPAutoIndentStrategy.smartPaste()
+	 */
+	protected void smartPaste(IDocument document, DocumentCommand command) {
+		if (command.offset == -1 || document.getLength() == 0)
+			return;
+		StringBuffer helpBuffer = new StringBuffer();
+		try {
+			if (document instanceof IStructuredDocument) {
+				DefaultIndentationStrategy
+						.placeMatchingBlanksForStructuredDocument(
+								(IStructuredDocument) document, helpBuffer,
+								document.getLineOfOffset(command.offset),
+								command.offset);
+				IRegion region = document.getLineInformation(document
+						.getLineOfOffset(command.offset));
+				if (document.get(region.getOffset(), region.getLength()).trim()
+						.length() == 0) { // blank line
+					if (command.offset != region.getOffset()) {
+						document.replace(region.getOffset(),
+								region.getLength(), "");
+						// adjust the offset
+						command.offset = region.getOffset();
+					}
+				} else {
+					// return;
+				}
+			}
+		} catch (BadLocationException e) {
+		}
+
+		String start = "<?php\n";
+		IStructuredModel model = StructuredModelManager.getModelManager()
+				.createUnManagedStructuredModelFor(
+						ContentTypeIdForPHP.ContentTypeID_PHP);
+		IStructuredDocument newdocument = model.getStructuredDocument();
+		newdocument.set(start + command.text);
+		PhpFormatter formatter = new PhpFormatter(0, newdocument.getLength());
+		formatter.format(((IDOMModel) model).getDocument());
+
+		List<String> list = new ArrayList<String>();
+		try {
+			int lineNumber = newdocument.getNumberOfLines();
+			for (int i = 1; i < lineNumber; i++) {
+				IRegion region = newdocument.getLineInformation(i);
+				String line = newdocument.get(region.getOffset(),
+						region.getLength());
+				list.add(line);
+			}
+		} catch (BadLocationException e) {
+		}
+		String newline = newdocument.getLineDelimiter();
+		StringBuffer sb = new StringBuffer();
+		for (int i = 0; i < list.size(); i++) {
+			sb.append(helpBuffer.toString()).append(list.get(i));
+			if (i != list.size() - 1) {
+				sb.append(newline);
+			}
+		}
+		command.text = sb.toString();
+
+		model.releaseFromEdit();
+	}
 }
Index: src/org/eclipse/php/internal/ui/autoEdit/MainAutoEditStrategy.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/autoEdit/MainAutoEditStrategy.java,v
retrieving revision 1.8
diff -u -r1.8 MainAutoEditStrategy.java
--- src/org/eclipse/php/internal/ui/autoEdit/MainAutoEditStrategy.java	24 Jul 2010 15:27:05 -0000	1.8
+++ src/org/eclipse/php/internal/ui/autoEdit/MainAutoEditStrategy.java	10 Aug 2012 02:57:01 -0000
@@ -47,10 +47,12 @@
 			// case of multi line comment or php doc
 			docBlockAutoEditStrategy
 					.customizeDocumentCommand(document, command);
+			tabAutoEditStrategy.customizeDocumentCommand(document, command);
 		} else if (partitionType.equals(PHPPartitionTypes.PHP_QUOTED_STRING)) {
 			indentLineAutoEditStrategy.customizeDocumentCommand(document,
 					command);
 			quotesAutoEditStrategy.customizeDocumentCommand(document, command);
+			tabAutoEditStrategy.customizeDocumentCommand(document, command);
 		} else if (partitionType.equals(PHPPartitionTypes.PHP_DEFAULT)
 				|| partitionType
 						.equals(PHPPartitionTypes.PHP_SINGLE_LINE_COMMENT)) {
Index: src/org/eclipse/php/internal/ui/autoEdit/PHPAutoIndentStrategy.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/autoEdit/PHPAutoIndentStrategy.java,v
retrieving revision 1.2
diff -u -r1.2 PHPAutoIndentStrategy.java
--- src/org/eclipse/php/internal/ui/autoEdit/PHPAutoIndentStrategy.java	2 Aug 2010 07:42:54 -0000	1.2
+++ src/org/eclipse/php/internal/ui/autoEdit/PHPAutoIndentStrategy.java	10 Aug 2012 02:57:01 -0000
@@ -11,21 +11,23 @@
  **********************************************************************/
 package org.eclipse.php.internal.ui.autoEdit;
 
-import java.io.BufferedReader;
-import java.io.Reader;
-import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.text.*;
-import org.eclipse.php.internal.core.documentModel.parser.PhpSourceParser;
+import org.eclipse.php.internal.core.documentModel.provisional.contenttype.ContentTypeIdForPHP;
 import org.eclipse.php.internal.core.format.DefaultIndentationStrategy;
 import org.eclipse.php.internal.core.format.PhpFormatter;
 import org.eclipse.php.internal.ui.PHPUiPlugin;
 import org.eclipse.php.internal.ui.preferences.PreferenceConstants;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.texteditor.ITextEditorExtension3;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
 import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
 
 /**
  * Auto indent strategy sensitive to brackets.
@@ -45,7 +47,7 @@
 		if (c.text != null
 				&& c.text.length() > 1
 				&& c.text.trim().length() > 1
-				&& !getPreferenceStore().getBoolean(
+				&& getPreferenceStore().getBoolean(
 						PreferenceConstants.EDITOR_SMART_PASTE)) {
 			smartPaste(d, c);
 		}
@@ -92,25 +94,22 @@
 		} catch (BadLocationException e) {
 		}
 
-		JobSafeStructuredDocument newdocument = new JobSafeStructuredDocument(
-				new PhpSourceParser());
-		String start = "<?php";
+		String start = "<?php\n";
+		IStructuredModel model = StructuredModelManager.getModelManager()
+				.createUnManagedStructuredModelFor(
+						ContentTypeIdForPHP.ContentTypeID_PHP);
+		IStructuredDocument newdocument = model.getStructuredDocument();
 		newdocument.set(start + command.text);
 		PhpFormatter formatter = new PhpFormatter(0, newdocument.getLength());
-		formatter.format(newdocument.getFirstStructuredDocumentRegion());
+		formatter.format(((IDOMModel) model).getDocument());
 
-		Reader reader = new StringReader(newdocument.get());
-		BufferedReader br = new BufferedReader(reader);
 		List<String> list = new ArrayList<String>();
 		try {
 			int lineNumber = newdocument.getNumberOfLines();
-			for (int i = 0; i < lineNumber; i++) {
+			for (int i = 1; i < lineNumber; i++) {
 				IRegion region = newdocument.getLineInformation(i);
-				String line = newdocument.get(region.getOffset(), region
-						.getLength());
-				if (list.isEmpty()) {
-					line = line.substring(start.length()).trim();
-				}
+				String line = newdocument.get(region.getOffset(),
+						region.getLength());
 				list.add(line);
 			}
 		} catch (BadLocationException e) {
@@ -124,5 +123,19 @@
 			}
 		}
 		command.text = sb.toString();
+
+		model.releaseFromEdit();
+	}
+
+	protected static boolean isSmartMode() {
+		IWorkbenchPage page = PHPUiPlugin.getActivePage();
+		if (page != null) {
+			IEditorPart part = page.getActiveEditor();
+			if (part instanceof ITextEditorExtension3) {
+				ITextEditorExtension3 extension = (ITextEditorExtension3) part;
+				return extension.getInsertMode() == ITextEditorExtension3.SMART_INSERT;
+			}
+		}
+		return false;
 	}
 }
Index: src/org/eclipse/php/internal/ui/autoEdit/TabAutoEditStrategy.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/autoEdit/TabAutoEditStrategy.java,v
retrieving revision 1.6
diff -u -r1.6 TabAutoEditStrategy.java
--- src/org/eclipse/php/internal/ui/autoEdit/TabAutoEditStrategy.java	18 Oct 2009 09:28:25 -0000	1.6
+++ src/org/eclipse/php/internal/ui/autoEdit/TabAutoEditStrategy.java	10 Aug 2012 02:57:02 -0000
@@ -12,11 +12,22 @@
 
 package org.eclipse.php.internal.ui.autoEdit;
 
+import java.io.IOException;
+
+import org.eclipse.dltk.core.ISourceModule;
+import org.eclipse.dltk.core.ModelException;
 import org.eclipse.jface.text.*;
+import org.eclipse.php.internal.core.ast.nodes.ASTNode;
+import org.eclipse.php.internal.core.ast.nodes.Program;
 import org.eclipse.php.internal.core.format.FormatPreferencesSupport;
 import org.eclipse.php.internal.ui.Logger;
 import org.eclipse.php.internal.ui.PHPUiPlugin;
+import org.eclipse.php.internal.ui.editor.PHPStructuredEditor;
 import org.eclipse.php.internal.ui.preferences.PreferenceConstants;
+import org.eclipse.php.ui.editor.SharedASTProvider;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
 
 /**
@@ -39,6 +50,16 @@
 	public void customizeDocumentCommand(IDocument document,
 			DocumentCommand command) {
 		if ((command.text != null) && command.text.equals("\t")) { //$NON-NLS-1$
+
+			// optional feature, run eclipse with "-D" VM argument
+			if (Boolean.getBoolean("jp.sourceforge.pdt_tools"
+					+ ".php.ui.disable_tab_space_conversion_in_quoted_string")) {
+				if (inQuotedString((IStructuredDocument) document,
+						command.offset)) {
+					return;
+				}
+			}
+
 			// override original tab command
 			command.text = ""; //$NON-NLS-1$
 
@@ -46,8 +67,8 @@
 			this.document = (IStructuredDocument) document;
 
 			boolean isAutoIndent = PHPUiPlugin.getDefault()
-					.getPreferenceStore().getBoolean(
-							PreferenceConstants.EDITOR_SMART_TAB);
+					.getPreferenceStore()
+					.getBoolean(PreferenceConstants.EDITOR_SMART_TAB);
 			if (!isAutoIndent) {
 				applyTabRule();
 				return;
@@ -254,6 +275,16 @@
 		if (indentChar == ' ') {
 			int indentSize = FormatPreferencesSupport.getInstance()
 					.getIndentationSize(document);
+			try {
+				int lineNumber = document.getLineOfOffset(command.offset);
+				IRegion originalLineInfo = document
+						.getLineInformation(lineNumber);
+				int cursorPositionSize = calculateCursorPositionSize(
+						lineNumber, originalLineInfo);
+				indentSize -= cursorPositionSize % indentSize;
+			} catch (BadLocationException e) {
+				Logger.logException(e);
+			}
 			command.text += getIndentationString(indentSize);
 		} else {
 			command.text += "\t"; //$NON-NLS-1$
@@ -273,4 +304,85 @@
 		lastIndentString = String.valueOf(result);
 		return lastIndentString;
 	}
+
+	/*
+	 * This method calculates the current cursor position size of the given line
+	 * Note : it considers Tab as 4 spaces
+	 */
+	private int calculateCursorPositionSize(int lineNumber, IRegion lineInfo)
+			throws BadLocationException {
+		int startOffset = lineInfo.getOffset();
+		int length = lineInfo.getLength();
+		String lineText = document.get(startOffset, length);
+		int result = 0;
+		for (int i = 0; i < command.offset - startOffset; i++) {
+			switch (lineText.charAt(i)) {
+			case '\t':
+				result += 4;
+				break;
+			default:
+				result += 1;
+				break;
+			}
+		}
+		return result;
+	}
+
+	/*
+	 * Determine if current cursor position is in quoted string
+	 */
+	private boolean inQuotedString(final IStructuredDocument document,
+			int offset) {
+		final ISourceModule[] sourceModule = new ISourceModule[1];
+		sourceModule[0] = null;
+		// resolve current sourceModule
+		PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+			public void run() {
+				IWorkbenchPage page = PHPUiPlugin.getActivePage();
+				if (page != null) {
+					IEditorPart editor = page.getActiveEditor();
+					if (editor instanceof PHPStructuredEditor) {
+						PHPStructuredEditor phpStructuredEditor = (PHPStructuredEditor) editor;
+						if (phpStructuredEditor.getTextViewer() != null
+								&& phpStructuredEditor.getDocument() == document) {
+							sourceModule[0] = (ISourceModule) phpStructuredEditor
+									.getModelElement();
+						}
+					}
+				}
+			}
+		});
+		// resolve AST
+		if (sourceModule[0] != null) {
+			try {
+				Program program = SharedASTProvider.getAST(sourceModule[0],
+						SharedASTProvider.WAIT_YES, null);
+				if (program != null) {
+					if (offset >= program.getLength()) {
+						offset = program.getLength() - 1;
+					}
+					ASTNode element = program.getElementAt(offset);
+					ASTNode node = element;
+					while (node != null && node.getType() != ASTNode.QUOTE) {
+						node = node.getParent();
+					}
+					if (node == null) {
+						node = element;
+					}
+					if (node != null) {
+						int type = node.getType();
+						if ((type == ASTNode.QUOTE || type == ASTNode.SCALAR)
+								&& offset > node.getStart()) {
+							return true;
+						}
+					}
+				}
+			} catch (ModelException e) {
+				Logger.logException(e);
+			} catch (IOException e) {
+				Logger.logException(e);
+			}
+		}
+		return false;
+	}
 }
Index: src/org/eclipse/php/internal/ui/compare/ContentMergeViewer.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/compare/ContentMergeViewer.java,v
retrieving revision 1.8
diff -u -r1.8 ContentMergeViewer.java
--- src/org/eclipse/php/internal/ui/compare/ContentMergeViewer.java	13 Apr 2011 06:34:52 -0000	1.8
+++ src/org/eclipse/php/internal/ui/compare/ContentMergeViewer.java	10 Aug 2012 02:57:02 -0000
@@ -76,6 +76,8 @@
  */
 public abstract class ContentMergeViewer extends ContentViewer implements
 		IPropertyChangeNotifier, IFlushable {
+	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=330672
+	org.eclipse.compare.contentmergeviewer.ContentMergeViewer cmv;
 
 	class SaveAction extends MergeViewerAction {
 
@@ -372,6 +374,55 @@
 		fRightSaveAction = new SaveAction(false);
 		fRightSaveAction.setEnabled(false);
 
+		// this is used to update the dirty status,if we use
+		// org.eclipse.php.internal.ui.compare.ContentMergeViewer,we will get a
+		// ClassCastException
+		cmv = new org.eclipse.compare.contentmergeviewer.ContentMergeViewer(
+				fStyles, fBundle, fCompareConfiguration) {
+
+			@Override
+			protected void createControls(Composite composite) {
+
+			}
+
+			@Override
+			protected void handleResizeAncestor(int x, int y, int width,
+					int height) {
+
+			}
+
+			@Override
+			protected void handleResizeLeftRight(int x, int y, int leftWidth,
+					int centerWidth, int rightWidth, int height) {
+
+			}
+
+			@Override
+			protected void updateContent(Object ancestor, Object left,
+					Object right) {
+
+			}
+
+			@Override
+			protected void copy(boolean leftToRight) {
+
+			}
+
+			@Override
+			protected byte[] getContents(boolean left) {
+				return null;
+			}
+
+			@Override
+			public boolean internalIsLeftDirty() {
+				return ContentMergeViewer.this.isLeftDirty();
+			}
+
+			@Override
+			public boolean internalIsRightDirty() {
+				return ContentMergeViewer.this.isRightDirty();
+			}
+		};
 	}
 
 	// ---- hooks ---------------------
@@ -1208,7 +1259,7 @@
 	}
 
 	private void fireDirtyState(boolean state) {
-		Utilities.firePropertyChange(fListenerList, this,
+		Utilities.firePropertyChange(fListenerList, cmv,
 				CompareEditorInput.DIRTY_STATE, null, new Boolean(state));
 	}
 
@@ -1358,9 +1409,7 @@
 				// post alert
 				Shell shell = fComposite.getShell();
 
-				MessageDialog dialog = new MessageDialog(
-						shell,
-						"", //$NON-NLS-1$
+				MessageDialog dialog = new MessageDialog(shell, "", //$NON-NLS-1$
 						null, // accept the default window icon
 						"", //$NON-NLS-1$
 						MessageDialog.QUESTION, new String[] {
Index: src/org/eclipse/php/internal/ui/compare/PhpMergeViewer.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/compare/PhpMergeViewer.java,v
retrieving revision 1.10
diff -u -r1.10 PhpMergeViewer.java
--- src/org/eclipse/php/internal/ui/compare/PhpMergeViewer.java	10 Jan 2011 06:34:03 -0000	1.10
+++ src/org/eclipse/php/internal/ui/compare/PhpMergeViewer.java	10 Aug 2012 02:57:02 -0000
@@ -14,20 +14,30 @@
 import java.util.ArrayList;
 
 import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.IDocumentPartitioner;
 import org.eclipse.jface.text.TextViewer;
 import org.eclipse.jface.text.source.SourceViewer;
 import org.eclipse.php.internal.core.documentModel.partitioner.PHPStructuredTextPartitioner;
+import org.eclipse.php.internal.core.documentModel.provisional.contenttype.ContentTypeIdForPHP;
 import org.eclipse.php.internal.ui.editor.configuration.PHPStructuredTextViewerConfiguration;
+import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
 import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredPartitioning;
+import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
+import org.eclipse.wst.validation.ValidationFramework;
 
 /**
  * Description: The viewer enables the file comparing with syntax coloring
  * 
  * @author Roy, 2007
  */
-public class PhpMergeViewer extends TextMergeViewer {
+public class PhpMergeViewer extends
+		org.eclipse.compare.contentmergeviewer.TextMergeViewer {
 
 	private ArrayList fSourceViewer;
 
@@ -61,4 +71,33 @@
 	public IDocumentPartitioner getDocumentPartitioner() {
 		return new PHPStructuredTextPartitioner();
 	}
+
+	@Override
+	protected SourceViewer createSourceViewer(Composite parent,
+			int textOrientation) {
+		return new StructuredTextViewer(parent, null, null, false,
+				textOrientation | SWT.H_SCROLL | SWT.V_SCROLL);
+	}
+
+	@Override
+	protected void updateContent(Object ancestor, Object left, Object right) {
+		try {
+			ValidationFramework.getDefault().join(new NullProgressMonitor());
+		} catch (OperationCanceledException e) {
+		} catch (InterruptedException e) {
+		}
+		super.updateContent(ancestor, left, right);
+	}
+
+	@Override
+	protected IDocument customizeDocument(IDocument document) {
+		if (document instanceof IStructuredDocument) {
+			return document;
+		}
+		IStructuredDocument newDoc = StructuredModelManager.getModelManager()
+				.createStructuredDocumentFor(
+						ContentTypeIdForPHP.ContentTypeID_PHP);
+		newDoc.set(document != null ? document.get() : ""); //$NON-NLS-1$
+		return newDoc;
+	}
 }
Index: src/org/eclipse/php/internal/ui/corext/codemanipulation/StubUtility.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/corext/codemanipulation/StubUtility.java,v
retrieving revision 1.15
diff -u -r1.15 StubUtility.java
--- src/org/eclipse/php/internal/ui/corext/codemanipulation/StubUtility.java	20 Aug 2010 03:16:29 -0000	1.15
+++ src/org/eclipse/php/internal/ui/corext/codemanipulation/StubUtility.java	10 Aug 2012 02:57:03 -0000
@@ -23,6 +23,7 @@
 import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.eclipse.dltk.core.IMethod;
 import org.eclipse.dltk.core.IScriptProject;
+import org.eclipse.dltk.core.ISourceModule;
 import org.eclipse.dltk.core.ModelException;
 import org.eclipse.dltk.internal.corext.util.Strings;
 import org.eclipse.dltk.internal.ui.DLTKUIStatus;
@@ -74,8 +75,8 @@
 		if (template == null) {
 			return bodyStatement;
 		}
-		CodeTemplateContext context = new CodeTemplateContext(template
-				.getContextTypeId(), project, lineDelimiter);
+		CodeTemplateContext context = new CodeTemplateContext(
+				template.getContextTypeId(), project, lineDelimiter);
 		context.setVariable(CodeTemplateContextType.ENCLOSING_METHOD,
 				methodName);
 		context.setVariable(CodeTemplateContextType.ENCLOSING_TYPE,
@@ -101,8 +102,8 @@
 		if (template == null) {
 			return null;
 		}
-		CodeTemplateContext context = new CodeTemplateContext(template
-				.getContextTypeId(), project, lineDelimiter);
+		CodeTemplateContext context = new CodeTemplateContext(
+				template.getContextTypeId(), project, lineDelimiter);
 		context.setVariable(CodeTemplateContextType.ENCLOSING_METHOD,
 				methodName);
 		context.setVariable(CodeTemplateContextType.ENCLOSING_TYPE,
@@ -123,8 +124,8 @@
 		if (template == null) {
 			return null;
 		}
-		CodeTemplateContext context = new CodeTemplateContext(template
-				.getContextTypeId(), project, lineDelimiter);
+		CodeTemplateContext context = new CodeTemplateContext(
+				template.getContextTypeId(), project, lineDelimiter);
 		context.setVariable(CodeTemplateContextType.ENCLOSING_METHOD,
 				methodName);
 		context.setVariable(CodeTemplateContextType.ENCLOSING_TYPE,
@@ -145,8 +146,8 @@
 			return null;
 		}
 
-		CodeTemplateContext context = new CodeTemplateContext(template
-				.getContextTypeId(), sp, lineDelimiter);
+		CodeTemplateContext context = new CodeTemplateContext(
+				template.getContextTypeId(), sp, lineDelimiter);
 		context.setVariable(CodeTemplateContextType.ENCLOSING_TYPE,
 				enclosingType);
 		context.setVariable(CodeTemplateContextType.ENCLOSING_METHOD,
@@ -167,16 +168,16 @@
 		}
 
 		IScriptProject project = sp;
-		CodeTemplateContext context = new CodeTemplateContext(template
-				.getContextTypeId(), project, lineDelimiter);
+		CodeTemplateContext context = new CodeTemplateContext(
+				template.getContextTypeId(), project, lineDelimiter);
 		context.setVariable(CodeTemplateContextType.TYPE_COMMENT,
 				typeComment != null ? typeComment : ""); //$NON-NLS-1$
 		context.setVariable(CodeTemplateContextType.FILE_COMMENT,
 				fileComment != null ? fileComment : ""); //$NON-NLS-1$
 		context.setVariable(CodeTemplateContextType.TYPE_DECLARATION,
 				typeContent);
-		context.setVariable(CodeTemplateContextType.TYPENAME, sp
-				.getElementName());
+		context.setVariable(CodeTemplateContextType.TYPENAME,
+				sp.getElementName());
 
 		String[] fullLine = { CodeTemplateContextType.PACKAGE_DECLARATION,
 				CodeTemplateContextType.FILE_COMMENT,
@@ -190,18 +191,21 @@
 	 * @see org.eclipse.jdt.ui.CodeGeneration#getFileComment(ICompilationUnit,
 	 * String)
 	 */
-	public static String getFileComment(IScriptProject sp, String lineDelimiter)
+	public static String getFileComment(ISourceModule sm, String lineDelimiter)
 			throws CoreException {
 		Template template = getCodeTemplate(
-				CodeTemplateContextType.FILECOMMENT_ID, sp);
+				CodeTemplateContextType.FILECOMMENT_ID, sm.getScriptProject());
 		if (template == null) {
 			return null;
 		}
 
-		CodeTemplateContext context = new CodeTemplateContext(template
-				.getContextTypeId(), sp, lineDelimiter);
-		context.setVariable(CodeTemplateContextType.FILENAME, sp
-				.getElementName());
+		CodeTemplateContext context = new CodeTemplateContext(
+				template.getContextTypeId(), sm.getScriptProject(),
+				lineDelimiter);
+		context.setVariable(CodeTemplateContextType.FILENAME,
+				sm.getElementName());
+		context.setVariable(CodeTemplateContextType.PROJECTNAME, sm
+				.getScriptProject().getElementName());
 		return evaluateTemplate(context, template);
 	}
 
@@ -219,12 +223,12 @@
 		if (template == null) {
 			return null;
 		}
-		CodeTemplateContext context = new CodeTemplateContext(template
-				.getContextTypeId(), sp, lineDelim);
-		context.setVariable(CodeTemplateContextType.ENCLOSING_TYPE, Signature
-				.getQualifier(typeQualifiedName));
-		context.setVariable(CodeTemplateContextType.TYPENAME, Signature
-				.getSimpleName(typeQualifiedName));
+		CodeTemplateContext context = new CodeTemplateContext(
+				template.getContextTypeId(), sp, lineDelim);
+		context.setVariable(CodeTemplateContextType.ENCLOSING_TYPE,
+				Signature.getQualifier(typeQualifiedName));
+		context.setVariable(CodeTemplateContextType.TYPENAME,
+				Signature.getSimpleName(typeQualifiedName));
 
 		TemplateBuffer buffer;
 		try {
@@ -285,8 +289,8 @@
 	private static String[] getParameterTypeNamesForSeeTag(IMethod overridden)
 			throws ModelException {
 		try {
-			Program program = SharedASTProvider.getAST(overridden
-					.getSourceModule(), SharedASTProvider.WAIT_YES,
+			Program program = SharedASTProvider.getAST(
+					overridden.getSourceModule(), SharedASTProvider.WAIT_YES,
 					new NullProgressMonitor());
 			ASTNode elementAt = program.getElementAt(overridden
 					.getSourceRange().getOffset());
@@ -378,8 +382,8 @@
 		if (template == null) {
 			return null;
 		}
-		CodeTemplateContext context = new CodeTemplateContext(template
-				.getContextTypeId(), sp, lineDelim);
+		CodeTemplateContext context = new CodeTemplateContext(
+				template.getContextTypeId(), sp, lineDelim);
 		// context.setCompilationUnitVariables(sp);
 		context.setVariable(CodeTemplateContextType.TYPENAME, typeName);
 
@@ -405,7 +409,7 @@
 				templateName = CodeTemplateContextType.OVERRIDECOMMENT_ID;
 		} else if (retTypeSig == null
 				&& typeName != null
-				&& (typeName.equals(methodName) || "constructor"
+				&& (typeName.equals(methodName) || "__construct"
 						.equals(methodName))) {
 			templateName = CodeTemplateContextType.CONSTRUCTORCOMMENT_ID;
 		}
@@ -413,8 +417,8 @@
 		if (template == null) {
 			return null;
 		}
-		CodeTemplateContext context = new CodeTemplateContext(template
-				.getContextTypeId(), sp, lineDelimiter);
+		CodeTemplateContext context = new CodeTemplateContext(
+				template.getContextTypeId(), sp, lineDelimiter);
 		// context.setCompilationUnitVariables(sp);
 		context.setVariable(CodeTemplateContextType.ENCLOSING_TYPE, typeName);
 		context.setVariable(CodeTemplateContextType.ENCLOSING_METHOD,
@@ -428,7 +432,8 @@
 					.getTypeQualifiedName(".");
 			String[] targetParamTypeNames = getParameterTypeNamesForSeeTag(target);
 			if (delegate)
-				context.setVariable(CodeTemplateContextType.SEE_TO_TARGET_TAG,
+				context.setVariable(
+						CodeTemplateContextType.SEE_TO_TARGET_TAG,
 						getSeeTag(targetTypeName, methodName,
 								targetParamTypeNames));
 			else
@@ -523,8 +528,8 @@
 		if (template == null) {
 			return null;
 		}
-		CodeTemplateContext context = new CodeTemplateContext(template
-				.getContextTypeId(), sp, lineDelimiter);
+		CodeTemplateContext context = new CodeTemplateContext(
+				template.getContextTypeId(), sp, lineDelimiter);
 		// context.setCompilationUnitVariables(sp);
 		context.setVariable(CodeTemplateContextType.FIELD_TYPE, fieldType);
 		context.setVariable(CodeTemplateContextType.FIELD, fieldName);
@@ -539,8 +544,8 @@
 		if (template == null) {
 			return null;
 		}
-		CodeTemplateContext context = new CodeTemplateContext(template
-				.getContextTypeId(), sp, lineDelimiter);
+		CodeTemplateContext context = new CodeTemplateContext(
+				template.getContextTypeId(), sp, lineDelimiter);
 		context.setVariable(CodeTemplateContextType.FIELD_TYPE, fieldType);
 		context.setVariable(CodeTemplateContextType.FIELD, fieldName);
 
@@ -563,8 +568,8 @@
 			return null;
 		}
 
-		CodeTemplateContext context = new CodeTemplateContext(template
-				.getContextTypeId(), sp, lineDelimiter);
+		CodeTemplateContext context = new CodeTemplateContext(
+				template.getContextTypeId(), sp, lineDelimiter);
 		context.setVariable(CodeTemplateContextType.ENCLOSING_TYPE, typeName);
 		context.setVariable(CodeTemplateContextType.ENCLOSING_METHOD,
 				methodName);
@@ -591,8 +596,8 @@
 		if (template == null) {
 			return null;
 		}
-		CodeTemplateContext context = new CodeTemplateContext(template
-				.getContextTypeId(), sp, lineDelimiter);
+		CodeTemplateContext context = new CodeTemplateContext(
+				template.getContextTypeId(), sp, lineDelimiter);
 		context.setVariable(CodeTemplateContextType.ENCLOSING_TYPE, typeName);
 		context.setVariable(CodeTemplateContextType.ENCLOSING_METHOD,
 				methodName);
@@ -669,8 +674,8 @@
 		if (region == null) {
 			return;
 		}
-		String lineStart = textBuffer.get(region.getOffset(), offset
-				- region.getOffset());
+		String lineStart = textBuffer.get(region.getOffset(),
+				offset - region.getOffset());
 
 		StringBuffer buf = new StringBuffer();
 		if (null != typeParameterNames) {
@@ -763,8 +768,8 @@
 		IScopeContext[] scopeContext;
 		if (project != null) {
 			// project preference
-			scopeContext = new IScopeContext[] { new ProjectScope(project
-					.getProject()) };
+			scopeContext = new IScopeContext[] { new ProjectScope(
+					project.getProject()) };
 			String lineDelimiter = Platform.getPreferencesService().getString(
 					Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null,
 					scopeContext);
@@ -812,8 +817,8 @@
 		if (sp == null)
 			return PHPUiPlugin.getDefault().getCodeTemplateStore()
 					.findTemplateById(id);
-		ProjectTemplateStore projectStore = new ProjectTemplateStore(sp
-				.getProject());
+		ProjectTemplateStore projectStore = new ProjectTemplateStore(
+				sp.getProject());
 		try {
 			projectStore.load();
 		} catch (IOException e) {
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.12
diff -u -r1.12 AbstractSemanticHighlighting.java
--- src/org/eclipse/php/internal/ui/editor/highlighter/AbstractSemanticHighlighting.java	29 Apr 2011 03:25:20 -0000	1.12
+++ src/org/eclipse/php/internal/ui/editor/highlighter/AbstractSemanticHighlighting.java	10 Aug 2012 02:57:03 -0000
@@ -114,14 +114,10 @@
 					if (editor instanceof PHPStructuredEditor) {
 						PHPStructuredEditor phpStructuredEditor = (PHPStructuredEditor) editor;
 						if (phpStructuredEditor.getTextViewer() != null
-								&& phpStructuredEditor != null
 								&& phpStructuredEditor.getDocument() == region
 										.getParentDocument()) {
-							if (phpStructuredEditor != null
-									&& phpStructuredEditor.getTextViewer() != null) {
-								sourceModule = (ISourceModule) phpStructuredEditor
-										.getModelElement();
-							}
+							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.7
diff -u -r1.7 DeprecatedHighlighting.java
--- src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java	21 Apr 2011 06:28:23 -0000	1.7
+++ src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java	10 Aug 2012 02:57:03 -0000
@@ -85,8 +85,28 @@
 			return true;
 		}
 
+		public boolean visit(StaticMethodInvocation staticInv) {
+			ITypeBinding type = staticInv.getClassName().resolveTypeBinding();
+			FunctionName funcName = staticInv.getMethod().getFunctionName();
+			String methodName = ModelUtils.getFunctionName(funcName);
+			if (type != null && methodName != null) {
+				IMethodBinding[] methods = type.getDeclaredMethods();
+				for (IMethodBinding method : methods) {
+					if (method.getName().equalsIgnoreCase(methodName)) {
+						if (ModelUtils.isDeprecated(method.getPHPElement())) {
+							highlight(funcName);
+							break;
+						}
+					}
+				}
+			}
+			return true;
+		}
+
 		public boolean visit(FunctionInvocation funcInv) {
-			if (!(funcInv.getParent() instanceof MethodInvocation)) {
+			ASTNode parent = funcInv.getParent();
+			if (!(parent instanceof MethodInvocation)
+					&& !(parent instanceof StaticMethodInvocation)) {
 				IModelAccessCache cache = funcInv.getAST().getBindingResolver()
 						.getModelAccessCache();
 				if (cache != null) {
Index: src/org/eclipse/php/internal/ui/editor/highlighters/FieldHighlighting.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/FieldHighlighting.java,v
retrieving revision 1.2
diff -u -r1.2 FieldHighlighting.java
--- src/org/eclipse/php/internal/ui/editor/highlighters/FieldHighlighting.java	6 Dec 2009 16:35:33 -0000	1.2
+++ src/org/eclipse/php/internal/ui/editor/highlighters/FieldHighlighting.java	10 Aug 2012 02:57:03 -0000
@@ -10,19 +10,24 @@
  *******************************************************************************/
 package org.eclipse.php.internal.ui.editor.highlighters;
 
+import org.eclipse.dltk.ast.Modifiers;
 import org.eclipse.php.internal.core.ast.nodes.*;
 import org.eclipse.php.internal.ui.editor.highlighter.AbstractSemanticApply;
 import org.eclipse.php.internal.ui.editor.highlighter.AbstractSemanticHighlighting;
 
 public class FieldHighlighting extends AbstractSemanticHighlighting {
 
-	protected class FielApply extends AbstractSemanticApply {
+	protected class FieldApply extends AbstractSemanticApply {
 
 		private int visitField = 0;
 
 		@Override
-		public boolean visit(SingleFieldDeclaration fieldDecl) {
-			highlight(fieldDecl.getName());
+		public boolean visit(FieldsDeclaration fieldsDeclaration) {
+			if ((fieldsDeclaration.getModifier() & Modifiers.AccStatic) == 0) {
+				for (Variable var : fieldsDeclaration.getVariableNames()) {
+					highlight(var);
+				}
+			}
 			return true;
 		}
 
@@ -66,7 +71,7 @@
 
 	@Override
 	public AbstractSemanticApply getSemanticApply() {
-		return new FielApply();
+		return new FieldApply();
 	}
 
 	@Override
Index: src/org/eclipse/php/internal/ui/editor/hyperlink/PHPHyperlinkDetector.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/hyperlink/PHPHyperlinkDetector.java,v
retrieving revision 1.13
diff -u -r1.13 PHPHyperlinkDetector.java
--- src/org/eclipse/php/internal/ui/editor/hyperlink/PHPHyperlinkDetector.java	24 Aug 2010 03:51:16 -0000	1.13
+++ src/org/eclipse/php/internal/ui/editor/hyperlink/PHPHyperlinkDetector.java	10 Aug 2012 02:57:03 -0000
@@ -11,9 +11,15 @@
  *******************************************************************************/
 package org.eclipse.php.internal.ui.editor.hyperlink;
 
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+
 import org.eclipse.dltk.core.ICodeAssist;
 import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.ISourceModule;
 import org.eclipse.dltk.core.ModelException;
+import org.eclipse.dltk.internal.core.SourceField;
 import org.eclipse.dltk.internal.ui.actions.ActionMessages;
 import org.eclipse.dltk.internal.ui.actions.OpenActionUtil;
 import org.eclipse.dltk.internal.ui.editor.EditorUtility;
@@ -24,8 +30,12 @@
 import org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector;
 import org.eclipse.jface.text.hyperlink.IHyperlink;
 import org.eclipse.php.internal.core.PHPVersion;
+import org.eclipse.php.internal.core.ast.nodes.ASTNode;
+import org.eclipse.php.internal.core.ast.nodes.Program;
+import org.eclipse.php.internal.core.ast.nodes.Variable;
 import org.eclipse.php.internal.core.project.ProjectOptions;
 import org.eclipse.php.internal.ui.editor.PHPStructuredEditor;
+import org.eclipse.php.ui.editor.SharedASTProvider;
 import org.eclipse.ui.texteditor.IEditorStatusLine;
 
 public class PHPHyperlinkDetector extends AbstractHyperlinkDetector {
@@ -71,6 +81,37 @@
 			IModelElement[] elements = null;
 			elements = ((ICodeAssist) input).codeSelect(wordRegion.getOffset(),
 					wordRegion.getLength());
+			// workaround for bug#365167
+			if (elements != null && elements.length > 0) {
+				if (elements[0] instanceof SourceField
+						&& input instanceof ISourceModule) {
+					try {
+						String word = document.get(wordRegion.getOffset(),
+								wordRegion.getLength());
+						if (!word.startsWith("$")) {
+							Program program = SharedASTProvider.getAST(
+									(ISourceModule) input,
+									SharedASTProvider.WAIT_ACTIVE_ONLY, null);
+							if (program != null) {
+								ASTNode node = program.getElementAt(offset)
+										.getParent();
+								if (node instanceof Variable) {
+									word = "$" + word;
+								}
+							}
+						}
+						List<IModelElement> list = new LinkedList<IModelElement>();
+						for (IModelElement element : elements) {
+							if (element.getElementName().equals(word)) {
+								list.add(element);
+							}
+						}
+						elements = list.toArray(new IModelElement[list.size()]);
+					} catch (BadLocationException e) {
+					} catch (IOException e) {
+					}
+				}
+			}
 			if (elements != null && elements.length > 0) {
 				final IHyperlink link;
 				if (elements.length == 1) {
Index: src/org/eclipse/php/internal/ui/editor/validation/PhpReconcilingStrategy.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/validation/PhpReconcilingStrategy.java,v
retrieving revision 1.16
diff -u -r1.16 PhpReconcilingStrategy.java
--- src/org/eclipse/php/internal/ui/editor/validation/PhpReconcilingStrategy.java	12 Mar 2010 03:17:42 -0000	1.16
+++ src/org/eclipse/php/internal/ui/editor/validation/PhpReconcilingStrategy.java	10 Aug 2012 02:57:03 -0000
@@ -90,6 +90,10 @@
 						if (activePage != null) {
 							if (editorInput != null) {
 								editor[0] = activePage.findEditor(editorInput);
+								if (editor[0] == null) {
+									// workaround for external file
+									editor[0] = activePage.getActiveEditor();
+								}
 							} else {
 								editor[0] = activePage.getActiveEditor(); // workaround
 								// for
@@ -237,8 +241,8 @@
 	 * @return the IFile
 	 */
 	public IFile getFile(String delta) {
-		IResource res = ResourcesPlugin.getWorkspace().getRoot().getFile(
-				new Path(delta));
+		IResource res = ResourcesPlugin.getWorkspace().getRoot()
+				.getFile(new Path(delta));
 		return res instanceof IFile ? (IFile) res : null;
 	}
 
Index: src/org/eclipse/php/internal/ui/folding/DefaultPHPFoldingPreferenceBlock.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/folding/DefaultPHPFoldingPreferenceBlock.java,v
retrieving revision 1.9
diff -u -r1.9 DefaultPHPFoldingPreferenceBlock.java
--- src/org/eclipse/php/internal/ui/folding/DefaultPHPFoldingPreferenceBlock.java	3 Aug 2010 09:20:57 -0000	1.9
+++ src/org/eclipse/php/internal/ui/folding/DefaultPHPFoldingPreferenceBlock.java	10 Aug 2012 02:57:03 -0000
@@ -50,8 +50,8 @@
 
 		public void widgetSelected(SelectionEvent e) {
 			Button button = (Button) e.widget;
-			fOverlayStore.setValue((String) fCheckBoxes.get(button), button
-					.getSelection());
+			fOverlayStore.setValue((String) fCheckBoxes.get(button),
+					button.getSelection());
 		}
 	};
 
@@ -76,6 +76,9 @@
 		// overlayKeys.add(new
 		// OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
 		// PreferenceConstants.EDITOR_FOLDING_INCLUDES));
+		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+				OverlayPreferenceStore.BOOLEAN,
+				PreferenceConstants.EDITOR_FOLDING_HEADER_COMMENTS));
 
 		return (OverlayKey[]) overlayKeys.toArray(new OverlayKey[overlayKeys
 				.size()]);
@@ -111,6 +114,9 @@
 		addCheckBox(inner,
 				PHPUIMessages.DefaultPHPFoldingPreferenceBlock_PHPdoc,
 				PreferenceConstants.EDITOR_FOLDING_PHPDOC, 0);
+		addCheckBox(inner,
+				PHPUIMessages.DefaultPHPFoldingPreferenceBlock_header_comments,
+				PreferenceConstants.EDITOR_FOLDING_HEADER_COMMENTS, 0);
 
 		return inner;
 	}
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.33
diff -u -r1.33 StructuredTextFoldingProviderPHP.java
--- src/org/eclipse/php/internal/ui/folding/StructuredTextFoldingProviderPHP.java	11 May 2011 02:53:54 -0000	1.33
+++ src/org/eclipse/php/internal/ui/folding/StructuredTextFoldingProviderPHP.java	10 Aug 2012 02:57:04 -0000
@@ -160,6 +160,25 @@
 		}
 
 		/**
+		 * Adds a projection region of class members(multi declarations over
+		 * several lines). Overwrites existing element's folding length.
+		 * 
+		 * @param annotation
+		 * @param position
+		 */
+		public void addProjectionRangeEx(PhpProjectionAnnotation annotation,
+				Position position) {
+			for (Object key : fMap.keySet()) {
+				Position pos = fMap.get(key);
+				if (pos.offset == position.offset) {
+					pos.setLength(position.getLength());
+					return;
+				}
+			}
+			fMap.put(annotation, position);
+		}
+
+		/**
 		 * Returns <code>true</code> if header comments should be collapsed.
 		 * 
 		 * @return <code>true</code> if header comments should be collapsed
@@ -1213,6 +1232,8 @@
 				.getBoolean(PreferenceConstants.EDITOR_FOLDING_PHPDOC);
 		fCollapseMembers = store
 				.getBoolean(PreferenceConstants.EDITOR_FOLDING_FUNCTIONS);
+		fCollapseHeaderComments = store
+				.getBoolean(PreferenceConstants.EDITOR_FOLDING_HEADER_COMMENTS);
 	}
 
 	private void update(FoldingStructureComputationContext ctx) {
@@ -1415,9 +1436,16 @@
 					Position position = element instanceof IMember ? createMemberPosition(
 							normalized, (IMember) element)
 							: createCommentPosition(normalized);
-					if (position != null)
-						ctx.addProjectionRange(new PhpProjectionAnnotation(
-								collapse, element, false), position);
+					if (position != null) {
+						if (element.getElementType() == IModelElement.FIELD) {
+							ctx.addProjectionRangeEx(
+									new PhpProjectionAnnotation(collapse,
+											element, false), position);
+						} else {
+							ctx.addProjectionRange(new PhpProjectionAnnotation(
+									collapse, element, false), position);
+						}
+					}
 				}
 			}
 		}
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.17
diff -u -r1.17 PHPSyntaxColoringPage.java
--- src/org/eclipse/php/internal/ui/preferences/PHPSyntaxColoringPage.java	29 Apr 2011 03:25:19 -0000	1.17
+++ src/org/eclipse/php/internal/ui/preferences/PHPSyntaxColoringPage.java	10 Aug 2012 02:57:05 -0000
@@ -779,7 +779,8 @@
 					switchEnablement(enablement);
 					getOverlayStore().setValue(
 							semantic.getEnabledPreferenceKey(), enablement);
-
+					applyStyles();
+					fText.redraw();
 				} else if (getStylePreferenceKeys().contains(namedStyle)) {
 					boolean enablement = fEnabler.getSelection();
 					switchEnablement(enablement);
@@ -787,6 +788,8 @@
 							PreferenceConstants
 									.getEnabledPreferenceKey(namedStyle),
 							enablement);
+					applyStyles();
+					fText.redraw();
 				}
 			}
 
@@ -1567,6 +1570,8 @@
 		fStrike.setEnabled(b);
 		fBackgroundColorEditor.setEnabled(b);
 		fForegroundColorEditor.setEnabled(b);
+		fForegroundLabel.setEnabled(b);
+		fBackgroundLabel.setEnabled(b);
 	}
 
 	private void initHighlightingStyles() {
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.55
diff -u -r1.55 PreferenceConstants.java
--- src/org/eclipse/php/internal/ui/preferences/PreferenceConstants.java	24 Mar 2011 02:36:27 -0000	1.55
+++ src/org/eclipse/php/internal/ui/preferences/PreferenceConstants.java	10 Aug 2012 02:57:06 -0000
@@ -750,6 +750,7 @@
 	public static final String EDITOR_FOLDING_CLASSES = "foldClasses"; //$NON-NLS-1$
 	public static final String EDITOR_FOLDING_FUNCTIONS = "foldFunctions"; //$NON-NLS-1$
 	//	public static final String EDITOR_FOLDING_INCLUDES = "foldIncludes"; //$NON-NLS-1$
+	public static final String EDITOR_FOLDING_HEADER_COMMENTS = "foldHeaderComment"; //$NON-NLS-1$
 
 	/**
 	 * A named preference that controls whether smart Home/End in PHP code is
Index: src/org/eclipse/php/internal/ui/preferences/TypingConfigurationBlock.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/preferences/TypingConfigurationBlock.java,v
retrieving revision 1.12
diff -u -r1.12 TypingConfigurationBlock.java
--- src/org/eclipse/php/internal/ui/preferences/TypingConfigurationBlock.java	18 Aug 2010 03:16:35 -0000	1.12
+++ src/org/eclipse/php/internal/ui/preferences/TypingConfigurationBlock.java	10 Aug 2012 02:57:06 -0000
@@ -132,6 +132,9 @@
 		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
 				OverlayPreferenceStore.STRING,
 				PreferenceConstants.EDITOR_ADD_PHP_FOR_PHPSTART_TAGS));
+		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
+				OverlayPreferenceStore.STRING,
+				PreferenceConstants.EDITOR_SMART_PASTE));
 
 		OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys
 				.size()];
@@ -159,6 +162,11 @@
 				PHPUIMessages.typingPage_smartTab_title);
 		addSmartTabSection(smartTabSection);
 
+		Composite smartPasteSection;
+		smartPasteSection = createSubsection(control,
+				PHPUIMessages.typingPage_smartPaste_title);
+		addSmartPasteSection(smartPasteSection);
+
 		scrolled.setContent(control);
 		final Point size = control.computeSize(SWT.DEFAULT, SWT.DEFAULT);
 		scrolled.setMinSize(size.x, size.y);
@@ -179,6 +187,17 @@
 
 	}
 
+	private void addSmartPasteSection(Composite smartPasteComposite) {
+		GridLayout layout = new GridLayout();
+		smartPasteComposite.setLayout(layout);
+
+		String label;
+		label = PHPUIMessages.PHPEditorPreferencePage_typing_smartPaste;
+		addCheckBox(smartPasteComposite, label,
+				PreferenceConstants.EDITOR_SMART_PASTE, 0);
+
+	}
+
 	private String autoIndentDetails = ""; //$NON-NLS-1$
 	private Link formatterPageLink;
 
Index: src/org/eclipse/php/internal/ui/text/PHPDocumentRegionEdgeMatcher.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/text/PHPDocumentRegionEdgeMatcher.java,v
retrieving revision 1.9
diff -u -r1.9 PHPDocumentRegionEdgeMatcher.java
--- src/org/eclipse/php/internal/ui/text/PHPDocumentRegionEdgeMatcher.java	11 Mar 2010 00:11:37 -0000	1.9
+++ src/org/eclipse/php/internal/ui/text/PHPDocumentRegionEdgeMatcher.java	10 Aug 2012 02:57:06 -0000
@@ -12,17 +12,13 @@
 
 package org.eclipse.php.internal.ui.text;
 
-import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.IRegion;
 import org.eclipse.jface.text.Region;
 import org.eclipse.jface.text.source.ICharacterPairMatcher;
-import org.eclipse.php.internal.core.documentModel.parser.regions.IPhpScriptRegion;
 import org.eclipse.php.internal.ui.editor.PHPPairMatcher;
 import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
 import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionContainer;
 import org.eclipse.wst.sse.ui.internal.text.DocumentRegionEdgeMatcher;
 import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
 
@@ -41,7 +37,7 @@
 	}
 
 	public IRegion match(IDocument document, int offset) {
-		if (offset < 0 || offset >= document.getLength())
+		if (offset < 0 || offset > document.getLength())
 			return null;
 
 		IRegion match = null;
@@ -78,77 +74,7 @@
 						match = new Region(docRegion.getEndOffset() - 1, 1);
 					}
 				}
-
-				if (match == null) {
-					/* Now check the text region */
-					ITextRegion currentTextRegion = docRegion
-							.getRegionAtCharacterOffset(offset);
-
-					// in case of container we have the extract the
-					// PhpScriptRegion
-					if (currentTextRegion instanceof ITextRegionContainer) {
-						ITextRegionContainer container = (ITextRegionContainer) currentTextRegion;
-						currentTextRegion = container
-								.getRegionAtCharacterOffset(offset);
-					}
-					if (currentTextRegion instanceof IPhpScriptRegion) {
-						IPhpScriptRegion scriptRegion = (IPhpScriptRegion) currentTextRegion;
-						try {
-							currentTextRegion = scriptRegion.getPhpToken(offset
-									- docRegion.getStartOffset(scriptRegion));
-
-							if (currentTextRegion != null
-									&& currentTextRegion.getTextLength() > 1) {
-								int offsetAtNearEdge = offset;
-								if (offset == docRegion
-										.getTextEndOffset(currentTextRegion)) {
-									offsetAtNearEdge = offset - 1;
-								} else if (offset == docRegion
-										.getStartOffset(currentTextRegion) + 1) {
-									offsetAtNearEdge = offset - 1;
-								}
-
-								if (offsetAtNearEdge == docRegion
-										.getStartOffset(currentTextRegion)) {
-									int end = docRegion
-											.getTextEndOffset(currentTextRegion);
-									try {
-										if (document.getChar(offsetAtNearEdge) == document
-												.getChar(end - 1)) {
-											fAnchor = ICharacterPairMatcher.LEFT;
-											match = new Region(end - 1, 1);
-										}
-									} catch (BadLocationException e) {
-										// nothing, not important enough
-									}
-								} else if (offsetAtNearEdge == docRegion
-										.getTextEndOffset(currentTextRegion) - 1) {
-									int start = docRegion
-											.getStartOffset(currentTextRegion);
-									if (document.getChar(offsetAtNearEdge) == document
-											.getChar(start)) {
-										fAnchor = ICharacterPairMatcher.RIGHT;
-										match = new Region(start, 1);
-									}
-								}
-							}
-						} catch (BadLocationException e) {
-							// nothing, not important enough
-						}
-					}
-				}
-			}
-		}
-		try {
-			// blank char
-			if (match != null && match.getLength() == 1) {
-				char currChar = document.getChar(match.getOffset());
-				// System.out.println((int) currChar);
-				if (currChar == 32 || currChar == 9) {
-					match = null;
-				}
 			}
-		} catch (BadLocationException e) {
 		}
 		if (match == null && fNextMatcher != null) {
 			fAnchor = -1;
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.22
diff -u -r1.22 PHPFileCreationWizard.java
--- src/org/eclipse/php/internal/ui/wizards/PHPFileCreationWizard.java	17 Aug 2010 05:49:12 -0000	1.22
+++ src/org/eclipse/php/internal/ui/wizards/PHPFileCreationWizard.java	10 Aug 2012 02:57:06 -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,34 @@
 				contents = contents.replaceAll("(\n\r?|\r\n?)", lineSeparator); //$NON-NLS-1$
 			}
 
+			// Handle encoding other than system encoding
+			InputStream stream = null;
+			String 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/ui/CodeGeneration.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.pdt/plugins/org.eclipse.php.ui/src/org/eclipse/php/ui/CodeGeneration.java,v
retrieving revision 1.21
diff -u -r1.21 CodeGeneration.java
--- src/org/eclipse/php/ui/CodeGeneration.java	17 Oct 2010 10:52:10 -0000	1.21
+++ src/org/eclipse/php/ui/CodeGeneration.java	10 Aug 2012 02:57:07 -0000
@@ -102,11 +102,12 @@
 	 * @throws CoreException
 	 *             Thrown when the evaluation of the code template fails.
 	 */
-	public static String getCompilationUnitContent(IScriptProject sp,
+	public static String getCompilationUnitContent(ISourceModule sm,
 			String typeComment, String typeContent, String lineDelimiter)
 			throws CoreException {
-		return getCompilationUnitContent(sp, getFileComment(sp, lineDelimiter),
-				typeComment, typeContent, lineDelimiter);
+		return getCompilationUnitContent(sm.getScriptProject(),
+				getFileComment(sm, lineDelimiter), typeComment, typeContent,
+				lineDelimiter);
 	}
 
 	/**
@@ -157,9 +158,9 @@
 	 *             Thrown when the evaluation of the code template fails.
 	 * @since 3.1
 	 */
-	public static String getFileComment(IScriptProject sp, String lineDelimiter)
+	public static String getFileComment(ISourceModule sm, String lineDelimiter)
 			throws CoreException {
-		return StubUtility.getFileComment(sp, lineDelimiter);
+		return StubUtility.getFileComment(sm, lineDelimiter);
 	}
 
 	/**
@@ -541,7 +542,7 @@
 
 		if (!(elementAt instanceof MethodDeclaration
 				|| elementAt instanceof FunctionDeclaration || elementAt
-				.getParent() instanceof MethodDeclaration)) {
+					.getParent() instanceof MethodDeclaration)) {
 			program = generageProgram(method, program);
 			if (program == null) {
 				return null;
