com.ibm.productivity.tools.ui.views.operations
Interface OperationListener


public interface OperationListener

This is the class that is notified when an operation is invoked in a RichDocumentView. A user can implement a listener and add it into a RichDocumentView. NewOperation, LoadOperation and CloseOperation won't be fired by RichDocumentView. Those events are be provided by 'com.ibm.productivity.tools.ui.views.listener' extension point.

The following code demonstrates how to monitor the start of an operation.

 	private void monitorLoading()
	{
		RichDocumentView view = this;
		OperationListener listener = new OperationListener()
		{

			public void afterExecute(Operation operation, RichDocumentView view) {

				if( operation instanceof LoadOperation )
				{
					System.out.println( "document is loaded:"
							+ ( (LoadOperation)operation ).getFileName());
				}
				
			}

			public void beforeExecute(Operation operation, RichDocumentView view) {
				if( operation instanceof LoadOperation )
					System.out.println( "document is about to be loaded:"
							+ ( (LoadOperation)operation ).getFileName());
				
			}
			
		};
		view.addOperationListener( listener );
	}
 

Since:
8.0.1
See Also:
RichDocumentView.addOperationListener(OperationListener), RichDocumentView.removeOperationListener(OperationListener), Operation

Method Summary
 void afterExecute(Operation operation, RichDocumentView view)
          The method is called after the operation is started.
 void beforeExecute(Operation operation, RichDocumentView view)
          The method is called before the operation is started.
 

Method Detail

beforeExecute

public void beforeExecute(Operation operation,
                          RichDocumentView view)
The method is called before the operation is started. SaveOperation and SaveAsOperation never fire this event.

Parameters:
operation - The operation to be started.
view - The rich document view to start the operation.
See Also:
RichDocumentView

afterExecute

public void afterExecute(Operation operation,
                         RichDocumentView view)
The method is called after the operation is started. The method will always be called even when an exception is thrown during the operation.

Parameters:
operation - The operation is started.
view - The rich document view that started the operation.