Controlling how error handlers for specific elements are displayed

You can control how error handlers for specified test elements are displayed.

In the test editor, users can configure error handling for a specific model element that produces an error. For example, if a specific instance of a content verification point fails, the user can change the error-handling behavior for only that instance of the content verification point. To change how the error handlers for protocol-specific elements are displayed, you must know what types of errors can be generated for the element when tests run.

The test editor SDK provides classes for the display of the error-handling user interface. The com.ibm.rational.test.lt.testeditor.main.exceptions.TestExceptionProducerUI class controls the error-handling user interface in the Details section of the Advanced page. The com.ibm.rational.test.lt.testeditor.main.exceptions.DialogExceptionProducerUI class controls the error-handling user interface in dialog boxes and properties pages.

The following code is an example for the Details section of the Advanced page in the test editor. In the layoutControls method, add code similar to these lines:

m_exceptionUi = new TestExceptionProducerUI( 
	getTestEditor(),
	new AuthenticationExceptionCreator());
m_exceptionUi.createErrorProducerContents( 
	getDetails(), 
	getNtlm(),
	(LoadTestWidgetFactory) getFactory());

The AuthenticationExceptionCreator class is the same class that is specified in the plugin.xml file in the exceptionDefinition extension point. In the refreshControls method, add code similar to this line:

m_exceptionUi.refresh( getNtlm() );

The following code is an example for dialog boxes and properties pages. In the createContents method or the createDialogArea method, add code similar to these lines:

m_errorHandling = new DialogExceptionProducerUI(
	m_page.getEditor(),
	new PageTitleErrorExceptionCreator());
m_errorHandling.createErrorProducerContents( parent, vp );

In the onCancelPressed method, which is called when the user clicks Cancel in a dialog box, add code similar to this line:

m_errorHandling.cleanUp();

When the user clicks OK in a dialog box or property page, the changes are applied to the CBError object immediately, so no extra code is required. When the user clicks Cancel in a dialog box or property page, the changes must be undone using the cleanUp method.

To receive notifications when changes are made to a CBError object, override the updateEditor method by using this code:

m_errorHandling = new DialogExceptionProducerUI( 
			TestEditorPlugin.getEditorFor(m_datapool), 
			new EndOfDatapoolExceptionCreator()){
		@Override
		protected void updateEditor() {
			getButton(OK).setEnabled(true);
			super.updateEditor();
		}
	};
	m_errorHandling.createErrorProducerContents(composite, m_datapool, null );