KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > debugger > importd2 > ImportDebuggerType


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.debugger.importd2;
21
22 import org.openide.TopManager;
23 import org.openide.execution.ExecInfo;
24 import org.openide.debugger.DebuggerType;
25 import org.openide.debugger.DebuggerException;
26 import org.openide.util.HelpCtx;
27 import org.openide.loaders.DataObject;
28 import org.openide.text.Line;
29
30 import org.netbeans.modules.debugger.AbstractDebuggerType;
31
32
33 /**
34 * Default debugger type for Import debugger.
35 */

36 public class ImportDebuggerType extends AbstractDebuggerType {
37
38     static final long serialVersionUID = 5234304898551299437L;
39
40     /* Gets the display name for this debugger type. */
41     public String JavaDoc displayName () {
42         return ImportDebugger.getLocString ("CTL_Import_Debugger_Type");
43     }
44
45     public HelpCtx getHelpCtx () {
46         return new HelpCtx (ImportDebuggerType.class);
47     }
48
49     /* Starts the debugger. */
50     public void startDebugger (ExecInfo info, boolean stopOnMain)
51     throws DebuggerException {
52         TopManager.getDefault ().getDebugger ().startDebugger (
53             new ImportDebuggerInfo (
54                 info.getClassName (),
55                 info.getArguments (),
56                 stopOnMain ? info.getClassName () : null
57             )
58         );
59         return;
60     }
61     
62     /**
63      * Should return <code>true</code> if this DebuggerType supports debugging
64      * of given {@link org.openide.loaders.DataObject}.
65      *
66      * @param obj DataObject to test
67      * @return <code>true</code> if this DebuggerType supports debugging
68      * of given {@link org.openide.loaders.DataObject}
69      */

70     public boolean supportsDebuggingOf (DataObject obj) {
71         return obj.getPrimaryFile ().getMIMEType ().equals ("text/x-java");
72     }
73     
74     /**
75      * Starts debugging for a dataobject. Debugging should stop on given line.
76      * This method is called from RunToCursorAction.
77      *
78      * @param obj object to run
79      * @param stopOnLine should the debugging stop on given line or go to
80      * first breakpoint (if stopOnLine == <code>null</code>)
81      * @exception DebuggerException if debugger is not installed or cannot
82      * be started
83      */

84     public void startDebugger (DataObject obj, Line stopOnline) throws DebuggerException {
85         startDebugger (obj, false);
86     }
87     
88 }
89
Popular Tags