1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Adding friend access

Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
Marc Khouzam 2015-03-23 09:20:23 -04:00
parent 51e701d5f4
commit 1a11a46fda
4 changed files with 17 additions and 20 deletions

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -32,7 +32,6 @@ import org.eclipse.debug.core.commands.IEnabledStateRequest;
/**
* @since 2.2
*/
@SuppressWarnings("restriction")
public abstract class DsfDebugViewLayoutCommand implements IDebugCommandHandler{
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 the same DSF session.
*/
protected IExecutionDMContext[] getDMContexts( IDebugCommandRequest request) {
protected IExecutionDMContext[] getDMContexts(IDebugCommandRequest request) {
HashSet<IExecutionDMContext> ret = new HashSet<IExecutionDMContext>();
String sessionId = null;
for( Object obj : request.getElements()) {
if(!( obj instanceof IDMVMContext ))
for (Object obj : request.getElements()) {
if (!(obj instanceof IDMVMContext))
return EMPTY_ARRAY;
IDMContext dmContext = ((IDMVMContext)obj).getDMContext();
IExecutionDMContext exeContext = DMContexts.getAncestorOfType(dmContext, IExecutionDMContext.class);
if( exeContext == null)
if (exeContext == null)
return EMPTY_ARRAY;
// make sure all elements are from the same DSF session.
if( sessionId == null) {
if (sessionId == null) {
sessionId = dmContext.getSessionId();
}
else {
if( !sessionId.equals(dmContext.getSessionId()))
if (!sessionId.equals(dmContext.getSessionId()))
return EMPTY_ARRAY;
}
@ -86,13 +85,13 @@ public abstract class DsfDebugViewLayoutCommand implements IDebugCommandHandler{
@Override
public void canExecute(final IEnabledStateRequest request) {
final IExecutionDMContext[] executionContexts = getDMContexts( request);
if( executionContexts.length > 0 && !fExecutor.isTerminated()) {
final IExecutionDMContext[] executionContexts = getDMContexts(request);
if (executionContexts.length > 0 && !fExecutor.isTerminated()) {
fExecutor.submit(new DsfRunnable() {
@Override
public void run() {
IExecutionContextTranslator translator = fTracker.getService(IExecutionContextTranslator.class);
if( translator != null) {
if (translator != null) {
canExecuteOnDsfThread(translator, executionContexts,
new DataRequestMonitor<Boolean>(fExecutor, null) {
@Override
@ -118,13 +117,13 @@ public abstract class DsfDebugViewLayoutCommand implements IDebugCommandHandler{
@Override
public boolean execute(final IDebugCommandRequest request) {
final IExecutionDMContext[] executionContexts = getDMContexts( request);
if( executionContexts.length > 0 && !fExecutor.isTerminated()) {
final IExecutionDMContext[] executionContexts = getDMContexts(request);
if (executionContexts.length > 0 && !fExecutor.isTerminated()) {
fExecutor.submit(new DsfRunnable() {
@Override
public void run() {
IExecutionContextTranslator translator = fTracker.getService(IExecutionContextTranslator.class);
if( translator != null) {
if (translator != null) {
executeOnDsfThread(translator, executionContexts,
new RequestMonitor(fExecutor, null) {
@Override
@ -143,6 +142,6 @@ public abstract class DsfDebugViewLayoutCommand implements IDebugCommandHandler{
return true;
}
abstract void executeOnDsfThread( IExecutionContextTranslator translator, IExecutionDMContext[] contexts, RequestMonitor requestMonitor);
abstract void canExecuteOnDsfThread( IExecutionContextTranslator translator, IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm);
abstract void executeOnDsfThread(IExecutionContextTranslator translator, IExecutionDMContext[] contexts, RequestMonitor rm);
abstract void canExecuteOnDsfThread(IExecutionContextTranslator translator, IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm);
}

View file

@ -20,7 +20,6 @@ import org.eclipse.debug.core.commands.IDebugCommandHandler;
/**
* @since 2.2
*/
@SuppressWarnings("restriction")
public class DsfGroupDebugContextsCommand extends DsfDebugViewLayoutCommand implements IDebugCommandHandler {
public DsfGroupDebugContextsCommand(DsfSession session) {

View file

@ -20,7 +20,6 @@ import org.eclipse.debug.core.commands.IDebugCommandHandler;
/**
* @since 2.2
*/
@SuppressWarnings("restriction")
public class DsfUngroupDebugContextsCommand extends DsfDebugViewLayoutCommand implements IDebugCommandHandler {
public DsfUngroupDebugContextsCommand(DsfSession session) {

View file

@ -14,8 +14,8 @@ Require-Bundle: org.eclipse.core.runtime,
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.cdt.dsf.concurrent,
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.service;x-internal:=true,
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-friends:="org.eclipse.cdt.dsf.ui",
org.eclipse.cdt.dsf.debug.model,
org.eclipse.cdt.dsf.debug.service,
org.eclipse.cdt.dsf.debug.service.command,