addAccountButton = new Button(area.getComponentsComposite(), SWT.PUSH);
addAccountButton.setText("Adicionar");
addAccountButton.setEnabled(system.hasAccess("Adicionar Contas"));
addAccountButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event arg0) {
new AccountDialog(getParent().getShell(), getMySelf()).open();
}
});
FormData data = new FormData();
data.top = new FormAttachment(0, 10);
data.right = new FormAttachment(100, -10);
data.width = 80;
addAccountButton.setLayoutData(data);
editAccountButton = new Button(area.getComponentsComposite(), SWT.PUSH);
editAccountButton.setText("Editar");
editAccountButton.setEnabled(system.hasAccess("Editar Contas"));
editAccountButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event arg0) {
TableItem[] itens = accountsTable.getSelection();
if (itens.length > 0) {
try {
String nameAccount = accountsTable.getSelection()[0].getText(1);
Account account = (Account) system.query(new GetAccountByName(nameAccount));
new AccountDialog(getParent().getShell(), getMySelf(), account).open();
} catch (Exception e) {
logger.error("GetAccountByName Exception: ", e);
}
}else{
setErrorMessage("Voc� deve selecionar uma conta para editar.");