cacheClearBtn = new Button(getFieldEditorParent(), SWT.PUSH);
cacheClearBtn.setText(Messages.WMSCTilePreferencePage_clearcachebtn);
cacheClearBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
MessageBox mb = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
mb.setText(Messages.WMSCTilePreferencePage_clearcachebtn);
mb.setMessage(Messages.WMSCTilePreferencePage_clearcacheConfirm);
int rc = mb.open();
if (rc == SWT.OK) {
boolean success = clearCache();
mb = new MessageBox(Display.getCurrent().getActiveShell(), SWT.OK );
mb.setText(Messages.WMSCTilePreferencePage_clearcachebtn);
if (!success) {
mb.setMessage(Messages.WMSCTilePreferencePage_clearcacheError);
}
else {
mb.setMessage(Messages.WMSCTilePreferencePage_clearcacheSuccess);
}
rc = mb.open();
}
}
});
cacheClearBtn.setEnabled(diskOn);
}