{
int selectionIndex = _table.getSelectionIndex();
if (selectionIndex != -1)
{
final CompositeData selectedChannel = (CompositeData)_table.getItem(selectionIndex).getData();
Integer id = (Integer) selectedChannel.get(CHAN_ID);
int response = ViewUtility.popupOkCancelConfirmationMessage("Commit Transactions",
"Commit transactions for channel:" + id + " ?");
if (response == SWT.OK)
{
try
{
_cmb.commitTransactions(id);
ViewUtility.operationResultFeedback(null, "Commited transactions", null);
}
catch (Exception e1)
{
ViewUtility.operationFailedStatusBarMessage("Error commiting transactions");
MBeanUtility.handleException(_mbean, e1);
}
refresh(_mbean);;
}
}
}
});
final Button rollbackButton = _toolkit.createButton(buttonsComposite, "Rollback Transactions", SWT.PUSH);
rollbackButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
rollbackButton.setEnabled(false);
rollbackButton.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
int selectionIndex = _table.getSelectionIndex();
if (selectionIndex != -1)
{
final CompositeData selectedChannel = (CompositeData)_table.getItem(selectionIndex).getData();
Integer id = (Integer) selectedChannel.get(CHAN_ID);
int response = ViewUtility.popupOkCancelConfirmationMessage("Rollback Transactions",
"Rollback transactions for channel:" + id + " ?");
if (response == SWT.OK)
{
try
{
_cmb.rollbackTransactions(id);
ViewUtility.operationResultFeedback(null, "Rolled back transactions", null);
}
catch (Exception e1)
{
ViewUtility.operationFailedStatusBarMessage("Error rolling back transactions");
MBeanUtility.handleException(_mbean, e1);
}
refresh(_mbean);;
}
}
}
});
//listener for double clicking to open the selection mbean
_table.addMouseListener(new MouseListener()
{
// MouseListener implementation
public void mouseDoubleClick(MouseEvent event)
{
openMBean(_table);
}
public void mouseDown(MouseEvent e){}
public void mouseUp(MouseEvent e){}
});
_tableViewer.addSelectionChangedListener(new ISelectionChangedListener(){
public void selectionChanged(SelectionChangedEvent evt)
{
int selectionIndex = _table.getSelectionIndex();
if (selectionIndex != -1)
{
final CompositeData selectedChannel = (CompositeData)_table.getItem(selectionIndex).getData();
Boolean transactional = (Boolean) selectedChannel.get(TRANSACTIONAL);
if(transactional)
{
rollbackButton.setEnabled(true);
commitButton.setEnabled(true);