Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.tcf.debug.ui')
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/icons/reset.gifbin0 -> 353 bytes
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/plugin.properties5
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/plugin.xml52
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/ResetHandler.java71
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/ResetMenu.java102
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/launch/TCFPropertyTester.java37
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java41
7 files changed, 303 insertions, 5 deletions
diff --git a/plugins/org.eclipse.tcf.debug.ui/icons/reset.gif b/plugins/org.eclipse.tcf.debug.ui/icons/reset.gif
new file mode 100644
index 000000000..5708b00dd
--- /dev/null
+++ b/plugins/org.eclipse.tcf.debug.ui/icons/reset.gif
Binary files differ
diff --git a/plugins/org.eclipse.tcf.debug.ui/plugin.properties b/plugins/org.eclipse.tcf.debug.ui/plugin.properties
index d5ce030e0..70ec4c099 100644
--- a/plugins/org.eclipse.tcf.debug.ui/plugin.properties
+++ b/plugins/org.eclipse.tcf.debug.ui/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2007, 2015 Wind River Systems, Inc. and others.
+# Copyright (c) 2007-2019 Wind River Systems, Inc. and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -63,6 +63,9 @@ propertyPage.name = Debug Element
debugview.menu.filters=Filter
debugview.menu.sorters=Sorting
+Reset.label=Reset
+Reset.tooltip=Reset
+
command.preferences.label=Preferences...
# ***** Activity contributions *****
diff --git a/plugins/org.eclipse.tcf.debug.ui/plugin.xml b/plugins/org.eclipse.tcf.debug.ui/plugin.xml
index 766d4a2e8..ae5c793cc 100644
--- a/plugins/org.eclipse.tcf.debug.ui/plugin.xml
+++ b/plugins/org.eclipse.tcf.debug.ui/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<!--
- Copyright (c) 2010, 2014 Wind River Systems, Inc. and others.
+ Copyright (c) 2010-2019 Wind River Systems, Inc. and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
@@ -75,7 +75,7 @@
<extension point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
namespace="org.eclipse.tcf.launch"
- properties="isExecutable,areUpdatePoliciesSupported"
+ properties="isExecutable,areUpdatePoliciesSupported,canReset"
type="org.eclipse.core.runtime.IAdaptable"
class="org.eclipse.tcf.internal.debug.ui.launch.TCFPropertyTester"
id="org.eclipse.tcf.launch.PropertyTester">
@@ -388,6 +388,16 @@
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
+ <command
+ categoryId="org.eclipse.tcf.debug.ui.commands"
+ id="org.eclipse.tcf.debug.ui.commands.reset"
+ name="%Reset.label">
+ <commandParameter
+ id="org.eclipse.tcf.debug.ui.commands.reset.param.type"
+ name="type"
+ optional="true">
+ </commandParameter>
+ </command>
</extension>
<extension point="org.eclipse.ui.handlers">
@@ -463,6 +473,25 @@
</with>
</activeWhen>
</handler>
+ <handler
+ class="org.eclipse.tcf.internal.debug.ui.commands.ResetHandler"
+ commandId="org.eclipse.tcf.debug.ui.commands.reset">
+ <activeWhen>
+ <with
+ variable="debugContext">
+ <iterate
+ ifEmpty="false"
+ operator="or">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.tcf.launch.canReset">
+ </test></iterate>
+ <count
+ value="1">
+ </count>
+ </with>
+ </activeWhen>
+ </handler>
</extension>
<extension
@@ -743,6 +772,25 @@
</visibleWhen>
</menu>
</menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="toolbar:org.eclipse.debug.ui.main.toolbar?after=stepGroup">
+ <command
+ commandId="org.eclipse.tcf.debug.ui.commands.reset"
+ icon="icons/reset.gif"
+ label="%Reset.label"
+ style="pulldown"
+ tooltip="%Reset.tooltip">
+ </command>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="menu:org.eclipse.tcf.debug.ui.commands.reset">
+ <dynamic
+ class="org.eclipse.tcf.internal.debug.ui.commands.ResetMenu"
+ id="org.eclipse.tcf.debug.ui.menu.dynamic">
+ </dynamic>
+ </menuContribution>
</extension>
<extension
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/ResetHandler.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/ResetHandler.java
new file mode 100644
index 000000000..add7eeb90
--- /dev/null
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/ResetHandler.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2019.
+ * 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
+ *******************************************************************************/
+package org.eclipse.tcf.internal.debug.ui.commands;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tcf.internal.debug.ui.model.TCFNode;
+import org.eclipse.tcf.internal.debug.ui.model.TCFNodeExecContext;
+import org.eclipse.tcf.services.IContextReset;
+import org.eclipse.tcf.util.TCFDataCache;
+import org.eclipse.tcf.util.TCFTask;
+
+public class ResetHandler extends AbstractHandler {
+
+ private String getDefaultResetType(final TCFNodeExecContext exec) {
+ return new TCFTask<String>(exec.getChannel()) {
+ @Override
+ public void run() {
+ TCFDataCache<Collection<Map<String, Object>>> cache = exec.getResetCapabilities();
+ if (!cache.validate(this)) {
+ return;
+ }
+ Collection<Map<String, Object>> caps = cache.getData();
+ if (caps == null || caps.isEmpty()) {
+ done(null);
+ }
+ else {
+ @SuppressWarnings("unchecked")
+ Map<String, Object>[] items = caps.toArray(new Map[caps.size()]);
+ String type = items[0].get(IContextReset.CAPABILITY_TYPE).toString();
+ done(type);
+ }
+ }
+ }.getE();
+ }
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = DebugUITools.getDebugContextForEvent(event);
+ if (selection != null && selection instanceof IStructuredSelection) {
+ IStructuredSelection ssel = (IStructuredSelection)selection;
+ Object obj = ssel.getFirstElement();
+ if (obj instanceof TCFNode) {
+ TCFNode node = (TCFNode)obj;
+ while (node != null) {
+ if (node instanceof TCFNodeExecContext) {
+ TCFNodeExecContext exec = (TCFNodeExecContext)node;
+ String type = event.getParameter("org.eclipse.tcf.debug.ui.commands.reset.param.type");
+ if (type == null) type = getDefaultResetType(exec);
+ exec.reset(type, null);
+ break;
+ }
+ node = node.getParent();
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/ResetMenu.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/ResetMenu.java
new file mode 100644
index 000000000..fef57c404
--- /dev/null
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/commands/ResetMenu.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2019.
+ * 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
+ *******************************************************************************/
+package org.eclipse.tcf.internal.debug.ui.commands;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.tcf.internal.debug.ui.model.TCFNode;
+import org.eclipse.tcf.internal.debug.ui.model.TCFNodeExecContext;
+import org.eclipse.tcf.services.IContextReset;
+import org.eclipse.tcf.util.TCFDataCache;
+import org.eclipse.tcf.util.TCFTask;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.menus.CommandContributionItem;
+import org.eclipse.ui.menus.CommandContributionItemParameter;
+import org.eclipse.ui.menus.IWorkbenchContribution;
+import org.eclipse.ui.services.IServiceLocator;
+
+public class ResetMenu extends CompoundContributionItem implements IWorkbenchContribution {
+
+ private static IContributionItem[] EMPTY_MENU = new IContributionItem[0];
+
+ private IServiceLocator serviceLocator;
+
+ @Override
+ public void initialize(IServiceLocator serviceLocator) {
+ this.serviceLocator = serviceLocator;
+ }
+
+ static IStructuredSelection getDebugContext() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ ISelection selection = DebugUITools.getDebugContextManager().getContextService(window).getActiveContext();
+ if (selection != null && selection instanceof IStructuredSelection) {
+ return (IStructuredSelection) selection;
+ }
+ return StructuredSelection.EMPTY;
+ }
+
+ private IContributionItem makeContributionItem(TCFNodeExecContext exec, Map<String, Object> capability) {
+ String type = capability.get(IContextReset.CAPABILITY_TYPE).toString();
+ String desc = capability.get(IContextReset.CAPABILITY_DESCRIPTION).toString();
+ Map<String, Object> params = new HashMap<String, Object>();
+ CommandContributionItemParameter itemParameter;
+
+ params.put("org.eclipse.tcf.debug.ui.commands.reset.param.type", type);
+ itemParameter = new CommandContributionItemParameter(serviceLocator, null, null, 0);
+ itemParameter.commandId = "org.eclipse.tcf.debug.ui.commands.reset";
+ itemParameter.parameters = params;
+ itemParameter.label = desc;
+ return new CommandContributionItem(itemParameter);
+ }
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ IStructuredSelection sselection = getDebugContext();
+ Object obj = sselection.getFirstElement();
+ IContributionItem[] items = EMPTY_MENU;
+
+ if (obj instanceof TCFNode) {
+ TCFNode node = (TCFNode) obj;
+ while (node != null) {
+ if (node instanceof TCFNodeExecContext) {
+ final TCFNodeExecContext exec = (TCFNodeExecContext) node;
+ Collection<Map<String, Object>> capabilities;
+ capabilities = new TCFTask<Collection<Map<String, Object>>>(exec.getChannel()) {
+ @Override
+ public void run() {
+ TCFDataCache<Collection<Map<String, Object>>> cache = exec.getResetCapabilities();
+ if (!cache.validate(this)) {
+ return;
+ }
+ Collection<Map<String, Object>> capabilities = cache.getData();
+ done(capabilities);
+ }
+ }.getE();
+ items = new IContributionItem[capabilities.size()];
+ int i = 0;
+ for (Map<String, Object> c : capabilities) {
+ items[i] = makeContributionItem(exec, c);
+ ++i;
+ }
+ break;
+ }
+ node = node.getParent();
+ }
+ }
+ return items;
+ }
+}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/launch/TCFPropertyTester.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/launch/TCFPropertyTester.java
index d6170355d..ebf5dbc9c 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/launch/TCFPropertyTester.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/launch/TCFPropertyTester.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Wind River Systems, Inc. and others.
+ * Copyright (c) 2008-2019 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,6 +10,9 @@
*******************************************************************************/
package org.eclipse.tcf.internal.debug.ui.launch;
+import java.util.Collection;
+import java.util.Map;
+
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
@@ -17,12 +20,17 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.tcf.debug.ui.ITCFLaunchContext;
import org.eclipse.tcf.internal.debug.ui.Activator;
+import org.eclipse.tcf.internal.debug.ui.model.TCFNode;
+import org.eclipse.tcf.internal.debug.ui.model.TCFNodeExecContext;
+import org.eclipse.tcf.util.TCFDataCache;
+import org.eclipse.tcf.util.TCFTask;
public class TCFPropertyTester extends PropertyTester {
public boolean test(Object receiver, String property, Object[] args, Object expected_value) {
if (property.equals("areUpdatePoliciesSupported")) return testUpdatePoliciesSupported(receiver);
if (property.equals("isExecutable")) return testIsExecutable(receiver, expected_value);
+ if (property.equals("canReset")) return testCanReset(receiver);
return false;
}
@@ -51,4 +59,31 @@ public class TCFPropertyTester extends PropertyTester {
if (expected_value != null) return expected_value.equals(value);
return (value instanceof Boolean) && ((Boolean)value).booleanValue();
}
+
+ private boolean testCanReset(Object receiver) {
+ boolean canReset = false;
+
+ if (receiver instanceof TCFNode) {
+ TCFNode node = (TCFNode)receiver;
+ while (!canReset && node != null) {
+ if (node instanceof TCFNodeExecContext) {
+ final TCFNodeExecContext exec = (TCFNodeExecContext)node;
+ canReset = new TCFTask<Boolean>(exec.getChannel()) {
+ @Override
+ public void run() {
+ TCFDataCache<Collection<Map<String, Object>>> cache = exec.getResetCapabilities();
+ if (!cache.validate(this)) {
+ return;
+ }
+ Collection<Map<String, Object>> caps = cache.getData();
+ boolean ok = caps != null && !caps.isEmpty();
+ done(ok);
+ }
+ }.getE();
+ }
+ node = node.getParent();
+ }
+ }
+ return canReset;
+ }
}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java
index 3151588b4..0f1d7c5c7 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2017 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007-2019 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -46,6 +46,7 @@ import org.eclipse.tcf.internal.debug.ui.ImageCache;
import org.eclipse.tcf.protocol.IToken;
import org.eclipse.tcf.protocol.JSON;
import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IContextReset;
import org.eclipse.tcf.services.ILineNumbers;
import org.eclipse.tcf.services.IMemory;
import org.eclipse.tcf.services.IMemoryMap;
@@ -77,6 +78,7 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner, ITCFExe
private final TCFData<TCFNodeExecContext> memory_node;
private final TCFData<TCFNodeExecContext> symbols_node;
private final TCFData<String> full_name;
+ private final TCFData<Collection<Map<String,Object>>> reset_capabilities;
private LinkedHashMap<BigInteger,TCFDataCache<TCFSymFileRef>> syms_info_lookup_cache;
private LinkedHashMap<BigInteger,TCFDataCache<TCFSourceRef>> line_info_lookup_cache;
@@ -503,6 +505,24 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner, ITCFExe
return true;
}
};
+
+ reset_capabilities = new TCFData<Collection<Map<String, Object>>>(channel) {
+ @Override
+ protected boolean startDataRetrieval() {
+ IContextReset reset = launch.getService(IContextReset.class);
+ if (reset == null) {
+ set(null, null, null);
+ return true;
+ }
+ command = reset.getCapabilities(id, new IContextReset.DoneGetCapabilities() {
+ @Override
+ public void doneGetCapabilities(IToken token, Exception error, Collection<Map<String, Object>> capabilities) {
+ set(token, error, capabilities);
+ }
+ });
+ return false;
+ }
+ };
TCFMemoryBlock.onMemoryNodeCreated(this);
updateTerminal();
}
@@ -838,6 +858,24 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner, ITCFExe
return full_name;
}
+ public TCFDataCache<Collection<Map<String, Object>>> getResetCapabilities() {
+ return reset_capabilities;
+ }
+
+ public void reset(String reset_type, Map<String, Object> params) {
+ IContextReset ctx_reset = launch.getService(IContextReset.class);
+ if (ctx_reset != null) {
+ ctx_reset.reset(id, reset_type, params, new IContextReset.DoneReset() {
+ @Override
+ public void doneReset(IToken token, Exception error) {
+ if (error != null) {
+ model.showMessageBox("Cannot reset context", error);
+ }
+ }
+ });
+ }
+ }
+
public void addSymbol(TCFNodeSymbol s) {
assert symbols.get(s.id) == null;
symbols.put(s.id, s);
@@ -1466,6 +1504,7 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner, ITCFExe
symbols_node.reset();
memory_node.reset();
signal_mask.reset();
+ reset_capabilities.reset();
if (state.isValid()) {
TCFContextState s = state.getData();
if (s == null || s.is_suspended) state.reset();

Back to the top