mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 360588 - [breakpoints] Allow user to edit all its properties prior to creating the breakpoint.
This commit is contained in:
parent
48eff8e4ae
commit
7c1e0556b6
77 changed files with 4131 additions and 2334 deletions
|
@ -1,5 +1,86 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<component id="org.eclipse.cdt.debug.core" version="2">
|
||||
<resource path="src/org/eclipse/cdt/debug/core/ICDebugConstants.java" type="org.eclipse.cdt.debug.core.ICDebugConstants">
|
||||
<filter id="403853384">
|
||||
<message_arguments>
|
||||
<message_argument value="org.eclipse.cdt.debug.core.ICDebugConstants"/>
|
||||
</message_arguments>
|
||||
</filter>
|
||||
</resource>
|
||||
<resource path="src/org/eclipse/cdt/debug/core/model/ICAddressBreakpoint.java" type="org.eclipse.cdt.debug.core.model.ICAddressBreakpoint">
|
||||
<filter comment="Binay backward compatible change." id="403767336">
|
||||
<message_arguments>
|
||||
<message_argument value="org.eclipse.cdt.debug.core.model.ICAddressBreakpoint"/>
|
||||
<message_argument value="C_ADDRESS_BREAKPOINT_MARKER"/>
|
||||
</message_arguments>
|
||||
</filter>
|
||||
</resource>
|
||||
<resource path="src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java" type="org.eclipse.cdt.debug.core.model.ICBreakpoint">
|
||||
<filter comment="Binary backward compatible change." id="403767336">
|
||||
<message_arguments>
|
||||
<message_argument value="org.eclipse.cdt.debug.core.model.ICBreakpoint"/>
|
||||
<message_argument value="C_BREAKPOINT_MARKER"/>
|
||||
</message_arguments>
|
||||
</filter>
|
||||
</resource>
|
||||
<resource path="src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java" type="org.eclipse.cdt.debug.core.model.ICEventBreakpoint">
|
||||
<filter comment="Binary backward compatible change." id="403767336">
|
||||
<message_arguments>
|
||||
<message_argument value="org.eclipse.cdt.debug.core.model.ICEventBreakpoint"/>
|
||||
<message_argument value="C_EVENT_BREAKPOINT_MARKER"/>
|
||||
</message_arguments>
|
||||
</filter>
|
||||
</resource>
|
||||
<resource path="src/org/eclipse/cdt/debug/core/model/ICFunctionBreakpoint.java" type="org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint">
|
||||
<filter comment="Binay backward compatible change." id="403767336">
|
||||
<message_arguments>
|
||||
<message_argument value="org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint"/>
|
||||
<message_argument value="C_FUNCTION_BREAKPOINT_MARKER"/>
|
||||
</message_arguments>
|
||||
</filter>
|
||||
</resource>
|
||||
<resource path="src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint.java" type="org.eclipse.cdt.debug.core.model.ICLineBreakpoint">
|
||||
<filter id="403767336">
|
||||
<message_arguments>
|
||||
<message_argument value="org.eclipse.cdt.debug.core.model.ICLineBreakpoint"/>
|
||||
<message_argument value="C_LINE_BREAKPOINT_MARKER"/>
|
||||
</message_arguments>
|
||||
</filter>
|
||||
</resource>
|
||||
<resource path="src/org/eclipse/cdt/debug/core/model/ICTracepoint.java" type="org.eclipse.cdt.debug.core.model.ICTracepoint">
|
||||
<filter comment="Binay backward compatible change." id="403767336">
|
||||
<message_arguments>
|
||||
<message_argument value="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
|
||||
<message_argument value="C_ADDRESS_TRACEPOINT_MARKER"/>
|
||||
</message_arguments>
|
||||
</filter>
|
||||
<filter comment="Binay backward compatible change." id="403767336">
|
||||
<message_arguments>
|
||||
<message_argument value="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
|
||||
<message_argument value="C_FUNCTION_TRACEPOINT_MARKER"/>
|
||||
</message_arguments>
|
||||
</filter>
|
||||
<filter comment="Binary backward compatible change." id="403767336">
|
||||
<message_arguments>
|
||||
<message_argument value="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
|
||||
<message_argument value="C_LINE_TRACEPOINT_MARKER"/>
|
||||
</message_arguments>
|
||||
</filter>
|
||||
<filter comment="Binary backward compatible change." id="403767336">
|
||||
<message_arguments>
|
||||
<message_argument value="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
|
||||
<message_argument value="C_TRACEPOINT_MARKER"/>
|
||||
</message_arguments>
|
||||
</filter>
|
||||
</resource>
|
||||
<resource path="src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java" type="org.eclipse.cdt.debug.core.model.ICWatchpoint">
|
||||
<filter comment="Binay backward compatible change." id="403767336">
|
||||
<message_arguments>
|
||||
<message_argument value="org.eclipse.cdt.debug.core.model.ICWatchpoint"/>
|
||||
<message_argument value="C_WATCHPOINT_MARKER"/>
|
||||
</message_arguments>
|
||||
</filter>
|
||||
</resource>
|
||||
<resource path="src/org/eclipse/cdt/debug/core/sourcelookup/MappingSourceContainer.java" type="org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer">
|
||||
<filter id="643846161">
|
||||
<message_arguments>
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -14,5 +14,11 @@ package org.eclipse.cdt.debug.core.model;
|
|||
* A breakpoint that suspend the execution when a particular address is reached.
|
||||
*/
|
||||
public interface ICAddressBreakpoint extends ICLineBreakpoint {
|
||||
|
||||
/**
|
||||
* Breakpoint marker type for this breakpoint type.
|
||||
* @since 7.2
|
||||
*/
|
||||
public static final String C_ADDRESS_BREAKPOINT_MARKER = "org.eclipse.cdt.debug.core.cAddressBreakpointMarker"; //$NON-NLS-1$
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,12 @@ import org.eclipse.debug.core.model.IBreakpoint;
|
|||
*/
|
||||
public interface ICBreakpoint extends IBreakpoint {
|
||||
|
||||
/**
|
||||
* Breakpoint marker type for this breakpoint type.
|
||||
* @since 7.2
|
||||
*/
|
||||
public static final String C_BREAKPOINT_MARKER = "org.eclipse.cdt.debug.core.cBreakpointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* This debug model identifier can be returned by a debug implementation
|
||||
* to indicate that a given debugger integration is using C Breakpoints.
|
||||
|
|
|
@ -36,4 +36,9 @@ public interface ICBreakpoint2 extends ICBreakpoint {
|
|||
*/
|
||||
public void refreshMessage() throws CoreException;
|
||||
|
||||
/**
|
||||
* Returns the marker type of the given CDT Breakpoint.
|
||||
* @return marker type ID
|
||||
*/
|
||||
public String getMarkerType();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,13 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* @since 7.0
|
||||
*/
|
||||
public interface ICEventBreakpoint extends ICBreakpoint {
|
||||
|
||||
/**
|
||||
* Breakpoint marker type for this breakpoint type.
|
||||
* @since 7.2
|
||||
*/
|
||||
public static final String C_EVENT_BREAKPOINT_MARKER = "org.eclipse.cdt.debug.core.cEventBreakpointMarker"; //$NON-NLS-1$;
|
||||
|
||||
/**
|
||||
* Breakpoint attribute storing the event breakpoint event id. Basically,
|
||||
* this indicates what type of event the breakpoint catches--e.g., a C++
|
||||
|
|
|
@ -15,5 +15,10 @@ package org.eclipse.cdt.debug.core.model;
|
|||
* A breakpoint that suspends the execution when a function is entered.
|
||||
*/
|
||||
public interface ICFunctionBreakpoint extends ICLineBreakpoint {
|
||||
/**
|
||||
* Breakpoint marker type for this breakpoint type.
|
||||
* @since 7.2
|
||||
*/
|
||||
public static final String C_FUNCTION_BREAKPOINT_MARKER = "org.eclipse.cdt.debug.core.cFunctionBreakpointMarker"; //$NON-NLS-1$
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,12 @@ import org.eclipse.debug.core.model.ILineBreakpoint;
|
|||
*/
|
||||
public interface ICLineBreakpoint extends ICBreakpoint, ILineBreakpoint {
|
||||
|
||||
/**
|
||||
* Breakpoint marker type for this breakpoint type.
|
||||
* @since 7.2
|
||||
*/
|
||||
public static final String C_LINE_BREAKPOINT_MARKER = "org.eclipse.cdt.debug.core.cLineBreakpointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Breakpoint attribute storing the function this breakpoint suspends
|
||||
* execution at (value <code>"org.eclipse.cdt.debug.core.function"</code>).
|
||||
|
@ -77,4 +83,5 @@ public interface ICLineBreakpoint extends ICBreakpoint, ILineBreakpoint {
|
|||
* underlying marker
|
||||
*/
|
||||
public String getFileName() throws CoreException;
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,31 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* @since 7.0
|
||||
*/
|
||||
public interface ICTracepoint extends ICLineBreakpoint {
|
||||
|
||||
/**
|
||||
* Breakpoint marker type for this breakpoint type.
|
||||
* @since 7.2
|
||||
*/
|
||||
public static final String C_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cTracepointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Breakpoint marker type for this breakpoint type.
|
||||
* @since 7.2
|
||||
*/
|
||||
public static final String C_LINE_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cLineTracepointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Breakpoint marker type for this breakpoint type.
|
||||
* @since 7.2
|
||||
*/
|
||||
public static final String C_ADDRESS_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cAddressTracepointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Breakpoint marker type for this breakpoint type.
|
||||
* @since 7.2
|
||||
*/
|
||||
public static final String C_FUNCTION_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cFunctionTracepointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Tracepoint attribute storing a tracepoint's pass count value (value
|
||||
* <code>"org.eclipse.cdt.debug.core.passCount"</code>). This attribute
|
||||
|
|
|
@ -18,6 +18,12 @@ import org.eclipse.debug.core.model.ILineBreakpoint;
|
|||
*/
|
||||
public interface ICWatchpoint extends ICBreakpoint, ILineBreakpoint {
|
||||
|
||||
/**
|
||||
* Breakpoint marker type for this breakpoint type.
|
||||
* @since 7.2
|
||||
*/
|
||||
public static final String C_WATCHPOINT_MARKER = "org.eclipse.cdt.debug.core.cWatchpointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Watchpoint attribute storing the expression associated with this
|
||||
* watchpoint (value <code>"org.eclipse.cdt.debug.core.expression"</code>).
|
||||
|
|
|
@ -42,8 +42,8 @@ public abstract class AbstractLineBreakpoint extends CBreakpoint implements ICLi
|
|||
* @param add
|
||||
* @throws CoreException
|
||||
*/
|
||||
public AbstractLineBreakpoint( IResource resource, String markerType, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, markerType, attributes, add );
|
||||
public AbstractLineBreakpoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, attributes, add );
|
||||
}
|
||||
|
||||
/*(non-Javadoc)
|
||||
|
|
|
@ -42,8 +42,8 @@ public abstract class AbstractTracepoint extends CBreakpoint implements ICTracep
|
|||
* @param add
|
||||
* @throws CoreException
|
||||
*/
|
||||
public AbstractTracepoint( IResource resource, String markerType, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, markerType, attributes, add );
|
||||
public AbstractTracepoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, attributes, add );
|
||||
}
|
||||
|
||||
/*(non-Javadoc)
|
||||
|
|
|
@ -24,8 +24,6 @@ import com.ibm.icu.text.MessageFormat;
|
|||
*/
|
||||
public class CAddressBreakpoint extends AbstractLineBreakpoint implements ICAddressBreakpoint {
|
||||
|
||||
private static final String C_ADDRESS_BREAKPOINT = "org.eclipse.cdt.debug.core.cAddressBreakpointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Constructor for CAddressBreakpoint.
|
||||
*/
|
||||
|
@ -36,14 +34,14 @@ public class CAddressBreakpoint extends AbstractLineBreakpoint implements ICAddr
|
|||
* Constructor for CAddressBreakpoint.
|
||||
*/
|
||||
public CAddressBreakpoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, getMarkerType(), attributes, add );
|
||||
super( resource, attributes, add );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of marker associated with this type of breakpoints
|
||||
*/
|
||||
public static String getMarkerType() {
|
||||
return C_ADDRESS_BREAKPOINT;
|
||||
public String getMarkerType() {
|
||||
return C_ADDRESS_BREAKPOINT_MARKER;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -27,8 +27,6 @@ import com.ibm.icu.text.MessageFormat;
|
|||
*/
|
||||
public class CAddressTracepoint extends AbstractTracepoint implements ICAddressBreakpoint, ICTracepoint {
|
||||
|
||||
private static final String C_ADDRESS_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cAddressTracepointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Constructor for CAddressTracepoint.
|
||||
*/
|
||||
|
@ -39,13 +37,13 @@ public class CAddressTracepoint extends AbstractTracepoint implements ICAddressB
|
|||
* Constructor for CAddressTracepoint.
|
||||
*/
|
||||
public CAddressTracepoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, getMarkerType(), attributes, add );
|
||||
super( resource, attributes, add );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of marker associated with this type of breakpoints
|
||||
*/
|
||||
public static String getMarkerType() {
|
||||
public String getMarkerType() {
|
||||
return C_ADDRESS_TRACEPOINT_MARKER;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.core.breakpoints;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -18,8 +17,7 @@ import java.util.Map;
|
|||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint2;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointExtension;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
|
@ -39,10 +37,12 @@ import org.eclipse.debug.core.DebugPlugin;
|
|||
import org.eclipse.debug.core.IDebugEventSetListener;
|
||||
import org.eclipse.debug.core.model.Breakpoint;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* The base class for all C/C++ specific breakpoints.
|
||||
*/
|
||||
public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ICBreakpointType, IDebugEventSetListener {
|
||||
public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint2, ICBreakpointType, IDebugEventSetListener {
|
||||
|
||||
/**
|
||||
* Map of breakpoint extensions. The keys to the map are debug model IDs
|
||||
|
@ -67,14 +67,14 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
|
|||
/**
|
||||
* Constructor for CBreakpoint.
|
||||
*/
|
||||
public CBreakpoint( final IResource resource, final String markerType, final Map<String, Object> attributes, final boolean add ) throws CoreException {
|
||||
public CBreakpoint( final IResource resource, final Map<String, Object> attributes, final boolean add ) throws CoreException {
|
||||
this();
|
||||
IWorkspaceRunnable wr = new IWorkspaceRunnable() {
|
||||
|
||||
@Override
|
||||
public void run( IProgressMonitor monitor ) throws CoreException {
|
||||
// create the marker
|
||||
setMarker( resource.createMarker( markerType ) );
|
||||
setMarker( resource.createMarker( getMarkerType() ) );
|
||||
// set attributes
|
||||
ensureMarker().setAttributes( attributes );
|
||||
//set the marker message
|
||||
|
@ -86,146 +86,69 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
|
|||
run( wr );
|
||||
}
|
||||
|
||||
public void createMarker( final IResource resource, final String markerType, final Map<String, Object> attributes, final boolean add ) throws DebugException {
|
||||
IWorkspaceRunnable wr = new IWorkspaceRunnable() {
|
||||
@Override
|
||||
public void run( IProgressMonitor monitor ) throws CoreException {
|
||||
// create the marker
|
||||
setMarker( resource.createMarker( markerType ) );
|
||||
// set attributes
|
||||
ensureMarker().setAttributes( attributes );
|
||||
//set the marker message
|
||||
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
|
||||
// add to breakpoint manager if requested
|
||||
register( add );
|
||||
}
|
||||
};
|
||||
run( wr );
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.core.model.IBreakpoint#getModelIdentifier()
|
||||
*/
|
||||
@Override
|
||||
public String getModelIdentifier() {
|
||||
return CDIDebugModel.getPluginIdentifier();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.debug.core.ICBreakpoint#isInstalled()
|
||||
*/
|
||||
@Override
|
||||
public boolean isInstalled() throws CoreException {
|
||||
return fInstallCount > 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.debug.core.ICBreakpoint#getCondition()
|
||||
*/
|
||||
@Override
|
||||
public String getCondition() throws CoreException {
|
||||
return ensureMarker().getAttribute( CONDITION, "" ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.debug.core.ICBreakpoint#setCondition(String)
|
||||
*/
|
||||
@Override
|
||||
public void setCondition( String condition ) throws CoreException {
|
||||
setAttribute( CONDITION, condition );
|
||||
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.debug.core.ICBreakpoint#getIgnoreCount()
|
||||
*/
|
||||
@Override
|
||||
public int getIgnoreCount() throws CoreException {
|
||||
return ensureMarker().getAttribute( IGNORE_COUNT, 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.debug.core.ICBreakpoint#setIgnoreCount(int)
|
||||
*/
|
||||
@Override
|
||||
public void setIgnoreCount( int ignoreCount ) throws CoreException {
|
||||
setAttribute( IGNORE_COUNT, ignoreCount );
|
||||
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getType()
|
||||
*/
|
||||
@Override
|
||||
public int getType() throws CoreException {
|
||||
return ensureMarker().getAttribute( TYPE, 0 );
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setType(int)
|
||||
*/
|
||||
@Override
|
||||
public void setType(int type) throws CoreException {
|
||||
setAttribute( TYPE, type );
|
||||
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.debug.core.ICBreakpoint#getThreadId()
|
||||
*/
|
||||
@Override
|
||||
public String getThreadId() throws CoreException {
|
||||
return ensureMarker().getAttribute( THREAD_ID, null );
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.debug.core.ICBreakpoint#setThreadId(String)
|
||||
*/
|
||||
@Override
|
||||
public void setThreadId( String threadId ) throws CoreException {
|
||||
setAttribute( THREAD_ID, threadId );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getSourceHandle()
|
||||
*/
|
||||
@Override
|
||||
public String getSourceHandle() throws CoreException {
|
||||
return ensureMarker().getAttribute( SOURCE_HANDLE, null );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setSourceHandle(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setSourceHandle( String sourceHandle ) throws CoreException {
|
||||
setAttribute( SOURCE_HANDLE, sourceHandle );
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(DebugEvent[])
|
||||
*/
|
||||
@Override
|
||||
public void handleDebugEvents( DebugEvent[] events ) {
|
||||
}
|
||||
|
@ -257,9 +180,6 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
|
|||
|
||||
abstract protected String getMarkerMessage() throws CoreException;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#incrementInstallCount()
|
||||
*/
|
||||
@Override
|
||||
public synchronized int incrementInstallCount() throws CoreException {
|
||||
++fInstallCount;
|
||||
|
@ -279,9 +199,6 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
|
|||
return fInstallCount;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#decrementInstallCount()
|
||||
*/
|
||||
@Override
|
||||
public synchronized int decrementInstallCount() throws CoreException {
|
||||
fInstallCount--;
|
||||
|
@ -293,9 +210,6 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
|
|||
return fInstallCount;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#resetInstallCount()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void resetInstallCount() throws CoreException {
|
||||
if (fInstallCount != 0) {
|
||||
|
@ -304,31 +218,6 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.core.model.Breakpoint#ensureMarker()
|
||||
*/
|
||||
@Override
|
||||
protected IMarker ensureMarker() throws DebugException {
|
||||
return super.ensureMarker();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.core.model.Breakpoint#setAttribute(String, Object)
|
||||
*/
|
||||
@Override
|
||||
protected void setAttribute( String attributeName, Object value ) throws CoreException {
|
||||
super.setAttribute( attributeName, value );
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#isConditional()
|
||||
*/
|
||||
@Override
|
||||
public boolean isConditional() throws CoreException {
|
||||
return ((getCondition() != null && getCondition().trim().length() > 0) || getIgnoreCount() > 0);
|
||||
|
@ -359,17 +248,11 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getModule()
|
||||
*/
|
||||
@Override
|
||||
public String getModule() throws CoreException {
|
||||
return ensureMarker().getAttribute( MODULE, null );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setModule(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setModule( String module ) throws CoreException {
|
||||
setAttribute( MODULE, module );
|
||||
|
@ -436,6 +319,10 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
|
|||
}
|
||||
return fExtensions.get(debugModelId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void refreshMessage() throws CoreException {
|
||||
IMarker marker = ensureMarker();
|
||||
marker.setAttribute(IMarker.MESSAGE, getMarkerMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,24 +14,15 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
|
||||
public class CEventBreakpoint extends CBreakpoint implements ICEventBreakpoint {
|
||||
|
||||
private static final String C_EVENTBREAKPOINT_MARKER_TYPE = "org.eclipse.cdt.debug.core.cEventBreakpointMarker"; //$NON-NLS-1$;
|
||||
|
||||
public CEventBreakpoint() {
|
||||
|
||||
}
|
||||
|
||||
public static String getMarkerType() {
|
||||
return C_EVENTBREAKPOINT_MARKER_TYPE;
|
||||
}
|
||||
|
||||
public CEventBreakpoint(IResource resource, Map<String, Object> attributes, boolean add) throws CoreException {
|
||||
|
@ -39,29 +30,14 @@ public class CEventBreakpoint extends CBreakpoint implements ICEventBreakpoint {
|
|||
// event breakpoint must set non null EVENT_TYPE_ID property to be valid
|
||||
if (attributes.get(EVENT_TYPE_ID) == null)
|
||||
throw new IllegalArgumentException();
|
||||
setBreakpointMarker(resource, getMarkerType(), attributes, add);
|
||||
|
||||
CDIDebugModel.createBreakpointMarker(this, resource, attributes, add);
|
||||
}
|
||||
|
||||
private void setBreakpointMarker(final IResource resource, final String markerType,
|
||||
final Map<String, Object> attributes, final boolean add) throws DebugException {
|
||||
IWorkspaceRunnable wr = new IWorkspaceRunnable() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
// create the marker
|
||||
setMarker(resource.createMarker(markerType));
|
||||
// set attributes
|
||||
ensureMarker().setAttributes(attributes);
|
||||
// set the marker message
|
||||
setAttribute(IMarker.MESSAGE, getMarkerMessage());
|
||||
// add to breakpoint manager if requested
|
||||
register(add);
|
||||
}
|
||||
};
|
||||
run(wr);
|
||||
@Override
|
||||
public String getMarkerType() {
|
||||
return C_EVENT_BREAKPOINT_MARKER;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getMarkerMessage() throws CoreException {
|
||||
// default message, overridden by label provider, which would take care of translation
|
||||
|
|
|
@ -24,8 +24,6 @@ import com.ibm.icu.text.MessageFormat;
|
|||
*/
|
||||
public class CFunctionBreakpoint extends AbstractLineBreakpoint implements ICFunctionBreakpoint {
|
||||
|
||||
private static final String C_FUNCTION_BREAKPOINT = "org.eclipse.cdt.debug.core.cFunctionBreakpointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Constructor for CFunctionBreakpoint.
|
||||
*/
|
||||
|
@ -36,14 +34,14 @@ public class CFunctionBreakpoint extends AbstractLineBreakpoint implements ICFun
|
|||
* Constructor for CFunctionBreakpoint.
|
||||
*/
|
||||
public CFunctionBreakpoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, getMarkerType(), attributes, add );
|
||||
super( resource, attributes, add );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of marker associated with this type of breakpoints
|
||||
*/
|
||||
public static String getMarkerType() {
|
||||
return C_FUNCTION_BREAKPOINT;
|
||||
public String getMarkerType() {
|
||||
return C_FUNCTION_BREAKPOINT_MARKER;
|
||||
}
|
||||
|
||||
/*(non-Javadoc)
|
||||
|
|
|
@ -27,8 +27,6 @@ import com.ibm.icu.text.MessageFormat;
|
|||
*/
|
||||
public class CFunctionTracepoint extends AbstractTracepoint implements ICFunctionBreakpoint, ICTracepoint {
|
||||
|
||||
private static final String C_FUNCTION_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cFunctionTracepointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Constructor for CFunctionTracepoint.
|
||||
*/
|
||||
|
@ -39,15 +37,15 @@ public class CFunctionTracepoint extends AbstractTracepoint implements ICFunctio
|
|||
* Constructor for CFunctionTracepoint.
|
||||
*/
|
||||
public CFunctionTracepoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, getMarkerType(), attributes, add );
|
||||
super( resource, attributes, add );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of marker associated with this type of breakpoints
|
||||
*/
|
||||
public static String getMarkerType() {
|
||||
return C_FUNCTION_TRACEPOINT_MARKER;
|
||||
}
|
||||
* Returns the type of marker associated with this type of breakpoints
|
||||
*/
|
||||
public String getMarkerType() {
|
||||
return C_FUNCTION_TRACEPOINT_MARKER;
|
||||
}
|
||||
|
||||
/*(non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.core.breakpoints;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||
|
@ -20,14 +19,14 @@ import org.eclipse.core.resources.IMarker;
|
|||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* A breakpoint that suspends the execution when a particular line of code is
|
||||
* reached.
|
||||
*/
|
||||
public class CLineBreakpoint extends AbstractLineBreakpoint {
|
||||
|
||||
private static final String C_LINE_BREAKPOINT = "org.eclipse.cdt.debug.core.cLineBreakpointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Constructor for CLineBreakpoint.
|
||||
*/
|
||||
|
@ -38,14 +37,12 @@ public class CLineBreakpoint extends AbstractLineBreakpoint {
|
|||
* Constructor for CLineBreakpoint.
|
||||
*/
|
||||
public CLineBreakpoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, getMarkerType(), attributes, add );
|
||||
super( resource, attributes, add );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of marker associated with this type of breakpoints
|
||||
*/
|
||||
public static String getMarkerType() {
|
||||
return C_LINE_BREAKPOINT;
|
||||
|
||||
@Override
|
||||
public String getMarkerType() {
|
||||
return C_LINE_BREAKPOINT_MARKER;
|
||||
}
|
||||
|
||||
/*(non-Javadoc)
|
||||
|
|
|
@ -29,8 +29,6 @@ import com.ibm.icu.text.MessageFormat;
|
|||
*/
|
||||
public class CLineTracepoint extends AbstractTracepoint implements ICTracepoint, ICLineBreakpoint2 {
|
||||
|
||||
private static final String C_LINE_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cLineTracepointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Constructor for CLineTracepoint.
|
||||
*/
|
||||
|
@ -41,16 +39,14 @@ public class CLineTracepoint extends AbstractTracepoint implements ICTracepoint,
|
|||
* Constructor for CLineTracepoint.
|
||||
*/
|
||||
public CLineTracepoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, getMarkerType(), attributes, add );
|
||||
super( resource, attributes, add );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of marker associated with this type of breakpoints
|
||||
*/
|
||||
public static String getMarkerType() {
|
||||
return C_LINE_TRACEPOINT_MARKER;
|
||||
@Override
|
||||
public String getMarkerType() {
|
||||
return C_LINE_TRACEPOINT_MARKER;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public synchronized int decrementInstallCount() throws CoreException {
|
||||
int count = super.decrementInstallCount();
|
||||
|
|
|
@ -25,8 +25,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
*/
|
||||
public class CWatchpoint extends CBreakpoint implements ICWatchpoint2 {
|
||||
|
||||
private static final String C_WATCHPOINT = "org.eclipse.cdt.debug.core.cWatchpointMarker"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Constructor for CWatchpoint.
|
||||
*/
|
||||
|
@ -37,13 +35,14 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint2 {
|
|||
* Constructor for CWatchpoint.
|
||||
*/
|
||||
public CWatchpoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, getMarkerType(), attributes, add );
|
||||
super( resource, attributes, add );
|
||||
}
|
||||
|
||||
protected CWatchpoint( IResource resource, String marker, Map<String, Object> attributes, boolean add ) throws CoreException {
|
||||
super( resource, marker, attributes, add );
|
||||
@Override
|
||||
public String getMarkerType() {
|
||||
return C_WATCHPOINT_MARKER;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICWatchpoint#isWriteType()
|
||||
*/
|
||||
|
@ -68,13 +67,6 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint2 {
|
|||
return ensureMarker().getAttribute( EXPRESSION, "" ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of marker associated with this type of breakpoints
|
||||
*/
|
||||
public static String getMarkerType() {
|
||||
return C_WATCHPOINT;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
|
||||
*/
|
||||
|
|
|
@ -9,6 +9,7 @@ Bundle-Localization: plugin
|
|||
Export-Package:
|
||||
org.eclipse.cdt.debug.internal.ui;x-internal:=true,
|
||||
org.eclipse.cdt.debug.internal.ui.actions;x-friends:="org.eclipse.cdt.dsf.ui,org.eclipse.cdt.debug.ui.memory.memorybrowser",
|
||||
org.eclipse.cdt.debug.internal.ui.actions.breakpoints;x-internal:=true,
|
||||
org.eclipse.cdt.debug.internal.ui.commands;x-internal:=true,
|
||||
org.eclipse.cdt.debug.internal.ui.dialogfields;x-internal:=true,
|
||||
org.eclipse.cdt.debug.internal.ui.dialogs;x-internal:=true,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2000, 2011 QNX Software Systems and others.
|
||||
# Copyright (c) 2000, 2012 QNX Software 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
|
||||
|
@ -36,6 +36,7 @@ ShowDebuggerConsoleAction.label=Show Debugger Console
|
|||
ShowDebuggerConsoleAction.tooltip=Show Debugger Console On Target Selection
|
||||
|
||||
AddBreakpoint.label=Toggle &Breakpoint
|
||||
AddBreakpointInteractive.label=&Add Breakpoint...
|
||||
EnableBreakpoint.label=&Toggle Breakpoint Enabled
|
||||
BreakpointProperties.label=Breakpoint P&roperties...
|
||||
BreakpointPropertiesCommand.name=C/C++ Breakpoint Properties
|
||||
|
|
|
@ -425,17 +425,24 @@
|
|||
<action
|
||||
label="%BreakpointProperties.label"
|
||||
helpContextId="breakpoint_properties_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesRulerActionDelegate"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CBreakpointPropertiesRulerActionDelegate"
|
||||
menubarPath="debug"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesRulerActionDelegate">
|
||||
</action>
|
||||
<action
|
||||
label="%EnableBreakpoint.label"
|
||||
helpContextId="enable_disable_breakpoint_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.EnableDisableBreakpointRulerActionDelegate"
|
||||
class="org.eclipse.debug.ui.actions.RulerEnableDisableBreakpointActionDelegate"
|
||||
menubarPath="debug"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.EnableDisableBreakpointRulerActionDelegate">
|
||||
</action>
|
||||
<action
|
||||
label="%AddBreakpointInteractive.label"
|
||||
helpContextId="add_breakpoint_interactive_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CAddBreakpointInteractiveRulerActionDelegate"
|
||||
menubarPath="debug"
|
||||
id="org.eclipse.debug.ui.actions.RulerCreateBreakpointInteractiveAction">
|
||||
</action>
|
||||
<action
|
||||
label="%AddBreakpoint.label"
|
||||
helpContextId="manage_breakpoint_action_context"
|
||||
|
@ -496,17 +503,24 @@
|
|||
<action
|
||||
label="%BreakpointProperties.label"
|
||||
helpContextId="breakpoint_properties_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesRulerActionDelegate"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CBreakpointPropertiesRulerActionDelegate"
|
||||
menubarPath="debug"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesRulerActionDelegate">
|
||||
</action>
|
||||
<action
|
||||
label="%EnableBreakpoint.label"
|
||||
helpContextId="enable_disable_breakpoint_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.EnableDisableBreakpointRulerActionDelegate"
|
||||
class="org.eclipse.debug.ui.actions.RulerEnableDisableBreakpointActionDelegate"
|
||||
menubarPath="debug"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.EnableDisableBreakpointRulerActionDelegate">
|
||||
</action>
|
||||
<action
|
||||
label="%AddBreakpointInteractive.label"
|
||||
helpContextId="create_breakpoint_interactive_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CAddBreakpointInteractiveRulerActionDelegate"
|
||||
menubarPath="debug"
|
||||
id="org.eclipse.debug.ui.actions.RulerCreateBreakpointInteractiveAction">
|
||||
</action>
|
||||
<action
|
||||
label="%AddBreakpoint.label"
|
||||
helpContextId="manage_breakpoint_action_context"
|
||||
|
@ -605,7 +619,7 @@
|
|||
icon="icons/elcl16/function_brkpt_co.gif"
|
||||
helpContextId="manage_function_breakpoint_action_context"
|
||||
tooltip="%ManageFunctionBreakpointAction.tooltip"
|
||||
class="org.eclipse.debug.ui.actions.ToggleMethodBreakpointActionDelegate"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CToggleMethodBreakpointActionDelegate"
|
||||
menubarPath="additions"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.debug.ui.actions.function.ToggleMethodBreakpointAction">
|
||||
|
@ -619,7 +633,7 @@
|
|||
icon="icons/elcl16/function_brkpt_co.gif"
|
||||
helpContextId="manage_function_breakpoint_action_context"
|
||||
tooltip="%ManageFunctionBreakpointAction.tooltip"
|
||||
class="org.eclipse.debug.ui.actions.ToggleMethodBreakpointActionDelegate"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CToggleMethodBreakpointActionDelegate"
|
||||
menubarPath="additions"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.debug.ui.actions.method.ToggleMethodBreakpointAction">
|
||||
|
@ -629,7 +643,7 @@
|
|||
objectClass="org.eclipse.cdt.debug.internal.core.ICWatchpointTarget"
|
||||
id="org.eclipse.cdt.debug.ui.WatchpointActions">
|
||||
<action
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnVariableActionDelegate"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.AddWatchpointOnVariableActionDelegate"
|
||||
enablesFor="1"
|
||||
icon="icons/elcl16/watchpoint_co.gif"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnVariableActionDelegate"
|
||||
|
@ -854,7 +868,7 @@
|
|||
id="org.eclipse.debug.ui.MemoryView.RenderingViewPane.popupMenu.1"
|
||||
targetID="org.eclipse.debug.ui.MemoryView.RenderingViewPane.1">
|
||||
<action
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnMemoryActionDelegate"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.AddWatchpointOnMemoryActionDelegate"
|
||||
enablesFor="1"
|
||||
icon="icons/elcl16/watchpoint_co.gif"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnMemoryActionDelegate.1"
|
||||
|
@ -867,7 +881,7 @@
|
|||
id="org.eclipse.debug.ui.MemoryView.RenderingViewPane.popupMenu.2"
|
||||
targetID="org.eclipse.debug.ui.MemoryView.RenderingViewPane.2">
|
||||
<action
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnMemoryActionDelegate"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.AddWatchpointOnMemoryActionDelegate"
|
||||
enablesFor="1"
|
||||
icon="icons/elcl16/watchpoint_co.gif"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnMemoryActionDelegate.2"
|
||||
|
@ -946,7 +960,7 @@
|
|||
</enablement>
|
||||
</action>
|
||||
<action
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointActionDelegate"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.AddWatchpointActionDelegate"
|
||||
icon="icons/elcl16/watchpoint_co.gif"
|
||||
id="org.eclipse.cdt.debug.ui.addWatchpoint"
|
||||
label="%AddWatchpoint.label"
|
||||
|
@ -955,7 +969,7 @@
|
|||
helpContextId="add_watchpoint_action_context"
|
||||
tooltip="%AddWatchpoint.tooltip"/>
|
||||
<action
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.AddEventBreakpointActionDelegate"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.AddEventBreakpointActionDelegate"
|
||||
icon="icons/obj16/eventbreakpoint_obj.gif"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.AddEventBreakpointActionDelegate"
|
||||
label="%AddEventBreakpoint.label"
|
||||
|
@ -1172,18 +1186,27 @@
|
|||
<extension
|
||||
point="org.eclipse.ui.propertyPages">
|
||||
<page
|
||||
class="org.eclipse.cdt.debug.internal.ui.propertypages.CBreakpointPropertyPage"
|
||||
class="org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointPropertyPage"
|
||||
id="org.eclipse.cdt.debug.ui.propertypages.breakpoint.common"
|
||||
name="%CommonBreakpointPage.label">
|
||||
<enabledWhen>
|
||||
<and>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint">
|
||||
</adapt>
|
||||
<not>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICTracepoint">
|
||||
<or>
|
||||
<and>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint">
|
||||
</adapt>
|
||||
</not>
|
||||
</and>
|
||||
<not>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICTracepoint">
|
||||
</adapt>
|
||||
</not>
|
||||
|
||||
</and>
|
||||
<and>
|
||||
<test property="org.eclipse.cdt.debug.ui.createBreakpointAdapt" value="org.eclipse.cdt.debug.core.model.ICBreakpoint" />
|
||||
<not>
|
||||
<test property="org.eclipse.cdt.debug.ui.createBreakpointAdapt" value="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
|
||||
</not>
|
||||
</and>
|
||||
</or>
|
||||
</enabledWhen>
|
||||
</page>
|
||||
<page
|
||||
|
@ -1201,7 +1224,7 @@
|
|||
</and>
|
||||
</enabledWhen>
|
||||
</page>
|
||||
<page class="org.eclipse.cdt.debug.internal.ui.propertypages.CBreakpointFilteringPage"
|
||||
<page class="org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointFilteringPage"
|
||||
id="org.eclipse.cdt.debug.ui.propertypages.breakpoint.filtering"
|
||||
name="%FilteringBreakpointPage.label">
|
||||
<filter name="debugModelId" value="org.eclipse.cdt.debug.core"/>
|
||||
|
@ -1296,7 +1319,7 @@
|
|||
<extension
|
||||
point="org.eclipse.ui.editors.markerAnnotationSpecification">
|
||||
<specification
|
||||
annotationImageProvider="org.eclipse.cdt.debug.internal.ui.BreakpointImageProvider"
|
||||
annotationImageProvider="org.eclipse.cdt.debug.internal.ui.breakpoints.BreakpointImageProvider"
|
||||
annotationType="org.eclipse.cdt.debug.core.breakpoint"
|
||||
colorPreferenceKey="breakpointIndicationColor"
|
||||
colorPreferenceValue="0,0,255"
|
||||
|
@ -1340,7 +1363,7 @@
|
|||
<adapter type="org.eclipse.cdt.debug.internal.ui.actions.IMoveToLineTarget"/>
|
||||
</factory>
|
||||
<factory
|
||||
class="org.eclipse.cdt.debug.internal.ui.CBreakpointWorkbenchAdapterFactory"
|
||||
class="org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointWorkbenchAdapterFactory"
|
||||
adaptableType="org.eclipse.cdt.debug.core.model.ICBreakpoint">
|
||||
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
|
||||
</factory>
|
||||
|
@ -1766,14 +1789,14 @@
|
|||
<extension
|
||||
point="org.eclipse.core.expressions.propertyTesters">
|
||||
<propertyTester
|
||||
class="org.eclipse.cdt.debug.internal.ui.ToggleCBreakpointTester"
|
||||
class="org.eclipse.cdt.debug.internal.ui.breakpoints.ToggleCBreakpointTester"
|
||||
id="org.eclipse.cdt.debug.ui.editorToggleBreakpointTester"
|
||||
namespace="org.eclipse.cdt.debug.ui"
|
||||
properties="isCEditorSupportsCBreakpoint,isAsmEditorSupportsCBreakpoint,isDisassemblyEditorSupportsCBreakpoint"
|
||||
type="org.eclipse.ui.IWorkbenchPart">
|
||||
</propertyTester>
|
||||
<propertyTester
|
||||
class="org.eclipse.cdt.debug.internal.ui.ToggleCBreakpointTester"
|
||||
class="org.eclipse.cdt.debug.internal.ui.breakpoints.ToggleCBreakpointTester"
|
||||
id="org.eclipse.cdt.debug.ui.declarationToggleBreakpointTester"
|
||||
namespace="org.eclipse.cdt.debug.ui"
|
||||
properties="isCDeclarationSupportsCBreakpoint"
|
||||
|
@ -1784,7 +1807,7 @@
|
|||
<extension point="org.eclipse.debug.ui.toggleBreakpointsTargetFactories">
|
||||
<toggleTargetFactory
|
||||
id="org.eclipse.cdt.debug.ui.ToggleCBreakpointsTargetFactory"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.ToggleCBreakpointsTargetFactory">
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.ToggleCBreakpointsTargetFactory">
|
||||
<enablement>
|
||||
<!-- Enable the breakpoint toggle for CDT's editors and model elements -->
|
||||
<or>
|
||||
|
@ -1802,7 +1825,7 @@
|
|||
</toggleTargetFactory>
|
||||
<toggleTargetFactory
|
||||
id="org.eclipse.cdt.debug.ui.ToggleCTracepointsTargetFactory"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.ToggleCTracepointsTargetFactory">
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.ToggleCTracepointsTargetFactory">
|
||||
<enablement>
|
||||
<!-- Enable the breakpoint toggle for CDT's editors and model elements -->
|
||||
<and>
|
||||
|
@ -2093,7 +2116,7 @@
|
|||
point="org.eclipse.ui.commands">
|
||||
<command
|
||||
categoryId="org.eclipse.debug.ui.category.run"
|
||||
defaultHandler="org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesHandler"
|
||||
defaultHandler="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CBreakpointPropertiesHandler"
|
||||
description="%BreakpointPropertiesCommand.description"
|
||||
helpContextId="breakpoint_properties_action_context"
|
||||
id="org.eclipse.cdt.debug.command.breakpointProperties"
|
||||
|
@ -2534,5 +2557,15 @@
|
|||
</activeWhen>
|
||||
</handler>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.core.expressions.propertyTesters">
|
||||
<propertyTester
|
||||
class="org.eclipse.cdt.debug.internal.ui.breakpoints.CreateBreakpointTester"
|
||||
id="org.eclipse.cdt.debug.ui.CreateBreakpointTester"
|
||||
namespace="org.eclipse.cdt.debug.ui"
|
||||
properties="createBreakpointAdapt"
|
||||
type="org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointContext">
|
||||
</propertyTester>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -107,7 +107,7 @@ If not specified this attribute will not be visible in Common page.
|
|||
<attribute name="type" type="string" use="default" value="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Type of the attribute: boolean, string, integer
|
||||
Type of the attribute. Value should be one of "boolean", "string", "integer", "float".
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
|
|
|
@ -11,9 +11,10 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICDebugElementStatus;
|
||||
import org.eclipse.cdt.debug.core.model.ICStackFrame;
|
||||
import org.eclipse.cdt.debug.core.model.ICType;
|
||||
|
@ -21,7 +22,9 @@ import org.eclipse.cdt.debug.core.model.ICValue;
|
|||
import org.eclipse.cdt.debug.core.model.IEnableDisableTarget;
|
||||
import org.eclipse.cdt.debug.internal.ui.disassembly.rendering.DisassemblyEditorInput;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointPropertyDialogAction;
|
||||
import org.eclipse.core.filesystem.URIUtil;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
@ -29,21 +32,38 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
|||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.model.IBreakpoint;
|
||||
import org.eclipse.debug.core.model.IValue;
|
||||
import org.eclipse.debug.core.model.IVariable;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
||||
import org.eclipse.debug.ui.contexts.IDebugContextProvider;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.IRegion;
|
||||
import org.eclipse.jface.text.Position;
|
||||
import org.eclipse.jface.text.Region;
|
||||
import org.eclipse.jface.text.source.Annotation;
|
||||
import org.eclipse.jface.text.source.IAnnotationModel;
|
||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
import org.eclipse.ui.IFileEditorInput;
|
||||
import org.eclipse.ui.IPathEditorInput;
|
||||
import org.eclipse.ui.IStorageEditorInput;
|
||||
import org.eclipse.ui.IURIEditorInput;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.progress.UIJob;
|
||||
import org.eclipse.ui.texteditor.ITextEditor;
|
||||
import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* Utility methods for C/C++ Debug UI.
|
||||
|
@ -209,7 +229,7 @@ public class CDebugUIUtils {
|
|||
return null;
|
||||
StringBuffer baseText = new StringBuffer( text );
|
||||
if ( element instanceof ICDebugElementStatus && !((ICDebugElementStatus)element).isOK() ) {
|
||||
baseText.append( MessageFormat.format( " <{0}>", new String[] { ((ICDebugElementStatus)element).getMessage() } ) ); //$NON-NLS-1$
|
||||
baseText.append( MessageFormat.format( " <{0}>", new Object[] { ((ICDebugElementStatus)element).getMessage() } ) ); //$NON-NLS-1$
|
||||
}
|
||||
if ( element instanceof IAdaptable ) {
|
||||
IEnableDisableTarget target = (IEnableDisableTarget)((IAdaptable)element).getAdapter( IEnableDisableTarget.class );
|
||||
|
@ -251,5 +271,71 @@ public class CDebugUIUtils {
|
|||
uiJob.setSystem(true);
|
||||
uiJob.schedule();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the {@link IBreakpoint} from the given editor and ruler information. Returns <code>null</code>
|
||||
* if no breakpoint exists or the operation fails.
|
||||
*
|
||||
* @param editor the editor
|
||||
* @param info the current ruler information
|
||||
* @return the {@link IBreakpoint} from the current editor position or <code>null</code>
|
||||
*/
|
||||
public static IBreakpoint getBreakpointFromEditor(ITextEditor editor, IVerticalRulerInfo info) {
|
||||
IAnnotationModel annotationModel = editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
|
||||
IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
|
||||
if (annotationModel != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Iterator<Annotation> iterator = annotationModel.getAnnotationIterator();
|
||||
while (iterator.hasNext()) {
|
||||
Object object = iterator.next();
|
||||
if (object instanceof SimpleMarkerAnnotation) {
|
||||
SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) object;
|
||||
IMarker marker = markerAnnotation.getMarker();
|
||||
try {
|
||||
if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
|
||||
Position position = annotationModel.getPosition(markerAnnotation);
|
||||
int line = document.getLineOfOffset(position.getOffset());
|
||||
if (line == info.getLineOfLastMouseButtonActivity()) {
|
||||
IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
|
||||
if (breakpoint != null) {
|
||||
return breakpoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
} catch (BadLocationException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void editBreakpointProperties(IWorkbenchPart part, final ICBreakpoint bp) {
|
||||
final ISelection debugContext = DebugUITools.getDebugContextForPart(part);
|
||||
CBreakpointPropertyDialogAction propertiesAction = new CBreakpointPropertyDialogAction(
|
||||
part.getSite(),
|
||||
new ISelectionProvider() {
|
||||
@Override
|
||||
public ISelection getSelection() {
|
||||
return new StructuredSelection( bp );
|
||||
}
|
||||
@Override public void addSelectionChangedListener( ISelectionChangedListener listener ) {}
|
||||
@Override public void removeSelectionChangedListener( ISelectionChangedListener listener ) {}
|
||||
@Override public void setSelection( ISelection selection ) {}
|
||||
},
|
||||
new IDebugContextProvider() {
|
||||
@Override
|
||||
public ISelection getActiveContext() {
|
||||
return debugContext;
|
||||
}
|
||||
@Override public void addDebugContextListener(IDebugContextListener listener) {}
|
||||
@Override public void removeDebugContextListener(IDebugContextListener listener) {}
|
||||
@Override public IWorkbenchPart getPart() { return null; }
|
||||
|
||||
}
|
||||
);
|
||||
propertiesAction.run();
|
||||
propertiesAction.dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,463 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011 Mentor Graphics 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:
|
||||
* Mentor Graphics - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IDeclaration;
|
||||
import org.eclipse.cdt.core.model.IFunction;
|
||||
import org.eclipse.cdt.core.model.IFunctionDeclaration;
|
||||
import org.eclipse.cdt.core.model.IMethod;
|
||||
import org.eclipse.cdt.core.model.ISourceRange;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.model.IVariable;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
|
||||
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.cdt.internal.ui.util.ExternalEditorInput;
|
||||
import org.eclipse.cdt.ui.CDTUITools;
|
||||
import org.eclipse.core.filesystem.URIUtil;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.window.Window;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IFileEditorInput;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.editors.text.ILocationProvider;
|
||||
import org.eclipse.ui.texteditor.IEditorStatusLine;
|
||||
import org.eclipse.ui.texteditor.ITextEditor;
|
||||
|
||||
abstract public class AbstractToggleBreakpointAdapter implements IToggleBreakpointsTargetExtension {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
@Override
|
||||
public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
|
||||
String errorMessage = null;
|
||||
if ( part instanceof ITextEditor ) {
|
||||
ITextEditor textEditor = (ITextEditor)part;
|
||||
IEditorInput input = textEditor.getEditorInput();
|
||||
if ( input == null ) {
|
||||
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Empty_editor_1" ); //$NON-NLS-1$
|
||||
}
|
||||
else {
|
||||
IDocument document = textEditor.getDocumentProvider().getDocument( input );
|
||||
if ( document == null ) {
|
||||
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Missing_document_1" ); //$NON-NLS-1$
|
||||
}
|
||||
else {
|
||||
IResource resource = getResource( textEditor );
|
||||
if ( resource == null ) {
|
||||
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Missing_resource_1" ); //$NON-NLS-1$
|
||||
}
|
||||
else {
|
||||
BreakpointLocationVerifier bv = new BreakpointLocationVerifier();
|
||||
int lineNumber = bv.getValidLineBreakpointLocation( document, ((ITextSelection)selection).getStartLine() );
|
||||
if ( lineNumber == -1 ) {
|
||||
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$
|
||||
}
|
||||
else {
|
||||
String sourceHandle = getSourceHandle( input );
|
||||
ICLineBreakpoint breakpoint = findLineBreakpoint( sourceHandle, resource, lineNumber );
|
||||
if ( breakpoint != null ) {
|
||||
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
|
||||
}
|
||||
else {
|
||||
createLineBreakpoint( sourceHandle, resource, lineNumber );
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
errorMessage = ActionMessages.getString( "RunToLineAdapter.Operation_is_not_supported_1" ); //$NON-NLS-1$
|
||||
}
|
||||
throw new CoreException(
|
||||
new Status( IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), IInternalCDebugUIConstants.INTERNAL_ERROR, errorMessage, null ) );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
@Override
|
||||
public boolean canToggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) {
|
||||
return (selection instanceof ITextSelection);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
@Override
|
||||
public void toggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
|
||||
ICElement element = getCElementFromSelection( part, selection );
|
||||
if ( element instanceof IFunction || element instanceof IMethod ) {
|
||||
toggleMethodBreakpoints0( (IDeclaration)element );
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
@Override
|
||||
public boolean canToggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) {
|
||||
ICElement element = getCElementFromSelection( part, selection );
|
||||
return (element instanceof IFunction || element instanceof IMethod);
|
||||
}
|
||||
|
||||
protected ICElement getCElementFromSelection( IWorkbenchPart part, ISelection selection ) {
|
||||
if ( selection instanceof ITextSelection ) {
|
||||
ITextSelection textSelection = (ITextSelection)selection;
|
||||
String text = textSelection.getText();
|
||||
if ( text != null ) {
|
||||
if ( part instanceof ITextEditor ) {
|
||||
ICElement editorElement = CDTUITools.getEditorInputCElement( ((ITextEditor)part).getEditorInput() );
|
||||
if ( editorElement instanceof ITranslationUnit ) {
|
||||
ITranslationUnit tu = (ITranslationUnit)editorElement;
|
||||
try {
|
||||
if ( tu.isStructureKnown() && tu.isConsistent() ) {
|
||||
return tu.getElementAtOffset( textSelection.getOffset() );
|
||||
}
|
||||
}
|
||||
catch( CModelException exc ) {
|
||||
// ignored on purpose
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
IResource resource = getResource( part );
|
||||
if ( resource instanceof IFile ) {
|
||||
ITranslationUnit tu = getTranslationUnit( (IFile)resource );
|
||||
if ( tu != null ) {
|
||||
try {
|
||||
ICElement element = tu.getElement( text.trim() );
|
||||
if ( element == null ) {
|
||||
element = tu.getElementAtLine( textSelection.getStartLine() );
|
||||
}
|
||||
return element;
|
||||
}
|
||||
catch( CModelException e ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( selection instanceof IStructuredSelection ) {
|
||||
IStructuredSelection ss = (IStructuredSelection)selection;
|
||||
if ( ss.size() == 1 ) {
|
||||
Object object = ss.getFirstElement();
|
||||
if ( object instanceof ICElement ) {
|
||||
return (ICElement)object;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
@Override
|
||||
public void toggleWatchpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
|
||||
IVariable variable = getVariableFromSelection( part, selection );
|
||||
if ( variable != null ) {
|
||||
toggleVariableWatchpoint( part, variable );
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
@Override
|
||||
public boolean canToggleWatchpoints( IWorkbenchPart part, ISelection selection ) {
|
||||
return getVariableFromSelection( part, selection ) != null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#canToggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
@Override
|
||||
public boolean canToggleBreakpoints( IWorkbenchPart part, ISelection selection ) {
|
||||
return ( canToggleLineBreakpoints( part, selection )
|
||||
|| canToggleWatchpoints( part, selection )
|
||||
|| canToggleMethodBreakpoints( part, selection ) );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#toggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
@Override
|
||||
public void toggleBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
|
||||
if ( canToggleLineBreakpoints( part, selection ) ) {
|
||||
toggleLineBreakpoints( part, selection );
|
||||
}
|
||||
else {
|
||||
ICElement element = getCElementFromSelection( part, selection );
|
||||
if ( element instanceof IFunction || element instanceof IMethod ) {
|
||||
toggleMethodBreakpoints0( (IDeclaration)element );
|
||||
}
|
||||
else if ( element instanceof IVariable ) {
|
||||
toggleVariableWatchpoint( part, (IVariable)element );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected IVariable getVariableFromSelection( IWorkbenchPart part, ISelection selection ) {
|
||||
ICElement element = getCElementFromSelection( part, selection );
|
||||
if ( element instanceof IVariable ) {
|
||||
return (IVariable)element;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void report( String message, IWorkbenchPart part ) {
|
||||
IEditorStatusLine statusLine = (IEditorStatusLine)part.getAdapter( IEditorStatusLine.class );
|
||||
if ( statusLine != null ) {
|
||||
if ( message != null ) {
|
||||
statusLine.setMessage( true, message, null );
|
||||
}
|
||||
else {
|
||||
statusLine.setMessage( true, null, null );
|
||||
}
|
||||
}
|
||||
if ( message != null && CDebugUIPlugin.getActiveWorkbenchShell() != null ) {
|
||||
CDebugUIPlugin.getActiveWorkbenchShell().getDisplay().beep();
|
||||
}
|
||||
}
|
||||
|
||||
protected static IResource getResource( IWorkbenchPart part ) {
|
||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||
if ( part instanceof IEditorPart ) {
|
||||
IEditorInput editorInput = ((IEditorPart)part).getEditorInput();
|
||||
IResource resource = null;
|
||||
if ( editorInput instanceof IFileEditorInput ) {
|
||||
resource = ((IFileEditorInput)editorInput).getFile();
|
||||
}
|
||||
else if ( editorInput instanceof ExternalEditorInput ) {
|
||||
resource = ((ExternalEditorInput)editorInput).getMarkerResource();
|
||||
}
|
||||
if ( resource != null )
|
||||
return resource;
|
||||
/* This file is not in a project, let default case handle it */
|
||||
ILocationProvider provider = (ILocationProvider)editorInput.getAdapter( ILocationProvider.class );
|
||||
if ( provider != null ) {
|
||||
IPath location = provider.getPath( editorInput );
|
||||
if ( location != null ) {
|
||||
IFile[] files = root.findFilesForLocationURI( URIUtil.toURI( location ) );
|
||||
if ( files.length > 0 && files[0].isAccessible())
|
||||
return files[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
private String getSourceHandle( IEditorInput input ) throws CoreException {
|
||||
return CDebugUIUtils.getEditorFilePath( input );
|
||||
}
|
||||
|
||||
private void toggleVariableWatchpoint( IWorkbenchPart part, IVariable variable ) throws CoreException {
|
||||
String sourceHandle = getSourceHandle( variable );
|
||||
IResource resource = getElementResource( variable );
|
||||
String expression = getVariableName( variable );
|
||||
ICWatchpoint watchpoint = findWatchpoint( sourceHandle, resource, expression );
|
||||
if ( watchpoint != null ) {
|
||||
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( watchpoint, true );
|
||||
}
|
||||
else {
|
||||
AddWatchpointDialog dlg = new AddWatchpointDialog( part.getSite().getShell(), AddWatchpointActionDelegate.getMemorySpaceManagement() );
|
||||
dlg.setExpression( expression );
|
||||
if ( dlg.open() != Window.OK )
|
||||
return;
|
||||
expression = dlg.getExpression();
|
||||
int lineNumber = -1;
|
||||
int charStart = -1;
|
||||
int charEnd = -1;
|
||||
try {
|
||||
ISourceRange sourceRange = variable.getSourceRange();
|
||||
if ( sourceRange != null ) {
|
||||
charStart = sourceRange.getStartPos();
|
||||
charEnd = charStart + sourceRange.getLength();
|
||||
if ( charEnd <= 0 ) {
|
||||
charStart = -1;
|
||||
charEnd = -1;
|
||||
}
|
||||
lineNumber = sourceRange.getStartLine();
|
||||
}
|
||||
}
|
||||
catch( CModelException e ) {
|
||||
DebugPlugin.log( e );
|
||||
}
|
||||
createWatchpoint(
|
||||
sourceHandle,
|
||||
resource,
|
||||
charStart,
|
||||
charEnd,
|
||||
lineNumber,
|
||||
dlg.getWriteAccess(),
|
||||
dlg.getReadAccess(),
|
||||
expression,
|
||||
dlg.getMemorySpace(),
|
||||
dlg.getRange() );
|
||||
}
|
||||
}
|
||||
|
||||
private String getSourceHandle( IDeclaration declaration ) {
|
||||
ITranslationUnit tu = declaration.getTranslationUnit();
|
||||
if ( tu != null ) {
|
||||
IPath location = tu.getLocation();
|
||||
if ( location != null ) {
|
||||
return location.toOSString();
|
||||
}
|
||||
}
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private IResource getElementResource( IDeclaration declaration ) {
|
||||
return declaration.getUnderlyingResource();
|
||||
}
|
||||
|
||||
private String getFunctionName( IFunction function ) {
|
||||
String functionName = function.getElementName();
|
||||
StringBuffer name = new StringBuffer( functionName );
|
||||
ITranslationUnit tu = function.getTranslationUnit();
|
||||
if ( tu != null && tu.isCXXLanguage() ) {
|
||||
appendParameters( name, function );
|
||||
}
|
||||
return name.toString();
|
||||
}
|
||||
|
||||
private String getMethodName( IMethod method ) {
|
||||
StringBuffer name = new StringBuffer();
|
||||
String methodName = method.getElementName();
|
||||
ICElement parent = method.getParent();
|
||||
while( parent != null
|
||||
&& (parent.getElementType() == ICElement.C_NAMESPACE || parent.getElementType() == ICElement.C_CLASS
|
||||
|| parent.getElementType() == ICElement.C_STRUCT || parent.getElementType() == ICElement.C_UNION) ) {
|
||||
name.append( parent.getElementName() ).append( "::" ); //$NON-NLS-1$
|
||||
parent = parent.getParent();
|
||||
}
|
||||
name.append( methodName );
|
||||
appendParameters( name, method );
|
||||
return name.toString();
|
||||
}
|
||||
|
||||
private void appendParameters( StringBuffer sb, IFunctionDeclaration fd ) {
|
||||
String[] params = fd.getParameterTypes();
|
||||
sb.append( '(' );
|
||||
for( int i = 0; i < params.length; ++i ) {
|
||||
sb.append( params[i] );
|
||||
if ( i != params.length - 1 )
|
||||
sb.append( ',' );
|
||||
}
|
||||
sb.append( ')' );
|
||||
}
|
||||
|
||||
private String getVariableName( IVariable variable ) {
|
||||
return variable.getElementName();
|
||||
}
|
||||
|
||||
private ITranslationUnit getTranslationUnit( IFile file ) {
|
||||
Object element = CoreModel.getDefault().create( file );
|
||||
if ( element instanceof ITranslationUnit ) {
|
||||
return (ITranslationUnit)element;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void toggleMethodBreakpoints0( IDeclaration declaration ) throws CoreException {
|
||||
String sourceHandle = getSourceHandle( declaration );
|
||||
IResource resource = getElementResource( declaration );
|
||||
String functionName = (declaration instanceof IFunction) ? getFunctionName( (IFunction)declaration ) : getMethodName( (IMethod)declaration );
|
||||
ICFunctionBreakpoint breakpoint = findFunctionBreakpoint( sourceHandle, resource, functionName );
|
||||
if ( breakpoint != null ) {
|
||||
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
|
||||
}
|
||||
else {
|
||||
int lineNumber = -1;
|
||||
int charStart = -1;
|
||||
int charEnd = -1;
|
||||
try {
|
||||
ISourceRange sourceRange = declaration.getSourceRange();
|
||||
if ( sourceRange != null ) {
|
||||
charStart = sourceRange.getStartPos();
|
||||
charEnd = charStart + sourceRange.getLength();
|
||||
if ( charEnd <= 0 ) {
|
||||
charStart = -1;
|
||||
charEnd = -1;
|
||||
}
|
||||
lineNumber = sourceRange.getStartLine();
|
||||
}
|
||||
}
|
||||
catch( CModelException e ) {
|
||||
DebugPlugin.log( e );
|
||||
}
|
||||
createFunctionBreakpoint(
|
||||
sourceHandle,
|
||||
resource,
|
||||
functionName,
|
||||
charStart,
|
||||
charEnd,
|
||||
lineNumber );
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract ICLineBreakpoint findLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException;
|
||||
|
||||
protected abstract void createLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException;
|
||||
|
||||
protected abstract ICFunctionBreakpoint findFunctionBreakpoint( String sourceHandle, IResource resource, String functionName ) throws CoreException;
|
||||
|
||||
protected abstract void createFunctionBreakpoint(
|
||||
String sourceHandle,
|
||||
IResource resource,
|
||||
String functionName,
|
||||
int charStart,
|
||||
int charEnd,
|
||||
int lineNumber ) throws CoreException;
|
||||
|
||||
protected abstract ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression ) throws CoreException;
|
||||
|
||||
protected abstract void createWatchpoint(
|
||||
String sourceHandle,
|
||||
IResource resource,
|
||||
int charStart,
|
||||
int charEnd,
|
||||
int lineNumber,
|
||||
boolean writeAccess,
|
||||
boolean readAccess,
|
||||
String expression,
|
||||
String memorySpace,
|
||||
BigInteger range ) throws CoreException;
|
||||
}
|
|
@ -46,6 +46,7 @@ ToggleWatchpointActionDelegate.Operation_failed_1=Operation failed.
|
|||
ToggleBreakpointRulerAction.Error_1=Error
|
||||
ToggleBreakpointRulerAction.Operation_failed_1=Operation failed
|
||||
CBreakpointPropertiesRulerAction.Breakpoint_Properties=Breakpoint &Properties...
|
||||
CBreakpointPropertiesRulerAction.Error=Unable to edit breakpoint properties.
|
||||
ResumeAtLineActionDelegate.Error_1=Error
|
||||
ResumeAtLineActionDelegate.1=Error
|
||||
ResumeAtLineActionDelegate.2=Resume at line failed
|
||||
|
@ -129,3 +130,9 @@ RetargetAction.0=Error
|
|||
RetargetAction.1=Operation failed
|
||||
RetargetMoveToLineAction.0=The operation is unavailable on the current selection. Please place the cursor on valid line to run to.
|
||||
RetargetResumeAtLineAction.0=The operation is unavailable on the current selection. Please place the cursor on valid line to run to.
|
||||
CAddBreakpointInteractiveRulerAction_label=&Add Breakpoint...
|
||||
CAddBreakpointInteractiveRulerAction_error_title=Error
|
||||
CAddBreakpointInteractiveRulerAction_error_message=Unable to create breakpoint
|
||||
CBreakpointToggleRulerAction_error_label=Toggle Brea&kpoint
|
||||
CBreakpointToggleRulerAction_error_title=Error
|
||||
CBreakpointToggleRulerAction_error_message=Unable to toggle breakpoint
|
|
@ -1,39 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2006 QNX Software 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since Aug 29, 2002
|
||||
*/
|
||||
public class BreakpointLocationVerifier
|
||||
{
|
||||
/**
|
||||
* Returns the line number closest to the given line number that represents a
|
||||
* valid location for a breakpoint in the given document, or -1 if a valid location
|
||||
* cannot be found.
|
||||
*/
|
||||
public int getValidLineBreakpointLocation( IDocument doc, int lineNumber )
|
||||
{
|
||||
// for now
|
||||
return lineNumber + 1;
|
||||
}
|
||||
|
||||
public int getValidAddressBreakpointLocation( IDocument doc, int lineNumber )
|
||||
{
|
||||
// for now
|
||||
return lineNumber + 1;
|
||||
}
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2008 QNX Software 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems) - bug 183397
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.ui.CBreakpointContext;
|
||||
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
||||
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
||||
import org.eclipse.debug.core.model.IBreakpoint;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.dialogs.PropertyDialogAction;
|
||||
|
||||
/**
|
||||
* Opens a custom properties dialog to configure the attibutes of a C/C++ breakpoint
|
||||
* from the ruler popup menu.
|
||||
*/
|
||||
public class CBreakpointPropertiesRulerAction extends AbstractBreakpointRulerAction {
|
||||
|
||||
private Object fContext;
|
||||
|
||||
/**
|
||||
* Creates the action to modify the breakpoint properties.
|
||||
*/
|
||||
public CBreakpointPropertiesRulerAction( IWorkbenchPart part, IVerticalRulerInfo info ) {
|
||||
super( part, info );
|
||||
setText( ActionMessages.getString( "CBreakpointPropertiesRulerAction.Breakpoint_Properties" ) ); //$NON-NLS-1$
|
||||
part.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.BREAKPOINT_PROPERTIES_ACTION );
|
||||
setId( IInternalCDebugUIConstants.ACTION_BREAKPOINT_PROPERTIES );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see Action#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
if ( fContext != null ) {
|
||||
PropertyDialogAction action = new PropertyDialogAction( getTargetPart().getSite(), new ISelectionProvider() {
|
||||
|
||||
@Override
|
||||
public void addSelectionChangedListener( ISelectionChangedListener listener ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISelection getSelection() {
|
||||
return new StructuredSelection( fContext );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSelectionChangedListener( ISelectionChangedListener listener ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelection( ISelection selection ) {
|
||||
}
|
||||
} );
|
||||
action.run();
|
||||
action.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see IUpdate#update()
|
||||
*/
|
||||
@Override
|
||||
public void update() {
|
||||
IBreakpoint breakpoint = getBreakpoint();
|
||||
if (breakpoint instanceof ICBreakpoint) {
|
||||
fContext = new CBreakpointContext((ICBreakpoint)breakpoint, getDebugContext());
|
||||
} else {
|
||||
fContext = breakpoint;
|
||||
}
|
||||
setEnabled( fContext != null );
|
||||
}
|
||||
|
||||
private ISelection getDebugContext() {
|
||||
return DebugUITools.getDebugContextManager().getContextService(getTargetPart().getSite().getWorkbenchWindow()).getActiveContext();
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2006 QNX Software 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||
import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
|
||||
import org.eclipse.ui.texteditor.ITextEditor;
|
||||
|
||||
public class EnableDisableBreakpointRulerActionDelegate extends AbstractRulerActionDelegate {
|
||||
|
||||
/*
|
||||
* @see AbstractRulerActionDelegate#createAction(ITextEditor, IVerticalRulerInfo)
|
||||
*/
|
||||
@Override
|
||||
protected IAction createAction( ITextEditor editor, IVerticalRulerInfo rulerInfo ) {
|
||||
return new EnableDisableBreakpointRulerAction( editor, rulerInfo );
|
||||
}
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2010 QNX Software 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
|
||||
* Warren Paul (Nokia) - Bug 217485, Bug 218342
|
||||
* Oyvind Harboe (oyvind.harboe@zylin.com) - Bug 225099
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
* Toggles a line breakpoint in a C/C++ editor.
|
||||
*/
|
||||
public class ToggleBreakpointAdapter extends AbstractToggleBreakpointAdapter {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findLineBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, int)
|
||||
*/
|
||||
@Override
|
||||
protected ICLineBreakpoint findLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
|
||||
return CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createLineBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, int)
|
||||
*/
|
||||
@Override
|
||||
protected void createLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
|
||||
CDIDebugModel.createLineBreakpoint( sourceHandle,
|
||||
resource,
|
||||
getBreakpointType(),
|
||||
lineNumber,
|
||||
true,
|
||||
0,
|
||||
"", //$NON-NLS-1$
|
||||
true );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findFunctionBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected ICFunctionBreakpoint findFunctionBreakpoint(
|
||||
String sourceHandle,
|
||||
IResource resource,
|
||||
String functionName ) throws CoreException {
|
||||
return CDIDebugModel.functionBreakpointExists( sourceHandle, resource, functionName );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createFunctionBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
protected void createFunctionBreakpoint(
|
||||
String sourceHandle,
|
||||
IResource resource,
|
||||
String functionName,
|
||||
int charStart,
|
||||
int charEnd,
|
||||
int lineNumber ) throws CoreException {
|
||||
CDIDebugModel.createFunctionBreakpoint( sourceHandle,
|
||||
resource,
|
||||
getBreakpointType(),
|
||||
functionName,
|
||||
charStart,
|
||||
charEnd,
|
||||
lineNumber,
|
||||
true,
|
||||
0,
|
||||
"", //$NON-NLS-1$
|
||||
true );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findWatchpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression ) throws CoreException {
|
||||
return CDIDebugModel.watchpointExists( sourceHandle, resource, expression );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createWatchpoint(java.lang.String, org.eclipse.core.resources.IResource, int, int, int, boolean, boolean, java.lang.String, java.lang.String, java.math.BigInteger)
|
||||
*/
|
||||
@Override
|
||||
protected void createWatchpoint(
|
||||
String sourceHandle,
|
||||
IResource resource,
|
||||
int charStart,
|
||||
int charEnd,
|
||||
int lineNumber,
|
||||
boolean writeAccess,
|
||||
boolean readAccess,
|
||||
String expression,
|
||||
String memorySpace,
|
||||
BigInteger range ) throws CoreException {
|
||||
|
||||
CDIDebugModel.createWatchpoint( sourceHandle,
|
||||
resource,
|
||||
charStart,
|
||||
charEnd,
|
||||
lineNumber,
|
||||
writeAccess,
|
||||
readAccess,
|
||||
expression,
|
||||
memorySpace,
|
||||
range,
|
||||
true,
|
||||
0,
|
||||
"", //$NON-NLS-1$
|
||||
true );
|
||||
}
|
||||
|
||||
protected int getBreakpointType() {
|
||||
return ICBreakpointType.REGULAR;
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2007 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
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
|
||||
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.swt.custom.BusyIndicator;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.texteditor.IUpdate;
|
||||
|
||||
/**
|
||||
* Action to toggle the use of contributed variables content providers on and off.
|
||||
* When on, all registered variables content providers for the current debug model
|
||||
* are used. When off, the default content provider (that shows all children)
|
||||
* is used for all debug models.
|
||||
*/
|
||||
public class ToggleShowColumnsAction extends Action implements IUpdate {
|
||||
|
||||
private TreeModelViewer fViewer;
|
||||
|
||||
public ToggleShowColumnsAction( TreeModelViewer viewew ) {
|
||||
super( "&Show Columns", IAction.AS_CHECK_BOX );
|
||||
fViewer = viewew;
|
||||
setToolTipText( "Show Columns" );
|
||||
setImageDescriptor( CDebugImages.DESC_OBJS_COMMON_TAB );
|
||||
setId( CDebugUIPlugin.getUniqueIdentifier() + ".ToggleShowColumsAction" ); //$NON-NLS-1$
|
||||
PlatformUI.getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.SHOW_COLUMNS_ACTION );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.action.Action#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
if ( fViewer.getControl().isDisposed() ) {
|
||||
return;
|
||||
}
|
||||
BusyIndicator.showWhile( fViewer.getControl().getDisplay(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fViewer.setShowColumns( isChecked() );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.texteditor.IUpdate#update()
|
||||
*/
|
||||
@Override
|
||||
public void update() {
|
||||
setEnabled( fViewer.canToggleColumns() );
|
||||
setChecked( fViewer.isShowColumns() );
|
||||
}
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson 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:
|
||||
* Ericsson - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
* Toggles a tracepoint in a C/C++ editor.
|
||||
*/
|
||||
public class ToggleTracepointAdapter extends AbstractToggleBreakpointAdapter {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findLineBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, int)
|
||||
*/
|
||||
@Override
|
||||
protected ICLineBreakpoint findLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
|
||||
return CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createLineBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, int)
|
||||
*/
|
||||
@Override
|
||||
protected void createLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
|
||||
|
||||
CDIDebugModel.createLineTracepoint(
|
||||
sourceHandle,
|
||||
resource,
|
||||
getBreakpointType(),
|
||||
lineNumber,
|
||||
true,
|
||||
0,
|
||||
"", //$NON-NLS-1$
|
||||
true );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findFunctionBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected ICFunctionBreakpoint findFunctionBreakpoint( String sourceHandle, IResource resource, String functionName ) throws CoreException {
|
||||
return CDIDebugModel.functionBreakpointExists( sourceHandle, resource, functionName );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createFunctionBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String, int, int, int)
|
||||
*/
|
||||
@Override
|
||||
protected void createFunctionBreakpoint(
|
||||
String sourceHandle,
|
||||
IResource resource,
|
||||
String functionName,
|
||||
int charStart,
|
||||
int charEnd,
|
||||
int lineNumber ) throws CoreException {
|
||||
|
||||
CDIDebugModel.createFunctionTracepoint(
|
||||
sourceHandle,
|
||||
resource,
|
||||
getBreakpointType(),
|
||||
functionName,
|
||||
charStart,
|
||||
charEnd,
|
||||
lineNumber,
|
||||
true,
|
||||
0,
|
||||
"", //$NON-NLS-1$
|
||||
true );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findWatchpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression ) throws CoreException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createWatchpoint(java.lang.String, org.eclipse.core.resources.IResource, int, int, int, boolean, boolean, java.lang.String, java.lang.String, java.math.BigInteger)
|
||||
*/
|
||||
@Override
|
||||
protected void createWatchpoint(
|
||||
String sourceHandle,
|
||||
IResource resource,
|
||||
int charStart,
|
||||
int charEnd,
|
||||
int lineNumber,
|
||||
boolean writeAccess,
|
||||
boolean readAccess,
|
||||
String expression,
|
||||
String memorySpace,
|
||||
BigInteger range ) throws CoreException {
|
||||
}
|
||||
|
||||
protected int getBreakpointType() {
|
||||
return ICBreakpointType.REGULAR;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2006 QNX Software 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since Sep 5, 2002
|
||||
*/
|
||||
public class WatchpointExpressionVerifier
|
||||
{
|
||||
/**
|
||||
* Returns whether the specified expression is valid for a watchpoint.
|
||||
*/
|
||||
public boolean isValidExpression( IDocument doc, String expression )
|
||||
{
|
||||
// for now
|
||||
return expression.trim().length() > 0;
|
||||
}
|
||||
}
|
|
@ -9,27 +9,17 @@
|
|||
* QNX Software Systems - Initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems) - bug 183397
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.model.IBreakpoint;
|
||||
import org.eclipse.debug.ui.actions.RulerBreakpointAction;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.Position;
|
||||
import org.eclipse.jface.text.source.IAnnotationModel;
|
||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.texteditor.IDocumentProvider;
|
||||
import org.eclipse.ui.texteditor.ITextEditor;
|
||||
import org.eclipse.ui.texteditor.IUpdate;
|
||||
import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
|
||||
|
||||
/**
|
||||
* Abstract base implementation of the breakpoint ruler actions.
|
||||
|
@ -61,33 +51,11 @@ public abstract class AbstractBreakpointRulerAction extends Action implements IU
|
|||
* @return breakpoint associated with activity in the ruler or <code>null</code>
|
||||
*/
|
||||
protected IBreakpoint getBreakpoint() {
|
||||
IAnnotationModel annotationModel = getAnnotationModel();
|
||||
IDocument document = getDocument();
|
||||
if (annotationModel != null) {
|
||||
Iterator<?> iterator = annotationModel.getAnnotationIterator();
|
||||
while (iterator.hasNext()) {
|
||||
Object object = iterator.next();
|
||||
if (object instanceof SimpleMarkerAnnotation) {
|
||||
SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) object;
|
||||
IMarker marker = markerAnnotation.getMarker();
|
||||
try {
|
||||
if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
|
||||
Position position = annotationModel.getPosition(markerAnnotation);
|
||||
int line = document.getLineOfOffset(position.getOffset());
|
||||
if (line == fRulerInfo.getLineOfLastMouseButtonActivity()) {
|
||||
IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
|
||||
if (breakpoint != null) {
|
||||
return breakpoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
} catch (BadLocationException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
IWorkbenchPart targetPart = getTargetPart();
|
||||
if (targetPart instanceof ITextEditor) {
|
||||
return CDebugUIUtils.getBreakpointFromEditor((ITextEditor)targetPart, getVerticalRulerInfo());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,25 +76,4 @@ public abstract class AbstractBreakpointRulerAction extends Action implements IU
|
|||
return fRulerInfo;
|
||||
}
|
||||
|
||||
private IDocument getDocument() {
|
||||
IWorkbenchPart targetPart = getTargetPart();
|
||||
if ( targetPart instanceof ITextEditor ) {
|
||||
ITextEditor textEditor = (ITextEditor)targetPart;
|
||||
IDocumentProvider provider = textEditor.getDocumentProvider();
|
||||
if ( provider != null )
|
||||
return provider.getDocument( textEditor.getEditorInput() );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private IAnnotationModel getAnnotationModel() {
|
||||
IWorkbenchPart targetPart = getTargetPart();
|
||||
if ( targetPart instanceof ITextEditor ) {
|
||||
ITextEditor textEditor = (ITextEditor)targetPart;
|
||||
IDocumentProvider provider = textEditor.getDocumentProvider();
|
||||
if ( provider != null )
|
||||
return provider.getAnnotationModel( textEditor.getEditorInput() );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -10,9 +10,10 @@
|
|||
* QNX Software Systems - Initial API and implementation
|
||||
* QNX Software Systems - catchpoints - bug 226689
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
|
||||
import org.eclipse.cdt.debug.internal.ui.dialogs.AddEventBreakpointDialog;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.cdt.debug.ui.UIMessages;
|
|
@ -9,7 +9,7 @@
|
|||
* QNX Software Systems - Initial API and implementation
|
||||
* Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
@ -17,6 +17,7 @@ import org.eclipse.cdt.debug.core.CDIDebugModel;
|
|||
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
|
@ -82,7 +83,7 @@ public class AddWatchpointActionDelegate extends ActionDelegate implements IView
|
|||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
static ICDIMemorySpaceManagement getMemorySpaceManagement(){
|
||||
public static ICDIMemorySpaceManagement getMemorySpaceManagement(){
|
||||
IAdaptable debugViewElement = DebugUITools.getDebugContext();
|
||||
ICDIMemorySpaceManagement memMgr = null;
|
||||
|
|
@ -10,13 +10,14 @@
|
|||
* Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
|
||||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement;
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* Nokia - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
|
||||
import java.math.BigInteger;
|
|
@ -8,11 +8,12 @@
|
|||
* Contributors:
|
||||
* Nokia - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
|
||||
import org.eclipse.cdt.debug.internal.core.CRequest;
|
||||
import org.eclipse.cdt.debug.internal.core.ICWatchpointTarget;
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
|
@ -0,0 +1,218 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 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
|
||||
* Wind River Systems - added support for IToggleBreakpointsTargetFactory
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetManagerListener;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.IRegion;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.text.TextSelection;
|
||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.texteditor.IDocumentProvider;
|
||||
import org.eclipse.ui.texteditor.ITextEditor;
|
||||
import org.eclipse.ui.texteditor.IUpdate;
|
||||
|
||||
/**
|
||||
* Action to interactively create a breakpoint from vertical ruler of a
|
||||
* workbench part containing a document. The part must provide an
|
||||
* <code>IToggleBreakpointsTargetExtension2</code> adapter.
|
||||
* <p>
|
||||
* Clients may instantiate this class.
|
||||
* </p>
|
||||
* @since 3.8
|
||||
* @see org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate
|
||||
*/
|
||||
public class CAddBreakpointInteractiveRulerAction extends Action implements IUpdate {
|
||||
|
||||
private IWorkbenchPart fPart;
|
||||
private IDocument fDocument;
|
||||
private IVerticalRulerInfo fRulerInfo;
|
||||
private IToggleBreakpointsTargetManagerListener fListener = new IToggleBreakpointsTargetManagerListener() {
|
||||
public void preferredTargetsChanged() {
|
||||
update();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a new action to toggle a breakpoint in the given
|
||||
* part containing the given document and ruler.
|
||||
*
|
||||
* @param part the part in which to toggle the breakpoint - provides
|
||||
* an <code>IToggleBreakpointsTarget</code> adapter
|
||||
* @param document the document breakpoints are being set in or
|
||||
* <code>null</code> when the document should be derived from the
|
||||
* given part
|
||||
* @param rulerInfo specifies location the user has double-clicked
|
||||
*/
|
||||
public CAddBreakpointInteractiveRulerAction(IWorkbenchPart part, IDocument document, IVerticalRulerInfo rulerInfo) {
|
||||
super(ActionMessages.getString("CAddBreakpointInteractiveRulerAction_label")); //$NON-NLS-1$
|
||||
fPart = part;
|
||||
fDocument = document;
|
||||
fRulerInfo = rulerInfo;
|
||||
DebugUITools.getToggleBreakpointsTargetManager().addChangedListener(fListener);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.jface.action.IAction#run()
|
||||
*/
|
||||
public void run() {
|
||||
IDocument document= getDocument();
|
||||
if (document == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int line = fRulerInfo.getLineOfLastMouseButtonActivity();
|
||||
|
||||
// Test if line is valid
|
||||
if (line == -1)
|
||||
return;
|
||||
|
||||
try {
|
||||
ITextSelection selection = getTextSelection(document, line);
|
||||
IToggleBreakpointsTarget toggleTarget =
|
||||
DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, selection);
|
||||
if (toggleTarget instanceof IToggleBreakpointsTargetCExtension) {
|
||||
IToggleBreakpointsTargetCExtension extension = (IToggleBreakpointsTargetCExtension) toggleTarget;
|
||||
if (extension.canCreateBreakpointsInteractive(fPart, selection)) {
|
||||
extension.createBreakpointsInteractive(fPart, selection);
|
||||
}
|
||||
}
|
||||
} catch (BadLocationException e) {
|
||||
reportException(e);
|
||||
} catch (CoreException e) {
|
||||
reportException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Report an error to the user.
|
||||
*
|
||||
* @param e underlying exception
|
||||
*/
|
||||
private void reportException(Exception e) {
|
||||
IStatus status= new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID, "Error creating breakpoint: ", e); //$NON-NLS-1$
|
||||
ErrorDialog.openError(
|
||||
fPart.getSite().getShell(),
|
||||
ActionMessages.getString("CAddBreakpointInteractiveRulerAction_error_title"), //$NON-NLS-1$
|
||||
ActionMessages.getString("CAddBreakpointInteractiveRulerAction_error_message"), //$NON-NLS-1$
|
||||
status);
|
||||
CDebugUIPlugin.log(status); //
|
||||
}
|
||||
|
||||
/**
|
||||
* Disposes this action. Clients must call this method when
|
||||
* this action is no longer needed.
|
||||
*/
|
||||
public void dispose() {
|
||||
fDocument = null;
|
||||
fPart = null;
|
||||
fRulerInfo = null;
|
||||
DebugUITools.getToggleBreakpointsTargetManager().removeChangedListener(fListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the document on which this action operates.
|
||||
*
|
||||
* @return the document or <code>null</code> if none
|
||||
*/
|
||||
private IDocument getDocument() {
|
||||
if (fDocument != null)
|
||||
return fDocument;
|
||||
|
||||
if (fPart instanceof ITextEditor) {
|
||||
ITextEditor editor= (ITextEditor)fPart;
|
||||
IDocumentProvider provider = editor.getDocumentProvider();
|
||||
if (provider != null)
|
||||
return provider.getDocument(editor.getEditorInput());
|
||||
}
|
||||
|
||||
IDocument doc = (IDocument) fPart.getAdapter(IDocument.class);
|
||||
if (doc != null) {
|
||||
return doc;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.texteditor.IUpdate#update()
|
||||
*/
|
||||
public void update() {
|
||||
IDocument document= getDocument();
|
||||
if (document != null) {
|
||||
int line = fRulerInfo.getLineOfLastMouseButtonActivity();
|
||||
if (line > -1) {
|
||||
try {
|
||||
ITextSelection selection = getTextSelection(document, line);
|
||||
|
||||
IToggleBreakpointsTarget adapter =
|
||||
DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, selection);
|
||||
if (adapter == null) {
|
||||
setEnabled(false);
|
||||
return;
|
||||
}
|
||||
if (adapter instanceof IToggleBreakpointsTargetCExtension) {
|
||||
IToggleBreakpointsTargetCExtension extension = (IToggleBreakpointsTargetCExtension) adapter;
|
||||
if (extension.canCreateBreakpointsInteractive(fPart, selection)) {
|
||||
setEnabled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (BadLocationException e) {
|
||||
reportException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the text selection for the breakpoint action. If clicking on the ruler inside
|
||||
* the highlighted text, return the text selection for the highlighted text. Otherwise,
|
||||
* return a text selection representing the start of the line.
|
||||
*
|
||||
* @param document The IDocument backing the Editor.
|
||||
* @param line The line clicked on in the ruler.
|
||||
* @return An ITextSelection as described.
|
||||
* @throws BadLocationException If underlying operations throw.
|
||||
*/
|
||||
private ITextSelection getTextSelection(IDocument document, int line) throws BadLocationException {
|
||||
IRegion region = document.getLineInformation(line);
|
||||
ITextSelection textSelection = new TextSelection(document, region.getOffset(), 0);
|
||||
ISelectionProvider provider = fPart.getSite().getSelectionProvider();
|
||||
if (provider != null){
|
||||
ISelection selection = provider.getSelection();
|
||||
if (selection instanceof ITextSelection
|
||||
&& ((ITextSelection) selection).getStartLine() <= line
|
||||
&& ((ITextSelection) selection).getEndLine() >= line) {
|
||||
textSelection = (ITextSelection) selection;
|
||||
}
|
||||
}
|
||||
return textSelection;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2012 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
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||
import org.eclipse.ui.IActionDelegate2;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
|
||||
import org.eclipse.ui.texteditor.ITextEditor;
|
||||
|
||||
/**
|
||||
* Creates a breakpoint interactively, that is with user input as well as context
|
||||
* information gathered from editor location. This action delegate can be
|
||||
* contributed to an editor with the <code>editorActions</code> extension point.
|
||||
* This action is as a factory that creates another action that performs the
|
||||
* actual breakpoint toggling. The created action acts on the editor's
|
||||
* <code>IToggleBreakpointsTagretCExtension</code> to create the breakpoint.
|
||||
* <p>
|
||||
* This action should be be contributed to a vertical ruler context menu via the
|
||||
* <code>popupMenus</code> extension point, by referencing the ruler's context
|
||||
* menu identifier in the <code>targetID</code> attribute.
|
||||
* <pre>
|
||||
* <extension point="org.eclipse.ui.popupMenus">
|
||||
* <viewerContribution
|
||||
* targetID="example.rulerContextMenuId"
|
||||
* id="example.RulerPopupActions">
|
||||
* <action
|
||||
* label="Toggle Breakpoint"
|
||||
* class="org.eclipse.debug.ui.actions.RulerCreateBreakpointInteractiveActionDelegate"
|
||||
* menubarPath="additions"
|
||||
* id="example.rulerContextMenu.createBreakpointAction">
|
||||
* </action>
|
||||
* </viewerContribution>
|
||||
* </pre>
|
||||
* </p>
|
||||
* <p>
|
||||
* Clients may refer to this class as an action delegate in plug-in XML.
|
||||
* </p>
|
||||
* @see IToggleBreakpointsTargetCExtension
|
||||
* @since 7.2
|
||||
* @noextend This class is not intended to be sub-classed by clients.
|
||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||
*/
|
||||
public class CAddBreakpointInteractiveRulerActionDelegate extends AbstractRulerActionDelegate implements IActionDelegate2 {
|
||||
|
||||
private IEditorPart fEditor = null;
|
||||
private CAddBreakpointInteractiveRulerAction fDelegate = null;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#createAction(org.eclipse.ui.texteditor.ITextEditor, org.eclipse.jface.text.source.IVerticalRulerInfo)
|
||||
*/
|
||||
protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
|
||||
fDelegate = new CAddBreakpointInteractiveRulerAction(editor, null, rulerInfo);
|
||||
return fDelegate;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
|
||||
*/
|
||||
public void setActiveEditor(IAction callerAction, IEditorPart targetEditor) {
|
||||
if (fEditor != null) {
|
||||
if (fDelegate != null) {
|
||||
fDelegate.dispose();
|
||||
fDelegate = null;
|
||||
}
|
||||
}
|
||||
fEditor = targetEditor;
|
||||
super.setActiveEditor(callerAction, targetEditor);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
|
||||
*/
|
||||
public void init(IAction action) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IActionDelegate2#dispose()
|
||||
*/
|
||||
public void dispose() {
|
||||
if (fDelegate != null) {
|
||||
fDelegate.dispose();
|
||||
}
|
||||
fDelegate = null;
|
||||
fEditor = null;
|
||||
}
|
||||
}
|
|
@ -9,24 +9,18 @@
|
|||
* QNX Software Systems - Initial API and implementation
|
||||
* Wind River Systems - Converted into a command
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.ui.CBreakpointContext;
|
||||
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.core.expressions.IEvaluationContext;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.ui.ISources;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.dialogs.PropertyDialogAction;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
/**
|
||||
|
@ -44,36 +38,12 @@ public class CBreakpointPropertiesHandler extends AbstractHandler {
|
|||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
|
||||
ICBreakpoint bp = getBreakpoint(event.getApplicationContext());
|
||||
final ICBreakpoint bp = getBreakpoint(event.getApplicationContext());
|
||||
|
||||
if (part != null && bp != null) {
|
||||
ISelection debugContext = DebugUITools.getDebugContextManager().
|
||||
getContextService(part.getSite().getWorkbenchWindow()).getActiveContext();
|
||||
|
||||
final CBreakpointContext bpContext = new CBreakpointContext(bp, debugContext);
|
||||
|
||||
PropertyDialogAction propertyAction = new PropertyDialogAction( part.getSite(), new ISelectionProvider() {
|
||||
|
||||
@Override
|
||||
public void addSelectionChangedListener( ISelectionChangedListener listener ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISelection getSelection() {
|
||||
return new StructuredSelection( bpContext );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSelectionChangedListener( ISelectionChangedListener listener ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelection( ISelection selection ) {
|
||||
assert false; // Not supported
|
||||
}
|
||||
} );
|
||||
propertyAction.run();
|
||||
}
|
||||
CDebugUIUtils.editBreakpointProperties(part, bp);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2008 QNX Software 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems) - bug 183397
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
||||
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
|
||||
import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointPropertyDialogAction;
|
||||
import org.eclipse.debug.core.model.IBreakpoint;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
||||
import org.eclipse.debug.ui.contexts.IDebugContextProvider;
|
||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
/**
|
||||
* Opens a custom properties dialog to configure the attibutes of a C/C++ breakpoint
|
||||
* from the ruler popup menu.
|
||||
*/
|
||||
public class CBreakpointPropertiesRulerAction extends AbstractBreakpointRulerAction {
|
||||
|
||||
private ICBreakpoint fBreakpoint;
|
||||
|
||||
/**
|
||||
* Creates the action to modify the breakpoint properties.
|
||||
*/
|
||||
public CBreakpointPropertiesRulerAction( IWorkbenchPart part, IVerticalRulerInfo info ) {
|
||||
super( part, info );
|
||||
setText( ActionMessages.getString( "CBreakpointPropertiesRulerAction.Breakpoint_Properties" ) ); //$NON-NLS-1$
|
||||
part.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.BREAKPOINT_PROPERTIES_ACTION );
|
||||
setId( IInternalCDebugUIConstants.ACTION_BREAKPOINT_PROPERTIES );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see Action#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
if ( fBreakpoint != null ) {
|
||||
final ISelection debugContext = DebugUITools.getDebugContextForPart(getTargetPart());
|
||||
CBreakpointPropertyDialogAction propertiesAction = new CBreakpointPropertyDialogAction(
|
||||
getTargetPart().getSite(),
|
||||
new ISelectionProvider() {
|
||||
@Override
|
||||
public ISelection getSelection() {
|
||||
return new StructuredSelection( fBreakpoint );
|
||||
}
|
||||
@Override public void addSelectionChangedListener( ISelectionChangedListener listener ) {}
|
||||
@Override public void removeSelectionChangedListener( ISelectionChangedListener listener ) {}
|
||||
@Override public void setSelection( ISelection selection ) {}
|
||||
},
|
||||
new IDebugContextProvider() {
|
||||
@Override
|
||||
public ISelection getActiveContext() {
|
||||
return debugContext;
|
||||
}
|
||||
@Override public void addDebugContextListener(IDebugContextListener listener) {}
|
||||
@Override public void removeDebugContextListener(IDebugContextListener listener) {}
|
||||
@Override public IWorkbenchPart getPart() { return null; }
|
||||
|
||||
}
|
||||
);
|
||||
propertiesAction.run();
|
||||
propertiesAction.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see IUpdate#update()
|
||||
*/
|
||||
@Override
|
||||
public void update() {
|
||||
IBreakpoint breakpoint= getBreakpoint();
|
||||
|
||||
if (breakpoint instanceof ICBreakpoint) {
|
||||
fBreakpoint = (ICBreakpoint)breakpoint;
|
||||
} else {
|
||||
fBreakpoint = null;
|
||||
}
|
||||
setEnabled( fBreakpoint != null );
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* QNX Software Systems - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
|
@ -0,0 +1,97 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2010 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
|
||||
* Wind River Systems - added support for IToggleBreakpointsTargetFactory
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.ui.IActionDelegate2;
|
||||
import org.eclipse.ui.IObjectActionDelegate;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
/**
|
||||
* A toggle breakpoint action that can be contributed to an object. The action
|
||||
* will perform a toggle breakpoint operation for a selected object.
|
||||
* <p>
|
||||
* This class is based on {@link org.eclipse.debug.internal.ui.actions.breakpoints.ToggleBreakpointObjectActionDelegate }
|
||||
* class. In addition to the copied functionality, it adds the handling of
|
||||
* action-triggering event.
|
||||
* </p>
|
||||
*
|
||||
* @since 7.2
|
||||
*/
|
||||
public abstract class CToggleBreakpointObjectActionDelegate implements IObjectActionDelegate, IActionDelegate2 {
|
||||
|
||||
private IWorkbenchPart fPart;
|
||||
private IStructuredSelection fSelection;
|
||||
|
||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||
fPart = targetPart;
|
||||
}
|
||||
|
||||
public void run(IAction action) {
|
||||
runWithEvent(action, null);
|
||||
}
|
||||
|
||||
public void runWithEvent(IAction action, Event event) {
|
||||
IToggleBreakpointsTarget target =
|
||||
DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, fSelection);
|
||||
if (target != null) {
|
||||
try {
|
||||
performAction(target, fPart, fSelection, event);
|
||||
} catch (CoreException e) {
|
||||
DebugPlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the operation specific to this action.
|
||||
*
|
||||
* @param target adapter to toggle breakpoints
|
||||
* @param part the active part
|
||||
* @param selection the selection in the active part
|
||||
* @param event that triggered this action
|
||||
* @exception CoreException if an exception occurs
|
||||
*/
|
||||
protected abstract void performAction(IToggleBreakpointsTarget target, IWorkbenchPart part, ISelection selection, Event event)
|
||||
throws CoreException;
|
||||
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
boolean enabled = false;
|
||||
if (selection instanceof IStructuredSelection) {
|
||||
IStructuredSelection ss = (IStructuredSelection) selection;
|
||||
this.fSelection = ss;
|
||||
// selectionChagned() can sometimes be called before setActivePart().
|
||||
// Guard here against that possibility.
|
||||
if (fPart != null) {
|
||||
IToggleBreakpointsTarget target =
|
||||
DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, fSelection);
|
||||
enabled = target != null;
|
||||
}
|
||||
}
|
||||
action.setEnabled(enabled);
|
||||
}
|
||||
|
||||
public void init(IAction action) {
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
fSelection = null;
|
||||
fPart = null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2008 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
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
/**
|
||||
* A toggle method breakpoint action that can be contributed an object
|
||||
* contribution. The action will toggle method breakpoints on objects
|
||||
* that provide an <code>IToggleBreakpointsTarget</code> adapter.
|
||||
* <p>
|
||||
* This class is based on {@link org.eclipse.debug.ui.actions.ToggleMethodBreakpointActionDelegate }
|
||||
* class. In addition to the copied functionality, it adds the handling of
|
||||
* action-triggering event.
|
||||
* </p>
|
||||
*
|
||||
* @since 7.2
|
||||
*/
|
||||
public class CToggleMethodBreakpointActionDelegate extends CToggleBreakpointObjectActionDelegate {
|
||||
|
||||
protected void performAction(IToggleBreakpointsTarget target, IWorkbenchPart part, ISelection selection, Event event)
|
||||
throws CoreException
|
||||
{
|
||||
if ((event.stateMask & SWT.MOD1) != 0 &&
|
||||
target instanceof IToggleBreakpointsTargetCExtension &&
|
||||
((IToggleBreakpointsTargetCExtension)target).canCreateBreakpointsInteractive(part, selection))
|
||||
{
|
||||
((IToggleBreakpointsTargetCExtension)target).createBreakpointsInteractive(part, selection);
|
||||
}
|
||||
else {
|
||||
target.toggleMethodBreakpoints(part, selection);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,10 +9,11 @@
|
|||
* QNX Software Systems - Initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems) - bug 183397
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
||||
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.model.IBreakpoint;
|
|
@ -0,0 +1,109 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2010 QNX Software 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
|
||||
* Warren Paul (Nokia) - Bug 217485, Bug 218342
|
||||
* Oyvind Harboe (oyvind.harboe@zylin.com) - Bug 225099
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||
import org.eclipse.cdt.debug.ui.breakpoints.AbstractToggleBreakpointAdapter;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.jface.window.Window;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
/**
|
||||
* Toggles a line breakpoint in a C/C++ editor.
|
||||
*
|
||||
* @since 7.2
|
||||
*/
|
||||
public class ToggleBreakpointAdapter extends AbstractToggleBreakpointAdapter {
|
||||
|
||||
@Override
|
||||
protected ICLineBreakpoint findLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
|
||||
return CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createLineBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
|
||||
IResource resource, int lineNumber) throws CoreException
|
||||
{
|
||||
if (interactive) {
|
||||
ICLineBreakpoint lineBp = CDIDebugModel.createBlankLineBreakpoint();
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
CDIDebugModel.setLineBreakpointAttributes(
|
||||
attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0, "" ); //$NON-NLS-1$
|
||||
openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
|
||||
} else {
|
||||
CDIDebugModel.createLineBreakpoint( sourceHandle, resource, getBreakpointType(), lineNumber, true, 0, "", true );//$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ICFunctionBreakpoint findFunctionBreakpoint(String sourceHandle, IResource resource, String functionName)
|
||||
throws CoreException
|
||||
{
|
||||
return CDIDebugModel.functionBreakpointExists( sourceHandle, resource, functionName );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createFunctionBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
|
||||
IResource resource, String functionName, int charStart, int charEnd, int lineNumber ) throws CoreException
|
||||
{
|
||||
if (interactive) {
|
||||
ICFunctionBreakpoint bp = CDIDebugModel.createBlankFunctionBreakpoint();
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
CDIDebugModel.setFunctionBreakpointAttributes( attributes, sourceHandle, getBreakpointType(), functionName,
|
||||
charStart, charEnd, lineNumber, true, 0, "" ); //$NON-NLS-1$
|
||||
openBreakpointPropertiesDialog(bp, part, resource, attributes);
|
||||
} else {
|
||||
CDIDebugModel.createFunctionBreakpoint(sourceHandle, resource, getBreakpointType(), functionName, charStart,
|
||||
charEnd, lineNumber, true, 0, "", true); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression ) throws CoreException {
|
||||
return CDIDebugModel.watchpointExists( sourceHandle, resource, expression );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createWatchpoint( boolean interactive, IWorkbenchPart part, String sourceHandle, IResource resource,
|
||||
int charStart, int charEnd, int lineNumber, String expression) throws CoreException
|
||||
{
|
||||
AddWatchpointDialog dlg = new AddWatchpointDialog(
|
||||
part.getSite().getShell(), AddWatchpointActionDelegate.getMemorySpaceManagement() );
|
||||
dlg.setExpression( expression );
|
||||
if ( dlg.open() != Window.OK )
|
||||
return;
|
||||
expression = dlg.getExpression();
|
||||
CDIDebugModel.createWatchpoint(sourceHandle, resource, charStart, charEnd, lineNumber, dlg.getWriteAccess(),
|
||||
dlg.getReadAccess(), expression, dlg.getMemorySpace(), dlg.getRange(), true, 0, "", true); //$NON-NLS-1$
|
||||
// if (interactive) {
|
||||
// ICWatchpoint bp = CDIDebugModel.createBlankWatchpoint();
|
||||
// Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
// CDIDebugModel.setWatchPointAttributes(attributes, sourceHandle, resource, writeAccess, readAccess,
|
||||
// expression, memorySpace, range, true, 0, ""); //$NON-NLS-1$
|
||||
// openBreakpointPropertiesDialog(bp, part, resource, attributes);
|
||||
// }
|
||||
}
|
||||
|
||||
protected int getBreakpointType() {
|
||||
return ICBreakpointType.REGULAR;
|
||||
}
|
||||
}
|
|
@ -8,13 +8,14 @@
|
|||
* Contributors:
|
||||
* Wind River Systems - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.debug.core.model.IDebugElement;
|
||||
|
@ -86,8 +87,7 @@ public class ToggleCBreakpointsTargetFactory implements IToggleBreakpointsTarget
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set getToggleTargets(IWorkbenchPart part, ISelection selection) {
|
||||
public Set<?> getToggleTargets(IWorkbenchPart part, ISelection selection) {
|
||||
return TOGGLE_TARGET_IDS;
|
||||
}
|
||||
|
|
@ -8,11 +8,12 @@
|
|||
* Contributors:
|
||||
* Ericsson - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetFactory;
|
||||
|
@ -66,8 +67,7 @@ public class ToggleCTracepointsTargetFactory implements IToggleBreakpointsTarget
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set getToggleTargets(IWorkbenchPart part, ISelection selection) {
|
||||
public Set<?> getToggleTargets(IWorkbenchPart part, ISelection selection) {
|
||||
return TOGGLE_TARGET_IDS;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson 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:
|
||||
* Ericsson - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||
import org.eclipse.cdt.debug.ui.breakpoints.AbstractToggleBreakpointAdapter;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
/**
|
||||
* Toggles a tracepoint in a C/C++ editor.
|
||||
*/
|
||||
public class ToggleTracepointAdapter extends AbstractToggleBreakpointAdapter {
|
||||
|
||||
@Override
|
||||
protected ICLineBreakpoint findLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
|
||||
return CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createLineBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
|
||||
IResource resource, int lineNumber) throws CoreException
|
||||
{
|
||||
if (interactive) {
|
||||
ICLineBreakpoint lineBp = CDIDebugModel.createBlankLineTracepoint();
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
CDIDebugModel.setLineBreakpointAttributes(
|
||||
attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0, "" ); //$NON-NLS-1$
|
||||
openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
|
||||
} else {
|
||||
CDIDebugModel.createLineTracepoint( sourceHandle, resource, getBreakpointType(), lineNumber, true, 0, "", true );//$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ICFunctionBreakpoint findFunctionBreakpoint( String sourceHandle, IResource resource, String functionName ) throws CoreException {
|
||||
return CDIDebugModel.functionBreakpointExists( sourceHandle, resource, functionName );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createFunctionBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
|
||||
IResource resource, String functionName, int charStart, int charEnd, int lineNumber ) throws CoreException
|
||||
{
|
||||
if (interactive) {
|
||||
ICFunctionBreakpoint bp = CDIDebugModel.createBlankFunctionTracepoint();
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
CDIDebugModel.setFunctionBreakpointAttributes( attributes, sourceHandle, getBreakpointType(), functionName,
|
||||
charStart, charEnd, lineNumber, true, 0, "" ); //$NON-NLS-1$
|
||||
openBreakpointPropertiesDialog(bp, part, resource, attributes);
|
||||
} else {
|
||||
CDIDebugModel.createFunctionTracepoint(sourceHandle, resource, getBreakpointType(), functionName, charStart,
|
||||
charEnd, lineNumber, true, 0, "", true); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression ) throws CoreException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void createWatchpoint( boolean interactive, IWorkbenchPart part, String sourceHandle, IResource resource,
|
||||
int charStart, int charEnd, int lineNumber, String expression) throws CoreException
|
||||
{
|
||||
}
|
||||
|
||||
protected int getBreakpointType() {
|
||||
return ICBreakpointType.REGULAR;
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui;
|
||||
package org.eclipse.cdt.debug.internal.ui.breakpoints;
|
||||
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
|
@ -0,0 +1,33 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2006 QNX Software 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.breakpoints;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class BreakpointsMessages {
|
||||
|
||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.breakpoints.BreakpointsMessages"; //$NON-NLS-1$
|
||||
|
||||
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||
|
||||
private BreakpointsMessages() {
|
||||
}
|
||||
|
||||
public static String getString( String key ) {
|
||||
try {
|
||||
return RESOURCE_BUNDLE.getString( key );
|
||||
}
|
||||
catch( MissingResourceException e ) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2003, 2009 QNX Software 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:
|
||||
# QNX Software Systems - initial API and implementation
|
||||
# Nokia - https://bugs.eclipse.org/bugs/show_bug.cgi?id=145606
|
||||
# IBM Corporation
|
||||
###############################################################################
|
||||
|
||||
CBreakpointPropertyPage.0=Ignore count must be a nonnegative integer
|
||||
CBreakpointPropertyPage.1=Not available
|
||||
CBreakpointPropertyPage.function_label=Function name:
|
||||
CBreakpointPropertyPage.3=C/C++ function breakpoint
|
||||
CBreakpointPropertyPage.4=Not available
|
||||
CBreakpointPropertyPage.address_label=Address:
|
||||
CBreakpointPropertyPage.6=C/C++ address breakpoint
|
||||
CBreakpointPropertyPage.7=File:
|
||||
CBreakpointPropertyPage.8=C/C++ line breakpoint
|
||||
CBreakpointPropertyPage.9=Line number:
|
||||
CBreakpointPropertyPage.10=Project:
|
||||
CBreakpointPropertyPage.11=C/C++ read watchpoint
|
||||
CBreakpointPropertyPage.12=C/C++ watchpoint
|
||||
CBreakpointPropertyPage.13=C/C++ access watchpoint
|
||||
CBreakpointPropertyPage.14=Expression to watch:
|
||||
CBreakpointPropertyPage.15=&Condition:
|
||||
CBreakpointPropertyPage.16=Invalid condition.
|
||||
CBreakpointPropertyPage.17=&Ignore count:
|
||||
CBreakpointPropertyPage.18=Class:
|
||||
CBreakpointPropertyPage.19=Enabled
|
||||
CBreakpointPropertyPage.20=File:
|
||||
CBreakpointPropertyPage.21=C/C++ Event Breakpoint
|
||||
|
||||
ThreadFilterEditor.0=&Restrict to Selected Targets and Threads:
|
|
@ -9,10 +9,13 @@
|
|||
* Wind River Systems - initial API and implementation
|
||||
* Ericsson - Added tracepoint support (284286)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui;
|
||||
package org.eclipse.cdt.debug.internal.ui.breakpoints;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICTracepoint;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IAdapterFactory;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
@ -20,9 +23,13 @@ import org.eclipse.core.runtime.PlatformObject;
|
|||
import org.eclipse.debug.core.model.IBreakpoint;
|
||||
import org.eclipse.debug.core.model.IDebugElement;
|
||||
import org.eclipse.debug.core.model.IDebugModelProvider;
|
||||
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
||||
import org.eclipse.debug.ui.contexts.IDebugContextProvider;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.ui.IActionFilter;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
/**
|
||||
* Input for breakpoint properties dialog. It captures both the
|
||||
|
@ -30,7 +37,7 @@ import org.eclipse.ui.IActionFilter;
|
|||
* This combined context can then be used by breakpoint property
|
||||
* pages to access model and target specific breakpoint settings.
|
||||
*/
|
||||
public class CBreakpointContext extends PlatformObject {
|
||||
public class CBreakpointContext extends PlatformObject implements IDebugContextProvider {
|
||||
|
||||
// Register an adapter factory for the class when it is first loaded.
|
||||
static {
|
||||
|
@ -42,29 +49,59 @@ public class CBreakpointContext extends PlatformObject {
|
|||
*/
|
||||
private final ICBreakpoint fBreakpoint;
|
||||
|
||||
/**
|
||||
* The resource that the breakpoint is to be created for.
|
||||
*/
|
||||
private final IResource fResource;
|
||||
|
||||
/**
|
||||
* The active debug context held by this context.
|
||||
*/
|
||||
private final ISelection fDebugContext;
|
||||
|
||||
/**
|
||||
* Creates a new breakpoint context with given breakpoint and debbug
|
||||
* Associated preference store.
|
||||
*/
|
||||
final CBreakpointPreferenceStore fPreferenceStore;
|
||||
|
||||
/**
|
||||
* Creates a new breakpoint context with given breakpoint and debug
|
||||
* context selection.
|
||||
*/
|
||||
public CBreakpointContext(ICBreakpoint breakpoint, ISelection debugContext) {
|
||||
this (breakpoint, debugContext, null, null);
|
||||
}
|
||||
|
||||
public CBreakpointContext(ICBreakpoint breakpoint, ISelection debugContext, IResource resource, Map<String, Object> attributes) {
|
||||
fBreakpoint = breakpoint;
|
||||
fResource = resource;
|
||||
fDebugContext = debugContext;
|
||||
fPreferenceStore = new CBreakpointPreferenceStore(this, attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the breakpoint.
|
||||
*/
|
||||
public ICBreakpoint getBreakpoint() { return fBreakpoint; }
|
||||
|
||||
public IResource getResource() { return fResource; }
|
||||
|
||||
/**
|
||||
* Returns the debug context.
|
||||
*/
|
||||
public ISelection getDebugContext() { return fDebugContext; }
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.contexts.IDebugContextProvider implementation
|
||||
*/
|
||||
public IWorkbenchPart getPart() { return null; }
|
||||
public void addDebugContextListener(IDebugContextListener listener) {}
|
||||
public void removeDebugContextListener(IDebugContextListener listener) {}
|
||||
|
||||
public ISelection getActiveContext() {
|
||||
return fDebugContext;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,24 +152,34 @@ class CBreakpointContextActionFilter implements IActionFilter {
|
|||
*/
|
||||
class CBreakpointContextAdapterFactory implements IAdapterFactory {
|
||||
|
||||
private static final Class[] fgAdapterList = new Class[] {
|
||||
IBreakpoint.class, ICBreakpoint.class, ICTracepoint.class, IActionFilter.class
|
||||
private static final Class<?>[] fgAdapterList = new Class[] {
|
||||
IBreakpoint.class, ICBreakpoint.class, ICTracepoint.class, IActionFilter.class, IPreferenceStore.class
|
||||
};
|
||||
|
||||
private static final IActionFilter fgActionFilter = new CBreakpointContextActionFilter();
|
||||
|
||||
@Override
|
||||
public Object getAdapter(Object obj, Class adapterType) {
|
||||
if (adapterType.isInstance( ((CBreakpointContext)obj).getBreakpoint() )) {
|
||||
public Object getAdapter(Object obj, @SuppressWarnings("rawtypes") Class adapterType) {
|
||||
// Note: only return the breakpoint object as an adapter if it has
|
||||
// an associated marker. Otherwise the property pages will throw multiple
|
||||
// exceptions.
|
||||
if (adapterType.isInstance( ((CBreakpointContext)obj).getBreakpoint() ) &&
|
||||
((CBreakpointContext)obj).getBreakpoint().getMarker() != null)
|
||||
{
|
||||
return ((CBreakpointContext)obj).getBreakpoint();
|
||||
}
|
||||
|
||||
if ( IPreferenceStore.class.equals(adapterType) ) {
|
||||
return ((CBreakpointContext)obj).fPreferenceStore;
|
||||
}
|
||||
|
||||
if (IActionFilter.class.equals(adapterType)) {
|
||||
return fgActionFilter;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Class[] getAdapterList() {
|
||||
return fgAdapterList;
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.propertypages;
|
||||
package org.eclipse.cdt.debug.internal.ui.breakpoints;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
|
@ -48,7 +48,7 @@ public class CBreakpointFilteringPage extends PropertyPage {
|
|||
ICBreakpoint bp = getBreakpoint();
|
||||
if (bp != null) {
|
||||
try {
|
||||
return (ICBreakpointFilterExtension)bp.getExtension(
|
||||
return bp.getExtension(
|
||||
CDIDebugModel.getPluginIdentifier(), ICBreakpointFilterExtension.class);
|
||||
} catch (CoreException e) {}
|
||||
}
|
|
@ -0,0 +1,315 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2008 QNX Software 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* QNX Software Systems - Refactored to use platform implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.breakpoints;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint2;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.ListenerList;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.jface.preference.IPersistentPreferenceStore;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
|
||||
/**
|
||||
* A preference store that presents the state of the properties of a C/C++ breakpoint.
|
||||
*/
|
||||
public class CBreakpointPreferenceStore implements IPersistentPreferenceStore {
|
||||
|
||||
// protected final static String ENABLED = "ENABLED"; //$NON-NLS-1$
|
||||
//
|
||||
// protected final static String CONDITION = "CONDITION"; //$NON-NLS-1$
|
||||
//
|
||||
// protected final static String IGNORE_COUNT = "IGNORE_COUNT"; //$NON-NLS-1$
|
||||
//
|
||||
// protected final static String LINE = "LINE"; //$NON-NLS-1$
|
||||
|
||||
// This map is the current properties/values being maintained/manipulated
|
||||
private HashMap<String, Object> fProperties = new HashMap<String, Object>();
|
||||
|
||||
// Original set of values. So we can see what has really changed on the save and
|
||||
// perform appropriate change operations. We only really want to operate on changed
|
||||
// values, to avoid generating churn.
|
||||
private HashMap<String, Object> fOriginalValues = new HashMap<String, Object>();
|
||||
private boolean fIsDirty = false;
|
||||
private boolean fIsCanceled = false;
|
||||
private ListenerList fListeners;
|
||||
private final CBreakpointContext fContext;
|
||||
|
||||
// TODO: remove after fixing add event breapoint dialog.
|
||||
public CBreakpointPreferenceStore() {
|
||||
this (null, null);
|
||||
}
|
||||
|
||||
public CBreakpointPreferenceStore(CBreakpointContext context, Map<String, Object> attributes) {
|
||||
fListeners = new ListenerList(org.eclipse.core.runtime.ListenerList.IDENTITY);
|
||||
fContext = context;
|
||||
|
||||
fOriginalValues.clear();
|
||||
fProperties.clear();
|
||||
if (context != null) {
|
||||
IMarker marker = context.getBreakpoint().getMarker();
|
||||
if (marker != null) {
|
||||
Map<String, Object> bpAttrs = Collections.emptyMap();
|
||||
try {
|
||||
bpAttrs = marker.getAttributes();
|
||||
fOriginalValues.putAll(bpAttrs);
|
||||
fProperties.putAll(bpAttrs);
|
||||
} catch (CoreException e) {
|
||||
DebugPlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (attributes != null) {
|
||||
fProperties.putAll(attributes);
|
||||
fIsDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, Object> getAttributes() {
|
||||
return fProperties;
|
||||
}
|
||||
|
||||
public void setCanceled(boolean canceled) {
|
||||
fIsCanceled = canceled;
|
||||
}
|
||||
|
||||
public void save() throws IOException {
|
||||
if (!fIsCanceled && fContext != null && fContext.getBreakpoint() != null) {
|
||||
ICBreakpoint bp = fContext.getBreakpoint();
|
||||
if (bp.getMarker() != null && fIsDirty) {
|
||||
saveToExistingMarker(bp, bp.getMarker());
|
||||
}
|
||||
else if (fContext.getResource() != null){
|
||||
saveToNewMarker(bp, fContext.getResource());
|
||||
} else {
|
||||
throw new IOException("Unable to create breakpoint: no resource specified."); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void saveToExistingMarker(final ICBreakpoint breakpoint, final IMarker marker) throws IOException {
|
||||
final List<String> changedProperties = new ArrayList<String>( 5 );
|
||||
Set<String> valueNames = fProperties.keySet();
|
||||
for ( String name : valueNames ) {
|
||||
if ( fProperties.containsKey( name ) ) {
|
||||
Object originalObject = fOriginalValues.get( name );
|
||||
Object currentObject = fProperties.get( name );
|
||||
if ( originalObject == null ) {
|
||||
changedProperties.add( name );
|
||||
}
|
||||
else if ( ! originalObject.equals( currentObject ) ) {
|
||||
changedProperties.add( name );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ! changedProperties.isEmpty() ) {
|
||||
IWorkspaceRunnable wr = new IWorkspaceRunnable() {
|
||||
public void run( IProgressMonitor monitor ) throws CoreException {
|
||||
Iterator<String> changed = changedProperties.iterator();
|
||||
while( changed.hasNext() ) {
|
||||
String property = changed.next();
|
||||
if ( property.equals( ICBreakpoint.ENABLED ) ) {
|
||||
breakpoint.setEnabled( getBoolean( ICBreakpoint.ENABLED ) );
|
||||
}
|
||||
else if ( property.equals( ICBreakpoint.IGNORE_COUNT ) ) {
|
||||
breakpoint.setIgnoreCount( getInt( ICBreakpoint.IGNORE_COUNT ) );
|
||||
}
|
||||
else if ( property.equals( ICBreakpoint.CONDITION ) ) {
|
||||
breakpoint.setCondition( getString( ICBreakpoint.CONDITION ) );
|
||||
}
|
||||
else if ( property.equals( IMarker.LINE_NUMBER ) ) {
|
||||
// already workspace runnable, setting markers are safe
|
||||
breakpoint.getMarker().setAttribute(IMarker.LINE_NUMBER, getInt(IMarker.LINE_NUMBER));
|
||||
breakpoint.getMarker().setAttribute(ICLineBreakpoint2.REQUESTED_LINE, getInt(IMarker.LINE_NUMBER));
|
||||
} else {
|
||||
// this allow set attributes contributed by other plugins
|
||||
String value = getPropertyAsString(property);
|
||||
if ( value != null ) {
|
||||
marker.setAttribute(property, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
try {
|
||||
ResourcesPlugin.getWorkspace().run( wr, null );
|
||||
}
|
||||
catch( CoreException ce ) {
|
||||
throw new IOException("Cannot save properties to breakpoint.", ce); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void saveToNewMarker(final ICBreakpoint breakpoint, final IResource resource) throws IOException {
|
||||
try {
|
||||
CDIDebugModel.createBreakpointMarker(breakpoint, resource, fProperties, true);
|
||||
}
|
||||
catch( CoreException ce ) {
|
||||
throw new IOException("Cannot save properties to new breakpoint.", ce); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
private String getPropertyAsString(String property) {
|
||||
if (fProperties.containsKey(property)) {
|
||||
return getString(property);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// IPreferenceStore
|
||||
|
||||
public boolean needsSaving() {
|
||||
return fIsDirty && !fIsCanceled;
|
||||
}
|
||||
|
||||
public boolean contains(String name) {
|
||||
return fProperties.containsKey(name);
|
||||
}
|
||||
|
||||
public void addPropertyChangeListener(IPropertyChangeListener listener) {
|
||||
fListeners.add(listener);
|
||||
}
|
||||
|
||||
public void removePropertyChangeListener(IPropertyChangeListener listener) {
|
||||
fListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void firePropertyChangeEvent(String name,
|
||||
Object oldValue,
|
||||
Object newValue)
|
||||
{
|
||||
Object[] listeners = fListeners.getListeners();
|
||||
// Do we need to fire an event.
|
||||
if (listeners.length > 0 && (oldValue == null || !oldValue.equals(newValue))) {
|
||||
PropertyChangeEvent pe = new PropertyChangeEvent(this, name, oldValue, newValue);
|
||||
for (int i = 0; i < listeners.length; ++i) {
|
||||
IPropertyChangeListener l = (IPropertyChangeListener) listeners[i];
|
||||
l.propertyChange(pe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getBoolean(String name) {
|
||||
boolean retVal = false;
|
||||
Object o = fProperties.get(name);
|
||||
if (o instanceof Boolean) {
|
||||
retVal = ((Boolean)o).booleanValue();
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public int getInt(String name) {
|
||||
int retVal = 0;
|
||||
Object o = fProperties.get(name);
|
||||
if (o instanceof Integer) {
|
||||
retVal = ((Integer)o).intValue();
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public String getString(String name) {
|
||||
String retVal = null;
|
||||
Object o = fProperties.get(name);
|
||||
if (o instanceof String) {
|
||||
retVal = (String)o;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public double getDouble(String name) { return 0; }
|
||||
public float getFloat(String name) { return 0; }
|
||||
public long getLong(String name) { return 0; }
|
||||
|
||||
public boolean isDefault(String name) { return false; }
|
||||
|
||||
public boolean getDefaultBoolean(String name) { return false; }
|
||||
public double getDefaultDouble(String name) { return 0; }
|
||||
public float getDefaultFloat(String name) { return 0; }
|
||||
public int getDefaultInt(String name) { return 0; }
|
||||
public long getDefaultLong(String name) { return 0; }
|
||||
public String getDefaultString(String name) { return null; }
|
||||
|
||||
public void putValue(String name, String value) {
|
||||
Object oldValue = fProperties.get(name);
|
||||
if ( oldValue == null || !oldValue.equals(value) ) {
|
||||
fProperties.put(name, value);
|
||||
setDirty(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setDefault(String name, double value) {}
|
||||
public void setDefault(String name, float value) {}
|
||||
public void setDefault(String name, int value) {}
|
||||
public void setDefault(String name, long value) {}
|
||||
public void setDefault(String name, String defaultObject) {}
|
||||
public void setDefault(String name, boolean value) {}
|
||||
public void setToDefault(String name) {}
|
||||
|
||||
public void setValue(String name, boolean value) {
|
||||
boolean oldValue = getBoolean(name);
|
||||
if (oldValue != value) {
|
||||
fProperties.put( name, new Boolean(value) );
|
||||
setDirty(true);
|
||||
firePropertyChangeEvent(name, new Boolean(oldValue), new Boolean(value) );
|
||||
}
|
||||
}
|
||||
|
||||
public void setValue(String name, int value) {
|
||||
int oldValue = getInt(name);
|
||||
if (oldValue != value) {
|
||||
fProperties.put( name, new Integer(value) );
|
||||
setDirty(true);
|
||||
firePropertyChangeEvent(name, new Integer(oldValue), new Integer(value) );
|
||||
}
|
||||
}
|
||||
|
||||
public void setValue(String name, String value) {
|
||||
Object oldValue = fProperties.get(name);
|
||||
if ( (oldValue == null && value != null) ||
|
||||
(oldValue != null && !oldValue.equals(value)) )
|
||||
{
|
||||
fProperties.put(name, value);
|
||||
setDirty(true);
|
||||
firePropertyChangeEvent(name, oldValue, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void setValue(String name, float value) {}
|
||||
public void setValue(String name, double value) {}
|
||||
public void setValue(String name, long value) {}
|
||||
|
||||
// IPreferenceStore
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void setDirty(boolean isDirty) {
|
||||
fIsDirty = isDirty;
|
||||
}
|
||||
}
|
|
@ -10,18 +10,13 @@
|
|||
* Nokia - https://bugs.eclipse.org/bugs/show_bug.cgi?id=145606
|
||||
* QNX Software Systems - Catchpoints support https://bugs.eclipse.org/bugs/show_bug.cgi?id=226689
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.propertypages;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
package org.eclipse.cdt.debug.internal.ui.breakpoints;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint2;
|
||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointUIContributionFactory;
|
||||
|
@ -31,11 +26,8 @@ import org.eclipse.core.resources.IFile;
|
|||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.debug.core.model.ILineBreakpoint;
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditor;
|
||||
|
@ -43,8 +35,6 @@ import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
|||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.preference.IntegerFieldEditor;
|
||||
import org.eclipse.jface.preference.StringFieldEditor;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.IWorkbenchPropertyPage;
|
||||
|
@ -59,7 +49,7 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
|
|||
|
||||
public BreakpointIntegerFieldEditor( String name, String labelText, Composite parent ) {
|
||||
super( name, labelText, parent );
|
||||
setErrorMessage( PropertyPageMessages.getString( "CBreakpointPropertyPage.0" ) ); //$NON-NLS-1$
|
||||
setErrorMessage( BreakpointsMessages.getString( "CBreakpointPropertyPage.0" ) ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -141,6 +131,10 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
|
|||
super.doStore();
|
||||
}
|
||||
}
|
||||
protected void doLoad() {
|
||||
String value = getPreferenceStore().getString(getPreferenceName());
|
||||
setStringValue(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see FieldEditor#refreshValidState()
|
||||
|
@ -201,8 +195,11 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
|
|||
private IAdaptable fElement;
|
||||
|
||||
/**
|
||||
* The "fake" preference store used to interface between
|
||||
* the breakpoint and the breakpoint preference page.
|
||||
* The preference store used to interface between the breakpoint and the
|
||||
* breakpoint preference page. This preference store is initialized only
|
||||
* when the preference store cannot be retrieved from the preference
|
||||
* dialog's element.
|
||||
* @see #getPreferenceStore()
|
||||
*/
|
||||
private CBreakpointPreferenceStore fCBreakpointPreferenceStore;
|
||||
|
||||
|
@ -214,7 +211,8 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
|
|||
public CBreakpointPropertyPage() {
|
||||
super( GRID );
|
||||
noDefaultAndApplyButton();
|
||||
fCBreakpointPreferenceStore = new CBreakpointPreferenceStore();
|
||||
// Control control = getControl();
|
||||
// fCBreakpointPreferenceStore = new CBreakpointPreferenceStore();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -226,29 +224,15 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
|
|||
protected void createFieldEditors() {
|
||||
ICBreakpoint breakpoint = getBreakpoint();
|
||||
createMainLabel(breakpoint);
|
||||
createContributetedFieldEditors(breakpoint);
|
||||
createContributedFieldEditors(breakpoint);
|
||||
createTypeSpecificLabelFieldEditors( breakpoint );
|
||||
createEnabledField( getFieldEditorParent() );
|
||||
IPreferenceStore store = getPreferenceStore();
|
||||
try {
|
||||
String condition = breakpoint.getCondition();
|
||||
if ( condition == null ) {
|
||||
condition = ""; //$NON-NLS-1$
|
||||
}
|
||||
store.setValue( CBreakpointPreferenceStore.CONDITION, condition );
|
||||
createConditionEditor( getFieldEditorParent() );
|
||||
store.setValue( CBreakpointPreferenceStore.ENABLED, breakpoint.isEnabled() );
|
||||
int ignoreCount = breakpoint.getIgnoreCount();
|
||||
store.setValue( CBreakpointPreferenceStore.IGNORE_COUNT, (ignoreCount >= 0) ? ignoreCount : 0 );
|
||||
createIgnoreCountEditor( getFieldEditorParent() );
|
||||
}
|
||||
catch( CoreException ce ) {
|
||||
CDebugUIPlugin.log( ce );
|
||||
}
|
||||
createConditionEditor( getFieldEditorParent() );
|
||||
createIgnoreCountEditor( getFieldEditorParent() );
|
||||
}
|
||||
|
||||
private void createMainLabel(ICBreakpoint breakpoint) {
|
||||
addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.18" ), //$NON-NLS-1$
|
||||
addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.18" ), //$NON-NLS-1$
|
||||
getBreakpointMainLabel(breakpoint) ) );
|
||||
}
|
||||
|
||||
|
@ -261,7 +245,7 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
|
|||
|
||||
if ( breakpoint instanceof ICFunctionBreakpoint ) {
|
||||
ICFunctionBreakpoint fbrkpt = (ICFunctionBreakpoint)breakpoint;
|
||||
String function = PropertyPageMessages.getString( "CBreakpointPropertyPage.1" ); //$NON-NLS-1$
|
||||
String function = BreakpointsMessages.getString( "CBreakpointPropertyPage.1" ); //$NON-NLS-1$
|
||||
try {
|
||||
function = fbrkpt.getFunction();
|
||||
}
|
||||
|
@ -270,19 +254,19 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
|
|||
catch( NumberFormatException e ) {
|
||||
}
|
||||
if ( function != null ) {
|
||||
addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.2" ), function ) ); //$NON-NLS-1$
|
||||
addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.function_label" ), function ) ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
else if ( breakpoint instanceof ICAddressBreakpoint ) {
|
||||
ICAddressBreakpoint abrkpt = (ICAddressBreakpoint)breakpoint;
|
||||
String address = PropertyPageMessages.getString( "CBreakpointPropertyPage.4" ); //$NON-NLS-1$
|
||||
String address = BreakpointsMessages.getString( "CBreakpointPropertyPage.4" ); //$NON-NLS-1$
|
||||
try {
|
||||
address = abrkpt.getAddress();
|
||||
}
|
||||
catch( CoreException e ) {
|
||||
}
|
||||
if ( address != null ) {
|
||||
addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.5" ), address ) ); //$NON-NLS-1$
|
||||
addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.address_label" ), address ) ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
else if ( breakpoint instanceof ICWatchpoint ) {
|
||||
|
@ -296,38 +280,25 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
|
|||
}
|
||||
IProject project = breakpoint.getMarker().getResource().getProject();
|
||||
if ( project != null ) {
|
||||
addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.10" ), project.getName() ) ); //$NON-NLS-1$
|
||||
addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.10" ), project.getName() ) ); //$NON-NLS-1$
|
||||
}
|
||||
IResource resource = breakpoint.getMarker().getResource();
|
||||
if ( resource instanceof IFile ) {
|
||||
String filename = resource.getLocation().toOSString();
|
||||
if ( filename != null ) {
|
||||
addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.20" ), filename ) ); //$NON-NLS-1$
|
||||
addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.20" ), filename ) ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.14" ), expression ) ); //$NON-NLS-1$
|
||||
addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.14" ), expression ) ); //$NON-NLS-1$
|
||||
}
|
||||
else if ( breakpoint instanceof ILineBreakpoint ) {
|
||||
String fileName = null;
|
||||
try {
|
||||
fileName = breakpoint.getSourceHandle();
|
||||
}
|
||||
catch( CoreException e ) {
|
||||
}
|
||||
String fileName = getPreferenceStore().getString(ICBreakpoint.SOURCE_HANDLE);
|
||||
if ( fileName != null ) {
|
||||
addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.7" ), fileName ) ); //$NON-NLS-1$
|
||||
addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.7" ), fileName ) ); //$NON-NLS-1$
|
||||
}
|
||||
ILineBreakpoint lBreakpoint = (ILineBreakpoint) breakpoint;
|
||||
|
||||
int lNumber = 0;
|
||||
try {
|
||||
lNumber = lBreakpoint.getLineNumber();
|
||||
} catch (CoreException e) {
|
||||
CDebugUIPlugin.log(e);
|
||||
}
|
||||
|
||||
int lNumber = getPreferenceStore().getInt(IMarker.LINE_NUMBER);
|
||||
if (lNumber > 0) {
|
||||
getPreferenceStore().setValue( CBreakpointPreferenceStore.LINE, lNumber);
|
||||
getPreferenceStore().setValue( IMarker.LINE_NUMBER, lNumber);
|
||||
createLineNumberEditor(getFieldEditorParent());
|
||||
}
|
||||
}
|
||||
|
@ -335,23 +306,23 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
|
|||
|
||||
private String getBreakpointMainLabel(ICBreakpoint breakpoint) {
|
||||
if (breakpoint instanceof ICFunctionBreakpoint)
|
||||
return PropertyPageMessages.getString("CBreakpointPropertyPage.3"); //$NON-NLS-1$
|
||||
return BreakpointsMessages.getString("CBreakpointPropertyPage.3"); //$NON-NLS-1$
|
||||
if (breakpoint instanceof ICAddressBreakpoint)
|
||||
return PropertyPageMessages.getString("CBreakpointPropertyPage.4"); //$NON-NLS-1$
|
||||
return BreakpointsMessages.getString("CBreakpointPropertyPage.4"); //$NON-NLS-1$
|
||||
if (breakpoint instanceof ICLineBreakpoint)
|
||||
return PropertyPageMessages.getString("CBreakpointPropertyPage.8"); //$NON-NLS-1$
|
||||
return BreakpointsMessages.getString("CBreakpointPropertyPage.8"); //$NON-NLS-1$
|
||||
if (breakpoint instanceof ICEventBreakpoint)
|
||||
return PropertyPageMessages.getString("CBreakpointPropertyPage.21"); //$NON-NLS-1$
|
||||
return BreakpointsMessages.getString("CBreakpointPropertyPage.21"); //$NON-NLS-1$
|
||||
if (breakpoint instanceof ICWatchpoint) {
|
||||
ICWatchpoint watchpoint = (ICWatchpoint) breakpoint;
|
||||
String type = ""; //$NON-NLS-1$
|
||||
try {
|
||||
if (watchpoint.isReadType() && !watchpoint.isWriteType())
|
||||
type = PropertyPageMessages.getString("CBreakpointPropertyPage.11"); //$NON-NLS-1$
|
||||
type = BreakpointsMessages.getString("CBreakpointPropertyPage.11"); //$NON-NLS-1$
|
||||
else if (!watchpoint.isReadType() && watchpoint.isWriteType())
|
||||
type = PropertyPageMessages.getString("CBreakpointPropertyPage.12"); //$NON-NLS-1$
|
||||
type = BreakpointsMessages.getString("CBreakpointPropertyPage.12"); //$NON-NLS-1$
|
||||
else
|
||||
type = PropertyPageMessages.getString("CBreakpointPropertyPage.13"); //$NON-NLS-1$
|
||||
type = BreakpointsMessages.getString("CBreakpointPropertyPage.13"); //$NON-NLS-1$
|
||||
|
||||
} catch (CoreException ce) {
|
||||
CDebugUIPlugin.log(ce);
|
||||
|
@ -368,27 +339,33 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
|
|||
return type;
|
||||
}
|
||||
protected void createLineNumberEditor( Composite parent ) {
|
||||
String title = PropertyPageMessages.getString( "CBreakpointPropertyPage.9" ); //$NON-NLS-1$
|
||||
BreakpointIntegerFieldEditor labelFieldEditor =new BreakpointIntegerFieldEditor( CBreakpointPreferenceStore.LINE ,title, parent);
|
||||
String title = BreakpointsMessages.getString( "CBreakpointPropertyPage.9" ); //$NON-NLS-1$
|
||||
BreakpointIntegerFieldEditor labelFieldEditor =new BreakpointIntegerFieldEditor( IMarker.LINE_NUMBER ,title, parent);
|
||||
labelFieldEditor.setValidRange( 1, Integer.MAX_VALUE );
|
||||
addField( labelFieldEditor );
|
||||
}
|
||||
|
||||
protected void createAddressEditor( Composite parent ) {
|
||||
String title = BreakpointsMessages.getString( "CBreakpointPropertyPage.addressLabel" ); //$NON-NLS-1$
|
||||
StringFieldEditor fe =new StringFieldEditor( ICLineBreakpoint.ADDRESS ,title, parent);
|
||||
fe.setEmptyStringAllowed(false);
|
||||
addField( fe );
|
||||
}
|
||||
|
||||
protected void createEnabledField( Composite parent ) {
|
||||
fEnabled = new BooleanFieldEditor( CBreakpointPreferenceStore.ENABLED, PropertyPageMessages.getString( "CBreakpointPropertyPage.19" ), parent ); //$NON-NLS-1$
|
||||
fEnabled = new BooleanFieldEditor( ICBreakpoint.ENABLED, BreakpointsMessages.getString( "CBreakpointPropertyPage.19" ), parent ); //$NON-NLS-1$
|
||||
addField( fEnabled );
|
||||
}
|
||||
|
||||
protected void createConditionEditor( Composite parent ) {
|
||||
fCondition = new BreakpointStringFieldEditor( CBreakpointPreferenceStore.CONDITION, PropertyPageMessages.getString( "CBreakpointPropertyPage.15" ), parent ); //$NON-NLS-1$
|
||||
fCondition = new BreakpointStringFieldEditor( ICBreakpoint.CONDITION, BreakpointsMessages.getString( "CBreakpointPropertyPage.15" ), parent ); //$NON-NLS-1$
|
||||
fCondition.setEmptyStringAllowed( true );
|
||||
fCondition.setErrorMessage( PropertyPageMessages.getString( "CBreakpointPropertyPage.16" ) ); //$NON-NLS-1$
|
||||
fCondition.setErrorMessage( BreakpointsMessages.getString( "CBreakpointPropertyPage.16" ) ); //$NON-NLS-1$
|
||||
addField( fCondition );
|
||||
}
|
||||
|
||||
protected void createIgnoreCountEditor( Composite parent ) {
|
||||
fIgnoreCount = new BreakpointIntegerFieldEditor( CBreakpointPreferenceStore.IGNORE_COUNT, PropertyPageMessages.getString( "CBreakpointPropertyPage.17" ), parent ); //$NON-NLS-1$
|
||||
fIgnoreCount = new BreakpointIntegerFieldEditor( ICBreakpoint.IGNORE_COUNT, BreakpointsMessages.getString( "CBreakpointPropertyPage.17" ), parent ); //$NON-NLS-1$
|
||||
fIgnoreCount.setValidRange( 0, Integer.MAX_VALUE );
|
||||
fIgnoreCountTextControl = fIgnoreCount.getTextControl( parent );
|
||||
try {
|
||||
|
@ -406,9 +383,47 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
|
|||
|
||||
protected ICBreakpoint getBreakpoint() {
|
||||
IAdaptable element = getElement();
|
||||
return ( element instanceof ICBreakpoint ) ? (ICBreakpoint)element : (ICBreakpoint)element.getAdapter(ICBreakpoint.class);
|
||||
if (element instanceof ICBreakpoint) {
|
||||
return (ICBreakpoint)element;
|
||||
} else if (element instanceof CBreakpointContext) {
|
||||
return ((CBreakpointContext)element).getBreakpoint();
|
||||
} else {
|
||||
return (ICBreakpoint)element.getAdapter(ICBreakpoint.class);
|
||||
}
|
||||
}
|
||||
|
||||
public IPreferenceStore getPreferenceStore() {
|
||||
IAdaptable element = getElement();
|
||||
IPreferenceStore store = (IPreferenceStore) element.getAdapter(IPreferenceStore.class);
|
||||
if (store == null) {
|
||||
if (fCBreakpointPreferenceStore == null) {
|
||||
CBreakpointContext bpContext = element instanceof CBreakpointContext ?
|
||||
(CBreakpointContext)element : null;
|
||||
fCBreakpointPreferenceStore = new CBreakpointPreferenceStore(bpContext, null);
|
||||
}
|
||||
store = fCBreakpointPreferenceStore;
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performCancel() {
|
||||
IPreferenceStore store = getPreferenceStore();
|
||||
if (store instanceof CBreakpointPreferenceStore) {
|
||||
((CBreakpointPreferenceStore)store).setCanceled(true);
|
||||
}
|
||||
return super.performCancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performOk() {
|
||||
IPreferenceStore store = getPreferenceStore();
|
||||
if (store instanceof CBreakpointPreferenceStore) {
|
||||
((CBreakpointPreferenceStore)store).setCanceled(false);
|
||||
}
|
||||
return super.performCancel();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
|
||||
*/
|
||||
|
@ -425,84 +440,28 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
|
|||
fElement = element;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPreferenceStore getPreferenceStore() {
|
||||
return fCBreakpointPreferenceStore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performOk() {
|
||||
final List changedProperties = new ArrayList( 5 );
|
||||
getPreferenceStore().addPropertyChangeListener( new IPropertyChangeListener() {
|
||||
|
||||
/**
|
||||
* @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
|
||||
*/
|
||||
@Override
|
||||
public void propertyChange( PropertyChangeEvent event ) {
|
||||
changedProperties.add( event.getProperty() );
|
||||
}
|
||||
} );
|
||||
boolean result = super.performOk();
|
||||
setBreakpointProperties( changedProperties );
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void setBreakpointProperties( final List changedProperties ) {
|
||||
IWorkspaceRunnable wr = new IWorkspaceRunnable() {
|
||||
|
||||
@Override
|
||||
public void run( IProgressMonitor monitor ) throws CoreException {
|
||||
ICBreakpoint breakpoint = getBreakpoint();
|
||||
Iterator changed = changedProperties.iterator();
|
||||
while( changed.hasNext() ) {
|
||||
String property = (String)changed.next();
|
||||
if ( property.equals( CBreakpointPreferenceStore.ENABLED ) ) {
|
||||
breakpoint.setEnabled( getPreferenceStore().getBoolean( CBreakpointPreferenceStore.ENABLED ) );
|
||||
}
|
||||
else if ( property.equals( CBreakpointPreferenceStore.IGNORE_COUNT ) ) {
|
||||
breakpoint.setIgnoreCount( getPreferenceStore().getInt( CBreakpointPreferenceStore.IGNORE_COUNT ) );
|
||||
}
|
||||
else if ( property.equals( CBreakpointPreferenceStore.CONDITION ) ) {
|
||||
breakpoint.setCondition( getPreferenceStore().getString( CBreakpointPreferenceStore.CONDITION ) );
|
||||
}
|
||||
else if ( property.equals( CBreakpointPreferenceStore.LINE ) ) {
|
||||
// already workspace runnable, setting markers are safe
|
||||
breakpoint.getMarker().setAttribute(IMarker.LINE_NUMBER, getPreferenceStore().getInt(CBreakpointPreferenceStore.LINE));
|
||||
breakpoint.getMarker().setAttribute(ICLineBreakpoint2.REQUESTED_LINE, getPreferenceStore().getInt(CBreakpointPreferenceStore.LINE));
|
||||
} else {
|
||||
// this allow set attributes contributed by other plugins
|
||||
String value = getPropertyAsString(property);
|
||||
breakpoint.getMarker().setAttribute(property, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
try {
|
||||
ResourcesPlugin.getWorkspace().run( wr, null );
|
||||
}
|
||||
catch( CoreException ce ) {
|
||||
CDebugUIPlugin.log( ce );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates field editors contributed using breakpointUIContribution extension point
|
||||
* @param breakpoint
|
||||
*/
|
||||
private void createContributetedFieldEditors(ICBreakpoint breakpoint) {
|
||||
private void createContributedFieldEditors(ICBreakpoint breakpoint) {
|
||||
Composite parent = getFieldEditorParent();
|
||||
try {
|
||||
ICBreakpointsUIContribution cons[] = CBreakpointUIContributionFactory.getInstance()
|
||||
.getBreakpointUIContributions(breakpoint);
|
||||
ICBreakpointsUIContribution[] cons;
|
||||
CBreakpointUIContributionFactory factory = CBreakpointUIContributionFactory.getInstance();
|
||||
IPreferenceStore prefStore = getPreferenceStore();
|
||||
if (prefStore instanceof CBreakpointPreferenceStore) {
|
||||
cons = factory.getBreakpointUIContributions(
|
||||
breakpoint, ((CBreakpointPreferenceStore) prefStore).getAttributes());
|
||||
} else {
|
||||
cons = factory.getBreakpointUIContributions(breakpoint);
|
||||
}
|
||||
|
||||
for (ICBreakpointsUIContribution con : cons) {
|
||||
|
||||
FieldEditor fieldEditor = con.getFieldEditor(con.getId(), con.getLabel()+":", parent); //$NON-NLS-1$
|
||||
if (fieldEditor != null)
|
||||
if (fieldEditor != null) {
|
||||
addField(fieldEditor);
|
||||
Object o = breakpoint.getMarker().getAttribute(con.getId());
|
||||
String value = o==null?"":o.toString(); //$NON-NLS-1$
|
||||
getPreferenceStore().setValue(con.getId(), value);
|
||||
}
|
||||
}
|
||||
} catch (CoreException ce) {
|
||||
CDebugUIPlugin.log(ce);
|
||||
|
@ -510,16 +469,4 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return string value of given property or null.
|
||||
*/
|
||||
protected String getPropertyAsString(String property) {
|
||||
// currently only supports String and Integer
|
||||
IPreferenceStore store = getPreferenceStore();
|
||||
|
||||
if (store.contains(property)) {
|
||||
String value = store.getString(property);
|
||||
return value;
|
||||
} else return null;
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui;
|
||||
package org.eclipse.cdt.debug.internal.ui.breakpoints;
|
||||
|
||||
import java.util.Map;
|
||||
import org.eclipse.cdt.debug.core.ICBreakpointListener;
|
||||
|
@ -79,7 +79,7 @@ public class CBreakpointUpdater implements ICBreakpointListener {
|
|||
* org.eclipse.debug.core.model.IBreakpoint, java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public void breakpointChanged( IDebugTarget target, final IBreakpoint breakpoint, final Map attributes ) {
|
||||
public void breakpointChanged( IDebugTarget target, final IBreakpoint breakpoint, @SuppressWarnings("rawtypes") final Map attributes ) {
|
||||
asyncExec( new Runnable() {
|
||||
|
||||
@Override
|
|
@ -8,11 +8,12 @@
|
|||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui;
|
||||
package org.eclipse.cdt.debug.internal.ui.breakpoints;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||
import org.eclipse.cdt.debug.internal.ui.CDebugUIMessages;
|
||||
import org.eclipse.core.runtime.IAdapterFactory;
|
||||
import org.eclipse.ui.model.IWorkbenchAdapter;
|
||||
import org.eclipse.ui.model.WorkbenchAdapter;
|
||||
|
@ -26,7 +27,7 @@ public class CBreakpointWorkbenchAdapterFactory implements IAdapterFactory {
|
|||
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
|
||||
*/
|
||||
@Override
|
||||
public Object getAdapter( Object adaptableObject, Class adapterType ) {
|
||||
public Object getAdapter( Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType ) {
|
||||
if ( adapterType != IWorkbenchAdapter.class || !(adaptableObject instanceof ICBreakpoint) ) {
|
||||
return null;
|
||||
}
|
||||
|
@ -48,7 +49,8 @@ public class CBreakpointWorkbenchAdapterFactory implements IAdapterFactory {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Class[] getAdapterList() {
|
||||
return new Class[] { IWorkbenchAdapter.class };
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012 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:
|
||||
* Wind River Systems - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.breakpoints;
|
||||
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.core.expressions.PropertyTester;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class CreateBreakpointTester extends PropertyTester {
|
||||
|
||||
private final static String PROP_CREATE_BREAKPOINT_ADAPT = "createBreakpointAdapt"; //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
|
||||
if (PROP_CREATE_BREAKPOINT_ADAPT.equals(property) &&
|
||||
receiver instanceof CBreakpointContext &&
|
||||
expectedValue instanceof String)
|
||||
{
|
||||
try {
|
||||
Class<?> expectedClass = Class.forName((String)expectedValue);
|
||||
return expectedClass.isAssignableFrom(
|
||||
((CBreakpointContext)receiver).getBreakpoint().getClass());
|
||||
} catch (ClassNotFoundException e) {
|
||||
CDebugUIPlugin.log(new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID, "Unable to create class: " + expectedValue, e)); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.propertypages;
|
||||
package org.eclipse.cdt.debug.internal.ui.breakpoints;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -149,7 +149,7 @@ public class ThreadFilterEditor {
|
|||
}
|
||||
}
|
||||
if ( parent instanceof ILaunchManager ) {
|
||||
List children = new ArrayList();
|
||||
List<Object> children = new ArrayList<Object>();
|
||||
ILaunch[] launches = ((ILaunchManager)parent).getLaunches();
|
||||
IDebugTarget[] targets;
|
||||
ICDebugTarget target;
|
||||
|
@ -251,7 +251,7 @@ public class ThreadFilterEditor {
|
|||
|
||||
private void createThreadViewer( Composite parent ) {
|
||||
Label label = new Label( parent, SWT.NONE );
|
||||
label.setText( PropertyPageMessages.getString( "ThreadFilterEditor.0" ) ); //$NON-NLS-1$
|
||||
label.setText( BreakpointsMessages.getString( "ThreadFilterEditor.0" ) ); //$NON-NLS-1$
|
||||
label.setFont( parent.getFont() );
|
||||
label.setLayoutData( new GridData() );
|
||||
GridData data = new GridData( GridData.FILL_BOTH );
|
||||
|
@ -338,11 +338,11 @@ public class ThreadFilterEditor {
|
|||
|
||||
private ICThread[] getTargetThreadFilters( ICDebugTarget target ) {
|
||||
Object[] threads = ((ITreeContentProvider)getThreadViewer().getContentProvider()).getChildren( target );
|
||||
ArrayList list = new ArrayList( threads.length );
|
||||
ArrayList<ICThread> list = new ArrayList<ICThread>( threads.length );
|
||||
for ( int i = 0; i < threads.length; ++i ) {
|
||||
if ( getThreadViewer().getChecked( threads[i] ) )
|
||||
list.add( threads[i] );
|
||||
list.add( (ICThread)threads[i] );
|
||||
}
|
||||
return (ICThread[])list.toArray( new ICThread[list.size()] );
|
||||
return list.toArray( new ICThread[list.size()] );
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
* Patrick Chuong (Texas Instruments) -
|
||||
* Update CDT ToggleBreakpointTargetFactory enablement (340177)
|
||||
*****************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui;
|
||||
package org.eclipse.cdt.debug.internal.ui.breakpoints;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -18,8 +18,7 @@ import java.util.Map;
|
|||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
|
||||
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CEventBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.ui.propertypages.CBreakpointPreferenceStore;
|
||||
import org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointPreferenceStore;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointUIContributionFactory;
|
||||
import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointsUIContribution;
|
||||
|
@ -75,10 +74,10 @@ public class AddEventBreakpointDialog extends Dialog implements ModifyListener,
|
|||
protected void createFieldEditors() {
|
||||
Composite parent = getFieldEditorParent();
|
||||
try {
|
||||
Map map = new HashMap();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(ICEventBreakpoint.EVENT_TYPE_ID, eventType);
|
||||
ICBreakpointsUIContribution cons[] = CBreakpointUIContributionFactory.getInstance()
|
||||
.getBreakpointUIContributions(modelId, CEventBreakpoint.getMarkerType(), map);
|
||||
.getBreakpointUIContributions(modelId, ICEventBreakpoint.C_EVENT_BREAKPOINT_MARKER, map);
|
||||
for (ICBreakpointsUIContribution con : cons) {
|
||||
|
||||
if (con.getId().equals(ICEventBreakpoint.EVENT_TYPE_ID)) continue;
|
||||
|
@ -116,7 +115,7 @@ public class AddEventBreakpointDialog extends Dialog implements ModifyListener,
|
|||
|
||||
private void loadEventTypes() {
|
||||
ICBreakpointsUIContribution[] cons = factory.getBreakpointUIContributions(debugModelId,
|
||||
CEventBreakpoint.getMarkerType(), null);
|
||||
ICEventBreakpoint.C_EVENT_BREAKPOINT_MARKER, null);
|
||||
for (int i = 0; i < cons.length; i++) {
|
||||
ICBreakpointsUIContribution con = cons[i];
|
||||
if (con.getId().equals(ICEventBreakpoint.EVENT_TYPE_ID)) {
|
||||
|
|
|
@ -13,8 +13,8 @@ package org.eclipse.cdt.debug.internal.ui.disassembly.editor;
|
|||
|
||||
import org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider;
|
||||
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesRulerAction;
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.EnableDisableBreakpointRulerAction;
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CBreakpointPropertiesRulerAction;
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.breakpoints.EnableDisableBreakpointRulerAction;
|
||||
import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyDocumentProvider;
|
||||
import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyPane;
|
||||
import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DocumentContentProvider;
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2008 QNX Software 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* QNX Software Systems - Refactored to use platform implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.propertypages;
|
||||
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.preference.PreferenceStore;
|
||||
|
||||
/**
|
||||
* A preference store that presents the state of the properties of a C/C++ breakpoint.
|
||||
*/
|
||||
public class CBreakpointPreferenceStore extends PreferenceStore implements IPreferenceStore {
|
||||
|
||||
protected final static String ENABLED = "ENABLED"; //$NON-NLS-1$
|
||||
|
||||
protected final static String CONDITION = "CONDITION"; //$NON-NLS-1$
|
||||
|
||||
protected final static String IGNORE_COUNT = "IGNORE_COUNT"; //$NON-NLS-1$
|
||||
|
||||
protected final static String LINE = "LINE"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Constructor for CBreakpointPreferenceStore.
|
||||
*/
|
||||
public CBreakpointPreferenceStore() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to not save.
|
||||
* This store used for temporary breakpoint setting in dialogs
|
||||
* and does not require permanent storage.
|
||||
*/
|
||||
@Override
|
||||
public boolean needsSaving() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -11,29 +11,6 @@
|
|||
# IBM Corporation
|
||||
###############################################################################
|
||||
|
||||
CBreakpointPropertyPage.0=Ignore count must be a nonnegative integer
|
||||
CBreakpointPropertyPage.1=Not available
|
||||
CBreakpointPropertyPage.2=Function name:
|
||||
CBreakpointPropertyPage.3=C/C++ function breakpoint
|
||||
CBreakpointPropertyPage.4=Not available
|
||||
CBreakpointPropertyPage.5=Address:
|
||||
CBreakpointPropertyPage.6=C/C++ address breakpoint
|
||||
CBreakpointPropertyPage.7=File:
|
||||
CBreakpointPropertyPage.8=C/C++ line breakpoint
|
||||
CBreakpointPropertyPage.9=Line number:
|
||||
CBreakpointPropertyPage.10=Project:
|
||||
CBreakpointPropertyPage.11=C/C++ read watchpoint
|
||||
CBreakpointPropertyPage.12=C/C++ watchpoint
|
||||
CBreakpointPropertyPage.13=C/C++ access watchpoint
|
||||
CBreakpointPropertyPage.14=Expression to watch:
|
||||
CBreakpointPropertyPage.15=&Condition:
|
||||
CBreakpointPropertyPage.16=Invalid condition.
|
||||
CBreakpointPropertyPage.17=&Ignore count:
|
||||
CBreakpointPropertyPage.18=Class:
|
||||
CBreakpointPropertyPage.19=Enabled
|
||||
CBreakpointPropertyPage.20=File:
|
||||
CBreakpointPropertyPage.21=C/C++ Event Breakpoint
|
||||
ThreadFilterEditor.0=&Restrict to Selected Targets and Threads:
|
||||
SignalPropertyPage.0=Description: {0}.
|
||||
SignalPropertyPage.1=Pass this signal to the program.
|
||||
SignalPropertyPage.2=Suspend the program when this signal happens.
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.Map;
|
|||
|
||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||
import org.eclipse.cdt.debug.core.model.ICDebugElement;
|
||||
import org.eclipse.cdt.debug.internal.ui.CBreakpointUpdater;
|
||||
import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry;
|
||||
import org.eclipse.cdt.debug.internal.ui.CDebugModelPresentation;
|
||||
import org.eclipse.cdt.debug.internal.ui.CDebuggerPageAdapter;
|
||||
|
@ -25,6 +24,7 @@ import org.eclipse.cdt.debug.internal.ui.CRegisterManagerProxies;
|
|||
import org.eclipse.cdt.debug.internal.ui.ColorManager;
|
||||
import org.eclipse.cdt.debug.internal.ui.EvaluationContextManager;
|
||||
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
||||
import org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointUpdater;
|
||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyBackendCdiFactory;
|
||||
import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditorManager;
|
||||
import org.eclipse.cdt.debug.internal.ui.pinclone.ViewIDCounterManager;
|
||||
|
|
|
@ -0,0 +1,713 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011 Mentor Graphics 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:
|
||||
* Mentor Graphics - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.debug.ui.breakpoints;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IDeclaration;
|
||||
import org.eclipse.cdt.core.model.IFunction;
|
||||
import org.eclipse.cdt.core.model.IFunctionDeclaration;
|
||||
import org.eclipse.cdt.core.model.IMethod;
|
||||
import org.eclipse.cdt.core.model.ISourceRange;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.model.IVariable;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
|
||||
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.breakpoints.EnableDisableBreakpointRulerAction;
|
||||
import org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointContext;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.cdt.internal.ui.util.ExternalEditorInput;
|
||||
import org.eclipse.cdt.ui.CDTUITools;
|
||||
import org.eclipse.core.filesystem.URIUtil;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.model.IBreakpoint;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension2;
|
||||
import org.eclipse.jface.preference.PreferenceDialog;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.text.Position;
|
||||
import org.eclipse.jface.text.source.Annotation;
|
||||
import org.eclipse.jface.text.source.IAnnotationModel;
|
||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IFileEditorInput;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.dialogs.PreferencesUtil;
|
||||
import org.eclipse.ui.editors.text.ILocationProvider;
|
||||
import org.eclipse.ui.texteditor.IEditorStatusLine;
|
||||
import org.eclipse.ui.texteditor.ITextEditor;
|
||||
import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
|
||||
|
||||
/**
|
||||
* Base class for toggle adapter to create/remove CDT breakpoints. Clients may
|
||||
* extend this class to gather additional data prior to creating the breakpoints.
|
||||
*
|
||||
* @since 7.2
|
||||
*/
|
||||
abstract public class AbstractToggleBreakpointAdapter
|
||||
implements IToggleBreakpointsTargetExtension2, IToggleBreakpointsTargetCExtension
|
||||
{
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canToggleBreakpointsWithEvent(IWorkbenchPart part, ISelection selection, Event event) {
|
||||
return canToggleBreakpoints(part, selection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggleBreakpointsWithEvent(IWorkbenchPart part, ISelection selection, Event event) throws CoreException {
|
||||
if((event.stateMask & SWT.MOD2) > 0) {
|
||||
if (toggleBreakpointEnable(part)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
boolean interactive = (event.stateMask & SWT.MOD1) > 0;
|
||||
updateBreakpoints(true, interactive, part, selection);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
|
||||
updateLineBreakpoints(true, false, part, selection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canToggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) {
|
||||
return (selection instanceof ITextSelection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
|
||||
ICElement element = getCElementFromSelection( part, selection );
|
||||
if ( element instanceof IFunction || element instanceof IMethod) {
|
||||
updateMethodBreakpoints(true, false, part, (IDeclaration)element);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canToggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) {
|
||||
ICElement element = getCElementFromSelection( part, selection );
|
||||
return (element instanceof IFunction || element instanceof IMethod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggleWatchpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
|
||||
IVariable variable = getVariableFromSelection( part, selection );
|
||||
if ( variable != null ) {
|
||||
updateVariableWatchpoint(true, false, part, variable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canToggleWatchpoints( IWorkbenchPart part, ISelection selection ) {
|
||||
return getVariableFromSelection( part, selection ) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canToggleBreakpoints( IWorkbenchPart part, ISelection selection ) {
|
||||
return ( canToggleLineBreakpoints( part, selection )
|
||||
|| canToggleWatchpoints( part, selection )
|
||||
|| canToggleMethodBreakpoints( part, selection ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggleBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
|
||||
updateBreakpoints(true, false, part, selection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCreateBreakpointsInteractive(IWorkbenchPart part, ISelection selection) {
|
||||
return canToggleBreakpoints( part, selection );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createBreakpointsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException {
|
||||
updateBreakpoints(false, true, part, selection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the breakpoint for given part and selection.
|
||||
* Depending on the flags and on whether a breakpoint exists, this method
|
||||
* executes the toggle action.
|
||||
*
|
||||
* @param toggle Whether the toggle action is requested. If
|
||||
* true and the breakpoint currently exists, it will cause the
|
||||
* toggle action to either remove breakpoint or edit its properties.
|
||||
* Otherwise a new breakpoint will be created.
|
||||
* @param interactive If true the toggle adapter should open a dialog before
|
||||
* creating a breakpoint, or open a properties dialog on an existing
|
||||
* breakpoint.
|
||||
* @param part Workbench part where the toggle action is to be executed.
|
||||
* @param selection Current selection on which the toggle action is to be
|
||||
* executed.
|
||||
* @throws CoreException Any error in creating or editing the breakpoint.
|
||||
*/
|
||||
private void updateBreakpoints(boolean toggle, boolean interactive, IWorkbenchPart part, ISelection selection ) throws CoreException {
|
||||
if ( canToggleLineBreakpoints( part, selection ) ) {
|
||||
updateLineBreakpoints(toggle, interactive, part, selection);
|
||||
}
|
||||
else {
|
||||
ICElement element = getCElementFromSelection( part, selection );
|
||||
if ( element instanceof IFunction || element instanceof IMethod ) {
|
||||
updateMethodBreakpoints(toggle, interactive, part, (IDeclaration)element);
|
||||
}
|
||||
else if ( element instanceof IVariable ) {
|
||||
updateVariableWatchpoint(toggle, interactive, part, (IVariable)element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLineBreakpoints(boolean toggle, boolean interactive, IWorkbenchPart part, ISelection selection)
|
||||
throws CoreException {
|
||||
String errorMessage = null;
|
||||
if (part instanceof ITextEditor) {
|
||||
ITextEditor textEditor = (ITextEditor) part;
|
||||
IEditorInput input = textEditor.getEditorInput();
|
||||
if (input == null) {
|
||||
errorMessage = ActionMessages.getString("ToggleBreakpointAdapter.Empty_editor_1"); //$NON-NLS-1$
|
||||
} else {
|
||||
IDocument document = textEditor.getDocumentProvider().getDocument(input);
|
||||
if (document == null) {
|
||||
errorMessage = ActionMessages.getString("ToggleBreakpointAdapter.Missing_document_1"); //$NON-NLS-1$
|
||||
} else {
|
||||
IResource resource = getResource(textEditor);
|
||||
if (resource == null) {
|
||||
errorMessage = ActionMessages.getString("ToggleBreakpointAdapter.Missing_resource_1"); //$NON-NLS-1$
|
||||
} else {
|
||||
int lineNumber = ((ITextSelection) selection).getStartLine() + 1;
|
||||
if (lineNumber == -1) {
|
||||
errorMessage = ActionMessages.getString("ToggleBreakpointAdapter.Invalid_line_1"); //$NON-NLS-1$
|
||||
} else {
|
||||
String sourceHandle = getSourceHandle(input);
|
||||
if (interactive && !toggle) {
|
||||
createLineBreakpoint(true, part, sourceHandle, resource, lineNumber);
|
||||
} else {
|
||||
ICLineBreakpoint breakpoint = findLineBreakpoint(sourceHandle, resource, lineNumber);
|
||||
if (breakpoint != null) {
|
||||
if (interactive) {
|
||||
CDebugUIUtils.editBreakpointProperties(part, breakpoint);
|
||||
} else {
|
||||
DebugPlugin.getDefault().getBreakpointManager()
|
||||
.removeBreakpoint(breakpoint, true);
|
||||
}
|
||||
} else {
|
||||
createLineBreakpoint(interactive, part, sourceHandle, resource, lineNumber);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
errorMessage = ActionMessages.getString("RunToLineAdapter.Operation_is_not_supported_1"); //$NON-NLS-1$
|
||||
}
|
||||
throw new CoreException(new Status(IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(),
|
||||
IInternalCDebugUIConstants.INTERNAL_ERROR, errorMessage, null));
|
||||
}
|
||||
|
||||
private void updateMethodBreakpoints(boolean toggle, boolean interactive, IWorkbenchPart part,
|
||||
IDeclaration declaration) throws CoreException {
|
||||
String sourceHandle = getSourceHandle(declaration);
|
||||
IResource resource = getElementResource(declaration);
|
||||
String functionName = (declaration instanceof IFunction) ? getFunctionName((IFunction) declaration)
|
||||
: getMethodName((IMethod) declaration);
|
||||
ICFunctionBreakpoint breakpoint = findFunctionBreakpoint(sourceHandle, resource, functionName);
|
||||
if (toggle && breakpoint != null) {
|
||||
if (interactive) {
|
||||
CDebugUIUtils.editBreakpointProperties(part, breakpoint);
|
||||
} else {
|
||||
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(breakpoint, true);
|
||||
}
|
||||
} else {
|
||||
int lineNumber = -1;
|
||||
int charStart = -1;
|
||||
int charEnd = -1;
|
||||
try {
|
||||
ISourceRange sourceRange = declaration.getSourceRange();
|
||||
if (sourceRange != null) {
|
||||
charStart = sourceRange.getStartPos();
|
||||
charEnd = charStart + sourceRange.getLength();
|
||||
if (charEnd <= 0) {
|
||||
charStart = -1;
|
||||
charEnd = -1;
|
||||
}
|
||||
lineNumber = sourceRange.getStartLine();
|
||||
}
|
||||
} catch (CModelException e) {
|
||||
DebugPlugin.log(e);
|
||||
}
|
||||
createFunctionBreakpoint(interactive, part, sourceHandle, resource, functionName, charStart, charEnd,
|
||||
lineNumber);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a watchpoint. Depending on the flags and on whether a breakpoint
|
||||
* exists, this method executes the toggle action.
|
||||
*
|
||||
* @param toggle
|
||||
* Whether the toggle action is requested. If true and the
|
||||
* breakpoint currently exists, it will cause the toggle action
|
||||
* to either remove breakpoint or edit its properties. Otherwise
|
||||
* a new breakpoint will be created.
|
||||
* @param interactive
|
||||
* If true the toggle adapter should open a dialog before
|
||||
* creating a breakpoint, or open a properties dialog on an
|
||||
* existing breakpoint.
|
||||
* @param part
|
||||
* Workbench part where the toggle action is to be executed.
|
||||
* @param selection
|
||||
* Variable on which to execute the toggle action.
|
||||
* @throws CoreException
|
||||
* Any error in creating or editing the breakpoint.
|
||||
*/
|
||||
private void updateVariableWatchpoint(boolean toggle, boolean interactive, IWorkbenchPart part, IVariable variable)
|
||||
throws CoreException {
|
||||
String sourceHandle = getSourceHandle(variable);
|
||||
IResource resource = getElementResource(variable);
|
||||
String expression = getVariableName(variable);
|
||||
ICWatchpoint watchpoint = findWatchpoint(sourceHandle, resource, expression);
|
||||
if (toggle && watchpoint != null) {
|
||||
if (interactive) {
|
||||
CDebugUIUtils.editBreakpointProperties(part, watchpoint);
|
||||
} else {
|
||||
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(watchpoint, true);
|
||||
}
|
||||
} else {
|
||||
int lineNumber = -1;
|
||||
int charStart = -1;
|
||||
int charEnd = -1;
|
||||
try {
|
||||
ISourceRange sourceRange = variable.getSourceRange();
|
||||
if (sourceRange != null) {
|
||||
charStart = sourceRange.getStartPos();
|
||||
charEnd = charStart + sourceRange.getLength();
|
||||
if (charEnd <= 0) {
|
||||
charStart = -1;
|
||||
charEnd = -1;
|
||||
}
|
||||
lineNumber = sourceRange.getStartLine();
|
||||
}
|
||||
} catch (CModelException e) {
|
||||
CDebugUIPlugin.log(e);
|
||||
}
|
||||
createWatchpoint(interactive, part, sourceHandle, resource, charStart, charEnd, lineNumber, expression);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the C model element at the given selection.
|
||||
* @param part Workbench part where the selection is.
|
||||
* @param selection Selection in part.
|
||||
* @return C model element if found.
|
||||
*/
|
||||
protected ICElement getCElementFromSelection( IWorkbenchPart part, ISelection selection ) {
|
||||
if ( selection instanceof ITextSelection ) {
|
||||
ITextSelection textSelection = (ITextSelection)selection;
|
||||
String text = textSelection.getText();
|
||||
if ( text != null ) {
|
||||
if ( part instanceof ITextEditor ) {
|
||||
ICElement editorElement = CDTUITools.getEditorInputCElement( ((ITextEditor)part).getEditorInput() );
|
||||
if ( editorElement instanceof ITranslationUnit ) {
|
||||
ITranslationUnit tu = (ITranslationUnit)editorElement;
|
||||
try {
|
||||
if ( tu.isStructureKnown() && tu.isConsistent() ) {
|
||||
return tu.getElementAtOffset( textSelection.getOffset() );
|
||||
}
|
||||
}
|
||||
catch( CModelException exc ) {
|
||||
// ignored on purpose
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
IResource resource = getResource( part );
|
||||
if ( resource instanceof IFile ) {
|
||||
ITranslationUnit tu = getTranslationUnit( (IFile)resource );
|
||||
if ( tu != null ) {
|
||||
try {
|
||||
ICElement element = tu.getElement( text.trim() );
|
||||
if ( element == null ) {
|
||||
element = tu.getElementAtLine( textSelection.getStartLine() );
|
||||
}
|
||||
return element;
|
||||
}
|
||||
catch( CModelException e ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( selection instanceof IStructuredSelection ) {
|
||||
IStructuredSelection ss = (IStructuredSelection)selection;
|
||||
if ( ss.size() == 1 ) {
|
||||
Object object = ss.getFirstElement();
|
||||
if ( object instanceof ICElement ) {
|
||||
return (ICElement)object;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the variable object at the given selection.
|
||||
* Returns the C model element at the given selection.
|
||||
* @param part Workbench part where the selection is.
|
||||
* @param selection Selection in part.
|
||||
* @return C model variable, if found.
|
||||
*/
|
||||
protected IVariable getVariableFromSelection( IWorkbenchPart part, ISelection selection ) {
|
||||
ICElement element = getCElementFromSelection( part, selection );
|
||||
if ( element instanceof IVariable ) {
|
||||
return (IVariable)element;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports the given error message to the user.
|
||||
* @param message Message to report.
|
||||
* @param part Workbench part where action was invoked.
|
||||
*/
|
||||
protected void report( String message, IWorkbenchPart part ) {
|
||||
IEditorStatusLine statusLine = (IEditorStatusLine)part.getAdapter( IEditorStatusLine.class );
|
||||
if ( statusLine != null ) {
|
||||
if ( message != null ) {
|
||||
statusLine.setMessage( true, message, null );
|
||||
}
|
||||
else {
|
||||
statusLine.setMessage( true, null, null );
|
||||
}
|
||||
}
|
||||
if ( message != null && CDebugUIPlugin.getActiveWorkbenchShell() != null ) {
|
||||
CDebugUIPlugin.getActiveWorkbenchShell().getDisplay().beep();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the resource being edited in the given workbench part.
|
||||
* @param part Workbench part to checm.
|
||||
* @return Resource being edited.
|
||||
*/
|
||||
protected static IResource getResource( IWorkbenchPart part ) {
|
||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||
if ( part instanceof IEditorPart ) {
|
||||
IEditorInput editorInput = ((IEditorPart)part).getEditorInput();
|
||||
IResource resource = null;
|
||||
if ( editorInput instanceof IFileEditorInput ) {
|
||||
resource = ((IFileEditorInput)editorInput).getFile();
|
||||
}
|
||||
else if ( editorInput instanceof ExternalEditorInput ) {
|
||||
resource = ((ExternalEditorInput)editorInput).getMarkerResource();
|
||||
}
|
||||
if ( resource != null )
|
||||
return resource;
|
||||
/* This file is not in a project, let default case handle it */
|
||||
ILocationProvider provider = (ILocationProvider)editorInput.getAdapter( ILocationProvider.class );
|
||||
if ( provider != null ) {
|
||||
IPath location = provider.getPath( editorInput );
|
||||
if ( location != null ) {
|
||||
IFile[] files = root.findFilesForLocationURI( URIUtil.toURI( location ) );
|
||||
if ( files.length > 0 && files[0].isAccessible())
|
||||
return files[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
private String getSourceHandle( IEditorInput input ) throws CoreException {
|
||||
return CDebugUIUtils.getEditorFilePath( input );
|
||||
}
|
||||
|
||||
protected String getSourceHandle( IDeclaration declaration ) {
|
||||
ITranslationUnit tu = declaration.getTranslationUnit();
|
||||
if ( tu != null ) {
|
||||
IPath location = tu.getLocation();
|
||||
if ( location != null ) {
|
||||
return location.toOSString();
|
||||
}
|
||||
}
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
protected IResource getElementResource( IDeclaration declaration ) {
|
||||
return declaration.getUnderlyingResource();
|
||||
}
|
||||
|
||||
private String getFunctionName( IFunction function ) {
|
||||
String functionName = function.getElementName();
|
||||
StringBuffer name = new StringBuffer( functionName );
|
||||
ITranslationUnit tu = function.getTranslationUnit();
|
||||
if ( tu != null && tu.isCXXLanguage() ) {
|
||||
appendParameters( name, function );
|
||||
}
|
||||
return name.toString();
|
||||
}
|
||||
|
||||
private String getMethodName( IMethod method ) {
|
||||
StringBuffer name = new StringBuffer();
|
||||
String methodName = method.getElementName();
|
||||
ICElement parent = method.getParent();
|
||||
while( parent != null
|
||||
&& (parent.getElementType() == ICElement.C_NAMESPACE || parent.getElementType() == ICElement.C_CLASS
|
||||
|| parent.getElementType() == ICElement.C_STRUCT || parent.getElementType() == ICElement.C_UNION) ) {
|
||||
name.append( parent.getElementName() ).append( "::" ); //$NON-NLS-1$
|
||||
parent = parent.getParent();
|
||||
}
|
||||
name.append( methodName );
|
||||
appendParameters( name, method );
|
||||
return name.toString();
|
||||
}
|
||||
|
||||
private void appendParameters( StringBuffer sb, IFunctionDeclaration fd ) {
|
||||
String[] params = fd.getParameterTypes();
|
||||
sb.append( '(' );
|
||||
for( int i = 0; i < params.length; ++i ) {
|
||||
sb.append( params[i] );
|
||||
if ( i != params.length - 1 )
|
||||
sb.append( ',' );
|
||||
}
|
||||
sb.append( ')' );
|
||||
}
|
||||
|
||||
private String getVariableName( IVariable variable ) {
|
||||
return variable.getElementName();
|
||||
}
|
||||
|
||||
private ITranslationUnit getTranslationUnit( IFile file ) {
|
||||
Object element = CoreModel.getDefault().create( file );
|
||||
if ( element instanceof ITranslationUnit ) {
|
||||
return (ITranslationUnit)element;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean toggleBreakpointEnable(IWorkbenchPart part) {
|
||||
ITextEditor textEditor = getTextEditor(part);
|
||||
if(textEditor != null) {
|
||||
IVerticalRulerInfo info = (IVerticalRulerInfo) textEditor.getAdapter(IVerticalRulerInfo.class);
|
||||
if(info != null) {
|
||||
EnableDisableBreakpointRulerAction enableAction = new EnableDisableBreakpointRulerAction(part, info);
|
||||
enableAction.update();
|
||||
enableAction.run();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text editor associated with the given part or <code>null</code>
|
||||
* if none. In case of a multi-page editor, this method should be used to retrieve
|
||||
* the correct editor to perform the breakpoint operation on.
|
||||
*
|
||||
* @param part workbench part
|
||||
* @return text editor part or <code>null</code>
|
||||
*/
|
||||
protected ITextEditor getTextEditor(IWorkbenchPart part) {
|
||||
if (part instanceof ITextEditor) {
|
||||
return (ITextEditor) part;
|
||||
}
|
||||
return (ITextEditor) part.getAdapter(ITextEditor.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the {@link IBreakpoint} from the given editor and ruler information. Returns <code>null</code>
|
||||
* if no breakpoint exists or the operation fails.
|
||||
*
|
||||
* @param editor the editor
|
||||
* @param info the current ruler information
|
||||
* @return the {@link IBreakpoint} from the current editor position or <code>null</code>
|
||||
*/
|
||||
protected IBreakpoint getBreakpointFromEditor(ITextEditor editor, IVerticalRulerInfo info) {
|
||||
IAnnotationModel annotationModel = editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
|
||||
IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
|
||||
if (annotationModel != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Iterator<Annotation> iterator = annotationModel.getAnnotationIterator();
|
||||
while (iterator.hasNext()) {
|
||||
Object object = iterator.next();
|
||||
if (object instanceof SimpleMarkerAnnotation) {
|
||||
SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) object;
|
||||
IMarker marker = markerAnnotation.getMarker();
|
||||
try {
|
||||
if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
|
||||
Position position = annotationModel.getPosition(markerAnnotation);
|
||||
int line = document.getLineOfOffset(position.getOffset());
|
||||
if (line == info.getLineOfLastMouseButtonActivity()) {
|
||||
IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
|
||||
if (breakpoint != null) {
|
||||
return breakpoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
} catch (BadLocationException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the properties dialog for the given breakpoint. This method can be
|
||||
* used on an existing breakpoint or on a blank breakpoint which doesn't
|
||||
* have an associated marker yet.
|
||||
*
|
||||
* @param bp
|
||||
* The breakpoint to edit. This breakpoint may not have an
|
||||
* associated marker yet.
|
||||
* @param part
|
||||
* Workbench part where the action was invoked.
|
||||
* @param resource
|
||||
* Workbench resource to create the breakpoint on.
|
||||
* @param attributes
|
||||
* Breakpoint attributes to show in properties dialog. If the
|
||||
* breakpoint already exists, this attribute map can be used to
|
||||
* override the attributes currently in the breakpoint. Can be
|
||||
* <code>null</code>.
|
||||
*/
|
||||
protected void openBreakpointPropertiesDialog(ICBreakpoint bp, IWorkbenchPart part, IResource resource,
|
||||
Map<String, Object> attributes) {
|
||||
ISelection debugContext = DebugUITools.getDebugContextManager()
|
||||
.getContextService(part.getSite().getWorkbenchWindow()).getActiveContext(part.getSite().getId());
|
||||
CBreakpointContext bpContext = new CBreakpointContext(bp, debugContext, resource, attributes);
|
||||
|
||||
PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(part.getSite().getShell(), bpContext, null,
|
||||
null, null);
|
||||
if (dialog != null) {
|
||||
dialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the line breakpoint at the given location.
|
||||
*
|
||||
* @param sourceHandle
|
||||
* Source handle for the line breakpoint.
|
||||
* @param resource
|
||||
* Resource of the line breakpoint.
|
||||
* @param lineNumber
|
||||
* Line number.
|
||||
* @return Line breakpoint with given parameters, if found.
|
||||
* @throws CoreException
|
||||
* Exception thrown while reading breakpoints' properties.
|
||||
*/
|
||||
protected abstract ICLineBreakpoint findLineBreakpoint(String sourceHandle, IResource resource, int lineNumber)
|
||||
throws CoreException;
|
||||
|
||||
/**
|
||||
* Creates a line breakpoint at the given location.
|
||||
* @param interactive true if action should open a dialog to let user edit
|
||||
* breakpoint properties prior to creation.
|
||||
* @param part Workbench part where action was invoked.
|
||||
* @param source Handle Source handle for the new breakpoint.
|
||||
* @param resource Resource to create breakpoint on.
|
||||
* @param lineNumber Line number for new breakpoint.
|
||||
* @throws CoreException Exception while creating breakpoint.
|
||||
*/
|
||||
protected abstract void createLineBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
|
||||
IResource resource, int lineNumber) throws CoreException;
|
||||
|
||||
/**
|
||||
* Finds the function breakpoint at the given location.
|
||||
*
|
||||
* @param sourceHandle
|
||||
* Source handle for the line breakpoint.
|
||||
* @param resource
|
||||
* Resource of the line breakpoint.
|
||||
* @param functionName
|
||||
* Function for the breakpoint.
|
||||
* @return Function breakpoint with given parameters, if found.
|
||||
* @throws CoreException
|
||||
* Exception thrown while reading breakpoints' properties.
|
||||
*/
|
||||
protected abstract ICFunctionBreakpoint findFunctionBreakpoint(String sourceHandle, IResource resource,
|
||||
String functionName) throws CoreException;
|
||||
|
||||
/**
|
||||
* Creates a function breakpoint at the given location.
|
||||
* @param interactive true if action should open a dialog to let user edit
|
||||
* breakpoint properties prior to creation.
|
||||
* @param part Workbench part where action was invoked.
|
||||
* @param source Handle Source handle for the new breakpoint.
|
||||
* @param resource Resource to create breakpoint on.
|
||||
* @param charStart Beginning of range where function is located. Can be
|
||||
* -1 if not known.
|
||||
* @param charStart End of range where function is located. Can be
|
||||
* -1 if not known.
|
||||
* @param lineNumber Line number where the function is located.
|
||||
* @throws CoreException Exception while creating breakpoint.
|
||||
*/
|
||||
protected abstract void createFunctionBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
|
||||
IResource resource, String functionName, int charStart, int charEnd, int lineNumber) throws CoreException;
|
||||
|
||||
/**
|
||||
* Finds the watchpoint with given expression.
|
||||
*
|
||||
* @param sourceHandle Source handle for the line breakpoint.
|
||||
* @param resource Resource of the line breakpoint.
|
||||
* @param expression Expression of the breakpoint.
|
||||
* @return Watchpoing with given parameters, if found.
|
||||
* @throws CoreException Exception thrown while reading breakpoints'
|
||||
*/
|
||||
protected abstract ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression )
|
||||
throws CoreException;
|
||||
|
||||
/**
|
||||
* Creates a watchpoint at the given location.
|
||||
* @param interactive true if action should open a dialog to let user edit
|
||||
* breakpoint properties prior to creation.
|
||||
* @param part Workbench part where action was invoked.
|
||||
* @param source Handle Source handle for the new breakpoint.
|
||||
* @param resource Resource to create breakpoint on.
|
||||
* @param charStart Beginning of range where variable is located. Can be
|
||||
* -1 if not known.
|
||||
* @param charStart End of range where variable is located. Can be
|
||||
* -1 if not known.
|
||||
* @param lineNumber Line number where the variable is located.
|
||||
* @throws CoreException Exception while creating breakpoint.
|
||||
*/
|
||||
protected abstract void createWatchpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
|
||||
IResource resource, int charStart, int charEnd, int lineNumber, String expression) throws CoreException;
|
||||
|
||||
}
|
|
@ -0,0 +1,182 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012 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:
|
||||
* Wind River Systems - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.ui.breakpoints;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointContext;
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.debug.ui.contexts.IDebugContextProvider;
|
||||
import org.eclipse.jface.preference.PreferenceDialog;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.window.IShellProvider;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.actions.SelectionProviderAction;
|
||||
import org.eclipse.ui.dialogs.PreferencesUtil;
|
||||
import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
|
||||
import org.eclipse.ui.internal.WorkbenchMessages;
|
||||
|
||||
/**
|
||||
* Action for opening a Property Pages Dialog on the C breakpoint object
|
||||
* in the currently selected element.
|
||||
* <p>
|
||||
* Generally speaking, this action is useful in pop-up menus because it allows
|
||||
* the user to browse and change properties of selected elements. When
|
||||
* performed, the action will bring up a Property Pages Dialog containing
|
||||
* property pages registered with the workbench for elements of the selected
|
||||
* type.
|
||||
* </p>
|
||||
* <p>
|
||||
* Although the action is capable of calculating if there are any applicable
|
||||
* pages for the current selection, this calculation is costly because it
|
||||
* require searching the workbench registry. Where performance is critical, the
|
||||
* action can simply be added to the pop-up menu. In the event of no applicable
|
||||
* pages, the action will just open an appropriate message dialog.
|
||||
* </p>
|
||||
* @noextend This class is not intended to be subclassed by clients.
|
||||
* @since 7.2
|
||||
*/
|
||||
public class CBreakpointPropertyDialogAction extends SelectionProviderAction {
|
||||
|
||||
/**
|
||||
* Provides the shell in which to open the property dialog.
|
||||
*/
|
||||
private IShellProvider fShellProvider;
|
||||
|
||||
private IDebugContextProvider fDebugContextProvider;
|
||||
|
||||
/**
|
||||
* The id of the page to open up on.
|
||||
*/
|
||||
private String fInitialPageId = "org.eclipse.cdt.debug.ui.propertypages.breakpoint.common"; //$NON-NLS-1$
|
||||
|
||||
public CBreakpointPropertyDialogAction(IShellProvider shell, ISelectionProvider selectionProvider, IDebugContextProvider debugContextProvider) {
|
||||
super(selectionProvider, WorkbenchMessages.PropertyDialog_text);
|
||||
Assert.isNotNull(shell);
|
||||
fDebugContextProvider = debugContextProvider;
|
||||
fShellProvider = shell;
|
||||
setToolTipText(WorkbenchMessages.PropertyDialog_toolTip);
|
||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
|
||||
IWorkbenchHelpContextIds.PROPERTY_DIALOG_ACTION);
|
||||
}
|
||||
|
||||
protected ISelection getDebugContext() {
|
||||
return fDebugContextProvider.getActiveContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this action is actually applicable to the current
|
||||
* selection. If this action is disabled, it will return <code>false</code>
|
||||
* without further calculation. If it is enabled, it will check with the
|
||||
* workbench's property page manager to see if there are any property pages
|
||||
* registered for the selected element's type.
|
||||
* <p>
|
||||
* This method is generally too expensive to use when updating the enabled
|
||||
* state of the action on each selection change.
|
||||
* </p>
|
||||
*
|
||||
* @return <code>true</code> if the selection is not empty and there are
|
||||
* property pages for the selected element, and <code>false</code>
|
||||
* otherwise
|
||||
*/
|
||||
public boolean isCBreakpointSelection() {
|
||||
if (!isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
return isApplicableForSelection(getStructuredSelection(), getDebugContext());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this action is applicable to the current selection. This
|
||||
* checks that the selection is not empty, and checks with the workbench's
|
||||
* property page manager to see if there are any property pages registered
|
||||
* for the selected element's type.
|
||||
* <p>
|
||||
* This method is generally too expensive to use when updating the enabled
|
||||
* state of the action on each selection change.
|
||||
* </p>
|
||||
*
|
||||
* @param selection
|
||||
* The selection to test
|
||||
* @return <code>true</code> if the selection is of not empty and there are
|
||||
* property pages for the selected element, and <code>false</code>
|
||||
* otherwise
|
||||
*/
|
||||
public boolean isApplicableForSelection(IStructuredSelection selection, ISelection debugContext) {
|
||||
return isCBreakpointSelection(selection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the given selection contains only elements of type ICBreakpoint
|
||||
* @param selection
|
||||
* @return
|
||||
*/
|
||||
private boolean isCBreakpointSelection(IStructuredSelection selection) {
|
||||
if (selection.isEmpty()) return false;
|
||||
|
||||
for (Iterator<?> itr = selection.iterator(); itr.hasNext();) {
|
||||
if ( !(itr.next() instanceof ICBreakpoint) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.action.IAction#run()
|
||||
*/
|
||||
public void run() {
|
||||
CBreakpointContext bpContext = getCBreakpointContext();
|
||||
if (bpContext != null) {
|
||||
PreferenceDialog dialog = createDialog(bpContext);
|
||||
|
||||
if (dialog != null) {
|
||||
dialog.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private CBreakpointContext getCBreakpointContext() {
|
||||
IStructuredSelection ss = getStructuredSelection();
|
||||
if (ss.size() >= 1 && ss.getFirstElement() instanceof ICBreakpoint) {
|
||||
return new CBreakpointContext((ICBreakpoint)ss.getFirstElement(), fDebugContextProvider.getActiveContext());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the dialog for the receiver. If no pages are found, an informative
|
||||
* message dialog is presented instead.
|
||||
*
|
||||
* @return PreferenceDialog or <code>null</code> if no applicable pages
|
||||
* are found.
|
||||
*/
|
||||
protected PreferenceDialog createDialog(CBreakpointContext bpContext) {
|
||||
IStructuredSelection ss = getStructuredSelection();
|
||||
if (ss.isEmpty())
|
||||
return null;
|
||||
|
||||
return PreferencesUtil.createPropertyDialogOn(fShellProvider.getShell(), bpContext, fInitialPageId, null, null);
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.actions.SelectionProviderAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection)
|
||||
*/
|
||||
public void selectionChanged(IStructuredSelection selection) {
|
||||
setEnabled(!selection.isEmpty());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 QNX Software Systems and others.
|
||||
* Copyright (c) 2008, 2012 QNX Software 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
|
||||
|
@ -13,8 +13,10 @@
|
|||
package org.eclipse.cdt.debug.ui.breakpoints;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.core.internal.resources.Workspace;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
|
@ -40,23 +42,60 @@ public class CBreakpointUIContributionFactory {
|
|||
}
|
||||
|
||||
/**
|
||||
* Calculates the breakpoint contributions for the given breakpoint.
|
||||
*
|
||||
* @param breakpoint
|
||||
* @param breakpoint Breakpoint to find UI contributions for.
|
||||
* @return non-null array of ICBreakpointsUIContribution
|
||||
* @throws CoreException
|
||||
* @throws CoreException if cannot get marker attributes from berakpoint
|
||||
* @throws CoreException if cannot get marker attributes from bearkpoint
|
||||
*/
|
||||
|
||||
public ICBreakpointsUIContribution[] getBreakpointUIContributions(IBreakpoint breakpoint) throws CoreException {
|
||||
String debugModelId = breakpoint.getModelIdentifier();
|
||||
IMarker bmarker = breakpoint.getMarker();
|
||||
Map attributes = bmarker.getAttributes();
|
||||
String markerType = bmarker.getType();
|
||||
Map<String, Object> attributes = Collections.emptyMap();
|
||||
String markerType = CDIDebugModel.calculateMarkerType(breakpoint);
|
||||
if (bmarker != null) {
|
||||
Map<String, Object> _attributes = bmarker.getAttributes();
|
||||
attributes = _attributes;
|
||||
markerType = bmarker.getType();
|
||||
}
|
||||
return getBreakpointUIContributions(debugModelId, markerType, attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the breakpoint contributions for the given breakpoint.
|
||||
*
|
||||
* @param breakpoint Breakpoint to find UI contributions for.
|
||||
* @param attributes Attributes of the breakpoint
|
||||
* @return non-null array of ICBreakpointsUIContribution
|
||||
* @throws CoreException if cannot get marker attributes from bearkpoint
|
||||
* @since 7.2
|
||||
*/
|
||||
public ICBreakpointsUIContribution[] getBreakpointUIContributions(IBreakpoint breakpoint,
|
||||
Map<String, Object> attributes)
|
||||
throws CoreException
|
||||
{
|
||||
String debugModelId = breakpoint.getModelIdentifier();
|
||||
IMarker bmarker = breakpoint.getMarker();
|
||||
String markerType = CDIDebugModel.calculateMarkerType(breakpoint);
|
||||
if (bmarker != null) {
|
||||
markerType = bmarker.getType();
|
||||
}
|
||||
return getBreakpointUIContributions(debugModelId, markerType, attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the breakpoint UI contributions for the given breakpoint.
|
||||
*
|
||||
* @param breakpoint Breakpoint to find UI contributions for.
|
||||
* @param markerType Marker type of the breakpoint.
|
||||
* @param attributes Attributes of the breakpoint
|
||||
* @return non-null array of ICBreakpointsUIContribution
|
||||
* @throws CoreException
|
||||
* @throws CoreException if cannot get marker attributes from berakpoint
|
||||
*/
|
||||
public ICBreakpointsUIContribution[] getBreakpointUIContributions(String debugModelId, String markerType,
|
||||
Map attributes) {
|
||||
Map<String, Object> attributes)
|
||||
{
|
||||
ArrayList<ICBreakpointsUIContribution> list = new ArrayList<ICBreakpointsUIContribution>();
|
||||
for (ICBreakpointsUIContribution con : contributions) {
|
||||
try {
|
||||
|
@ -185,9 +224,9 @@ public class CBreakpointUIContributionFactory {
|
|||
String elementValue = configurationElement.getAttribute(name);
|
||||
if (elementValue == null)
|
||||
CDebugUIPlugin.log(new Status(IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(),
|
||||
DebugPlugin.INTERNAL_ERROR, "Extension "
|
||||
DebugPlugin.INTERNAL_ERROR, "Extension " //$NON-NLS-1$
|
||||
+ configurationElement.getDeclaringExtension().getUniqueIdentifier()
|
||||
+ " missing required attribute: " + name, null));
|
||||
+ " missing required attribute: " + name, null)); //$NON-NLS-1$
|
||||
return elementValue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 QNX Software Systems and others.
|
||||
* Copyright (c) 2008, 2012 QNX Software 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
|
||||
|
@ -82,5 +82,5 @@ public interface ICBreakpointsUIContribution {
|
|||
* @param map - contains pairs of attribute=value for other breakpoint attributes
|
||||
* @return
|
||||
*/
|
||||
public boolean isApplicable(Map map);
|
||||
public boolean isApplicable(Map<String, Object> map);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012 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:
|
||||
* Wind River Systems - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.ui.breakpoints;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
/**
|
||||
* Second extension interface for {@link org.eclipse.debug.ui.actions.IToggleBreakpointsTarget}.
|
||||
* This interface provides the ability open edit a breakpoint's properties and
|
||||
* to create a breakpoint in the given context with additional user input
|
||||
* (such as using a dialog or a wizard).
|
||||
* <p>
|
||||
* Clients implementing <code>IToggleBreakpointsTarget</code> may optionally
|
||||
* implement this interface.
|
||||
* </p>
|
||||
* @since 7.2
|
||||
* @see org.eclipse.debug.ui.actions.ToggleBreakpointAction
|
||||
*/
|
||||
public interface IToggleBreakpointsTargetCExtension extends IToggleBreakpointsTargetExtension {
|
||||
|
||||
/**
|
||||
* Returns whether the toggle target can create a a breakpoint at the
|
||||
* given location. If the implementation does not support creating the
|
||||
* breakpoint interactively then it should return <code>false</code>.
|
||||
* <p>
|
||||
* The selection varies depending on the given part. For example,
|
||||
* a text selection is provided for text editors, and a structured
|
||||
* selection is provided for tree views, and may be a multi-selection.
|
||||
* </p>
|
||||
* @param part the part on which the action has been invoked
|
||||
* @param selection selection on which line breakpoints should be toggled
|
||||
* @return Returns <code>true</code> if toggle target is able interactively
|
||||
* create a breakpoint(s) at the given location.
|
||||
*/
|
||||
public boolean canCreateBreakpointsInteractive(IWorkbenchPart part, ISelection selection);
|
||||
|
||||
/**
|
||||
* Creates new breakpoints interactively. The implementation should allows
|
||||
* the user to edit all of the breakpoint's settings prior to creating the
|
||||
* breakpoint.
|
||||
* <p>
|
||||
* The selection varies depending on the given part. For example,
|
||||
* a text selection is provided for text editors, and a structured
|
||||
* selection is provided for tree views, and may be a multi-selection.
|
||||
* </p>
|
||||
* @param part the part on which the action has been invoked
|
||||
* @param selection selection on which line breakpoints should be toggled
|
||||
* @throws CoreException if unable to perform the action
|
||||
*/
|
||||
public void createBreakpointsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException;
|
||||
}
|
|
@ -75,11 +75,22 @@ public class ReadOnlyFieldEditor extends FieldEditor implements ICBreakpointsUIC
|
|||
if (textField != null) {
|
||||
String value = getPreferenceStore().getString(getPreferenceName());
|
||||
if (contribution!=null) {
|
||||
if ("integer".equals (contribution.getType())) { //$NON-NLS-1$
|
||||
value = Integer.toString( getPreferenceStore().getInt(getPreferenceName()) );
|
||||
} else if ("boolean".equals (contribution.getType()) ) {//$NON-NLS-1$
|
||||
value = Boolean.toString( getPreferenceStore().getBoolean(getPreferenceName()) );
|
||||
} else if ("float".equals (contribution.getType()) ) {//$NON-NLS-1$
|
||||
value = Float.toString( getPreferenceStore().getFloat(getPreferenceName()) );
|
||||
} else if ("double".equals (contribution.getType()) ) {//$NON-NLS-1$
|
||||
value = Double.toString( getPreferenceStore().getDouble(getPreferenceName()) );
|
||||
}
|
||||
String tryValue = contribution.getLabelForValue(value);
|
||||
if (tryValue!=null)
|
||||
value = tryValue;
|
||||
}
|
||||
textField.setText(value);
|
||||
if (value != null) {
|
||||
textField.setText(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2008, 2012 Wind River Systems, Inc. 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
|
||||
|
@ -11,58 +11,65 @@
|
|||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.ui.CBreakpointContext;
|
||||
import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointPropertyDialogAction;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyMessages;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
import org.eclipse.debug.core.model.IBreakpoint;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
||||
import org.eclipse.debug.ui.contexts.IDebugContextProvider;
|
||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.ui.dialogs.PropertyDialogAction;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
/**
|
||||
* Ruler action to display breakpoint properties.
|
||||
*/
|
||||
@SuppressWarnings("restriction")
|
||||
public class BreakpointPropertiesRulerAction extends AbstractDisassemblyBreakpointRulerAction {
|
||||
|
||||
private Object fContext;
|
||||
|
||||
|
||||
private ICBreakpoint fBreakpoint;
|
||||
|
||||
protected BreakpointPropertiesRulerAction(IDisassemblyPart disassemblyPart, IVerticalRulerInfo rulerInfo) {
|
||||
super(disassemblyPart, rulerInfo);
|
||||
setText(DisassemblyMessages.Disassembly_action_BreakpointProperties_label);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.AbstractDisassemblyAction#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
if ( fContext != null ) {
|
||||
PropertyDialogAction action = new PropertyDialogAction( getDisassemblyPart().getSite(), new ISelectionProvider() {
|
||||
|
||||
@Override
|
||||
public void addSelectionChangedListener( ISelectionChangedListener listener ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISelection getSelection() {
|
||||
return new StructuredSelection( fContext );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSelectionChangedListener( ISelectionChangedListener listener ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelection( ISelection selection ) {
|
||||
}
|
||||
} );
|
||||
action.run();
|
||||
action.dispose();
|
||||
if ( fBreakpoint != null ) {
|
||||
final ISelection debugContext = getDebugContext();
|
||||
|
||||
CBreakpointPropertyDialogAction propertiesAction = new CBreakpointPropertyDialogAction(
|
||||
getDisassemblyPart().getSite(),
|
||||
new ISelectionProvider() {
|
||||
@Override
|
||||
public ISelection getSelection() {
|
||||
return new StructuredSelection( fBreakpoint );
|
||||
}
|
||||
@Override public void addSelectionChangedListener( ISelectionChangedListener listener ) {}
|
||||
@Override public void removeSelectionChangedListener( ISelectionChangedListener listener ) {}
|
||||
@Override public void setSelection( ISelection selection ) {}
|
||||
},
|
||||
new IDebugContextProvider() {
|
||||
@Override
|
||||
public ISelection getActiveContext() {
|
||||
return debugContext;
|
||||
}
|
||||
@Override public void addDebugContextListener(IDebugContextListener listener) {}
|
||||
@Override public void removeDebugContextListener(IDebugContextListener listener) {}
|
||||
@Override public IWorkbenchPart getPart() { return null; }
|
||||
|
||||
}
|
||||
);
|
||||
propertiesAction.run();
|
||||
propertiesAction.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,12 +79,13 @@ public class BreakpointPropertiesRulerAction extends AbstractDisassemblyBreakpoi
|
|||
@Override
|
||||
public void update() {
|
||||
IBreakpoint breakpoint= getBreakpoint();
|
||||
|
||||
if (breakpoint instanceof ICBreakpoint) {
|
||||
fContext = new CBreakpointContext((ICBreakpoint)breakpoint, getDebugContext());
|
||||
fBreakpoint = (ICBreakpoint)breakpoint;
|
||||
} else {
|
||||
fContext = breakpoint;
|
||||
fBreakpoint = null;
|
||||
}
|
||||
setEnabled( fContext != null );
|
||||
setEnabled( fBreakpoint != null );
|
||||
}
|
||||
|
||||
private ISelection getDebugContext() {
|
||||
|
|
Loading…
Add table
Reference in a new issue