use of com.android.tools.idea.logcat.PersistentAndroidLogFilters.FilterData in project android by JetBrains.
the class EditLogFilterDialog method createNewFilter.
private FilterData createNewFilter() {
FilterData filter = new FilterData();
myFilters.add(filter);
filter.setName(getUniqueName());
return filter;
}
use of com.android.tools.idea.logcat.PersistentAndroidLogFilters.FilterData in project android by JetBrains.
the class EditLogFilterDialog method initFiltersList.
private void initFiltersList() {
myFiltersList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
int i = myFiltersList.getSelectedIndex();
myActiveFilter = (i == -1) ? null : myFilters.get(i);
resetFieldEditors();
}
});
myFiltersListModel = new CollectionListModel<>();
for (FilterData filter : myFilters) {
myFiltersListModel.add(filter.getName());
}
myFiltersList.setModel(myFiltersListModel);
myFiltersList.setEmptyText(AndroidBundle.message("android.logcat.edit.filter.dialog.no.filters"));
}
use of com.android.tools.idea.logcat.PersistentAndroidLogFilters.FilterData in project android by JetBrains.
the class EditLogFilterDialog method doValidate.
@Override
protected ValidationInfo doValidate() {
if (!myFilterNameField.isEnabled()) {
return null;
}
final String name = myFilterNameField.getText().trim();
if (name.isEmpty()) {
return new ValidationInfo(AndroidBundle.message("android.logcat.new.filter.dialog.name.not.specified.error"), myFilterNameField);
}
if (name.equals(AndroidLogcatView.NO_FILTERS) || name.equals(AndroidLogcatView.SELECTED_APP_FILTER) || name.equals(AndroidLogcatView.EDIT_FILTER_CONFIGURATION)) {
return new ValidationInfo(AndroidBundle.message("android.logcat.new.filter.dialog.name.busy.error", name));
}
for (FilterData filter : myFilters) {
if (filter != myActiveFilter && name.equals(filter.getName())) {
return new ValidationInfo(AndroidBundle.message("android.logcat.new.filter.dialog.name.busy.error", name));
}
}
if (myTagField.getParseError() != null) {
return new ValidationInfo(AndroidBundle.message("android.logcat.new.filter.dialog.incorrect.log.tag.pattern.error") + '\n' + myTagField.getParseError());
}
if (myLogMessageField.getParseError() != null) {
return new ValidationInfo(AndroidBundle.message("android.logcat.new.filter.dialog.incorrect.message.pattern.error") + '\n' + myLogMessageField.getParseError());
}
if (myPackageNameField.getParseError() != null) {
return new ValidationInfo(AndroidBundle.message("android.logcat.new.filter.dialog.incorrect.application.name.pattern.error") + '\n' + myPackageNameField.getParseError());
}
boolean validPid = false;
try {
final String pidStr = myPidField.getText().trim();
final Integer pid = pidStr.length() > 0 ? Integer.parseInt(pidStr) : null;
if (pid == null || pid.intValue() >= 0) {
validPid = true;
}
} catch (NumberFormatException ignored) {
}
if (!validPid) {
return new ValidationInfo(AndroidBundle.message("android.logcat.new.filter.dialog.incorrect.pid.error"));
}
return null;
}
Aggregations