Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: cb644d3e0881efb478e05e8ff47b92ce3ea79258 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*******************************************************************************
 * Copyright (c) 2008 Wind River Systems 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
 *     Wind River Systems - adapted to use with IToggleBreakpiontsTargetFactory extension
 *******************************************************************************/
package org.eclipse.debug.ui.actions;

import java.util.Set;

import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchPart;

/**
 * A toggle breakpoints target factory creates one or more toggle breakpoint 
 * targets.  The toggle breakpoints targets are used by toggle breakpoint actions
 * to create breakpoints appropriate for the active editor, debug session, project, 
 * or selection.
 *  
 * <p>
 * Toggle breakpoints target factories are contributed via the 
 * <code>org.eclipse.debug.ui.toggleBreakpointsTargetFactories</code>
 * extension point. Following is an example of a detail pane factory extension:
 * <pre>
 * &lt;extension point="org.eclipse.debug.ui.toggleBreakpointsTargetFactories"&gt;
 *    &lt;toggleTargetFactory
 *            id="com.example.ExampleBreakpointToggleTargetFactory"
 *            class="com.example.BreakpointToggleTargetFactory"&gt;
 *        &lt;enablement&gt;
 *           &lt;!-- Test the active debug context.  Enable only if the active context
 *                is an element from "Example" debugger, or if there is no debug context 
 *                associated with the context element.  Also enable if debug context is
 *                empty --&gt;
 *           &lt;with variable="debugContext"&gt;
 *              &lt;iterate&gt;
 *               &lt;or&gt;
 *                  &lt;test property="org.eclipse.debug.ui.getModelIdentifier" value="com.example.model"/&gt;
 *                  &lt;test property="org.eclipse.debug.ui.getModelIdentifier" value=""/&gt;
 *               &lt;/or&gt;
 *           &lt;/iterate&gt;
 *           &lt;/with&gt;
 *           &lt;!-- If there is no active debug context.  Enable the breakpoint toggle for 
 *                the "Example" editors --&gt;
 *           &lt;instanceof value="com.example.Editor"/&gt;
 *        &lt;/enablement&gt;
 *    &lt;/toggleTargetFactory&gt;
 * &lt;/extension&gt;
 * </pre>
 * </p>
 * <p>
 * <p>
 * Clients contributing a toggle breakpoints target factory are intended to 
 * implement this interface.
 * 
 * @see IToggleBreakpointsTarget
 * @see IToggleBreakpointsTargetExtension
 * @see org.eclipse.debug.internal.ui.actions.ToggleBreakpointsTargetManager
 * @since 3.5
 */
public interface IToggleBreakpointsTargetFactory {
    /**
     * Returns all possible types of toggle breakpoints targets that this 
     * factory can create for the given selection and part, possibly empty. 
     * Toggle breakpoints targets  are returned as a set of IDs.
     * 
     * @param part The active part.
     * @param selection The current selection
     * @return Set of <code>String</code> IDs for possible toggle breakpoint 
     * targets, possibly empty
     */
    public Set getToggleTargets(IWorkbenchPart part, ISelection selection);
    
    /**
     * Returns the identifier of the default toggle breakpoints target to use 
     * for the given selection, or <code>null</code> if this factory has no 
     * preference.   
     * 
     * @param part The active part.
     * @param selection The current selection
     * @return a breakpoint toggle target identifier or <code>null</code>
     */
    public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection);
    
    /**
     * Creates and returns a toggle breakpoint target corresponding to the 
     * given identifier that this factory can produce (according to 
     * {@link #getToggleTargets}).
     *  
     * @param targetID The id of the toggle target to be created
     * @return toggle target or <code>null</code> if one could not be created
     */
    public IToggleBreakpointsTarget createToggleTarget(String targetID);
    
    /**
     * Returns a human readable name for the breakpoint toggle target associated with the 
     * given ID. Used to populate the context menu with meaningful names of the types of
     * breakpoints created by the given target.
     * 
     * @param targetID toggle breakpoints target identifier
     * @return toggle target name
     */
    public String getToggleTargetName(String targetID);
    
    /**
     * Returns a description for the breakpoint toggle target associated with the 
     * given ID or <code>null</code> if none. 
     * 
     * @param targetID toggle breakpoints target identifier
     * @return toggle target name or <code>null</code> if none
     */
    public String getToggleTargetDescription(String targetID);
    
}

Back to the top