Package org.eclipse.php.internal.debug.ui.console

Source Code of org.eclipse.php.internal.debug.ui.console.PHPConsoleListener

/*******************************************************************************
* Copyright (c) 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*     IBM Corporation - initial API and implementation
*     Zend Technologies
*******************************************************************************/
package org.eclipse.php.internal.debug.ui.console;

import org.eclipse.debug.core.ILaunch;
import org.eclipse.php.internal.debug.core.IPHPConsoleEventListener;
import org.eclipse.php.internal.debug.core.launching.DebugConsoleMonitor;
import org.eclipse.php.internal.debug.core.launching.PHPHyperLink;
import org.eclipse.php.internal.debug.core.zend.debugger.DebugError;
import org.eclipse.ui.console.IHyperlink;

public class PHPConsoleListener implements IPHPConsoleEventListener {

  protected ILaunch fLaunch;
  protected DebugConsoleMonitor fConsoleMonitor;
  protected PHPHyperLink fPHPHyperLink;

  public void init(ILaunch launch, DebugConsoleMonitor consoleMonitor,
      PHPHyperLink link) {
    fLaunch = launch;
    fConsoleMonitor = consoleMonitor;
    fPHPHyperLink = link;
  }

  public void handleEvent(DebugError debugError) {
    IHyperlink link = createLink(debugError);
    String message = debugError.toString().trim();
    fPHPHyperLink.addLink(link, message, message.length()
        - debugError.getErrorTextLength());
    fConsoleMonitor.append(debugError.toString() + '\n');
  }

  protected IHyperlink createLink(DebugError debugError) {
    String fileName = debugError.getFullPathName();
    int lineNumber = debugError.getLineNumber();
    return new PHPFileLink(fileName, lineNumber);
  }
}
TOP

Related Classes of org.eclipse.php.internal.debug.ui.console.PHPConsoleListener

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.