use of com.intellij.ui.classFilter.ClassFilter in project intellij-community by JetBrains.
the class InstanceFilterEditor method addClassFilter.
protected void addClassFilter() {
String idString = Messages.showInputDialog(myProject, DebuggerBundle.message("add.instance.filter.dialog.prompt"), DebuggerBundle.message("add.instance.filter.dialog.title"), Messages.getQuestionIcon(), null, new InputValidatorEx() {
@Nullable
@Override
public String getErrorText(String inputString) {
try {
//noinspection ResultOfMethodCallIgnored
Long.parseLong(inputString);
return null;
} catch (NumberFormatException e) {
return DebuggerBundle.message("add.instance.filter.dialog.error.numeric.value.expected");
}
}
@Override
public boolean checkInput(String inputString) {
return getErrorText(inputString) == null;
}
@Override
public boolean canClose(String inputString) {
return getErrorText(inputString) == null;
}
});
if (idString != null) {
ClassFilter filter = createFilter(idString);
myTableModel.addRow(filter);
int row = myTableModel.getRowCount() - 1;
myTable.getSelectionModel().setSelectionInterval(row, row);
myTable.scrollRectToVisible(myTable.getCellRect(row, 0, true));
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
IdeFocusManager.getGlobalInstance().requestFocus(myTable, true);
});
}
}
use of com.intellij.ui.classFilter.ClassFilter in project intellij-community by JetBrains.
the class CoverageJavaRunConfigurationExtension method wrapElementListener.
@Override
public RefactoringElementListener wrapElementListener(PsiElement element, RunConfigurationBase configuration, RefactoringElementListener listener) {
if (!isApplicableFor(configuration)) {
return listener;
}
final JavaCoverageEnabledConfiguration coverageEnabledConfiguration = JavaCoverageEnabledConfiguration.getFrom(configuration);
if (coverageEnabledConfiguration != null) {
final Project project = configuration.getProject();
final ClassFilter[] patterns = coverageEnabledConfiguration.getCoveragePatterns();
final String[] filters = getFilters(coverageEnabledConfiguration);
if (patterns != null) {
assert filters != null;
if (element instanceof PsiClass) {
final String qualifiedName = ((PsiClass) element).getQualifiedName();
final int idx = ArrayUtil.find(filters, qualifiedName);
if (idx > -1) {
final RefactoringListeners.Accessor<PsiClass> accessor = new MyClassAccessor(project, patterns, idx, filters);
final RefactoringElementListener classListener = RefactoringListeners.getClassOrPackageListener(element, accessor);
if (classListener != null) {
listener = appendListener(listener, classListener);
}
} else if (qualifiedName != null) {
final String packageName = StringUtil.getPackageName(qualifiedName);
if (!StringUtil.isEmpty(packageName)) {
for (int i = 0; i < filters.length; i++) {
String filter = filters[i];
if (filter.equals(packageName + ".*")) {
listener = appendListener(listener, new RefactoringListeners.RefactorPackageByClass(new MyClassAccessor(project, patterns, i, filters)));
break;
}
}
}
}
} else if (element instanceof PsiPackage) {
final String qualifiedName = ((PsiPackage) element).getQualifiedName();
for (int i = 0, filtersLength = filters.length; i < filtersLength; i++) {
if (filters[i].startsWith(qualifiedName + ".")) {
final RefactoringElementListener packageListener;
if (filters[i].endsWith("*")) {
packageListener = RefactoringListeners.getListener((PsiPackage) element, new MyPackageAccessor(project, patterns, i, filters));
} else {
packageListener = RefactoringListeners.getClassOrPackageListener(element, new MyClassAccessor(project, patterns, i, filters));
}
if (packageListener != null) {
listener = appendListener(listener, packageListener);
}
}
}
}
}
}
return listener;
}
use of com.intellij.ui.classFilter.ClassFilter in project kotlin by JetBrains.
the class DebuggerSteppingHelper method createStepRequest.
// copied from DebugProcessImpl.doStep
private static void createStepRequest(@NotNull SuspendContextImpl suspendContext, @Nullable ThreadReferenceProxyImpl stepThread, @NotNull EventRequestManager requestManager, int size, int depth) {
if (stepThread == null) {
return;
}
try {
ThreadReference stepThreadReference = stepThread.getThreadReference();
requestManager.deleteEventRequests(requestManager.stepRequests());
StepRequest stepRequest = requestManager.createStepRequest(stepThreadReference, size, depth);
List<ClassFilter> activeFilters = getActiveFilters();
if (!activeFilters.isEmpty()) {
String currentClassName = getCurrentClassName(stepThread);
if (currentClassName == null || !DebuggerUtilsEx.isFiltered(currentClassName, activeFilters)) {
// add class filters
for (ClassFilter filter : activeFilters) {
stepRequest.addClassExclusionFilter(filter.getPattern());
}
}
}
// suspend policy to match the suspend policy of the context:
// if all threads were suspended, then during stepping all the threads must be suspended
// if only event thread were suspended, then only this particular thread must be suspended during stepping
stepRequest.setSuspendPolicy(suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD ? EventRequest.SUSPEND_EVENT_THREAD : EventRequest.SUSPEND_ALL);
stepRequest.enable();
} catch (ObjectCollectedException ignored) {
}
}
Aggregations