mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Allow to more easily extend GDBControl service.
Change-Id: Iec5ef773222390237d4665fb9bd3daa5b3cae947
This commit is contained in:
parent
1bdfc29020
commit
93fa9c00a6
4 changed files with 103 additions and 57 deletions
|
@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
|
|||
Bundle-Name: %pluginName
|
||||
Bundle-Vendor: %providerName
|
||||
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true
|
||||
Bundle-Version: 5.0.0.qualifier
|
||||
Bundle-Version: 5.1.0.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin
|
||||
Bundle-Localization: plugin
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
<version>5.1.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.dsf.gdb</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
|
|
@ -505,53 +505,73 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
|||
|
||||
@Override
|
||||
protected void initialize(final RequestMonitor requestMonitor) {
|
||||
InputStream errorStream = null;
|
||||
if (fMIBackend instanceof IMIBackend2) {
|
||||
errorStream = ((IMIBackend2)fMIBackend).getMIErrorStream();
|
||||
}
|
||||
startCommandProcessing(fMIBackend.getMIInputStream(), fMIBackend.getMIOutputStream(), errorStream);
|
||||
requestMonitor.done();
|
||||
doCommandMonitoringStep(requestMonitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutdown(RequestMonitor requestMonitor) {
|
||||
stopCommandProcessing();
|
||||
requestMonitor.done();
|
||||
undoCommandMonitoringStep(requestMonitor);
|
||||
}
|
||||
}
|
||||
|
||||
/** @since 5.1 */
|
||||
protected void doCommandMonitoringStep(final RequestMonitor requestMonitor) {
|
||||
InputStream errorStream = null;
|
||||
if (fMIBackend instanceof IMIBackend2) {
|
||||
errorStream = ((IMIBackend2)fMIBackend).getMIErrorStream();
|
||||
}
|
||||
startCommandProcessing(fMIBackend.getMIInputStream(), fMIBackend.getMIOutputStream(), errorStream);
|
||||
requestMonitor.done();
|
||||
}
|
||||
|
||||
/** @since 5.1 */
|
||||
protected void undoCommandMonitoringStep(RequestMonitor requestMonitor) {
|
||||
stopCommandProcessing();
|
||||
requestMonitor.done();
|
||||
}
|
||||
|
||||
protected class CommandProcessorsStep extends InitializationShutdownStep {
|
||||
CommandProcessorsStep(Direction direction) { super(direction); }
|
||||
|
||||
@Override
|
||||
public void initialize(final RequestMonitor requestMonitor) {
|
||||
try {
|
||||
fCLIProcess = new GDBBackendCLIProcess(GDBControl.this, fMIBackend);
|
||||
}
|
||||
catch(IOException e) {
|
||||
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "Failed to create CLI Process", e)); //$NON-NLS-1$
|
||||
requestMonitor.done();
|
||||
return;
|
||||
}
|
||||
|
||||
fCLICommandProcessor = createCLIEventProcessor(GDBControl.this, getContext());
|
||||
fMIEventProcessor = createMIRunControlEventProcessor(GDBControl.this, getContext());
|
||||
fControlEventProcessor = createControlEventProcessor();
|
||||
|
||||
requestMonitor.done();
|
||||
doCommandProcessorsStep(requestMonitor);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void shutdown(RequestMonitor requestMonitor) {
|
||||
fControlEventProcessor.dispose();
|
||||
fCLICommandProcessor.dispose();
|
||||
fMIEventProcessor.dispose();
|
||||
fCLIProcess.dispose();
|
||||
|
||||
requestMonitor.done();
|
||||
undoCommandProcessorsStep(requestMonitor);
|
||||
}
|
||||
}
|
||||
|
||||
/** @since 5.1 */
|
||||
protected void doCommandProcessorsStep(final RequestMonitor requestMonitor) {
|
||||
try {
|
||||
fCLIProcess = new GDBBackendCLIProcess(GDBControl.this, fMIBackend);
|
||||
}
|
||||
catch(IOException e) {
|
||||
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "Failed to create CLI Process", e)); //$NON-NLS-1$
|
||||
requestMonitor.done();
|
||||
return;
|
||||
}
|
||||
|
||||
fCLICommandProcessor = createCLIEventProcessor(GDBControl.this, getContext());
|
||||
fMIEventProcessor = createMIRunControlEventProcessor(GDBControl.this, getContext());
|
||||
fControlEventProcessor = createControlEventProcessor();
|
||||
|
||||
requestMonitor.done();
|
||||
}
|
||||
|
||||
/** @since 5.1 */
|
||||
protected void undoCommandProcessorsStep(RequestMonitor requestMonitor) {
|
||||
fControlEventProcessor.dispose();
|
||||
fCLICommandProcessor.dispose();
|
||||
fMIEventProcessor.dispose();
|
||||
fCLIProcess.dispose();
|
||||
|
||||
requestMonitor.done();
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 4.1
|
||||
*/
|
||||
|
@ -562,47 +582,67 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
|||
|
||||
@Override
|
||||
public void initialize( final RequestMonitor requestMonitor ) {
|
||||
fCommandTimeoutManager = createCommandTimeoutManager( GDBControl.this );
|
||||
if (fCommandTimeoutManager != null) {
|
||||
fCommandTimeoutManager.addCommandTimeoutListener(fTimeoutListener);
|
||||
}
|
||||
requestMonitor.done();
|
||||
doCommandTimeoutStep(requestMonitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutdown( RequestMonitor requestMonitor ) {
|
||||
if ( fCommandTimeoutManager != null ) {
|
||||
fCommandTimeoutManager.removeCommandTimeoutListener(fTimeoutListener);
|
||||
fCommandTimeoutManager.dispose();
|
||||
}
|
||||
requestMonitor.done();
|
||||
undoCommandTimeoutStep(requestMonitor);
|
||||
}
|
||||
}
|
||||
|
||||
/** @since 5.1 */
|
||||
protected void doCommandTimeoutStep(final RequestMonitor requestMonitor) {
|
||||
fCommandTimeoutManager = createCommandTimeoutManager( GDBControl.this );
|
||||
if (fCommandTimeoutManager != null) {
|
||||
fCommandTimeoutManager.addCommandTimeoutListener(fTimeoutListener);
|
||||
}
|
||||
requestMonitor.done();
|
||||
}
|
||||
|
||||
/** @since 5.1 */
|
||||
protected void undoCommandTimeoutStep(RequestMonitor requestMonitor) {
|
||||
if ( fCommandTimeoutManager != null ) {
|
||||
fCommandTimeoutManager.removeCommandTimeoutListener(fTimeoutListener);
|
||||
fCommandTimeoutManager.dispose();
|
||||
}
|
||||
requestMonitor.done();
|
||||
}
|
||||
|
||||
protected class RegisterStep extends InitializationShutdownStep {
|
||||
RegisterStep(Direction direction) { super(direction); }
|
||||
@Override
|
||||
public void initialize(final RequestMonitor requestMonitor) {
|
||||
getSession().addServiceEventListener(GDBControl.this, null);
|
||||
register(
|
||||
new String[]{ ICommandControl.class.getName(),
|
||||
ICommandControlService.class.getName(),
|
||||
IMICommandControl.class.getName(),
|
||||
AbstractMIControl.class.getName(),
|
||||
IGDBControl.class.getName() },
|
||||
new Hashtable<String,String>());
|
||||
getSession().dispatchEvent(new GDBControlInitializedDMEvent(getContext()), getProperties());
|
||||
requestMonitor.done();
|
||||
doRegisterStep(requestMonitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutdown(RequestMonitor requestMonitor) {
|
||||
unregister();
|
||||
getSession().removeServiceEventListener(GDBControl.this);
|
||||
requestMonitor.done();
|
||||
undoRegisterStep(requestMonitor);
|
||||
}
|
||||
}
|
||||
|
||||
/** @since 5.1 */
|
||||
protected void doRegisterStep(final RequestMonitor requestMonitor) {
|
||||
getSession().addServiceEventListener(GDBControl.this, null);
|
||||
register(
|
||||
new String[]{ ICommandControl.class.getName(),
|
||||
ICommandControlService.class.getName(),
|
||||
IMICommandControl.class.getName(),
|
||||
AbstractMIControl.class.getName(),
|
||||
IGDBControl.class.getName() },
|
||||
new Hashtable<String,String>());
|
||||
getSession().dispatchEvent(new GDBControlInitializedDMEvent(getContext()), getProperties());
|
||||
requestMonitor.done();
|
||||
}
|
||||
|
||||
/** @since 5.1 */
|
||||
protected void undoRegisterStep(RequestMonitor requestMonitor) {
|
||||
unregister();
|
||||
getSession().removeServiceEventListener(GDBControl.this);
|
||||
requestMonitor.done();
|
||||
}
|
||||
|
||||
/** @since 4.0 */
|
||||
@Override
|
||||
public List<String> getFeatures() {
|
||||
|
|
|
@ -91,7 +91,8 @@ public class GDBControl_7_0 extends GDBControl {
|
|||
return new MIRunControlEventProcessor_7_0(connection, controlDmc);
|
||||
}
|
||||
|
||||
private void listFeatures(final RequestMonitor requestMonitor) {
|
||||
/** @since 5.1 */
|
||||
protected void doListFeatures(final RequestMonitor requestMonitor) {
|
||||
queueCommand(
|
||||
getCommandFactory().createMIListFeatures(getContext()),
|
||||
new DataRequestMonitor<MIListFeaturesInfo>(getExecutor(), requestMonitor) {
|
||||
|
@ -103,6 +104,11 @@ public class GDBControl_7_0 extends GDBControl {
|
|||
});
|
||||
}
|
||||
|
||||
/** @since 5.1 */
|
||||
protected void undoListFeatures(RequestMonitor requestMonitor) {
|
||||
requestMonitor.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes, RequestMonitorWithProgress rm) {
|
||||
return new FinalLaunchSequence_7_0(getSession(), attributes, rm);
|
||||
|
@ -130,12 +136,12 @@ public class GDBControl_7_0 extends GDBControl {
|
|||
|
||||
@Override
|
||||
protected void initialize(final RequestMonitor requestMonitor) {
|
||||
listFeatures(requestMonitor);
|
||||
doListFeatures(requestMonitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutdown(RequestMonitor requestMonitor) {
|
||||
requestMonitor.done();
|
||||
undoListFeatures(requestMonitor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue