initial implementation
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / problem / DefaultProblem.java
index 9e433d3..1e7169e 100644 (file)
@@ -1,19 +1,21 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials 
- * are made available under the terms of the Common Public License v0.5 
+ * are made available under the terms of the Common Public License v1.0
  * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
+ * http://www.eclipse.org/legal/cpl-v10.html
  * 
  * Contributors:
  *     IBM Corporation - initial API and implementation
- ******************************************************************************/
+ *******************************************************************************/
 package net.sourceforge.phpdt.internal.compiler.problem;
 
 import net.sourceforge.phpdt.core.compiler.IProblem;
-import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit;
 import net.sourceforge.phpdt.internal.compiler.util.Util;
 
+import org.eclipse.ui.texteditor.ITextEditor;
+
+
 public class DefaultProblem implements ProblemSeverities, IProblem {
                
        private char[] fileName;
@@ -43,7 +45,7 @@ public class DefaultProblem implements ProblemSeverities, IProblem {
                this.line = line;
        }
 
-       public String errorReportSource(ICompilationUnit compilationUnit) {
+       public String errorReportSource(ITextEditor textEditor){ //ICompilationUnit compilationUnit) {
                //extra from the source the innacurate     token
                //and "highlight" it using some underneath ^^^^^
                //put some context around too.
@@ -58,7 +60,8 @@ public class DefaultProblem implements ProblemSeverities, IProblem {
                final char SPACE = '\u0020';
                final char MARK = '^';
                final char TAB = '\t';
-               char[] source = compilationUnit.getContents();
+//             char[] source = compilationUnit.getContents();
+               char[] source = textEditor.getDocumentProvider().getDocument(null).get().toCharArray();
                //the next code tries to underline the token.....
                //it assumes (for a good display) that token source does not
                //contain any \r \n. This is false on statements ! 
@@ -246,4 +249,4 @@ public class DefaultProblem implements ProblemSeverities, IProblem {
                }
                return s;
        }
-}
\ No newline at end of file
+}