Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » [dsf-gdb] service which requires multiple commands
[dsf-gdb] service which requires multiple commands [message #1726878] Thu, 17 March 2016 08:41
florent Vion is currently offline florent VionFriend
Messages: 2
Registered: March 2016
Junior Member
Hi,

I develop plugins installed on a CDT Eclipse to manage my own debug session.
I am based on the dsf plugin example (org.eclipse.cdt.examples.dsf.gdb).
I create a service via a service factory which implements several commands (each command needs to be executed in a chain).
My service is called via a button and thus via an handler.
For the time being, in order to execute commands one after the others, in my handler I call the next command in the "handleCompleted" method of the previous one. Like this:

MyHandler.java
public class MyHandler implements IMyHandler {
	...
	@Override
	public boolean execute(final IDebugCommandRequest request) {
		...
		executeCommandA(context, request);
		...
	}
	
	// execute the first command of my service
	private void executeCommandA(final Optional<ICommandControlDMContext> context, 
			final IDebugCommandRequest request) {
		fExecutor.execute(new DsfRunnable() {
			@Override
			public void run() {
				...
				myService.doCommandA(context.get(), new DataRequestMonitor<Boolean>(fExecutor, null) {
					@Override
					protected void handleCompleted() {
						if (isSuccess()) {
							...
							executeCommandB(context, request);
						}
						request.done();
					}
				});
			}
		}
	}
	
	// execute the second command of my service
	private void executeCommandB(final Optional<ICommandControlDMContext> context, 
			final IDebugCommandRequest request) {
		fExecutor.execute(new DsfRunnable() {
			@Override
			public void run() {
				...
				myService.doCommandB(context.get(), new DataRequestMonitor<String>(fExecutor, null) {
					@Override
					protected void handleCompleted() {
						if (isSuccess()) {
							...
							executeCommandC(context, request);
						}
						request.done();
					}
				});
			}
		}
	}
	
	...


Each "doCommandX" of my service executes the associated command line via a MIInterpreterExecConsole.

Even if it works, I strongly suspect that I am not using the proper process to manage my commands. Am I right?
And I think I should use the class Sequence (org.eclipse.cdt.dsf.concurrent) but I'm not sure to truly understand how it works. Embarrassed

Cheers
Flo
Previous Topic:Compiler starts linking after first source file
Next Topic:Error setting breakpoint: type root could not be computed
Goto Forum:
  


Current Time: Thu Apr 25 06:02:49 GMT 2024

Powered by FUDForum. Page generated in 0.03442 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top