mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 340177 - [breakpoints] Update CDT ToggleBreakpointTargetFactory enablement
This commit is contained in:
parent
16fdcfdd18
commit
c1d6a1cffe
8 changed files with 361 additions and 77 deletions
|
@ -1,49 +1,56 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<component id="org.eclipse.cdt.debug.core" version="2">
|
<component id="org.eclipse.cdt.debug.core" version="2">
|
||||||
<resource path="src/org/eclipse/cdt/debug/core/sourcelookup/MappingSourceContainer.java" type="org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer">
|
<resource path="src/org/eclipse/cdt/debug/core/ICDebugConstants.java" type="org.eclipse.cdt.debug.core.ICDebugConstants">
|
||||||
<filter id="643846161">
|
<filter id="403853384">
|
||||||
<message_arguments>
|
<message_arguments>
|
||||||
<message_argument value="MapEntrySourceContainer"/>
|
<message_argument value="org.eclipse.cdt.debug.core.ICDebugConstants"/>
|
||||||
<message_argument value="MappingSourceContainer"/>
|
</message_arguments>
|
||||||
<message_argument value="addMapEntries(MapEntrySourceContainer[])"/>
|
</filter>
|
||||||
</message_arguments>
|
</resource>
|
||||||
</filter>
|
<resource path="src/org/eclipse/cdt/debug/core/sourcelookup/MappingSourceContainer.java" type="org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer">
|
||||||
<filter id="643846161">
|
<filter id="643846161">
|
||||||
<message_arguments>
|
<message_arguments>
|
||||||
<message_argument value="MapEntrySourceContainer"/>
|
<message_argument value="MapEntrySourceContainer"/>
|
||||||
<message_argument value="MappingSourceContainer"/>
|
<message_argument value="MappingSourceContainer"/>
|
||||||
<message_argument value="addMapEntry(MapEntrySourceContainer)"/>
|
<message_argument value="addMapEntries(MapEntrySourceContainer[])"/>
|
||||||
</message_arguments>
|
</message_arguments>
|
||||||
</filter>
|
</filter>
|
||||||
<filter id="643846161">
|
<filter id="643846161">
|
||||||
<message_arguments>
|
<message_arguments>
|
||||||
<message_argument value="MapEntrySourceContainer"/>
|
<message_argument value="MapEntrySourceContainer"/>
|
||||||
<message_argument value="MappingSourceContainer"/>
|
<message_argument value="MappingSourceContainer"/>
|
||||||
<message_argument value="removeMapEntries(MapEntrySourceContainer[])"/>
|
<message_argument value="addMapEntry(MapEntrySourceContainer)"/>
|
||||||
</message_arguments>
|
</message_arguments>
|
||||||
</filter>
|
</filter>
|
||||||
<filter id="643846161">
|
<filter id="643846161">
|
||||||
<message_arguments>
|
<message_arguments>
|
||||||
<message_argument value="MapEntrySourceContainer"/>
|
<message_argument value="MapEntrySourceContainer"/>
|
||||||
<message_argument value="MappingSourceContainer"/>
|
<message_argument value="MappingSourceContainer"/>
|
||||||
<message_argument value="removeMapEntry(MapEntrySourceContainer)"/>
|
<message_argument value="removeMapEntries(MapEntrySourceContainer[])"/>
|
||||||
</message_arguments>
|
</message_arguments>
|
||||||
</filter>
|
</filter>
|
||||||
</resource>
|
<filter id="643846161">
|
||||||
<resource path="src/org/eclipse/cdt/debug/core/sourcelookup/SourceLookupMessages.java" type="org.eclipse.cdt.debug.core.sourcelookup.SourceLookupMessages">
|
<message_arguments>
|
||||||
<filter comment="SourceLookupMessages class is no longer public." id="305365105">
|
<message_argument value="MapEntrySourceContainer"/>
|
||||||
<message_arguments>
|
<message_argument value="MappingSourceContainer"/>
|
||||||
<message_argument value="org.eclipse.cdt.debug.core.sourcelookup.SourceLookupMessages"/>
|
<message_argument value="removeMapEntry(MapEntrySourceContainer)"/>
|
||||||
<message_argument value="org.eclipse.cdt.debug.core_7.1.0"/>
|
</message_arguments>
|
||||||
</message_arguments>
|
</filter>
|
||||||
</filter>
|
</resource>
|
||||||
</resource>
|
<resource path="src/org/eclipse/cdt/debug/core/sourcelookup/SourceLookupMessages.java" type="org.eclipse.cdt.debug.core.sourcelookup.SourceLookupMessages">
|
||||||
<resource path="src/org/eclipse/cdt/debug/internal/core/srcfinder/CSourceFinder.java" type="org.eclipse.cdt.debug.internal.core.srcfinder.CSourceFinder">
|
<filter comment="SourceLookupMessages class is no longer public." id="305365105">
|
||||||
<filter id="574619656">
|
<message_arguments>
|
||||||
<message_arguments>
|
<message_argument value="org.eclipse.cdt.debug.core.sourcelookup.SourceLookupMessages"/>
|
||||||
<message_argument value="ISourceFinder"/>
|
<message_argument value="org.eclipse.cdt.debug.core_7.1.0"/>
|
||||||
<message_argument value="CSourceFinder"/>
|
</message_arguments>
|
||||||
</message_arguments>
|
</filter>
|
||||||
</filter>
|
</resource>
|
||||||
</resource>
|
<resource path="src/org/eclipse/cdt/debug/internal/core/srcfinder/CSourceFinder.java" type="org.eclipse.cdt.debug.internal.core.srcfinder.CSourceFinder">
|
||||||
|
<filter id="574619656">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="ISourceFinder"/>
|
||||||
|
<message_argument value="CSourceFinder"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
</resource>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2010 QNX Software Systems and others.
|
* Copyright (c) 2000, 2011 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
* Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
|
* Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
|
||||||
|
* Patrick Chuong (Texas Instruments) - Update CDT ToggleBreakpointTargetFactory enablement (340177)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.core;
|
package org.eclipse.cdt.debug.core;
|
||||||
|
|
||||||
|
@ -43,16 +44,19 @@ import org.eclipse.cdt.debug.internal.core.model.CFloatingPointValue;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.ProjectScope;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.debug.core.IStatusHandler;
|
import org.eclipse.debug.core.IStatusHandler;
|
||||||
import org.eclipse.debug.core.model.IBreakpoint;
|
import org.eclipse.debug.core.model.IBreakpoint;
|
||||||
|
import org.osgi.service.prefs.BackingStoreException;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
|
||||||
import com.ibm.icu.text.MessageFormat;
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
@ -696,4 +700,60 @@ public class CDebugUtils {
|
||||||
}
|
}
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overrides the standard project ICBreakpoint toggle breakpoint factory with
|
||||||
|
* a custom toggle breakpoint factory. The ICBreakpoint toggle breakpoint factory
|
||||||
|
* will be disabled and it is up to the client to contribute it's own toggle
|
||||||
|
* breakpoint factory.
|
||||||
|
*
|
||||||
|
* @param project a project
|
||||||
|
* @param factoryId a breakpoint toggle factory identifier
|
||||||
|
* @since 7.1
|
||||||
|
*/
|
||||||
|
public static void setToggleBreakpointFactory(IProject project, String factoryId) {
|
||||||
|
try {
|
||||||
|
IEclipsePreferences pref = new ProjectScope(project).getNode(CDebugCorePlugin.PLUGIN_ID);
|
||||||
|
pref.put(ICDebugConstants.PREF_TOGGLE_BREAKPOINT_MODEL_IDENTIFIER, factoryId);
|
||||||
|
pref.flush();
|
||||||
|
} catch (BackingStoreException e) {
|
||||||
|
CDebugCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the toggle breakpoint factory identifier for the project
|
||||||
|
*
|
||||||
|
* @param project the project
|
||||||
|
* @return the toggle breakpoint factory identifier, can be {@code null}
|
||||||
|
* @since 7.1
|
||||||
|
*/
|
||||||
|
public static String getToggleBreakpointFactory(IProject project) {
|
||||||
|
IEclipsePreferences pref = new ProjectScope(project.getProject()).getNode(CDebugCorePlugin.PLUGIN_ID);
|
||||||
|
return pref.get(ICDebugConstants.PREF_TOGGLE_BREAKPOINT_MODEL_IDENTIFIER, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the project uses the standard ICBreakpoint toggle breakpoint factory.
|
||||||
|
*
|
||||||
|
* @param project the project
|
||||||
|
* @return {@code true} if the project uses the standard ICBreakpoint breakpoint toggle factory
|
||||||
|
* @since 7.1
|
||||||
|
*/
|
||||||
|
public static boolean isStandardCBreakpointFactory(IProject project) {
|
||||||
|
return getToggleBreakpointFactory(project) == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the custom toggle breakpoint factory should be consider when evaluating the
|
||||||
|
* enablement of the standard ICBreakpoint toggle breakpoint factory.
|
||||||
|
*
|
||||||
|
* @return true if the custom model breakpoint system property is set
|
||||||
|
* @since 7.1
|
||||||
|
* @see ICDebugConstants#PREF_TOGGLE_BREAKPOINT_MODEL_IDENTIFIER
|
||||||
|
*/
|
||||||
|
public static boolean isCustomToggleBreakpointFactory() {
|
||||||
|
String customModel = System.getProperty(ICDebugConstants.PREF_TOGGLE_BREAKPOINT_MODEL_IDENTIFIER, null);
|
||||||
|
return customModel != null && Boolean.valueOf(customModel);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2010 QNX Software Systems and others.
|
* Copyright (c) 2000, 2011 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,11 +8,14 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
* Ken Ryall (Nokia) - 207675
|
* Ken Ryall (Nokia) - 207675
|
||||||
|
* Patrick Chuong (Texas Instruments) - Update CDT ToggleBreakpointTargetFactory enablement (340177)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.core;
|
package org.eclipse.cdt.debug.core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant definitions for C/C++ debug plug-in.
|
* Constant definitions for C/C++ debug plug-in.
|
||||||
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
*/
|
*/
|
||||||
public interface ICDebugConstants {
|
public interface ICDebugConstants {
|
||||||
|
|
||||||
|
@ -114,4 +117,14 @@ public interface ICDebugConstants {
|
||||||
public static final String PREF_VALUE_STEP_MODE_CONTEXT = "context"; //$NON-NLS-1$
|
public static final String PREF_VALUE_STEP_MODE_CONTEXT = "context"; //$NON-NLS-1$
|
||||||
public static final String PREF_VALUE_STEP_MODE_SOURCE = "source"; //$NON-NLS-1$
|
public static final String PREF_VALUE_STEP_MODE_SOURCE = "source"; //$NON-NLS-1$
|
||||||
public static final String PREF_VALUE_STEP_MODE_INSTRUCTION = "instruction"; //$NON-NLS-1$
|
public static final String PREF_VALUE_STEP_MODE_INSTRUCTION = "instruction"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preference key for toggle breakpoint model identifier. Debugger that contribute custom
|
||||||
|
* CBreakpoint should set the system property with this key to true. when this system property
|
||||||
|
* is set to true, the standard ICBreakpoint toggle breakpoint factory enablement will take
|
||||||
|
* into account for non-standard ICElement input.
|
||||||
|
*
|
||||||
|
* @since 7.1
|
||||||
|
*/
|
||||||
|
public static final String PREF_TOGGLE_BREAKPOINT_MODEL_IDENTIFIER = PLUGIN_ID + ".toggleBreakpointModel"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -1754,6 +1754,23 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
</breakpointLabels>
|
</breakpointLabels>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.core.expressions.propertyTesters">
|
||||||
|
<propertyTester
|
||||||
|
class="org.eclipse.cdt.debug.internal.ui.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"
|
||||||
|
id="org.eclipse.cdt.debug.ui.declarationToggleBreakpointTester"
|
||||||
|
namespace="org.eclipse.cdt.debug.ui"
|
||||||
|
properties="isCDeclarationSupportsCBreakpoint"
|
||||||
|
type="java.util.List">
|
||||||
|
</propertyTester>
|
||||||
|
</extension>
|
||||||
|
|
||||||
<extension point="org.eclipse.debug.ui.toggleBreakpointsTargetFactories">
|
<extension point="org.eclipse.debug.ui.toggleBreakpointsTargetFactories">
|
||||||
<toggleTargetFactory
|
<toggleTargetFactory
|
||||||
|
@ -1762,18 +1779,14 @@
|
||||||
<enablement>
|
<enablement>
|
||||||
<!-- Enable the breakpoint toggle for CDT's editors and model elements -->
|
<!-- Enable the breakpoint toggle for CDT's editors and model elements -->
|
||||||
<or>
|
<or>
|
||||||
<instanceof value="org.eclipse.cdt.internal.ui.editor.CEditor"/>
|
<test property="org.eclipse.cdt.debug.ui.isCEditorSupportsCBreakpoint"/>
|
||||||
<instanceof value="org.eclipse.cdt.internal.ui.editor.asm.AsmTextEditor"/>
|
<test property="org.eclipse.cdt.debug.ui.isAsmEditorSupportsCBreakpoint"/>
|
||||||
<instanceof value="org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditor"/>
|
<test
|
||||||
|
property="org.eclipse.cdt.debug.ui.isDisassemblyEditorSupportsCBreakpoint">
|
||||||
|
</test>
|
||||||
<with variable="selection">
|
<with variable="selection">
|
||||||
<count value="1"/>
|
<count value="1"/>
|
||||||
<iterate>
|
<test property="org.eclipse.cdt.debug.ui.isCDeclarationSupportsCBreakpoint"/>
|
||||||
<or>
|
|
||||||
<instanceof value="org.eclipse.cdt.core.model.IFunction"/>
|
|
||||||
<instanceof value="org.eclipse.cdt.core.model.IMethod"/>
|
|
||||||
<instanceof value="org.eclipse.cdt.core.model.IVariable"/>
|
|
||||||
</or>
|
|
||||||
</iterate>
|
|
||||||
</with>
|
</with>
|
||||||
</or>
|
</or>
|
||||||
</enablement>
|
</enablement>
|
||||||
|
@ -1788,19 +1801,12 @@
|
||||||
definitionId="org.eclipse.cdt.debug.ui.testIsTracepointActionSetActive">
|
definitionId="org.eclipse.cdt.debug.ui.testIsTracepointActionSetActive">
|
||||||
</reference>
|
</reference>
|
||||||
<or>
|
<or>
|
||||||
<instanceof value="org.eclipse.cdt.internal.ui.editor.CEditor"/>
|
<test property="org.eclipse.cdt.debug.ui.isCEditorSupportsCBreakpoint"/>
|
||||||
<instanceof value="org.eclipse.cdt.internal.ui.editor.asm.AsmTextEditor"/>
|
<test property="org.eclipse.cdt.debug.ui.isAsmEditorSupportsCBreakpoint"/>
|
||||||
<instanceof value="org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditor"/>
|
<with variable="selection">
|
||||||
<with variable="selection">
|
<count value="1"/>
|
||||||
<count value="1"/>
|
<test property="org.eclipse.cdt.debug.ui.isCDeclarationSupportsCBreakpoint"/>
|
||||||
<iterate>
|
</with>
|
||||||
<or>
|
|
||||||
<instanceof value="org.eclipse.cdt.core.model.IFunction"/>
|
|
||||||
<instanceof value="org.eclipse.cdt.core.model.IMethod"/>
|
|
||||||
<instanceof value="org.eclipse.cdt.core.model.IVariable"/>
|
|
||||||
</or>
|
|
||||||
</iterate>
|
|
||||||
</with>
|
|
||||||
</or>
|
</or>
|
||||||
</and>
|
</and>
|
||||||
</enablement>
|
</enablement>
|
||||||
|
|
|
@ -0,0 +1,126 @@
|
||||||
|
/*****************************************************************
|
||||||
|
* Copyright (c) 2011 Texas Instruments 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:
|
||||||
|
* Patrick Chuong (Texas Instruments) -
|
||||||
|
* Update CDT ToggleBreakpointTargetFactory enablement (340177)
|
||||||
|
*****************************************************************/
|
||||||
|
package org.eclipse.cdt.debug.internal.ui;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.core.model.IDeclaration;
|
||||||
|
import org.eclipse.cdt.core.model.IFunctionDeclaration;
|
||||||
|
import org.eclipse.cdt.core.model.IMethodDeclaration;
|
||||||
|
import org.eclipse.cdt.core.model.IVariableDeclaration;
|
||||||
|
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||||
|
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||||
|
import org.eclipse.cdt.internal.ui.editor.asm.AsmTextEditor;
|
||||||
|
import org.eclipse.core.expressions.PropertyTester;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle breakpoint factor enablement tester for editors and IDeclaration.
|
||||||
|
*
|
||||||
|
* @since 7.1
|
||||||
|
*/
|
||||||
|
public class ToggleCBreakpointTester extends PropertyTester {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
|
||||||
|
*/
|
||||||
|
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
|
||||||
|
// test for CEditor
|
||||||
|
if ("isCEditorSupportsCBreakpoint".equals(property) && (receiver instanceof CEditor)) { //$NON-NLS-1$
|
||||||
|
if (!CDebugUtils.isCustomToggleBreakpointFactory())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
CEditor editor = (CEditor) receiver;
|
||||||
|
ICElement cElement = editor.getInputCElement();
|
||||||
|
if (cElement != null) {
|
||||||
|
ICProject cproject = cElement.getCProject();
|
||||||
|
if (cproject != null) {
|
||||||
|
// Handles the case for external file, check to see whether the file exist.
|
||||||
|
// This is to workaround the EditorUtility wrongly assign the project for
|
||||||
|
// external file.
|
||||||
|
IResource resource = cElement.getResource();
|
||||||
|
if (resource == null || !resource.exists())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (CDebugUtils.isStandardCBreakpointFactory(cproject.getProject()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return true; // can't figure the associated project, enable it by default.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// test for AsmEditor
|
||||||
|
} else if ("isAsmEditorSupportsCBreakpoint".equals(property) && (receiver instanceof AsmTextEditor)) { //$NON-NLS-1$
|
||||||
|
if (!CDebugUtils.isCustomToggleBreakpointFactory())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
AsmTextEditor editor = (AsmTextEditor) receiver;
|
||||||
|
ICElement cElement = editor.getInputCElement();
|
||||||
|
if (cElement != null) {
|
||||||
|
// Handles the case for external file, check to see whether the file exist.
|
||||||
|
// This is to workaround the EditorUtility wrongly assign the project for
|
||||||
|
// external file.
|
||||||
|
IResource resource = cElement.getResource();
|
||||||
|
if (resource == null || !resource.exists())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
ICProject cproject = cElement.getCProject();
|
||||||
|
if (cproject != null) {
|
||||||
|
if (CDebugUtils.isStandardCBreakpointFactory(cproject.getProject()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return true; // can't figure the associated project, enable it by default.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// test for IVariableDeclaration, IFunctionDeclaration, IMethodDeclaration
|
||||||
|
} else if ("isCDeclarationSupportsCBreakpoint".equals(property) && (receiver instanceof List<?>)) { //$NON-NLS-1$
|
||||||
|
if (!CDebugUtils.isCustomToggleBreakpointFactory())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
List<?> list = (List<?>) receiver;
|
||||||
|
if (list.size() == 1) {
|
||||||
|
Object element = list.get(0);
|
||||||
|
if ((element instanceof IDeclaration) &&
|
||||||
|
(element instanceof IVariableDeclaration ||
|
||||||
|
element instanceof IFunctionDeclaration ||
|
||||||
|
element instanceof IMethodDeclaration)) {
|
||||||
|
|
||||||
|
IDeclaration cElement = (IDeclaration) element;
|
||||||
|
|
||||||
|
// Handles the case for external file, check to see whether the file exist.
|
||||||
|
// This is to workaround the EditorUtility wrongly assign the project for
|
||||||
|
// external file.
|
||||||
|
IResource resource = cElement.getResource();
|
||||||
|
if (resource == null || !resource.exists())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
ICProject cproject = cElement.getCProject();
|
||||||
|
if (cproject != null) {
|
||||||
|
if (CDebugUtils.isStandardCBreakpointFactory(cproject.getProject()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return true; // can't figure the associated project, enable it by default.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -474,7 +474,9 @@
|
||||||
<reference
|
<reference
|
||||||
definitionId="org.eclipse.cdt.debug.ui.testIsTracepointActionSetActive">
|
definitionId="org.eclipse.cdt.debug.ui.testIsTracepointActionSetActive">
|
||||||
</reference>
|
</reference>
|
||||||
<instanceof value="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart"/>
|
<test
|
||||||
|
property="org.eclipse.cdt.dsf.debug.ui.isCLaunchTypeDisassembly">
|
||||||
|
</test>
|
||||||
</and>
|
</and>
|
||||||
</enablement>
|
</enablement>
|
||||||
</toggleTargetFactory>
|
</toggleTargetFactory>
|
||||||
|
|
|
@ -457,6 +457,13 @@
|
||||||
properties="isGroupDebugContextsVisible,isUngroupDebugContextsVisible"
|
properties="isGroupDebugContextsVisible,isUngroupDebugContextsVisible"
|
||||||
type="org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext">
|
type="org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext">
|
||||||
</propertyTester>
|
</propertyTester>
|
||||||
|
<propertyTester
|
||||||
|
class="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyToggleBreakpointTester"
|
||||||
|
id="org.eclipse.cdt.dsf.debug.ui.disassemblyViewToggleBreakpointTester"
|
||||||
|
namespace="org.eclipse.cdt.dsf.debug.ui"
|
||||||
|
properties="isDisassemblyViewSupportsCBreakpoint"
|
||||||
|
type="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyView">
|
||||||
|
</propertyTester>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.debug.ui.detailPaneFactories">
|
point="org.eclipse.debug.ui.detailPaneFactories">
|
||||||
|
@ -768,7 +775,9 @@
|
||||||
class="org.eclipse.cdt.dsf.debug.internal.ui.ToggleBreakpointsTargetFactory">
|
class="org.eclipse.cdt.dsf.debug.internal.ui.ToggleBreakpointsTargetFactory">
|
||||||
<enablement>
|
<enablement>
|
||||||
<!-- Enable the breakpoint toggle for DSF Disassembly -->
|
<!-- Enable the breakpoint toggle for DSF Disassembly -->
|
||||||
<instanceof value="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart"/>
|
<test
|
||||||
|
property="org.eclipse.cdt.dsf.debug.ui.isDisassemblyViewSupportsCBreakpoint">
|
||||||
|
</test>
|
||||||
</enablement>
|
</enablement>
|
||||||
</toggleTargetFactory>
|
</toggleTargetFactory>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*****************************************************************
|
||||||
|
* Copyright (c) 2011 Texas Instruments 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:
|
||||||
|
* Patrick Chuong (Texas Instruments) -
|
||||||
|
* Update CDT ToggleBreakpointTargetFactory enablement (340177 )
|
||||||
|
*****************************************************************/
|
||||||
|
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||||
|
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||||
|
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||||
|
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||||
|
import org.eclipse.core.expressions.PropertyTester;
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
import org.eclipse.debug.core.model.IDebugElement;
|
||||||
|
import org.eclipse.debug.core.model.IDebugModelProvider;
|
||||||
|
import org.eclipse.debug.ui.DebugUITools;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disassembly toggle breakpoint factory enablement tester.
|
||||||
|
*
|
||||||
|
* @since 2.2
|
||||||
|
*/
|
||||||
|
public class DisassemblyToggleBreakpointTester extends PropertyTester {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
|
||||||
|
*/
|
||||||
|
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
|
||||||
|
if ("isDisassemblyViewSupportsCBreakpoint".equals(property) && (receiver instanceof IDisassemblyPart)) { //$NON-NLS-1$
|
||||||
|
IDisassemblyPart view = ((IDisassemblyPart) receiver);
|
||||||
|
if (!CDebugUtils.isCustomToggleBreakpointFactory())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
IAdaptable element = DebugUITools.getPartDebugContext(view.getSite());
|
||||||
|
if (element != null) {
|
||||||
|
IDebugModelProvider modelProvider = (IDebugModelProvider)element.getAdapter(IDebugModelProvider.class);
|
||||||
|
if (modelProvider != null) {
|
||||||
|
String[] models = modelProvider.getModelIdentifiers();
|
||||||
|
for (String model : models) {
|
||||||
|
if (CDIDebugModel.getPluginIdentifier().equals(model) ||
|
||||||
|
ICBreakpoint.C_BREAKPOINTS_DEBUG_MODEL_ID.equals(model)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (element instanceof IDebugElement) {
|
||||||
|
if (CDIDebugModel.getPluginIdentifier().equals(((IDebugElement)element).getModelIdentifier()) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue