use of org.eclipse.titan.log.viewer.search.SearchPattern in project titan.EclipsePlug-ins by eclipse.
the class LogSearchPage method writeConfiguration.
private void writeConfiguration() {
IDialogSettings settings = getDialogSettings();
int historySize = Math.min(previousSearchPatterns.size(), HISTORY_SIZE);
settings.put("historySize", historySize);
for (int i = 0; i < historySize; ++i) {
IDialogSettings histSettings = settings.addNewSection("history" + i);
SearchPattern pattern = previousSearchPatterns.get(i);
pattern.store(histSettings);
}
}
use of org.eclipse.titan.log.viewer.search.SearchPattern in project titan.EclipsePlug-ins by eclipse.
the class LogSearchPage method getPattern.
private SearchPattern getPattern() {
String string = this.searchString.getText();
SearchPattern match = findInPrevious(string);
if (match != null) {
previousSearchPatterns.remove(match);
}
Map<String, Boolean> events = new TreeMap<String, Boolean>();
for (int i = 0; i < searchFor.length - ALL_NONE_BUTTONS; ++i) {
events.put(searchFor[i].getData().toString(), searchFor[i].getSelection());
}
Map<Field, Boolean> limitToMap = new HashMap<Field, Boolean>();
for (Button aLimitTo : limitTo) {
limitToMap.put(Field.valueOf(aLimitTo.getData().toString()), aLimitTo.getSelection());
}
match = new SearchPattern(string, caseSensitive.getSelection(), regularExpression.getSelection(), events, limitToMap, getContainer().getSelectedScope(), getContainer().getSelectedWorkingSets());
previousSearchPatterns.add(0, match);
return match;
}
use of org.eclipse.titan.log.viewer.search.SearchPattern in project titan.EclipsePlug-ins by eclipse.
the class LogSearchPage method handlePatternSelected.
private void handlePatternSelected() {
int selectionIndex = searchString.getSelectionIndex();
if (selectionIndex < 0 || selectionIndex >= previousSearchPatterns.size()) {
return;
}
SearchPattern pattern = previousSearchPatterns.get(selectionIndex);
SortedMap<String, Boolean> events = pattern.getEvents();
for (int i = 0; i < searchFor.length - ALL_NONE_BUTTONS; ++i) {
searchFor[i].setSelection(events.get(searchFor[i].getData().toString()));
}
Map<Field, Boolean> limitToMap = pattern.getLimitTo();
for (Button button : limitTo) {
button.setSelection(limitToMap.get(button.getData()));
}
searchString.setText(pattern.getSearchString());
caseSensitive.setSelection(pattern.isCaseSensitive());
regularExpression.setSelection(pattern.isRegularExpression());
if (pattern.getWorkingSets() != null) {
getContainer().setSelectedWorkingSets(pattern.getWorkingSets());
} else {
getContainer().setSelectedScope(pattern.getScope());
}
}
use of org.eclipse.titan.log.viewer.search.SearchPattern in project titan.EclipsePlug-ins by eclipse.
the class LogSearchPage method readConfiguration.
private void readConfiguration() {
IDialogSettings settings = getDialogSettings();
int historySize;
try {
historySize = settings.getInt("historySize");
} catch (NumberFormatException e) {
historySize = HISTORY_SIZE;
}
try {
for (int i = 0; i < historySize; ++i) {
IDialogSettings histSettings = settings.getSection("history" + i);
if (histSettings != null) {
SearchPattern data = SearchPattern.create(histSettings);
if (data != null) {
previousSearchPatterns.add(data);
}
}
}
} catch (NumberFormatException e) {
ErrorReporter.logExceptionStackTrace(e);
TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("Could not read the configuration of the page. Reason: ") + e.getMessage()));
}
}
Aggregations