use of com.intellij.debugger.InstanceFilter in project intellij-community by JetBrains.
the class ToggleFieldBreakpointAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
if (project == null) {
return;
}
final SourcePosition place = getPlace(e);
if (place != null) {
Document document = PsiDocumentManager.getInstance(project).getDocument(place.getFile());
if (document != null) {
DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(project);
BreakpointManager manager = debuggerManager.getBreakpointManager();
final int offset = place.getOffset();
final Breakpoint breakpoint = offset >= 0 ? manager.findBreakpoint(document, offset, FieldBreakpoint.CATEGORY) : null;
if (breakpoint == null) {
FieldBreakpoint fieldBreakpoint = manager.addFieldBreakpoint(document, offset);
if (fieldBreakpoint != null) {
if (DebuggerAction.isContextView(e)) {
final DebuggerTreeNodeImpl selectedNode = DebuggerAction.getSelectedNode(e.getDataContext());
if (selectedNode != null && selectedNode.getDescriptor() instanceof FieldDescriptorImpl) {
ObjectReference object = ((FieldDescriptorImpl) selectedNode.getDescriptor()).getObject();
if (object != null) {
long id = object.uniqueID();
InstanceFilter[] instanceFilters = new InstanceFilter[] { InstanceFilter.create(Long.toString(id)) };
fieldBreakpoint.setInstanceFilters(instanceFilters);
fieldBreakpoint.setInstanceFiltersEnabled(true);
}
}
}
final Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
if (editor != null) {
manager.editBreakpoint(fieldBreakpoint, editor);
}
}
} else {
manager.removeBreakpoint(breakpoint);
}
}
}
}
use of com.intellij.debugger.InstanceFilter in project kotlin by JetBrains.
the class KotlinBreakpointFiltersPanel method reloadInstanceFilters.
private void reloadInstanceFilters() {
String filtersText = myInstanceFiltersField.getText();
ArrayList<InstanceFilter> idxs = new ArrayList<InstanceFilter>();
int startNumber = -1;
for (int i = 0; i <= filtersText.length(); i++) {
if (i < filtersText.length() && Character.isDigit(filtersText.charAt(i))) {
if (startNumber == -1) {
startNumber = i;
}
} else {
if (startNumber >= 0) {
idxs.add(InstanceFilter.create(filtersText.substring(startNumber, i)));
startNumber = -1;
}
}
}
for (InstanceFilter instanceFilter : myInstanceFilters) {
if (!instanceFilter.isEnabled()) {
idxs.add(instanceFilter);
}
}
myInstanceFilters = idxs.toArray(new InstanceFilter[idxs.size()]);
}
use of com.intellij.debugger.InstanceFilter in project intellij-community by JetBrains.
the class FilteredRequestorImpl method readExternal.
public void readExternal(Element parentNode) throws InvalidDataException {
DefaultJDOMExternalizer.readExternal(this, parentNode);
if (DebuggerSettings.SUSPEND_NONE.equals(SUSPEND_POLICY)) {
// compatibility with older format
SUSPEND = false;
SUSPEND_POLICY = DebuggerSettings.SUSPEND_ALL;
}
String condition = JDOMExternalizerUtil.readField(parentNode, CONDITION_OPTION_NAME);
if (condition != null) {
setCondition(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, condition));
}
myClassFilters = DebuggerUtilsEx.readFilters(parentNode.getChildren(FILTER_OPTION_NAME));
myClassExclusionFilters = DebuggerUtilsEx.readFilters(parentNode.getChildren(EXCLUSION_FILTER_OPTION_NAME));
final ClassFilter[] instanceFilters = DebuggerUtilsEx.readFilters(parentNode.getChildren(INSTANCE_ID_OPTION_NAME));
final List<InstanceFilter> iFilters = new ArrayList<>(instanceFilters.length);
for (ClassFilter instanceFilter : instanceFilters) {
try {
iFilters.add(InstanceFilter.create(instanceFilter));
} catch (Exception ignored) {
}
}
myInstanceFilters = iFilters.isEmpty() ? InstanceFilter.EMPTY_ARRAY : iFilters.toArray(new InstanceFilter[iFilters.size()]);
}
use of com.intellij.debugger.InstanceFilter in project intellij-community by JetBrains.
the class JavaBreakpointFiltersPanel method updateInstanceFilterEditor.
private void updateInstanceFilterEditor(boolean updateText) {
List<String> filters = new ArrayList<>();
for (InstanceFilter instanceFilter : myInstanceFilters) {
if (instanceFilter.isEnabled()) {
filters.add(Long.toString(instanceFilter.getId()));
}
}
if (updateText) {
myInstanceFiltersField.setText(StringUtil.join(filters, " "));
}
String tipText = concatWithEx(filters, " ", (int) Math.sqrt(myInstanceFilters.length) + 1, "\n");
myInstanceFiltersField.getTextField().setToolTipText(tipText);
}
use of com.intellij.debugger.InstanceFilter in project intellij-community by JetBrains.
the class JavaBreakpointFiltersPanel method reloadInstanceFilters.
private void reloadInstanceFilters() {
String filtersText = myInstanceFiltersField.getText();
ArrayList<InstanceFilter> idxs = new ArrayList<>();
int startNumber = -1;
for (int i = 0; i <= filtersText.length(); i++) {
if (i < filtersText.length() && Character.isDigit(filtersText.charAt(i))) {
if (startNumber == -1) {
startNumber = i;
}
} else {
if (startNumber >= 0) {
idxs.add(InstanceFilter.create(filtersText.substring(startNumber, i)));
startNumber = -1;
}
}
}
myInstanceFilters = StreamEx.of(myInstanceFilters).remove(InstanceFilter::isEnabled).prepend(idxs).toArray(InstanceFilter[]::new);
}
Aggregations