use of com.intellij.xdebugger.XSourcePosition in project intellij-community by JetBrains.
the class XVariablesViewBase method buildTreeAndRestoreState.
protected void buildTreeAndRestoreState(@NotNull final XStackFrame stackFrame) {
XSourcePosition position = stackFrame.getSourcePosition();
XDebuggerTree tree = getTree();
tree.setSourcePosition(position);
createNewRootNode(stackFrame);
final Project project = tree.getProject();
project.putUserData(XVariablesView.DEBUG_VARIABLES, new XVariablesView.InlineVariablesInfo());
clearInlays(tree);
Object newEqualityObject = stackFrame.getEqualityObject();
if (myFrameEqualityObject != null && newEqualityObject != null && myFrameEqualityObject.equals(newEqualityObject) && myTreeState != null) {
disposeTreeRestorer();
myTreeRestorer = myTreeState.restoreState(tree);
}
if (position != null && Registry.is("debugger.valueTooltipAutoShowOnSelection")) {
registerInlineEvaluator(stackFrame, position, project);
}
}
use of com.intellij.xdebugger.XSourcePosition in project intellij-community by JetBrains.
the class JavaBreakpointFiltersPanel method loadFrom.
@Override
public void loadFrom(@NotNull B breakpoint) {
myCatchFiltersPanel.setVisible(false);
JavaBreakpointProperties properties = breakpoint.getProperties();
if (properties != null) {
if (properties.getCOUNT_FILTER() > 0) {
myPassCountField.setText(Integer.toString(properties.getCOUNT_FILTER()));
} else {
myPassCountField.setText("");
}
myPassCountCheckbox.setSelected(properties.isCOUNT_FILTER_ENABLED());
myInstanceFiltersCheckBox.setSelected(properties.isINSTANCE_FILTERS_ENABLED());
myInstanceFilters = properties.getInstanceFilters();
updateInstanceFilterEditor(true);
myClassFiltersCheckBox.setSelected(properties.isCLASS_FILTERS_ENABLED());
myClassFiltersField.setClassFilters(properties.getClassFilters(), properties.getClassExclusionFilters());
if (properties instanceof JavaExceptionBreakpointProperties) {
myCatchFiltersPanel.setVisible(true);
JavaExceptionBreakpointProperties exceptionBreakpointProperties = (JavaExceptionBreakpointProperties) properties;
myCatchCheckBox.setSelected(exceptionBreakpointProperties.isCatchFiltersEnabled());
myCatchClassFilters.setClassFilters(exceptionBreakpointProperties.getCatchClassFilters(), exceptionBreakpointProperties.getCatchClassExclusionFilters());
}
XSourcePosition position = breakpoint.getSourcePosition();
// TODO: need to calculate psi class
//myBreakpointPsiClass = breakpoint.getPsiClass();
}
updateCheckboxes();
}
use of com.intellij.xdebugger.XSourcePosition in project kotlin by JetBrains.
the class KotlinBreakpointFiltersPanel method loadFrom.
@Override
public void loadFrom(@NotNull B breakpoint) {
JavaBreakpointProperties properties = breakpoint.getProperties();
if (properties != null) {
if (properties.getCOUNT_FILTER() > 0) {
myPassCountField.setText(Integer.toString(properties.getCOUNT_FILTER()));
} else {
myPassCountField.setText("");
}
myPassCountCheckbox.setSelected(properties.isCOUNT_FILTER_ENABLED());
myInstanceFiltersCheckBox.setSelected(properties.isINSTANCE_FILTERS_ENABLED());
myInstanceFiltersField.setEnabled(properties.isINSTANCE_FILTERS_ENABLED());
myInstanceFiltersField.getTextField().setEditable(properties.isINSTANCE_FILTERS_ENABLED());
myInstanceFilters = properties.getInstanceFilters();
updateInstanceFilterEditor(true);
myClassFiltersCheckBox.setSelected(properties.isCLASS_FILTERS_ENABLED());
myClassFiltersField.setEnabled(properties.isCLASS_FILTERS_ENABLED());
myClassFiltersField.getTextField().setEditable(properties.isCLASS_FILTERS_ENABLED());
myClassFilters = properties.getClassFilters();
myClassExclusionFilters = properties.getClassExclusionFilters();
updateClassFilterEditor(true);
XSourcePosition position = breakpoint.getSourcePosition();
// TODO: need to calculate psi class
//myBreakpointPsiClass = breakpoint.getPsiClass();
}
updateCheckboxes();
}
use of com.intellij.xdebugger.XSourcePosition in project flutter-intellij by flutter.
the class PositionMapperTest method shouldGetPositionInFileUnderRemoteBaseUri.
@Test
public void shouldGetPositionInFileUnderRemoteBaseUri() throws Exception {
tmp.writeFile("root/pubspec.yaml", "");
tmp.ensureDir("root/lib");
final VirtualFile main = tmp.writeFile("root/lib/main.dart", "");
final VirtualFile hello = tmp.writeFile("root/lib/hello.dart", "");
final PositionMapper mapper = setUpMapper(main, "remote:root");
scripts.addScript("1", "2", "remote:root/lib/hello.dart", ImmutableList.of(new Line(10, 123, 1)));
final XSourcePosition pos = mapper.getSourcePosition("1", makeScriptRef("2", "remote:root/lib/hello.dart"), 123);
assertNotNull(pos);
assertEquals(pos.getFile(), hello);
// zero-based
assertEquals(pos.getLine(), 9);
}
use of com.intellij.xdebugger.XSourcePosition in project Perl5-IDEA by Camelcade.
the class PerlXNamedValue method computeMySourcePosition.
protected boolean computeMySourcePosition(@Nullable XNavigatable navigatable, @Nullable final XInlineDebuggerDataCallback callback) {
String name = myPerlValueDescriptor.getName();
if (StringUtil.isEmpty(name) || name.length() < 2) {
return false;
}
final PerlVariableType variableType = PerlVariableType.bySigil(name.charAt(0));
if (variableType == null || variableType == PerlVariableType.CODE) {
return false;
}
final String variableName = name.substring(1);
final XSourcePosition sourcePosition = myStackFrame.getSourcePosition();
if (sourcePosition == null) {
return false;
}
final Project project = myStackFrame.getPerlExecutionStack().getSuspendContext().getDebugSession().getProject();
final VirtualFile virtualFile = sourcePosition.getFile();
PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
if (!(psiFile instanceof PerlFileImpl)) {
return false;
}
PsiElement element = psiFile.findElementAt(sourcePosition.getOffset());
if (element == null) {
return false;
}
if (navigatable != null) {
PerlVariableDeclarationSearcher variableProcessor = new PerlVariableDeclarationSearcher(variableName, variableType, element);
PerlResolveUtil.treeWalkUp(element, variableProcessor);
PerlVariableDeclarationElement result = variableProcessor.getResult();
if (result == null) {
return false;
}
navigatable.setSourcePosition(XSourcePositionImpl.createByElement(result));
} else if (callback != null) {
final Document document = psiFile.getViewProvider().getDocument();
if (document == null) {
return false;
}
final boolean[] found = new boolean[] { false };
PerlVariableDeclarationSearcher variableProcessor = new PerlVariableDeclarationSearcher(variableName, variableType, element) {
@Override
public boolean execute(@NotNull PsiElement possibleElement, @NotNull ResolveState state) {
boolean result = super.execute(possibleElement, state);
if (!result) {
registerElement(getResult());
} else if (possibleElement instanceof PerlVariable && ((PerlVariable) possibleElement).getActualType() == variableType && StringUtil.equals(variableName, ((PerlVariable) possibleElement).getName())) {
registerElement(possibleElement);
}
return result;
}
private void registerElement(@Nullable PsiElement targetElement) {
if (targetElement == null) {
return;
}
found[0] = true;
try {
if (mySourcePositionMethod != null) {
mySourcePositionMethod.invoke(callback, XSourcePositionImpl.createByElement(targetElement));
} else if (myLegacyMethod != null) {
myLegacyMethod.invoke(callback, virtualFile, document, document.getLineNumber(targetElement.getTextOffset()));
} else {
found[0] = false;
}
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
};
PerlResolveUtil.treeWalkUp(element, variableProcessor);
return found[0];
}
return true;
}
Aggregations