}
Assert.isTrue(obj.isConfigured(), "Dialect should be configured by now"); //$NON-NLS-1$
}
// Create the log resource
final ILogResource log = logResourcePage.createLogResource(dialectInstance);
Assert.isTrue(log.isConfigured(), "Log resource should be configured by now"); //$NON-NLS-1$
UIPlugin.getDefault().getLogResourceManager().add(log);
UIPlugin.getDefault().getLogResourceManager().saveState();
UIPlugin.getDefault().getLogResourceManager().synchronize(log,
new IGenericCallback<SynchronizationResult>() {
@Override
public void doCallback(final SynchronizationResult payload) {
Display.getDefault().asyncExec(new Runnable() {
/* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
@Override
public void run() {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorReference[] editorRefs = page.findEditors(
(IEditorInput) log.getAdapter(IEditorInput.class),
null, IWorkbenchPage.MATCH_INPUT);
for (IEditorReference editorRef : editorRefs) {
// Refresh editor
IEditorPart editorPart = editorRef.getEditor(false);
ILogViewEditor editor = editorPart != null ?
(ILogViewEditor) editorPart.getAdapter(ILogViewEditor.class) : null;
if (editor != null) {
editor.clearQueryContext();
editor.refresh();
}
}
NumberFormat fmt = DecimalFormat.getInstance();
String title = payload.isCanceled() ?
Messages.SynchronizeLogResourceAction_canceled_title :
Messages.SynchronizeLogResourceAction_finished_title;
String message = payload.isCanceled() ?
Messages.SynchronizeLogResourceAction_canceled_message :
Messages.SynchronizeLogResourceAction_finished_message;
message = NLS.bind(message, new Object[] {
log.getName(),
UIUtils.formatRuntime(payload.getRuntime()),
fmt.format(payload.getNumberOfEntriesAdded())});
if (payload.getMessages().isEmpty()) {
// Everything is fine
MessageDialog.openInformation(Display.getDefault().getActiveShell(),