mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 16:56:04 +02:00
Adding friend access
Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
parent
51e701d5f4
commit
1a11a46fda
4 changed files with 17 additions and 20 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2011 Texas Instruments, Inc. and others.
|
* Copyright (c) 2011, 2015 Texas Instruments, Inc. 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
|
||||||
|
@ -32,7 +32,6 @@ import org.eclipse.debug.core.commands.IEnabledStateRequest;
|
||||||
/**
|
/**
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("restriction")
|
|
||||||
public abstract class DsfDebugViewLayoutCommand implements IDebugCommandHandler{
|
public abstract class DsfDebugViewLayoutCommand implements IDebugCommandHandler{
|
||||||
|
|
||||||
protected final DsfExecutor fExecutor;
|
protected final DsfExecutor fExecutor;
|
||||||
|
@ -55,27 +54,27 @@ public abstract class DsfDebugViewLayoutCommand implements IDebugCommandHandler{
|
||||||
* - all elements are from a DSF session.
|
* - all elements are from a DSF session.
|
||||||
* - all elements are from the same DSF session.
|
* - all elements are from the same DSF session.
|
||||||
*/
|
*/
|
||||||
protected IExecutionDMContext[] getDMContexts( IDebugCommandRequest request) {
|
protected IExecutionDMContext[] getDMContexts(IDebugCommandRequest request) {
|
||||||
|
|
||||||
HashSet<IExecutionDMContext> ret = new HashSet<IExecutionDMContext>();
|
HashSet<IExecutionDMContext> ret = new HashSet<IExecutionDMContext>();
|
||||||
String sessionId = null;
|
String sessionId = null;
|
||||||
|
|
||||||
for( Object obj : request.getElements()) {
|
for (Object obj : request.getElements()) {
|
||||||
if(!( obj instanceof IDMVMContext ))
|
if (!(obj instanceof IDMVMContext))
|
||||||
return EMPTY_ARRAY;
|
return EMPTY_ARRAY;
|
||||||
|
|
||||||
IDMContext dmContext = ((IDMVMContext)obj).getDMContext();
|
IDMContext dmContext = ((IDMVMContext)obj).getDMContext();
|
||||||
IExecutionDMContext exeContext = DMContexts.getAncestorOfType(dmContext, IExecutionDMContext.class);
|
IExecutionDMContext exeContext = DMContexts.getAncestorOfType(dmContext, IExecutionDMContext.class);
|
||||||
|
|
||||||
if( exeContext == null)
|
if (exeContext == null)
|
||||||
return EMPTY_ARRAY;
|
return EMPTY_ARRAY;
|
||||||
|
|
||||||
// make sure all elements are from the same DSF session.
|
// make sure all elements are from the same DSF session.
|
||||||
if( sessionId == null) {
|
if (sessionId == null) {
|
||||||
sessionId = dmContext.getSessionId();
|
sessionId = dmContext.getSessionId();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if( !sessionId.equals(dmContext.getSessionId()))
|
if (!sessionId.equals(dmContext.getSessionId()))
|
||||||
return EMPTY_ARRAY;
|
return EMPTY_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,13 +85,13 @@ public abstract class DsfDebugViewLayoutCommand implements IDebugCommandHandler{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void canExecute(final IEnabledStateRequest request) {
|
public void canExecute(final IEnabledStateRequest request) {
|
||||||
final IExecutionDMContext[] executionContexts = getDMContexts( request);
|
final IExecutionDMContext[] executionContexts = getDMContexts(request);
|
||||||
if( executionContexts.length > 0 && !fExecutor.isTerminated()) {
|
if (executionContexts.length > 0 && !fExecutor.isTerminated()) {
|
||||||
fExecutor.submit(new DsfRunnable() {
|
fExecutor.submit(new DsfRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
IExecutionContextTranslator translator = fTracker.getService(IExecutionContextTranslator.class);
|
IExecutionContextTranslator translator = fTracker.getService(IExecutionContextTranslator.class);
|
||||||
if( translator != null) {
|
if (translator != null) {
|
||||||
canExecuteOnDsfThread(translator, executionContexts,
|
canExecuteOnDsfThread(translator, executionContexts,
|
||||||
new DataRequestMonitor<Boolean>(fExecutor, null) {
|
new DataRequestMonitor<Boolean>(fExecutor, null) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -118,13 +117,13 @@ public abstract class DsfDebugViewLayoutCommand implements IDebugCommandHandler{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final IDebugCommandRequest request) {
|
public boolean execute(final IDebugCommandRequest request) {
|
||||||
final IExecutionDMContext[] executionContexts = getDMContexts( request);
|
final IExecutionDMContext[] executionContexts = getDMContexts(request);
|
||||||
if( executionContexts.length > 0 && !fExecutor.isTerminated()) {
|
if (executionContexts.length > 0 && !fExecutor.isTerminated()) {
|
||||||
fExecutor.submit(new DsfRunnable() {
|
fExecutor.submit(new DsfRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
IExecutionContextTranslator translator = fTracker.getService(IExecutionContextTranslator.class);
|
IExecutionContextTranslator translator = fTracker.getService(IExecutionContextTranslator.class);
|
||||||
if( translator != null) {
|
if (translator != null) {
|
||||||
executeOnDsfThread(translator, executionContexts,
|
executeOnDsfThread(translator, executionContexts,
|
||||||
new RequestMonitor(fExecutor, null) {
|
new RequestMonitor(fExecutor, null) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -143,6 +142,6 @@ public abstract class DsfDebugViewLayoutCommand implements IDebugCommandHandler{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract void executeOnDsfThread( IExecutionContextTranslator translator, IExecutionDMContext[] contexts, RequestMonitor requestMonitor);
|
abstract void executeOnDsfThread(IExecutionContextTranslator translator, IExecutionDMContext[] contexts, RequestMonitor rm);
|
||||||
abstract void canExecuteOnDsfThread( IExecutionContextTranslator translator, IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm);
|
abstract void canExecuteOnDsfThread(IExecutionContextTranslator translator, IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import org.eclipse.debug.core.commands.IDebugCommandHandler;
|
||||||
/**
|
/**
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("restriction")
|
|
||||||
public class DsfGroupDebugContextsCommand extends DsfDebugViewLayoutCommand implements IDebugCommandHandler {
|
public class DsfGroupDebugContextsCommand extends DsfDebugViewLayoutCommand implements IDebugCommandHandler {
|
||||||
|
|
||||||
public DsfGroupDebugContextsCommand(DsfSession session) {
|
public DsfGroupDebugContextsCommand(DsfSession session) {
|
||||||
|
|
|
@ -20,7 +20,6 @@ import org.eclipse.debug.core.commands.IDebugCommandHandler;
|
||||||
/**
|
/**
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("restriction")
|
|
||||||
public class DsfUngroupDebugContextsCommand extends DsfDebugViewLayoutCommand implements IDebugCommandHandler {
|
public class DsfUngroupDebugContextsCommand extends DsfDebugViewLayoutCommand implements IDebugCommandHandler {
|
||||||
|
|
||||||
public DsfUngroupDebugContextsCommand(DsfSession session) {
|
public DsfUngroupDebugContextsCommand(DsfSession session) {
|
||||||
|
|
|
@ -14,8 +14,8 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: org.eclipse.cdt.dsf.concurrent,
|
Export-Package: org.eclipse.cdt.dsf.concurrent,
|
||||||
org.eclipse.cdt.dsf.datamodel,
|
org.eclipse.cdt.dsf.datamodel,
|
||||||
org.eclipse.cdt.dsf.debug.internal.provisional.model;x-friends:="org.eclipse.cdt.dsf.ui, org.eclipse.cdt.dsf.gdb",
|
org.eclipse.cdt.dsf.debug.internal.provisional.model;x-friends:="org.eclipse.cdt.dsf.ui,org.eclipse.cdt.dsf.gdb",
|
||||||
org.eclipse.cdt.dsf.debug.internal.provisional.service;x-internal:=true,
|
org.eclipse.cdt.dsf.debug.internal.provisional.service;x-friends:="org.eclipse.cdt.dsf.ui",
|
||||||
org.eclipse.cdt.dsf.debug.model,
|
org.eclipse.cdt.dsf.debug.model,
|
||||||
org.eclipse.cdt.dsf.debug.service,
|
org.eclipse.cdt.dsf.debug.service,
|
||||||
org.eclipse.cdt.dsf.debug.service.command,
|
org.eclipse.cdt.dsf.debug.service.command,
|
||||||
|
|
Loading…
Add table
Reference in a new issue