4

私のプロジェクトでは、例外の場合に例外スタックトレースを表示する特別な JSP があります。

Eclipse でファイルを開く URL ハンドラなどを使用する方法はありますか? たぶんxdg-open

Kubuntu Linux で Eclipse 4.3 を使用しています。

4

1 に答える 1

2

私はこの解決策に行き着きました:

  1. 編集xdebug.ini(のような場所にする必要があります/etc/php/7.0/mods-available/xdebug.ini)、追加:

    xdebug.file_link_format="xdebug://%f(%l)"
    

    サーバーまたは php-fpm を再起動します。Ubuntu 上の Apache の場合は、sudo service apache2 restart.

  2. を作成しますeclipse-launch.sh。URL を解析し、ファイルを Eclipse に渡すことを目的としています。好きな名前を付けて、好きな場所に置くことができます。私は eclise ディレクトリに配置しました。/home/user必ず実際のホーム ディレクトリとpath="..."実際の Eclipse パスに置き換えてください。

    #! /bin/bash
    
    arg=$1
    path="/home/user/eclipse/eclipse-neon/"
    
    # file name directly followed by a line number in parenthesis
    regex="//([^(]*)\(([0-9]+)\)"
    
    if [[ $arg =~ $regex ]]
    then
        file=${BASH_REMATCH[1]}
        line=${BASH_REMATCH[2]}
        $path/eclipse --launcher.openFile "$file"+"$line"
    else
        msg="Unsupported URL: $arg"
        zenity --info --text="$msg"
    
        # alternatives:
        # notify-send "$msg" # another notification program
        # $path/eclipse # just run eclipse
    fi
    

    Eclipse コマンド ライン オプションの詳細については、http: //help.eclipse.org/mars/index.jsp?topic= /org.eclipse.platform.doc.isv/guide/product_open_file.htm を参照してください。

  3. ファイルに実行権限を付与します。chmod +a eclipse-launch.sh

  4. で作成xdebug.desktop~/.local/share/applications/ます。によって使用されxdg-openます (Chrome はデフォルトで xdg-open を使用します)。

    [Desktop Entry]
    Comment=
    Exec=/home/user/eclipse/eclipse-neon/eclipse-launch.sh "%u"
    Icon=/home/user/eclipse/eclipse-neon/eclipse/icon.xpm
    Name=Eclipse xdebug Launch
    NoDisplay=false
    StartupNotify=true
    Terminal=0
    TerminalOptions=
    Type=Application
    MimeType=x-scheme-handler/xdebug;
    
  5. 実行しますxdg-mime default xdebug.desktop x-scheme-handler/xdebug。これにより、セクションにエントリが追加さ~.local/share/applications/mimeapps.list[Default Applications]ます。エントリ自体は次のようになりますx-scheme-handler/xdebug=xdebug.desktop

  6. Firefox の場合は、次の手順に従ってください: https://xdebug.org/docs/all_settings#file_link_format

    • 開けるabout:config
    • 新しいブール値設定を追加しnetwork.protocol-handler.expose.xdebugて、false
    • xdebug:/// リンクを初めてクリックすると、Firefox は、実行するアプリケーションを選択するようにプロンプ​​トを出し、作成されたeclipse-launch.shファイルをポイントします。
于 2017-05-07T23:46:28.267 に答える