mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
Merge remote-tracking branch 'cdt/master' into sd90
This commit is contained in:
commit
367eabaaa0
25 changed files with 651 additions and 89 deletions
|
@ -51,9 +51,11 @@ import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||||
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.IExtensionPoint;
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -202,7 +204,7 @@ public class ManagedBuildCoreTests20 extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Convert path to OS specific representation
|
* Convert path to OS specific representation
|
||||||
*/
|
*/
|
||||||
private String toOSString(String path) {
|
private String toOSLocation(String path) {
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
try {
|
try {
|
||||||
path = file.getCanonicalPath();
|
path = file.getCanonicalPath();
|
||||||
|
@ -211,7 +213,14 @@ public class ManagedBuildCoreTests20 extends TestCase {
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert path to OS specific representation
|
||||||
|
*/
|
||||||
|
private String toOSString(String path) {
|
||||||
|
return new Path(path).toOSString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The purpose of this test is to exercise the build path info interface.
|
* The purpose of this test is to exercise the build path info interface.
|
||||||
* To get to that point, a new project/config has to be created in the test
|
* To get to that point, a new project/config has to be created in the test
|
||||||
|
@ -232,21 +241,44 @@ public class ManagedBuildCoreTests20 extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
//These are the expected path settings
|
//These are the expected path settings
|
||||||
final String[] expectedPaths = {
|
IPath buildCWD = project.getLocation().append("Sub Config");
|
||||||
toOSString("/usr/include"),
|
|
||||||
toOSString("/opt/gnome/include"),
|
final String[] expectedPaths;
|
||||||
toOSString("C:\\home\\tester/include"),
|
if (new Path("C:\\home\\tester/include").isAbsolute()) {
|
||||||
// relative path makes 2 entries
|
// Windows
|
||||||
project.getLocation().append("includes").toOSString(),
|
expectedPaths = new String[] {
|
||||||
"includes",
|
toOSLocation("/usr/include"),
|
||||||
"/usr/gnu/include", // This one set to ICSettingEntry.RESOLVED
|
toOSLocation("/opt/gnome/include"),
|
||||||
};
|
toOSLocation("C:\\home\\tester/include"),
|
||||||
|
// relative paths from MBS will make 3 entries
|
||||||
|
project.getLocation().append("includes").toOSString(),
|
||||||
|
buildCWD.append("includes").toOSString(),
|
||||||
|
toOSString("includes"),
|
||||||
|
"/usr/gnu/include", // Not converted to OS string due to being flagged as ICSettingEntry.RESOLVED
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Unix
|
||||||
|
expectedPaths = new String[] {
|
||||||
|
toOSLocation("/usr/include"),
|
||||||
|
toOSLocation("/opt/gnome/include"),
|
||||||
|
// on unix "C:\\home\\tester/include" is relative path
|
||||||
|
// looks like nonsense but has to be this way as MBS converts entry to keep "Sub Config/C:\\home\\tester/include" in its storage
|
||||||
|
project.getLocation().append("Sub Config/C:\\home\\tester/include").toOSString(),
|
||||||
|
buildCWD.append("Sub Config/C:\\home\\tester/include").toOSString(),
|
||||||
|
toOSString("Sub Config/C:\\home\\tester/include"),
|
||||||
|
// relative paths from MBS will make 3 entries
|
||||||
|
project.getLocation().append("includes").toOSString(),
|
||||||
|
buildCWD.append("includes").toOSString(),
|
||||||
|
toOSString("includes"),
|
||||||
|
"/usr/gnu/include", // Not converted to OS string due to being flagged as ICSettingEntry.RESOLVED
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Create a new managed project based on the sub project type
|
// Create a new managed project based on the sub project type
|
||||||
IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.sub");
|
IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.sub");
|
||||||
assertNotNull(projType);
|
assertNotNull(projType);
|
||||||
|
|
||||||
// Create the managed-project (.cdtbuild) for our project
|
// Create the managed-project for our project
|
||||||
IManagedProject newProject = null;
|
IManagedProject newProject = null;
|
||||||
try {
|
try {
|
||||||
newProject = ManagedBuildManager.createManagedProject(project, projType);
|
newProject = ManagedBuildManager.createManagedProject(project, projType);
|
||||||
|
@ -527,7 +559,7 @@ public class ManagedBuildCoreTests20 extends TestCase {
|
||||||
IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.root");
|
IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.root");
|
||||||
assertNotNull(projType);
|
assertNotNull(projType);
|
||||||
|
|
||||||
// Create the managed-project (.cdtbuild) for our project that builds a dummy executable
|
// Create the managed-project for our project that builds a dummy executable
|
||||||
IManagedProject newProject = ManagedBuildManager.createManagedProject(project, projType);
|
IManagedProject newProject = ManagedBuildManager.createManagedProject(project, projType);
|
||||||
assertEquals(newProject.getName(), projType.getName());
|
assertEquals(newProject.getName(), projType.getName());
|
||||||
assertFalse(newProject.equals(projType));
|
assertFalse(newProject.equals(projType));
|
||||||
|
|
|
@ -1841,11 +1841,10 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if(!buildPath.isAbsolute()){
|
if(!buildPath.isAbsolute()){
|
||||||
buildPath = project.getFullPath().append(buildPath);
|
|
||||||
IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
|
IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
|
||||||
|
// build dir may not exist yet and non-existent paths will resolve to empty string by VariablesPlugin
|
||||||
result = buildPath.toString();
|
// so append relative part outside of expression, i.e. ${workspace_loc:/Project}/BuildDir
|
||||||
result = mngr.generateVariableExpression("workspace_loc", result); //$NON-NLS-1$
|
result = mngr.generateVariableExpression("workspace_loc", project.getFullPath().toString()) + Path.SEPARATOR + buildPath.toString(); //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
result = buildPath.toString();
|
result = buildPath.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,11 +22,16 @@ import org.eclipse.cdt.core.settings.model.ICFileDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
|
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICPathEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||||
|
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
|
import org.eclipse.core.variables.IStringVariableManager;
|
||||||
|
import org.eclipse.core.variables.VariablesPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of language settings provider for CDT Managed Build System.
|
* Implementation of language settings provider for CDT Managed Build System.
|
||||||
|
@ -62,6 +67,20 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
|
||||||
if ((kindsBits & kind) != 0) {
|
if ((kindsBits & kind) != 0) {
|
||||||
List<ICLanguageSettingEntry> additions = langSetting.getSettingEntriesList(kind);
|
List<ICLanguageSettingEntry> additions = langSetting.getSettingEntriesList(kind);
|
||||||
for (ICLanguageSettingEntry entry : additions) {
|
for (ICLanguageSettingEntry entry : additions) {
|
||||||
|
if (entry instanceof ICPathEntry) {
|
||||||
|
// have to use getName() rather than getLocation() and not use IPath operations to avoid collapsing ".."
|
||||||
|
String pathStr = ((ICPathEntry) entry).getName();
|
||||||
|
if (!new Path(pathStr).isAbsolute()) {
|
||||||
|
// We need to add project-rooted entry for relative path as MBS counts it this way in some UI
|
||||||
|
// The relative entry below also should be added for indexer to resolve from source file locations
|
||||||
|
IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
|
||||||
|
String projectRootedPath = mngr.generateVariableExpression("workspace_loc", rc.getProject().getName()) + Path.SEPARATOR + pathStr; //$NON-NLS-1$
|
||||||
|
ICLanguageSettingEntry projectRootedEntry = (ICLanguageSettingEntry) CDataUtil.createEntry(kind, projectRootedPath, projectRootedPath, null, entry.getFlags());
|
||||||
|
if (! list.contains(projectRootedEntry)) {
|
||||||
|
list.add(projectRootedEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (! list.contains(entry)) {
|
if (! list.contains(entry)) {
|
||||||
list.add(entry);
|
list.add(entry);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,10 +30,10 @@ import org.eclipse.cdt.core.parser.ExtendedScannerInfo;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
|
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
||||||
import org.eclipse.cdt.core.settings.model.ACPathEntry;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICMacroEntry;
|
import org.eclipse.cdt.core.settings.model.ICMacroEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICPathEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||||
|
@ -132,17 +132,15 @@ public class LanguageSettingsScannerInfoProvider implements IScannerInfoProvider
|
||||||
return new ExtendedScannerInfo(definedMacros, includePaths, macroFiles, includeFiles, includePathsLocal);
|
return new ExtendedScannerInfo(definedMacros, includePaths, macroFiles, includeFiles, includePathsLocal);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPath expandVariables(IPath path, ICConfigurationDescription cfgDescription) {
|
private String expandVariables(String pathStr, ICConfigurationDescription cfgDescription) {
|
||||||
ICdtVariableManager varManager = CCorePlugin.getDefault().getCdtVariableManager();
|
|
||||||
String pathStr = path.toString();
|
|
||||||
try {
|
try {
|
||||||
|
ICdtVariableManager varManager = CCorePlugin.getDefault().getCdtVariableManager();
|
||||||
pathStr = varManager.resolveValue(pathStr, "", null, cfgDescription); //$NON-NLS-1$
|
pathStr = varManager.resolveValue(pathStr, "", null, cfgDescription); //$NON-NLS-1$
|
||||||
} catch (CdtVariableException e) {
|
} catch (Exception e) {
|
||||||
// Swallow exceptions but also log them
|
// Swallow exceptions but also log them
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
IPath resolvedLoc = new Path(pathStr);
|
return pathStr;
|
||||||
return resolvedLoc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,7 +149,7 @@ public class LanguageSettingsScannerInfoProvider implements IScannerInfoProvider
|
||||||
*/
|
*/
|
||||||
private static IPath getBuildCWD(ICConfigurationDescription cfgDescription) {
|
private static IPath getBuildCWD(ICConfigurationDescription cfgDescription) {
|
||||||
IPath buildCWD = cfgDescription.getBuildSetting().getBuilderCWD();
|
IPath buildCWD = cfgDescription.getBuildSetting().getBuilderCWD();
|
||||||
if (buildCWD==null) {
|
if (buildCWD == null) {
|
||||||
IProject project = cfgDescription.getProjectDescription().getProject();
|
IProject project = cfgDescription.getProjectDescription().getProject();
|
||||||
buildCWD = project.getLocation();
|
buildCWD = project.getLocation();
|
||||||
} else {
|
} else {
|
||||||
|
@ -195,28 +193,44 @@ public class LanguageSettingsScannerInfoProvider implements IScannerInfoProvider
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
// use OS file separators (i.e. '\' on Windows)
|
// use OS file separators (i.e. '\' on Windows)
|
||||||
if (java.io.File.separatorChar != '/') {
|
if (java.io.File.separatorChar != IPath.SEPARATOR) {
|
||||||
location = location.replace('/', java.io.File.separatorChar);
|
location = location.replace(IPath.SEPARATOR, java.io.File.separatorChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
// note that we avoid using org.eclipse.core.runtime.Path for manipulations being careful
|
IPath locPath = new Path(location);
|
||||||
// to preserve "../" segments and not let collapsing them which is not correct for symbolic links.
|
if (locPath.isAbsolute() && locPath.getDevice() == null) {
|
||||||
Path locPath = new Path(location);
|
|
||||||
if (locPath.isAbsolute() && locPath.getDevice()==null) {
|
|
||||||
// prepend device (C:) for Windows
|
|
||||||
IPath buildCWD = getBuildCWD(cfgDescription);
|
IPath buildCWD = getBuildCWD(cfgDescription);
|
||||||
|
// prepend device (C:) for Windows
|
||||||
String device = buildCWD.getDevice();
|
String device = buildCWD.getDevice();
|
||||||
if (device!=null)
|
if (device != null) {
|
||||||
|
// note that we avoid using org.eclipse.core.runtime.Path for manipulations being careful
|
||||||
|
// to preserve "../" segments and not let collapsing them which is not correct for symbolic links.
|
||||||
location = device + location;
|
location = device + location;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!locPath.isAbsolute()) {
|
if (!locPath.isAbsolute()) {
|
||||||
// consider relative path to be from build working directory
|
// consider relative path to be from build working directory
|
||||||
IPath buildCWD = getBuildCWD(cfgDescription);
|
IPath buildCWD = getBuildCWD(cfgDescription);
|
||||||
location = buildCWD.toOSString() + locPath;
|
// again, we avoid using org.eclipse.core.runtime.Path for manipulations being careful
|
||||||
|
// to preserve "../" segments and not let collapsing them which is not correct for symbolic links.
|
||||||
|
location = buildCWD.addTrailingSeparator().toOSString() + location;
|
||||||
}
|
}
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert path delimiters to OS representation avoiding using org.eclipse.core.runtime.Path
|
||||||
|
* being careful to preserve "../" segments and not let collapsing them which is not correct for symbolic links.
|
||||||
|
*/
|
||||||
|
private String toOSString(String loc) {
|
||||||
|
// use OS file separators (i.e. '\' on Windows)
|
||||||
|
if (java.io.File.separatorChar != IPath.SEPARATOR) {
|
||||||
|
loc = loc.replace(IPath.SEPARATOR, java.io.File.separatorChar);
|
||||||
|
}
|
||||||
|
return loc;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the path entries to absolute file system locations represented as String array.
|
* Convert the path entries to absolute file system locations represented as String array.
|
||||||
* Resolve the entries which are not resolved.
|
* Resolve the entries which are not resolved.
|
||||||
|
@ -225,10 +239,10 @@ public class LanguageSettingsScannerInfoProvider implements IScannerInfoProvider
|
||||||
* @param cfgDescription - configuration description for resolving entries.
|
* @param cfgDescription - configuration description for resolving entries.
|
||||||
* @return array of the locations.
|
* @return array of the locations.
|
||||||
*/
|
*/
|
||||||
private String[] convertToLocations(LinkedHashSet<ICLanguageSettingEntry> entriesPath, ICConfigurationDescription cfgDescription){
|
private String[] convertToLocations(LinkedHashSet<ICLanguageSettingEntry> entriesPath, ICConfigurationDescription cfgDescription) {
|
||||||
List<String> locations = new ArrayList<String>(entriesPath.size());
|
List<String> locations = new ArrayList<String>(entriesPath.size());
|
||||||
for (ICLanguageSettingEntry entry : entriesPath) {
|
for (ICLanguageSettingEntry entry : entriesPath) {
|
||||||
ACPathEntry entryPath = (ACPathEntry)entry;
|
ICPathEntry entryPath = (ICPathEntry)entry;
|
||||||
if (entryPath.isValueWorkspacePath()) {
|
if (entryPath.isValueWorkspacePath()) {
|
||||||
ICLanguageSettingEntry[] entries = new ICLanguageSettingEntry[] {entry};
|
ICLanguageSettingEntry[] entries = new ICLanguageSettingEntry[] {entry};
|
||||||
if (!entry.isResolved()) {
|
if (!entry.isResolved()) {
|
||||||
|
@ -236,7 +250,7 @@ public class LanguageSettingsScannerInfoProvider implements IScannerInfoProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ICLanguageSettingEntry resolved : entries) {
|
for (ICLanguageSettingEntry resolved : entries) {
|
||||||
IPath loc = ((ACPathEntry) resolved).getLocation();
|
IPath loc = ((ICPathEntry) resolved).getLocation();
|
||||||
if (loc != null) {
|
if (loc != null) {
|
||||||
if (checkBit(resolved.getFlags(), ICSettingEntry.FRAMEWORKS_MAC)) {
|
if (checkBit(resolved.getFlags(), ICSettingEntry.FRAMEWORKS_MAC)) {
|
||||||
// handle frameworks, see IScannerInfo.getIncludePaths()
|
// handle frameworks, see IScannerInfo.getIncludePaths()
|
||||||
|
@ -248,24 +262,25 @@ public class LanguageSettingsScannerInfoProvider implements IScannerInfoProvider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String locStr = entryPath.getName();
|
// have to use getName() rather than getLocation() to avoid collapsing ".."
|
||||||
|
String loc = entryPath.getName();
|
||||||
if (entryPath.isResolved()) {
|
if (entryPath.isResolved()) {
|
||||||
locations.add(locStr);
|
locations.add(loc);
|
||||||
} else {
|
} else {
|
||||||
locStr = resolveEntry(locStr, cfgDescription);
|
loc = resolveEntry(loc, cfgDescription);
|
||||||
if (locStr!=null) {
|
if (loc != null) {
|
||||||
if (checkBit(entryPath.getFlags(), ICSettingEntry.FRAMEWORKS_MAC)) {
|
if (checkBit(entryPath.getFlags(), ICSettingEntry.FRAMEWORKS_MAC)) {
|
||||||
// handle frameworks, see IScannerInfo.getIncludePaths()
|
// handle frameworks, see IScannerInfo.getIncludePaths()
|
||||||
locations.add(locStr+FRAMEWORK_HEADERS_INCLUDE);
|
locations.add(toOSString(loc + FRAMEWORK_HEADERS_INCLUDE));
|
||||||
locations.add(locStr+FRAMEWORK_PRIVATE_HEADERS_INCLUDE);
|
locations.add(toOSString(loc + FRAMEWORK_PRIVATE_HEADERS_INCLUDE));
|
||||||
} else {
|
} else {
|
||||||
locations.add(locStr);
|
locations.add(toOSString(loc));
|
||||||
// add relative paths again for indexer to resolve from source file location
|
String unresolvedPath = entryPath.getName();
|
||||||
IPath unresolvedPath = entryPath.getLocation();
|
if (!new Path(unresolvedPath).isAbsolute()) {
|
||||||
if (!unresolvedPath.isAbsolute()) {
|
// add relative paths again for indexer to resolve from source file location
|
||||||
IPath expandedPath = expandVariables(unresolvedPath, cfgDescription);
|
String expandedPath = expandVariables(unresolvedPath, cfgDescription);
|
||||||
if (!expandedPath.isAbsolute()) {
|
if (!expandedPath.isEmpty() && !new Path(expandedPath).isAbsolute()) {
|
||||||
locations.add(expandedPath.toOSString());
|
locations.add(toOSString(expandedPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2007, 2012 Nokia 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:
|
||||||
|
* Marc Dumais (Ericsson) - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.debug.core.breakpointactions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 7.3
|
||||||
|
*/
|
||||||
|
public interface IReverseDebugEnabler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles the state of the reverse debugging mode.
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
void toggle() throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the reverse debugging mode. No effect if already enabled.
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
void enable() throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables the reverse debugging mode. No effect if it's not enabled.
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
void disable() throws Exception;
|
||||||
|
|
||||||
|
}
|
|
@ -11,6 +11,7 @@
|
||||||
# Patrick Chuong (Texas Instruments) - Pin and Clone Supports (Bug 331781)
|
# Patrick Chuong (Texas Instruments) - Pin and Clone Supports (Bug 331781)
|
||||||
# Dobrin Alexiev (Texas Instruments) - initial API and implementation (bug 336876)
|
# Dobrin Alexiev (Texas Instruments) - initial API and implementation (bug 336876)
|
||||||
# Marc Khouzam (Ericsson) - Added support for connect command (Bug 365601)
|
# Marc Khouzam (Ericsson) - Added support for connect command (Bug 365601)
|
||||||
|
# Marc Dumais (Ericsson) - Added support for reverse debug action (Bug 365776)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
pluginName=C/C++ Development Tools Debugger UI
|
pluginName=C/C++ Development Tools Debugger UI
|
||||||
|
@ -37,10 +38,10 @@ ShowDebuggerConsoleAction.label=Show Debugger Console
|
||||||
ShowDebuggerConsoleAction.tooltip=Show Debugger Console On Target Selection
|
ShowDebuggerConsoleAction.tooltip=Show Debugger Console On Target Selection
|
||||||
|
|
||||||
AddBreakpoint.label=Toggle Brea&kpoint
|
AddBreakpoint.label=Toggle Brea&kpoint
|
||||||
AddBreakpointInteractive.label=&Add Breakpoint...\tCtrl+Double Click
|
AddBreakpointInteractive.label=&Add Breakpoint...
|
||||||
EnableBreakpoint.label=&Toggle Breakpoint Enabled\tShift+Double Click
|
EnableBreakpoint.label=&Toggle Breakpoint Enabled
|
||||||
BreakpointProperties.label=Breakpoint P&roperties...
|
BreakpointProperties.label=Breakpoint P&roperties...
|
||||||
RulerBreakpointProperties.label=Breakpoint P&roperties...\tCtrl+Double Click
|
RulerBreakpointProperties.label=Breakpoint P&roperties...
|
||||||
BreakpointPropertiesCommand.name=C/C++ Breakpoint Properties
|
BreakpointPropertiesCommand.name=C/C++ Breakpoint Properties
|
||||||
BreakpointPropertiesCommand.description=View and edit properties for a given C/C++ breakpoint
|
BreakpointPropertiesCommand.description=View and edit properties for a given C/C++ breakpoint
|
||||||
ManageFunctionBreakpointAction.label=Toggle Breakpoint
|
ManageFunctionBreakpointAction.label=Toggle Breakpoint
|
||||||
|
@ -157,6 +158,7 @@ SoundAction.name=Sound Action
|
||||||
LogAction.name=Log Action
|
LogAction.name=Log Action
|
||||||
ResumeAction.name=Resume Action
|
ResumeAction.name=Resume Action
|
||||||
ExternalToolAction.name=External Tool Action
|
ExternalToolAction.name=External Tool Action
|
||||||
|
ReverseDebugAction.name=Reverse Debug Action
|
||||||
|
|
||||||
# Breakpoint Types
|
# Breakpoint Types
|
||||||
breapointType.label=Type
|
breapointType.label=Type
|
||||||
|
|
|
@ -1710,6 +1710,14 @@
|
||||||
class="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolAction"
|
class="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolAction"
|
||||||
id="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolAction"/>
|
id="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolAction"/>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.debug.core.BreakpointActionType">
|
||||||
|
<actionType
|
||||||
|
class="org.eclipse.cdt.debug.ui.breakpointactions.ReverseDebugAction"
|
||||||
|
id="org.eclipse.cdt.debug.ui.breakpointactions.ReverseDebugAction"
|
||||||
|
name="%ReverseDebugAction.name">
|
||||||
|
</actionType>
|
||||||
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.cdt.debug.ui.BreakpointActionPage">
|
point="org.eclipse.cdt.debug.ui.BreakpointActionPage">
|
||||||
<actionPage
|
<actionPage
|
||||||
|
@ -1740,6 +1748,14 @@
|
||||||
id="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolActionPage"
|
id="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolActionPage"
|
||||||
actionType="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolAction"/>
|
actionType="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolAction"/>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.debug.ui.BreakpointActionPage">
|
||||||
|
<actionPage
|
||||||
|
actionType="org.eclipse.cdt.debug.ui.breakpointactions.ReverseDebugAction"
|
||||||
|
class="org.eclipse.cdt.debug.ui.breakpointactions.ReverseDebugActionPage"
|
||||||
|
id="org.eclipse.cdt.debug.ui.breakpointactions.ReverseDebugActionPage">
|
||||||
|
</actionPage>
|
||||||
|
</extension>
|
||||||
|
|
||||||
<extension point="org.eclipse.debug.ui.detailPaneFactories">
|
<extension point="org.eclipse.debug.ui.detailPaneFactories">
|
||||||
<detailFactories
|
<detailFactories
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.eclipse.debug.core.model.IVariable;
|
||||||
import org.eclipse.debug.ui.DebugUITools;
|
import org.eclipse.debug.ui.DebugUITools;
|
||||||
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
||||||
import org.eclipse.debug.ui.contexts.IDebugContextProvider;
|
import org.eclipse.debug.ui.contexts.IDebugContextProvider;
|
||||||
|
import org.eclipse.jface.bindings.keys.KeyStroke;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.jface.text.BadLocationException;
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.jface.text.IDocument;
|
||||||
|
@ -338,4 +339,20 @@ public class CDebugUIUtils {
|
||||||
propertiesAction.run();
|
propertiesAction.run();
|
||||||
propertiesAction.dispose();
|
propertiesAction.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats the given key stroke or click name and the modifier keys
|
||||||
|
* to a key binding string that can be used in action texts.
|
||||||
|
*
|
||||||
|
* @param modifierKeys the modifier keys
|
||||||
|
* @param keyOrClick a key stroke or click, e.g. "Double Click"
|
||||||
|
* @return the formatted keyboard shortcut string, e.g. "Shift+Double Click"
|
||||||
|
*
|
||||||
|
* @since 8.1
|
||||||
|
*/
|
||||||
|
public static final String formatKeyBindingString(int modifierKeys, String keyOrClick) {
|
||||||
|
// this should actually all be delegated to KeyStroke class
|
||||||
|
return KeyStroke.getInstance(modifierKeys, KeyStroke.NO_KEY).format() + keyOrClick;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,14 +37,14 @@ ToggleBreakpointAdapter.Missing_document_2=Missing document
|
||||||
ToggleBreakpointAdapter.Missing_resource_2=Missing resource
|
ToggleBreakpointAdapter.Missing_resource_2=Missing resource
|
||||||
ToggleBreakpointAdapter.Invalid_expression_1=Invalid expression:
|
ToggleBreakpointAdapter.Invalid_expression_1=Invalid expression:
|
||||||
RunToLineAdapter.Operation_is_not_supported_1=Operation is not supported.
|
RunToLineAdapter.Operation_is_not_supported_1=Operation is not supported.
|
||||||
EnableDisableBreakpointRulerAction.Enable_Breakpoint_1=&Enable Breakpoint\tShift+Double Click
|
EnableDisableBreakpointRulerAction.Enable_Breakpoint_1=&Enable Breakpoint
|
||||||
EnableDisableBreakpointRulerAction.Enabling_disabling_breakpoints_1=Enabling/disabling breakpoints
|
EnableDisableBreakpointRulerAction.Enabling_disabling_breakpoints_1=Enabling/disabling breakpoints
|
||||||
EnableDisableBreakpointRulerAction.Exceptions_occurred_enabling_or_disabling_breakpoint_1=Exceptions occurred enabling or disabling the breakpoint
|
EnableDisableBreakpointRulerAction.Exceptions_occurred_enabling_or_disabling_breakpoint_1=Exceptions occurred enabling or disabling the breakpoint
|
||||||
EnableDisableBreakpointRulerAction.Disable_Breakpoint_1=&Disable Breakpoint\tShift+Double Click
|
EnableDisableBreakpointRulerAction.Disable_Breakpoint_1=&Disable Breakpoint
|
||||||
ToggleWatchpointActionDelegate.Operation_failed_1=Operation failed.
|
ToggleWatchpointActionDelegate.Operation_failed_1=Operation failed.
|
||||||
ToggleBreakpointRulerAction.Error_1=Error
|
ToggleBreakpointRulerAction.Error_1=Error
|
||||||
ToggleBreakpointRulerAction.Operation_failed_1=Operation failed
|
ToggleBreakpointRulerAction.Operation_failed_1=Operation failed
|
||||||
CBreakpointPropertiesRulerAction.Breakpoint_Properties=Breakpoint &Properties...\tCtrl+Double Click
|
CBreakpointPropertiesRulerAction.Breakpoint_Properties=Breakpoint &Properties...
|
||||||
CBreakpointPropertiesRulerAction.Error=Unable to edit breakpoint properties.
|
CBreakpointPropertiesRulerAction.Error=Unable to edit breakpoint properties.
|
||||||
ResumeAtLineActionDelegate.Error_1=Error
|
ResumeAtLineActionDelegate.Error_1=Error
|
||||||
ResumeAtLineActionDelegate.1=Error
|
ResumeAtLineActionDelegate.1=Error
|
||||||
|
@ -129,7 +129,8 @@ RetargetAction.0=Error
|
||||||
RetargetAction.1=Operation failed
|
RetargetAction.1=Operation failed
|
||||||
RetargetMoveToLineAction.0=The operation is unavailable on the current selection. Please place the cursor on valid line to run to.
|
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.
|
RetargetResumeAtLineAction.0=The operation is unavailable on the current selection. Please place the cursor on valid line to run to.
|
||||||
CAddBreakpointInteractiveRulerAction_label=&Add Breakpoint...\tCtrl+Double Click
|
CAddBreakpointInteractiveRulerAction_label=&Add Breakpoint...
|
||||||
CAddBreakpointInteractiveRulerAction_error_title=Error
|
CAddBreakpointInteractiveRulerAction_error_title=Error
|
||||||
CAddBreakpointInteractiveRulerAction_error_message=Unable to create breakpoint
|
CAddBreakpointInteractiveRulerAction_error_message=Unable to create breakpoint
|
||||||
CRulerToggleBreakpointActionDelegate_label=Toggle Brea&kpoint
|
CRulerToggleBreakpointActionDelegate_label=Toggle Brea&kpoint
|
||||||
|
CRulerToggleBreakpointAction_accelerator=Double Click
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
|
||||||
import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
|
import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
|
import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
|
||||||
|
@ -30,6 +31,7 @@ import org.eclipse.jface.text.TextSelection;
|
||||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
import org.eclipse.ui.texteditor.IDocumentProvider;
|
import org.eclipse.ui.texteditor.IDocumentProvider;
|
||||||
import org.eclipse.ui.texteditor.ITextEditor;
|
import org.eclipse.ui.texteditor.ITextEditor;
|
||||||
|
@ -68,7 +70,8 @@ public class CAddBreakpointInteractiveRulerAction extends Action implements IUpd
|
||||||
* @param rulerInfo specifies location the user has double-clicked
|
* @param rulerInfo specifies location the user has double-clicked
|
||||||
*/
|
*/
|
||||||
public CAddBreakpointInteractiveRulerAction(IWorkbenchPart part, IDocument document, IVerticalRulerInfo rulerInfo) {
|
public CAddBreakpointInteractiveRulerAction(IWorkbenchPart part, IDocument document, IVerticalRulerInfo rulerInfo) {
|
||||||
super(ActionMessages.getString("CAddBreakpointInteractiveRulerAction_label")); //$NON-NLS-1$
|
super(ActionMessages.getString("CAddBreakpointInteractiveRulerAction_label") + "\t" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
CDebugUIUtils.formatKeyBindingString(SWT.MOD1, ActionMessages.getString("CRulerToggleBreakpointAction_accelerator")) ); //$NON-NLS-1$
|
||||||
fPart = part;
|
fPart = part;
|
||||||
fDocument = document;
|
fDocument = document;
|
||||||
fRulerInfo = rulerInfo;
|
fRulerInfo = rulerInfo;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
|
||||||
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
||||||
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
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.ActionMessages;
|
||||||
|
@ -25,6 +26,7 @@ import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,7 +42,8 @@ public class CBreakpointPropertiesRulerAction extends AbstractBreakpointRulerAct
|
||||||
*/
|
*/
|
||||||
public CBreakpointPropertiesRulerAction( IWorkbenchPart part, IVerticalRulerInfo info ) {
|
public CBreakpointPropertiesRulerAction( IWorkbenchPart part, IVerticalRulerInfo info ) {
|
||||||
super( part, info );
|
super( part, info );
|
||||||
setText( ActionMessages.getString( "CBreakpointPropertiesRulerAction.Breakpoint_Properties" ) ); //$NON-NLS-1$
|
setText( ActionMessages.getString( "CBreakpointPropertiesRulerAction.Breakpoint_Properties" ) + "\t" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
CDebugUIUtils.formatKeyBindingString(SWT.MOD1, ActionMessages.getString("CRulerToggleBreakpointAction_accelerator")) ); //$NON-NLS-1$
|
||||||
part.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.BREAKPOINT_PROPERTIES_ACTION );
|
part.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.BREAKPOINT_PROPERTIES_ACTION );
|
||||||
setId( IInternalCDebugUIConstants.ACTION_BREAKPOINT_PROPERTIES );
|
setId( IInternalCDebugUIConstants.ACTION_BREAKPOINT_PROPERTIES );
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
|
||||||
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
||||||
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
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.ActionMessages;
|
||||||
|
@ -19,6 +20,7 @@ import org.eclipse.debug.core.DebugPlugin;
|
||||||
import org.eclipse.debug.core.model.IBreakpoint;
|
import org.eclipse.debug.core.model.IBreakpoint;
|
||||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
|
||||||
public class EnableDisableBreakpointRulerAction extends AbstractBreakpointRulerAction {
|
public class EnableDisableBreakpointRulerAction extends AbstractBreakpointRulerAction {
|
||||||
|
@ -30,7 +32,8 @@ public class EnableDisableBreakpointRulerAction extends AbstractBreakpointRulerA
|
||||||
*/
|
*/
|
||||||
public EnableDisableBreakpointRulerAction( IWorkbenchPart part, IVerticalRulerInfo info ) {
|
public EnableDisableBreakpointRulerAction( IWorkbenchPart part, IVerticalRulerInfo info ) {
|
||||||
super( part, info );
|
super( part, info );
|
||||||
setText( ActionMessages.getString( "EnableDisableBreakpointRulerAction.Enable_Breakpoint_1" ) ); //$NON-NLS-1$
|
setText( ActionMessages.getString( "EnableDisableBreakpointRulerAction.Enable_Breakpoint_1" ) + "\t" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
CDebugUIUtils.formatKeyBindingString(SWT.MOD2, ActionMessages.getString("CRulerToggleBreakpointAction_accelerator")) ); //$NON-NLS-1$
|
||||||
part.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.ENABLE_DISABLE_BREAKPOINT_ACTION );
|
part.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.ENABLE_DISABLE_BREAKPOINT_ACTION );
|
||||||
setId( IInternalCDebugUIConstants.ACTION_ENABLE_DISABLE_BREAKPOINT );
|
setId( IInternalCDebugUIConstants.ACTION_ENABLE_DISABLE_BREAKPOINT );
|
||||||
}
|
}
|
||||||
|
@ -61,8 +64,13 @@ public class EnableDisableBreakpointRulerAction extends AbstractBreakpointRulerA
|
||||||
setEnabled( fBreakpoint != null );
|
setEnabled( fBreakpoint != null );
|
||||||
if ( isEnabled() ) {
|
if ( isEnabled() ) {
|
||||||
try {
|
try {
|
||||||
boolean enabled = getBreakpoint().isEnabled();
|
if (getBreakpoint().isEnabled()) {
|
||||||
setText( enabled ? ActionMessages.getString( "EnableDisableBreakpointRulerAction.Disable_Breakpoint_1" ) : ActionMessages.getString( "EnableDisableBreakpointRulerAction.Enable_Breakpoint_1" ) ); //$NON-NLS-1$ //$NON-NLS-2$
|
setText( ActionMessages.getString("EnableDisableBreakpointRulerAction.Disable_Breakpoint_1") + "\t" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
CDebugUIUtils.formatKeyBindingString(SWT.MOD2, ActionMessages.getString("CRulerToggleBreakpointAction_accelerator")) ); //$NON-NLS-1$
|
||||||
|
} else {
|
||||||
|
setText( ActionMessages.getString("EnableDisableBreakpointRulerAction.Enable_Breakpoint_1") + "\t" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
CDebugUIUtils.formatKeyBindingString(SWT.MOD2, ActionMessages.getString("CRulerToggleBreakpointAction_accelerator")) ); //$NON-NLS-1$
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch( CoreException e ) {
|
catch( CoreException e ) {
|
||||||
DebugPlugin.log( e );
|
DebugPlugin.log( e );
|
||||||
|
|
|
@ -0,0 +1,193 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2007, 2012 Nokia 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 implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.debug.ui.breakpointactions;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.StringReader;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.transform.OutputKeys;
|
||||||
|
import javax.xml.transform.Transformer;
|
||||||
|
import javax.xml.transform.TransformerFactory;
|
||||||
|
import javax.xml.transform.dom.DOMSource;
|
||||||
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||||
|
import org.eclipse.cdt.debug.core.breakpointactions.AbstractBreakpointAction;
|
||||||
|
import org.eclipse.cdt.debug.core.breakpointactions.IReverseDebugEnabler;
|
||||||
|
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
||||||
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.debug.core.model.IBreakpoint;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.xml.sax.InputSource;
|
||||||
|
import org.xml.sax.helpers.DefaultHandler;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the reverse debug breakpoint action
|
||||||
|
*
|
||||||
|
*@since 7.3
|
||||||
|
*/
|
||||||
|
public class ReverseDebugAction extends AbstractBreakpointAction{
|
||||||
|
/**
|
||||||
|
* The available reverse debug action modes: enable, disable and toggle.
|
||||||
|
*/
|
||||||
|
public static enum REVERSE_DEBUG_ACTIONS_ENUM {
|
||||||
|
|
||||||
|
ENABLE, DISABLE, TOGGLE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param index
|
||||||
|
* @return the enum value for the given index
|
||||||
|
*/
|
||||||
|
public static REVERSE_DEBUG_ACTIONS_ENUM getValue(int index) {
|
||||||
|
return REVERSE_DEBUG_ACTIONS_ENUM.values()[index];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
private REVERSE_DEBUG_ACTIONS_ENUM fOperation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the currently configured reverse debug mode, for this BP action
|
||||||
|
*/
|
||||||
|
public REVERSE_DEBUG_ACTIONS_ENUM getOperation() {
|
||||||
|
return fOperation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the currently configured reverse debug mode, for this BP action
|
||||||
|
* @param operation
|
||||||
|
*/
|
||||||
|
public void setOperation(REVERSE_DEBUG_ACTIONS_ENUM operation) {
|
||||||
|
this.fOperation = operation;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IStatus execute(IBreakpoint breakpoint, IAdaptable context, IProgressMonitor monitor) {
|
||||||
|
IStatus errorStatus = null;
|
||||||
|
|
||||||
|
IReverseDebugEnabler enabler = (IReverseDebugEnabler) context.getAdapter(IReverseDebugEnabler.class);
|
||||||
|
if (enabler != null) {
|
||||||
|
try {
|
||||||
|
switch (fOperation) {
|
||||||
|
case TOGGLE:
|
||||||
|
enabler.toggle();
|
||||||
|
break;
|
||||||
|
case ENABLE:
|
||||||
|
enabler.enable();
|
||||||
|
break;
|
||||||
|
case DISABLE:
|
||||||
|
enabler.disable();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
errorStatus = new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, e.getMessage(), e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
errorStatus = new Status( IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), IInternalCDebugUIConstants.INTERNAL_ERROR, Messages.getString("ReverseDebugAction.error.0"), null ); //$NON-NLS-1$
|
||||||
|
|
||||||
|
if (errorStatus != null) {
|
||||||
|
MultiStatus ms = new MultiStatus( CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, Messages.getString("ReverseDebugAction.error.1"), null ); //$NON-NLS-1$
|
||||||
|
ms.add( errorStatus);
|
||||||
|
errorStatus = ms;
|
||||||
|
} else {
|
||||||
|
errorStatus = monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return errorStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMemento() {
|
||||||
|
String reverseDebugData = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
|
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
|
||||||
|
DocumentBuilder docBuilder = null;
|
||||||
|
try {
|
||||||
|
docBuilder = dfactory.newDocumentBuilder();
|
||||||
|
Document doc = docBuilder.newDocument();
|
||||||
|
|
||||||
|
Element rootElement = doc.createElement("reverseDebugData"); //$NON-NLS-1$
|
||||||
|
rootElement.setAttribute("operation", fOperation.toString()); //$NON-NLS-1$
|
||||||
|
|
||||||
|
doc.appendChild(rootElement);
|
||||||
|
|
||||||
|
ByteArrayOutputStream s = new ByteArrayOutputStream();
|
||||||
|
|
||||||
|
TransformerFactory factory = TransformerFactory.newInstance();
|
||||||
|
Transformer transformer = factory.newTransformer();
|
||||||
|
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
|
||||||
|
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
DOMSource source = new DOMSource(doc);
|
||||||
|
StreamResult outputTarget = new StreamResult(s);
|
||||||
|
transformer.transform(source, outputTarget);
|
||||||
|
|
||||||
|
reverseDebugData = s.toString("UTF8"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return reverseDebugData;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initializeFromMemento(String data) {
|
||||||
|
Element root = null;
|
||||||
|
DocumentBuilder parser;
|
||||||
|
try {
|
||||||
|
parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||||
|
parser.setErrorHandler(new DefaultHandler());
|
||||||
|
root = parser.parse(new InputSource(new StringReader(data))).getDocumentElement();
|
||||||
|
String value = root.getAttribute("operation"); //$NON-NLS-1$
|
||||||
|
if (value == null)
|
||||||
|
throw new Exception();
|
||||||
|
fOperation = REVERSE_DEBUG_ACTIONS_ENUM.valueOf(value);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultName() {
|
||||||
|
return Messages.getString("ReverseDebugAction.UntitledName"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSummary() {
|
||||||
|
// get translated operation
|
||||||
|
String operation = Messages.getString("ReverseDebugAction."+fOperation.toString().toLowerCase()); //$NON-NLS-1$
|
||||||
|
|
||||||
|
return operation + " " + Messages.getString("ReverseDebugAction.Summary"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTypeName() {
|
||||||
|
return Messages.getString("ReverseDebugAction.TypeName"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdentifier() {
|
||||||
|
return "org.eclipse.cdt.debug.ui.breakpointactions.ReverseDebugAction"; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2007, 2012 Nokia 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 implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.debug.ui.breakpointactions;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.ui.breakpointactions.ReverseDebugAction.REVERSE_DEBUG_ACTIONS_ENUM;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Combo;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 7.3
|
||||||
|
*/
|
||||||
|
public class ReverseDebugActionComposite extends Composite {
|
||||||
|
private Combo combo;
|
||||||
|
|
||||||
|
public ReverseDebugActionComposite(Composite parent, int style, ReverseDebugActionPage page) {
|
||||||
|
super(parent, style);
|
||||||
|
final GridLayout gridLayout = new GridLayout();
|
||||||
|
gridLayout.numColumns = 3;
|
||||||
|
setLayout(gridLayout);
|
||||||
|
|
||||||
|
final Label reverseDebugActionLabel = new Label(this, SWT.NONE);
|
||||||
|
reverseDebugActionLabel.setText(Messages.getString("ReverseDebugActionComposite.label")); //$NON-NLS-1$
|
||||||
|
|
||||||
|
// combo widget that lets the user select which reverse debug action to set
|
||||||
|
combo = new Combo(this, SWT.READ_ONLY);
|
||||||
|
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
||||||
|
|
||||||
|
// add the available reverse debug actions to the combo drop-down list
|
||||||
|
for(REVERSE_DEBUG_ACTIONS_ENUM elem : REVERSE_DEBUG_ACTIONS_ENUM.values()) {
|
||||||
|
String option = elem.toString().toLowerCase();
|
||||||
|
combo.add(Messages.getString("ReverseDebugAction."+option)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
combo.select(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The currently selected reverse debug action
|
||||||
|
*/
|
||||||
|
public REVERSE_DEBUG_ACTIONS_ENUM getOperation() {
|
||||||
|
int index = combo.getSelectionIndex();
|
||||||
|
|
||||||
|
return REVERSE_DEBUG_ACTIONS_ENUM.getValue(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2007, 2012 Nokia 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 implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.debug.ui.breakpointactions;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.breakpointactions.IBreakpointAction;
|
||||||
|
import org.eclipse.core.runtime.PlatformObject;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@since 7.3
|
||||||
|
*/
|
||||||
|
public class ReverseDebugActionPage extends PlatformObject implements IBreakpointActionPage{
|
||||||
|
|
||||||
|
private ReverseDebugActionComposite reverseDebugActionComposite;
|
||||||
|
private ReverseDebugAction reverseDebugAction;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionDialogCanceled() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionDialogOK() {
|
||||||
|
reverseDebugAction.setOperation(reverseDebugActionComposite.getOperation());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Composite createComposite(IBreakpointAction action,
|
||||||
|
Composite composite, int style) {
|
||||||
|
reverseDebugAction = (ReverseDebugAction) action;
|
||||||
|
reverseDebugActionComposite = new ReverseDebugActionComposite(composite, style, this);
|
||||||
|
return reverseDebugActionComposite;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Copyright (c) 2005, 2007 Nokia
|
# Copyright (c) 2005, 2012 Nokia
|
||||||
# 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
|
||||||
|
@ -60,3 +60,13 @@ ResumeActionComposite.Seconds=seconds
|
||||||
ResumeAction.TypeName=Resume Action
|
ResumeAction.TypeName=Resume Action
|
||||||
ResumeAction.error.0=IResumeActionEnabler not registered in context.
|
ResumeAction.error.0=IResumeActionEnabler not registered in context.
|
||||||
ResumeAction.error.1=Could not resume.
|
ResumeAction.error.1=Could not resume.
|
||||||
|
|
||||||
|
ReverseDebugAction.UntitledName=Untitled Rev Debug Action
|
||||||
|
ReverseDebugAction.TypeName=Rev Debug Action
|
||||||
|
ReverseDebugActionComposite.label=Select Reverse Debugging Action
|
||||||
|
ReverseDebugAction.Summary= reverse debugging
|
||||||
|
ReverseDebugAction.error.0=IReverseToggleEnabler not registered in context.
|
||||||
|
ReverseDebugAction.error.1=Could not do reverse debug operation
|
||||||
|
ReverseDebugAction.enable=Enable
|
||||||
|
ReverseDebugAction.disable=Disable
|
||||||
|
ReverseDebugAction.toggle=Toggle
|
||||||
|
|
|
@ -225,20 +225,20 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
|
||||||
contextBreakpoints.put(reference, newBreakpoint);
|
contextBreakpoints.put(reference, newBreakpoint);
|
||||||
|
|
||||||
// Format the return value
|
// Format the return value
|
||||||
MIBreakpointDMContext dmc = new MIBreakpointDMContext(GDBBreakpoints_7_2.this, new IDMContext[] { context }, reference);
|
MIBreakpointDMContext dmc = new MIBreakpointDMContext(GDBBreakpoints_7_2.this, new IDMContext[] { context }, reference);
|
||||||
drm.setData(dmc);
|
drm.setData(dmc);
|
||||||
|
|
||||||
// Flag the event
|
// Flag the event
|
||||||
getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
|
getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties());
|
||||||
|
|
||||||
// Tracepoints are created with no passcount (passcount are not
|
// Tracepoints are created with no passcount (passcount are not
|
||||||
// the same thing as ignore-count, which is not supported by
|
// the same thing as ignore-count, which is not supported by
|
||||||
// tracepoints). We have to set the passcount manually now.
|
// tracepoints). We have to set the passcount manually now.
|
||||||
// Same for commands.
|
// Same for commands.
|
||||||
Map<String,Object> delta = new HashMap<String,Object>();
|
Map<String,Object> delta = new HashMap<String,Object>();
|
||||||
delta.put(MIBreakpoints.PASS_COUNT, getProperty(attributes, MIBreakpoints.PASS_COUNT, 0));
|
delta.put(MIBreakpoints.PASS_COUNT, getProperty(attributes, MIBreakpoints.PASS_COUNT, 0));
|
||||||
delta.put(MIBreakpoints.COMMANDS, getProperty(attributes, MIBreakpoints.COMMANDS, "")); //$NON-NLS-1$
|
delta.put(MIBreakpoints.COMMANDS, getProperty(attributes, MIBreakpoints.COMMANDS, "")); //$NON-NLS-1$
|
||||||
modifyBreakpoint(dmc, delta, drm, false);
|
modifyBreakpoint(dmc, delta, drm, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008, 2010 Ericsson and others.
|
* Copyright (c) 2008, 2012 Ericsson 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
|
||||||
|
@ -7,12 +7,14 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Ericsson - Initial API and implementation
|
* Ericsson - Initial API and implementation
|
||||||
|
* Marc Dumais (Ericsson) - Added support for reverse debug action (Bug 365776)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.dsf.mi.service.breakpoint.actions;
|
package org.eclipse.cdt.dsf.mi.service.breakpoint.actions;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.breakpointactions.ILogActionEnabler;
|
import org.eclipse.cdt.debug.core.breakpointactions.ILogActionEnabler;
|
||||||
import org.eclipse.cdt.debug.core.breakpointactions.IResumeActionEnabler;
|
import org.eclipse.cdt.debug.core.breakpointactions.IResumeActionEnabler;
|
||||||
|
import org.eclipse.cdt.debug.core.breakpointactions.IReverseDebugEnabler;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
||||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||||
|
@ -42,6 +44,9 @@ public class BreakpointActionAdapter implements IAdaptable {
|
||||||
if (adapter.equals(IResumeActionEnabler.class)) {
|
if (adapter.equals(IResumeActionEnabler.class)) {
|
||||||
return new MIResumeActionEnabler(fExecutor, fServiceTracker, fContext);
|
return new MIResumeActionEnabler(fExecutor, fServiceTracker, fContext);
|
||||||
}
|
}
|
||||||
|
if (adapter.equals(IReverseDebugEnabler.class)) {
|
||||||
|
return new MIReverseDebugEnabler(fExecutor, fServiceTracker, fContext);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2012 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:
|
||||||
|
* Marc Dumais (Ericsson) - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.dsf.mi.service.breakpoint.actions;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.breakpointactions.IReverseDebugEnabler;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
|
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
|
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.service.IReverseRunControl;
|
||||||
|
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This class permits to enable, disable or toggle the reverse
|
||||||
|
* debugging mode.
|
||||||
|
*
|
||||||
|
* @since 4.2
|
||||||
|
*/
|
||||||
|
public class MIReverseDebugEnabler implements IReverseDebugEnabler {
|
||||||
|
private final DsfExecutor fExecutor;
|
||||||
|
private final DsfServicesTracker fServiceTracker;
|
||||||
|
private final ICommandControlDMContext fContext;
|
||||||
|
private static enum REVERSE_DEBUG_MODE {ENABLE, DISABLE, TOGGLE};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param executor
|
||||||
|
* @param serviceTracker
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
public MIReverseDebugEnabler(DsfExecutor executor, DsfServicesTracker serviceTracker, IDMContext context) {
|
||||||
|
fExecutor = executor;
|
||||||
|
fServiceTracker = serviceTracker;
|
||||||
|
fContext = DMContexts.getAncestorOfType(context, ICommandControlDMContext.class);
|
||||||
|
assert fContext != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enable() throws Exception {
|
||||||
|
setMode(REVERSE_DEBUG_MODE.ENABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disable() throws Exception {
|
||||||
|
setMode(REVERSE_DEBUG_MODE.DISABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toggle() throws Exception {
|
||||||
|
setMode(REVERSE_DEBUG_MODE.TOGGLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setMode(final REVERSE_DEBUG_MODE mode) throws Exception {
|
||||||
|
fExecutor.execute(new DsfRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
final IReverseRunControl runControl = fServiceTracker.getService(IReverseRunControl.class);
|
||||||
|
if (runControl != null) {
|
||||||
|
runControl.isReverseModeEnabled(fContext, new DataRequestMonitor<Boolean>(fExecutor, null) {
|
||||||
|
@Override
|
||||||
|
public void handleSuccess() {
|
||||||
|
Boolean enabled = getData();
|
||||||
|
if ( (enabled.equals(false) && mode.equals(REVERSE_DEBUG_MODE.ENABLE) ) ||
|
||||||
|
(enabled.equals(true) && mode.equals(REVERSE_DEBUG_MODE.DISABLE) ) ||
|
||||||
|
(mode.equals(REVERSE_DEBUG_MODE.TOGGLE)) )
|
||||||
|
{
|
||||||
|
runControl.enableReverseMode(fContext, !enabled, new RequestMonitor(fExecutor, null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -31,9 +31,9 @@ commandContext.name= In Disassembly
|
||||||
commandContext.description= When debugging in assembly mode
|
commandContext.description= When debugging in assembly mode
|
||||||
|
|
||||||
# actions
|
# actions
|
||||||
action.breakpointProperties.label = Breakpoint Properties...\Ctrl+Double Click
|
action.breakpointProperties.label = Breakpoint Properties...
|
||||||
action.toggleBreakpoint.label = Toggle Breakpoint\tDouble Click
|
action.toggleBreakpoint.label = Toggle Breakpoint
|
||||||
action.addBreakpoint.label = Add Breakpoint...\tCtrl+Double Click
|
action.addBreakpoint.label = Add Breakpoint...
|
||||||
|
|
||||||
menu.updatePolicy = Update Policy
|
menu.updatePolicy = Update Policy
|
||||||
menu.threadsUpdatePolicy = Threads Update Policy
|
menu.threadsUpdatePolicy = Threads Update Policy
|
||||||
|
|
|
@ -83,9 +83,11 @@ public final class DisassemblyMessages extends NLS {
|
||||||
public static String Disassembly_Error_Dialog_title;
|
public static String Disassembly_Error_Dialog_title;
|
||||||
public static String Disassembly_Error_Dialog_ok_button;
|
public static String Disassembly_Error_Dialog_ok_button;
|
||||||
public static String DisassemblyBackendDsf_error_UnableToRetrieveData;
|
public static String DisassemblyBackendDsf_error_UnableToRetrieveData;
|
||||||
public static String Disassembly_action_AddBreakpoint_label;
|
public static String Disassembly_action_AddBreakpoint_label;
|
||||||
public static String Disassembly_action_AddBreakpoint_errorTitle;
|
public static String Disassembly_action_AddBreakpoint_errorTitle;
|
||||||
public static String Disassembly_action_AddBreakpoint_errorMessage;
|
public static String Disassembly_action_AddBreakpoint_errorMessage;
|
||||||
|
public static String Disassembly_action_ToggleBreakpoint_accelerator;
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
NLS.initializeMessages(DisassemblyMessages.class.getName(), DisassemblyMessages.class);
|
NLS.initializeMessages(DisassemblyMessages.class.getName(), DisassemblyMessages.class);
|
||||||
|
|
|
@ -18,14 +18,15 @@ Disassembly_action_GotoPC_tooltip=Go to Current Program Counter
|
||||||
Disassembly_action_GotoAddress_label=Go to Address...
|
Disassembly_action_GotoAddress_label=Go to Address...
|
||||||
Disassembly_action_Copy_label=&Copy
|
Disassembly_action_Copy_label=&Copy
|
||||||
Disassembly_action_SelectAll_label=Select &All
|
Disassembly_action_SelectAll_label=Select &All
|
||||||
Disassembly_action_BreakpointProperties_label=Breakpoint Properties...\tCtrl+Double Click
|
Disassembly_action_BreakpointProperties_label=Breakpoint Properties...
|
||||||
Disassembly_action_DisableBreakpoint_label=Disable Breakpoint\tShift+Double Click
|
Disassembly_action_ToggleBreakpoint_accelerator=Double Click
|
||||||
Disassembly_action_EnableBreakpoint_label=Enable Breakpoint\tShift+Double Click
|
Disassembly_action_EnableBreakpoint_label=Enable Breakpoint
|
||||||
|
Disassembly_action_DisableBreakpoint_label=Disable Breakpoint
|
||||||
Disassembly_action_RefreshView_label=Re&fresh View
|
Disassembly_action_RefreshView_label=Re&fresh View
|
||||||
Disassembly_action_OpenPreferences_label=&Preferences...
|
Disassembly_action_OpenPreferences_label=&Preferences...
|
||||||
Disassembly_action_Sync_label=Link with Active Debug Context
|
Disassembly_action_Sync_label=Link with Active Debug Context
|
||||||
Disassembly_action_TrackExpression_label=Track Expression
|
Disassembly_action_TrackExpression_label=Track Expression
|
||||||
Disassembly_action_AddBreakpoint_label=Add Breakpoint...\tCtrl+Double Click
|
Disassembly_action_AddBreakpoint_label=Add Breakpoint...
|
||||||
Disassembly_action_AddBreakpoint_errorTitle=Error
|
Disassembly_action_AddBreakpoint_errorTitle=Error
|
||||||
Disassembly_action_AddBreakpoint_errorMessage=Unable to create breakpoint
|
Disassembly_action_AddBreakpoint_errorMessage=Unable to create breakpoint
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.IAddress;
|
import org.eclipse.cdt.core.IAddress;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AbstractDisassemblyBackend;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AbstractDisassemblyBackend;
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition;
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyPosition;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyPosition;
|
||||||
|
@ -414,7 +415,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
private IBreakpoint fBreakpoint;
|
private IBreakpoint fBreakpoint;
|
||||||
public ActionToggleBreakpointEnablement() {
|
public ActionToggleBreakpointEnablement() {
|
||||||
super(DisassemblyPart.this);
|
super(DisassemblyPart.this);
|
||||||
setText(DisassemblyMessages.Disassembly_action_EnableBreakpoint_label);
|
setText(DisassemblyMessages.Disassembly_action_EnableBreakpoint_label + "\t" + //$NON-NLS-1$
|
||||||
|
CDebugUIUtils.formatKeyBindingString(SWT.MOD2, DisassemblyMessages.Disassembly_action_ToggleBreakpoint_accelerator));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -436,9 +438,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
fBreakpoint = bps[0];
|
fBreakpoint = bps[0];
|
||||||
try {
|
try {
|
||||||
if (fBreakpoint.isEnabled()) {
|
if (fBreakpoint.isEnabled()) {
|
||||||
setText(DisassemblyMessages.Disassembly_action_DisableBreakpoint_label);
|
setText(DisassemblyMessages.Disassembly_action_DisableBreakpoint_label + "\t" + //$NON-NLS-1$
|
||||||
|
CDebugUIUtils.formatKeyBindingString(SWT.MOD2, DisassemblyMessages.Disassembly_action_ToggleBreakpoint_accelerator));
|
||||||
} else {
|
} else {
|
||||||
setText(DisassemblyMessages.Disassembly_action_EnableBreakpoint_label);
|
setText(DisassemblyMessages.Disassembly_action_EnableBreakpoint_label + "\t" + //$NON-NLS-1$
|
||||||
|
CDebugUIUtils.formatKeyBindingString(SWT.MOD2, DisassemblyMessages.Disassembly_action_ToggleBreakpoint_accelerator));
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
|
||||||
import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
|
import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
|
import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
|
||||||
|
@ -31,6 +32,7 @@ import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,7 +43,8 @@ public class AddBreakpointRulerAction extends AbstractDisassemblyBreakpointRuler
|
||||||
|
|
||||||
protected AddBreakpointRulerAction(IDisassemblyPart disassemblyPart, IVerticalRulerInfo rulerInfo) {
|
protected AddBreakpointRulerAction(IDisassemblyPart disassemblyPart, IVerticalRulerInfo rulerInfo) {
|
||||||
super(disassemblyPart, rulerInfo);
|
super(disassemblyPart, rulerInfo);
|
||||||
setText(DisassemblyMessages.Disassembly_action_AddBreakpoint_label);
|
setText(DisassemblyMessages.Disassembly_action_AddBreakpoint_label + "\t" + //$NON-NLS-1$
|
||||||
|
CDebugUIUtils.formatKeyBindingString(SWT.MOD1, DisassemblyMessages.Disassembly_action_ToggleBreakpoint_accelerator));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
|
||||||
import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointPropertyDialogAction;
|
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.DisassemblyMessages;
|
||||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||||
|
@ -23,6 +24,7 @@ import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +37,8 @@ public class BreakpointPropertiesRulerAction extends AbstractDisassemblyBreakpoi
|
||||||
|
|
||||||
protected BreakpointPropertiesRulerAction(IDisassemblyPart disassemblyPart, IVerticalRulerInfo rulerInfo) {
|
protected BreakpointPropertiesRulerAction(IDisassemblyPart disassemblyPart, IVerticalRulerInfo rulerInfo) {
|
||||||
super(disassemblyPart, rulerInfo);
|
super(disassemblyPart, rulerInfo);
|
||||||
setText(DisassemblyMessages.Disassembly_action_BreakpointProperties_label);
|
setText(DisassemblyMessages.Disassembly_action_BreakpointProperties_label + "\t" + //$NON-NLS-1$
|
||||||
|
CDebugUIUtils.formatKeyBindingString(SWT.MOD1, DisassemblyMessages.Disassembly_action_ToggleBreakpoint_accelerator));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue