#757 - net.sourceforge.phpeclipse.xdebug.php.launching.PHPRemoteLaunchConfigurationDe...
[phpeclipse.git] / net.sourceforge.phpeclipse.launching / src / net / sourceforge / phpdt / internal / launching / ConsoleLineTracker.java
index 5eb4656..49d1b3c 100644 (file)
@@ -8,7 +8,6 @@ import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.debug.ui.console.IConsole;
-// TODO XXX Disabled for 3.1 import org.eclipse.debug.ui.console.IConsoleHyperlink;
 import org.eclipse.debug.ui.console.IConsoleLineTracker;
 import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.jface.text.IDocument;
@@ -17,41 +16,53 @@ import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.texteditor.ITextEditor;
 
-
 public class ConsoleLineTracker implements IConsoleLineTracker {
-    
-       private static class JavadocConsoleHyperLink /* TODO XXX Disabled for 3.1 implements IConsoleHyperlink */ {
-               
+
+       private static class JavadocConsoleHyperLink /*
+                                                                                                        * TODO XXX Disabled for 3.1
+                                                                                                        * implements
+                                                                                                        * IConsoleHyperlink
+                                                                                                        */{
+
                private IPath fExternalPath;
+
                private int fLineNumber;
 
                public JavadocConsoleHyperLink(IPath externalPath, int lineNumber) {
-                       fExternalPath= externalPath;
-                       fLineNumber= lineNumber;
+                       fExternalPath = externalPath;
+                       fLineNumber = lineNumber;
                }
 
-               /* (non-Javadoc)
+               /*
+                * (non-Javadoc)
+                * 
                 * @see org.eclipse.debug.ui.console.IConsoleHyperlink#linkEntered()
                 */
                public void linkEntered() {
                }
 
-               /* (non-Javadoc)
+               /*
+                * (non-Javadoc)
+                * 
                 * @see org.eclipse.debug.ui.console.IConsoleHyperlink#linkExited()
                 */
                public void linkExited() {
                }
 
-               /* (non-Javadoc)
+               /*
+                * (non-Javadoc)
+                * 
                 * @see org.eclipse.debug.ui.console.IConsoleHyperlink#linkActivated()
                 */
                public void linkActivated() {
                        try {
-                               IFile[] files= ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(fExternalPath);
+                               IFile[] files = ResourcesPlugin.getWorkspace().getRoot()
+                                               .findFilesForLocation(fExternalPath);
                                if (files.length > 0) {
                                        for (int i = 0; i < files.length; i++) {
-                                               IFile curr= files[0];
-                                               IEditorPart part= EditorUtility.openInEditor(curr, true);
+                                               IFile curr = files[0];
+                                               IEditorPart part = EditorUtility.openInEditor(curr,
+                                                               true);
                                                if (part != null) {
                                                        if (part instanceof ITextEditor) {
                                                                revealLine((ITextEditor) part, fLineNumber);
@@ -59,39 +70,44 @@ public class ConsoleLineTracker implements IConsoleLineTracker {
                                                        return;
                                                }
                                        }
-                               }       
+                               }
                        } catch (BadLocationException e) {
                                PHPLaunchingPlugin.log(e);
                        } catch (PartInitException e) {
-                         PHPLaunchingPlugin.log(e);
+                               PHPLaunchingPlugin.log(e);
                        } catch (JavaModelException e) {
-                         PHPLaunchingPlugin.log(e);
+                               PHPLaunchingPlugin.log(e);
                        }
                }
-               
-               private void revealLine(ITextEditor editor, int lineNumber) throws BadLocationException {
-                       IDocument document= editor.getDocumentProvider().getDocument(editor.getEditorInput());
-                       IRegion region= document.getLineInformation(lineNumber - 1);
+
+               private void revealLine(ITextEditor editor, int lineNumber)
+                               throws BadLocationException {
+                       IDocument document = editor.getDocumentProvider().getDocument(
+                                       editor.getEditorInput());
+                       IRegion region = document.getLineInformation(lineNumber - 1);
                        editor.selectAndReveal(region.getOffset(), 0);
                }
-               
+
        }
-       
 
        private IConsole fConsole;
-       
+
        public ConsoleLineTracker() {
-         super();
+               super();
        }
-       
-       /* (non-Javadoc)
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.eclipse.debug.ui.console.IConsoleLineTracker#init(org.eclipse.debug.ui.console.IConsole)
         */
        public void init(IConsole console) {
-               fConsole= console;
+               fConsole = console;
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.eclipse.debug.ui.console.IConsoleLineTracker#lineAppended(org.eclipse.jface.text.IRegion)
         */
        public void lineAppended(IRegion line) {
@@ -99,32 +115,34 @@ public class ConsoleLineTracker implements IConsoleLineTracker {
                        int offset = line.getOffset();
                        int length = line.getLength();
                        String text = fConsole.getDocument().get(offset, length);
-                       
-                       int index1= text.indexOf(':');
+
+                       int index1 = text.indexOf(':');
                        if (index1 == -1) {
                                return;
                        }
-                       
-                       int lineNumber= -1;
-                       IPath path= null;
-                       int index2= text.indexOf(':', index1 + 1);
+
+                       int lineNumber = -1;
+                       IPath path = null;
+                       int index2 = text.indexOf(':', index1 + 1);
                        while ((index2 != -1) && (path == null)) {
                                if (index1 < index2) {
                                        try {
-                                               String substr= text.substring(index1 + 1, index2);
-                                               lineNumber= Integer.parseInt(substr);
-                                               path= new Path(text.substring(0, index1));
+                                               String substr = text.substring(index1 + 1, index2);
+                                               lineNumber = Integer.parseInt(substr);
+                                               path = new Path(text.substring(0, index1));
                                        } catch (NumberFormatException e) {
                                                // ignore
                                        }
                                }
-                               index1= index2;
-                               index2= text.indexOf(':', index1 + 1);
+                               index1 = index2;
+                               index2 = text.indexOf(':', index1 + 1);
                        }
-                       
+
                        if (lineNumber != -1) {
-                               JavadocConsoleHyperLink link= new JavadocConsoleHyperLink(path, lineNumber);
-                               // TODO XXX Disabled for 3.1 fConsole.addLink(link, line.getOffset(), index1);
+                               JavadocConsoleHyperLink link = new JavadocConsoleHyperLink(
+                                               path, lineNumber);
+                               // TODO XXX Disabled for 3.1 fConsole.addLink(link,
+                               // line.getOffset(), index1);
 
                        }
                } catch (BadLocationException e) {
@@ -132,9 +150,9 @@ public class ConsoleLineTracker implements IConsoleLineTracker {
                }
        }
 
-
-
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.eclipse.debug.ui.console.IConsoleLineTracker#dispose()
         */
        public void dispose() {