Eclipseプラグイン開発デバッグ編

2331 ワード

  • 紹介
  • この文書では、自分のプロジェクトのデバッグに適した方法をカスタマイズする方法について説明します.
  • 拡張点org.eclipse.debug.ui.launchShortcuts

  • [codesyntax lang="xml"]
    <extension
     point="org.eclipse.debug.ui.launchShortcuts">
     <shortcut class="surenpi.com.dev.debugger.surenpi.comShortcut"
     	icon="icons/surenpi.com16x16.png"
     	id="surenpi.com.dev.debugger.launchShortcuts"
     	label="surenpi.comDebug"
     	modes="run,debug">
     	<configurationType
     		id="surenpi.com.dev.debugger.launchConfigurationTypes"/>
     	<contextualLaunch>
     		<enablement>
     			<with variable="selection">
     				<count value="1">
     				</count>
     				<iterate>
     					<or>
     						<test
     							property="org.eclipse.debug.ui.matchesPattern"
     							value="*.xml">
     						</test>
     					</or>
    		         		<or>
    		                    <adapt type="org.eclipse.core.resources.IFile">
    		                       <test property="org.eclipse.core.resources.name" value="pom.xml"/>
    		                    </adapt>
    		                    <adapt type="org.eclipse.core.resources.IProject">
    		                       <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.m2e.core.maven2Nature"/>
    		                    </adapt>
    		                 </or>
     				</iterate>
     			</with>
     		</enablement>
     	</contextualLaunch>
     </shortcut>
    </extension>
    [/codesyntax]以上の拡張子は、プロジェクトまたはファイル上で右クリックで実行する構成に使用されます.対応する実装クラスは以下の通りである.[codesyntax lang="php"]
    /**
    * surenpi.com
    */
    
    import org.eclipse.debug.ui.ILaunchShortcut;
    import org.eclipse.jface.viewers.ISelection;
    import org.eclipse.ui.IEditorPart;
    
    /**
     * @author surenpi.com
     * @since jdk1.6
     * 2015 8 10 
     */
    public class GboatShortcut implements ILaunchShortcut {
    
    	@Override
    	public void launch(ISelection arg0, String arg1) {
    		System.out.println("public void launch(ISelection arg0, String arg1) {");
    	}
    
    	@Override
    	public void launch(IEditorPart arg0, String arg1) {
    		System.out.println("public void launch(IEditorPart arg0, String arg1) {");
    	}
    
    }
    [/codesyntax]