use of org.eclipse.titan.log.viewer.models.TimeInterval in project titan.EclipsePlug-ins by eclipse.
the class FilterAction method run.
@Override
public void run() {
if (isFilterRunning) {
MessageBox msgBox = new MessageBox(textTableView.getSite().getShell());
msgBox.setMessage("The filter is already running!");
msgBox.setText("Filter");
msgBox.open();
return;
}
isFilterRunning = true;
if (textTableView.getFilterPattern() == null) {
textTableView.setFilterPattern(new FilterPattern(new TimeInterval("", "", textTableView.getLogFileMetaData().getTimeStampFormat())));
SortedMap<String, Boolean> eventsToFilter = new TreeMap<String, Boolean>();
for (Map.Entry<String, String[]> entry : Constants.EVENT_CATEGORIES.entrySet()) {
eventsToFilter.put(entry.getKey(), true);
}
textTableView.getFilterPattern().setEventsToFilter(eventsToFilter, true, false);
}
MSCFilterDialog dialog = new MSCFilterDialog(textTableView.getSite().getShell(), textTableView.getFilterPattern());
if (dialog.open() == 0 && dialog.getChanged() && !dialog.getFilterPattern().equals(textTableView.getFilterPattern())) {
final FilterPattern tmpFilterPattern = dialog.getFilterPattern();
WorkspaceJob op = new WorkspaceJob("Filtering") {
@Override
public IStatus runInWorkspace(final IProgressMonitor monitor) throws CoreException {
try {
textTableView.getFilteredLogReader().runFilter(tmpFilterPattern, monitor);
} catch (IOException e) {
ErrorReporter.logExceptionStackTrace(e);
// $NON-NLS-1$
TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("TextTableModel.6") + e.getMessage()));
monitor.setCanceled(true);
} catch (ParseException e) {
ErrorReporter.logExceptionStackTrace(e);
// $NON-NLS-1$
TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("TextTableModel.7") + e.getMessage()));
monitor.setCanceled(true);
}
if (monitor.isCanceled()) {
monitor.done();
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
isFilterRunning = false;
textTableView.getTable().setEnabled(true);
}
});
monitor.done();
return Status.CANCEL_STATUS;
}
monitor.done();
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
textTableView.setFilterPattern(tmpFilterPattern);
textTableView.refreshTable();
isFilterRunning = false;
textTableView.getTable().setEnabled(true);
}
});
return Status.OK_STATUS;
}
};
op.setPriority(Job.LONG);
op.setSystem(false);
op.setUser(true);
op.setRule(ResourcesPlugin.getWorkspace().getRoot());
op.setProperty(IProgressConstants.ICON_PROPERTY, Activator.getImageDescriptor("titan.gif"));
textTableView.getTable().setEnabled(false);
op.schedule();
} else {
isFilterRunning = false;
}
}
use of org.eclipse.titan.log.viewer.models.TimeInterval in project titan.EclipsePlug-ins by eclipse.
the class MSCFilterDialog method okPressed.
@Override
protected void okPressed() {
if (!changed) {
setReturnCode(OK);
close();
return;
}
for (TreeItem item : checkTree.getItems()) {
filterPattern.getEventsToFilter().put((String) item.getData(), item.getChecked());
}
filterPattern.setInclusive(inclusiveButton.getSelection());
Map<Field, Boolean> fieldsToFilter = new HashMap<Field, Boolean>();
fieldsToFilter.put(Field.SOURCE_INFO, sourceInfoButton.getSelection());
fieldsToFilter.put(Field.MESSAGE, messageButton.getSelection());
filterPattern.setFilterExpression(filterStringBox.getText(), fieldsToFilter, isCaseSensitiveButton.getSelection(), isRegularExpressionButton.getSelection());
filterPattern.setCaseSensitive(isCaseSensitiveButton.getSelection());
filterPattern.setRegularExpression(isRegularExpressionButton.getSelection());
filterPattern.setTimeInterval(new TimeInterval(startTimestamp.getText(), endTimestamp.getText(), filterPattern.getTimeInterval().getTimeStampFormat()));
setReturnCode(OK);
close();
}
Aggregations